
13 Jul
2013
13 Jul
'13
1:46 p.m.
On Sat, Jul 13, 2013 at 4:47 PM, Deng Wu
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 -- Kim-Ee