
15 Oct
2008
15 Oct
'08
6:51 p.m.
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