News for hackers. Stuff that matters.
Re:Once you go functional, you can never go back by philh on Monday May 18, 2015 @09:40AM (#9564323)
> Actually calculating the Fibonacci series efficiently in a non-lazy functional language looks surprisingly non-trivial.

I don't know if you'd count it as trivial, but one could do

    def fib(n, a=0, b=1, c=2):
        if n <= 1:
            return n
        if n == c:
            return a+b
        return fib(n, b, a+b, c+1)
which beats the Haskell lazy list in being O(1) space (except Python doesn't eliminate tail calls).
Re:Once you go functional, you can never go back by wz1000 on Monday May 18, 2015 @10:07AM (#9564473)
The front of the list can be garbage collected, so the Haskell version can be O(1) in memory.
Re:Once you go functional, you can never go back by dllthomas on Monday May 18, 2015 @08:35PM (#9567614)
Ignoring growth in the size of the output itself (and the intermediary values that are output of earlier stages), anyway...