[Haskell-cafe] Cute code [was: The C Equiv of != in Haskell miscommunication thread]

Tomasz Zielonka tomasz.zielonka at gmail.com
Tue May 29 09:09:00 EDT 2007


On Tue, May 29, 2007 at 02:19:31PM +0200, Tomasz Zielonka wrote:
> On Tue, May 29, 2007 at 12:15:23PM +0200, Vincent Kraeutler wrote:
> > ever the interested amateur, i admittedly remain stumped by fix (there's
> > evidence i'm not the only one [1])
> 
> The above code is equivalent to
> 
>     let l = 1 : scanl (+) 1 l in l
> 
> which is a bit easier to decipher.
> 
> The rest is maths and the subtleties of lazy evaluation.
... and these are the things you need to focus on to understand this
code. In this case the use of fix is almost a small syntactic issue -
you can eliminate it by inlining its definition.

Best regards
Tomek


More information about the Haskell-Cafe mailing list