
Well, it won't work. Oh, it will compile and you can run it too (stuck in
a infinte loop if you try to force it in any way). Compilation happens
because this satisfies the type solver. However, the compiler cannot
ensure non-termination of said program. Just unrolling it should show you
what's wrong with it.
Unroll once:
oddsForm3 = map (+2) (map (+2) oddsForm3)
Unroll again:
oddsForm3 = map (+2) (map (+2) (map (+2) oddsForm3)
And you can keep on going. It will never evaluate to a terminal value.
On Mon, Aug 17, 2015 at 11:55 AM, Debdut Karmakar
I am a haskell beginner and wondering how the following function works (in procedure) :
oddsFrom3 :: [Integer] oddsFrom3 = map (+2) oddsFrom3
Thanks for your help.
_______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners