[racket-dev] foldl does a right fold?

From: John Clements (clements at brinckerhoff.org)
Date: Sat Jul 9 20:40:22 EDT 2011

On Jul 9, 2011, at 5:38 PM, Clark Grubb wrote:

> This seems to be a bug.  Here is the
> Racket behavior and Haskell behavior
> for comparison.

I believe what you're actually observing here is a difference in the order in which arguments are presented to the given function. E.G., try "cons".

John


> 
> ======================
> 
> $ racket
> Welcome to Racket v5.1.1.
>> (foldl - 0 '(1 2 3))
> 2
>> (foldr - 0 '(1 2 3))
> 2
> 
> ======================
> 
> $ ghci
> GHCi, version 6.10.4: http://www.haskell.org/ghc/  :? for help
> Prelude> foldl (-) 0 [1,2,3]
> -6
> Prelude> foldr (-) 0 [1,2,3]
> 2
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/dev

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4624 bytes
Desc: not available
URL: <http://lists.racket-lang.org/dev/archive/attachments/20110709/2cc55281/attachment.p7s>

Posted on the dev mailing list.