
17 Jul
2009
17 Jul
'09
8 a.m.
On Fri, Jul 17, 2009 at 12:41 PM, Cristiano Paris
... Now, to confirm my hypothesis, I wrote a slight different version of fib, like follows:
fib' n = 1:1:(fib' n) `plus` (tail $ fib' n) where plus = zipWith (+)
i.e. I inserted a fictious argument n in the definition of fib'.
Now, if I try "take 30 $ fib' 100", it takes significntly longer than "take 30 fib": specifically, the latter is instantaneous, while the former takes about 5 seconds to complete on my MacBook Pro. Is this an evidence that the "tying the knot" process is going on in the first version?
BTW, after a -O2 compilation, fib' is apparently as fast a fib. Cristiano
5788
Age (days ago)
5788
Last active (days ago)
1 comments
2 participants
participants (2)
-
Cristiano Paris
-
Matthias Görgens