[Haskell-beginners] cps in yaht

吴登 wudeng at 4399.net
Sun Jul 14 03:36:51 CEST 2013


Hi, Brent, thanks for pointing it out, it helps.

Regards!
-
wudeng


On Sun, Jul 14, 2013 at 6:58 AM, Brent Yorgey <byorgey at seas.upenn.edu>wrote:

> On Sat, Jul 13, 2013 at 05:47:45PM +0800, Deng Wu wrote:
> >
> > It makes sense to me, so I change the definition of cps to something like
> > this:
> >
> > cfold f z [] = z
> > cfold f z (x:xs) = (\y -> cfold f y xs) (f x z)
>
> Note that if we just reduce the application of (\y -> ...) to (f x z), we
> get
>
>   cfold f z (x:xs) = cfold f (f x z) xs
>
> But that is just the usual definition of foldl.  So it certainly works
> fine but it is not in CPS.
>
> -Brent
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130714/cd57da13/attachment.htm>


More information about the Beginners mailing list