Re: using less stack

2002-03-23 Thread Alastair Reid
Gertjan Kamsteeg <[EMAIL PROTECTED]> writes: >> You don't have to define cpsfold explicitly recursively since it >> can be expressed in terms of foldr: Hal Daume III <[EMAIL PROTECTED]> writes: > Is this generally considered good design? [...] Three different attempts at an answer: As with al

Re: using less stack

2002-03-23 Thread Hal Daume III
Hi, > You don't have to define cpsfold explicitly recursively since it can be > expressed in terms of foldr: Is this generally considered good design? That is, is it generally preferred to express functions in a nonrecursive style if that can be done using standard library functions like foldr

Re: using less stack

2002-03-23 Thread Gertjan Kamsteeg
You don't have to define cpsfold explicitly recursively since it can be expressed in terms of foldr: cpsfold f a xs = foldr (\x k y -> f x y k) id xs a The following definition would even be better (but not equivalent): cpsfold' f a xs = foldr (\x k y -> f y x k) id xs a The list members are