[Haskell-beginners] cps in yaht
ky3 at atamo.com
Sat Jul 13 15:46:00 CEST 2013
On Sat, Jul 13, 2013 at 4:47 PM, Deng Wu <wudeng256 at gmail.com> wrote:
> cfold’ f z (x:xs) = f x z (\y -> cfold’ f y xs)
> and gives the test result:
> CPS> cfold (+) 0 [1,2,3,4]
The apostrophe matters!
Functions cfold and cfold' (read: see-fold prime) are two different
functions, for which you gave the definition of one but not the other.
To clear up your confusion, try giving the type signatures for both.
Daume's text is normally pretty good about this but the section on cfold
falls down in this regard.
Let me do the cfold one for you:
cfold :: (a -> r -> r) -> r -> [a] -> r
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners