Re: [Haskell-cafe] Python vs Haskell in tying the knot

2009-07-17 Thread Matthias Görgens
> BTW, after a -O2 compilation, fib' is apparently as fast a fib. The compiler is your friend. :o) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Python vs Haskell in tying the knot

2009-07-17 Thread Cristiano Paris
On Fri, Jul 17, 2009 at 12:41 PM, Cristiano Paris 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'. >

Re: [Haskell-cafe] Python vs Haskell in tying the knot

2009-07-17 Thread Cristiano Paris
On Fri, Jul 17, 2009 at 12:46 PM, Thomas Davie wrote: > > Memoization is not a feature of lazyness.  If you can do it in such a way > that you don't waste significant amount of RAM, then it may be a nice > optimisation, and an alternative evaluation strategy, but it would not be > lazy. Thank you

Re: [Haskell-cafe] Python vs Haskell in tying the knot

2009-07-17 Thread Thomas Davie
On 17 Jul 2009, at 12:41, Cristiano Paris wrote: Thank you all for your answers and sorry for the delay I'm writing this message but before replying, I wanted to be sure to understand your arguments! Now, I'm starting to get into this "tying the knot" thing and understand why the Haskell versi

Re: [Haskell-cafe] Python vs Haskell in tying the knot

2009-07-17 Thread Cristiano Paris
Thank you all for your answers and sorry for the delay I'm writing this message but before replying, I wanted to be sure to understand your arguments! Now, I'm starting to get into this "tying the knot" thing and understand why the Haskell version of fib ties the knot while my Python version does

Re: [Haskell-cafe] Python vs Haskell in tying the knot

2009-07-15 Thread Matthew Brecknell
Robert Greayer wrote: > Isn't tying the knot (in the way 'fib' does) straightforward with closures > a la Python/Ruby/Smalltalk (without mutation)? > Even in a syntactically clumsy language like Java, a > tying-the-knot implementation equivalent to the canonical Haskell one is > not difficult, e.g.

Re: [Haskell-cafe] Python vs Haskell in tying the knot

2009-07-15 Thread Robert Greayer
On Wed, Jul 15, 2009 at 2:18 PM, Max Rabkin wrote: > On Wed, Jul 15, 2009 at 7:33 PM, Cristiano > Paris wrote: >> fib = 1:1:fib `plus` (tail fib) where plus = zipWith (+) > ... > ... > This indicates that you think tying the knot should be impossible in > Python. In my opinion this is not the case.

Re: [Haskell-cafe] Python vs Haskell in tying the knot

2009-07-15 Thread Max Rabkin
On Wed, Jul 15, 2009 at 7:33 PM, Cristiano Paris wrote: > fib = 1:1:fib `plus` (tail fib) where plus = zipWith (+) > > Of course, this was something I already encountered when exploring the > Y-combinator. Anyhow, I tried to translate this implementation to > Python using Iterators and this is what

[Haskell-cafe] Python vs Haskell in tying the knot

2009-07-15 Thread Cristiano Paris
Hi, as pointed out in this list, it seems that a "tying the knot" example would be the one better explaining the power of Haskell's lazy-by-default approach against Python+Iterator's approach to laziness. So, in these days I'm trying to grasp the meaning of this "tying the knot" concept which see