[racket] question about foldl implementation
On Fri, Aug 13, 2010 at 2:53 AM, Will Kurt <wckurt at gmail.com> wrote:
> So which of these is the canonical implementation of a left fold? Why the
> difference in Racket?
> For pure aesthetics I like the behavior of Racket in the case of cons, but
> for '-' the others seems to make more sense.
I don't think there is a canonical implementation. In Racket is seen
as the same function as right fold; it just happens to process the
list in a different order and so can be tail recursive. Hence it has
the same interface. Racket values consistency and clarity in code.
In Haskell left fold is seen as a different function to right fold,
and hence has a different interface. Haskell values confusing code so
Haskell programmers appreciate having different interfaces for very
similar functions (and the type system will catch some errors).
HTH,
N.
PS: Some of the above is not to be taken seriously.