[Haskell-beginners] fix
Matthew J. Williams
matthewjwilliams1 at googlemail.com
Wed Oct 15 18:51:45 EDT 2008
hello listers, a few days ago A fellow lister sent me the following link:
http://en.wikibooks.org/wiki/Haskell/Fix_and_recursion
The 'fix' function is interesting to say the least. There is one
example that I've had difficulty expanding:
fix (\rec n -> if n == 0 then 1 else n * rec (n-1)) 5
120
My interpretation:
fix (\rec n -> if n == 0 then 1 else n * rec (n-1)) 5
((\rec n -> if n == 0 then 1 else n * rec (n-1)) (fix (\rec n -> if
n == 0 then 1 else n * rec (n-1)) )) 5
. . .
Yet, it does not quite explain how 'fix' does not result in infinite
recursion.
Sincerely
Matthew J. Williams
More information about the Beginners
mailing list