On Thu, Jul 16, 2009 at 8:22 PM, Thomas Hartman<[email protected]> wrote:
> I played with this a bit, and ok, it seems the difference between
> iterate' and iterate'' is
>
> h _ = 2
>
> tit' = head . drop 1 . iterate' h $ undefined
> tit'' = head . drop 1 . iterate'' h $ undefined

Exactly, iterate' first evaluates 'undefined' which is undefined.
iterate'' returns 'undefined : iterate'' h 2'. Which then evaluates
to: 'undefined : 2 : iterate'' h 2'.

So both iterates are strict in their accumulator. They differ in when
they force it. The former is more strict in that it forces its
accumulator on entry while the latter is more lazy by first returning
the accumulator and later forcing it.

>> (Bas wishes for a type system that can express the different
> strictness properties of these functions...)
>
> Is this being worked on?

I have no idea.

regards,

Bas
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to