On Fri, Jul 17, 2009 at 12:41 PM, Cristiano Paris<[email protected]> wrote:
> ...
> 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
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to