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
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
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