News for hackers. Stuff that matters.
Re:Why isn't Haskell popular in industry? by loewenskind on Monday August 02, 2010 @08:29AM (#1567449)
I should have pointed out that my code was theoretical and not actual. My example assumes a (non-tail call) merge sort.

Sort specifically was (I felt) a small part of my point but I should have known that on a "hacker" site one must be exact. :)

Re:Why isn't Haskell popular in industry? by ithkuil on Tuesday August 03, 2010 @08:28AM (#1570884)
I understand that you wanted to make a simple example, I just wanted to expand a little bit the issue of laziness and make it look slightly less magic.

I found a fascinating examples of the expressiveness and beauty of haskell due to lazy evaluation, which I think is better suited for FP evangelism:

fibs = 0 : 1 : zipWith (+) fibs (tail fibs)

Here we are defining the fibonacci sequence in a declarative way, recursing with a recursive "call".

The way the 'fibs' function is coded directly reflects the definition of the fibonacci sequence itself:

The 'fibs' list is defined as a list containing the first 2 elements and then, as a tail, the result of the application of the + function on the previous pair of elements.

"You can borrow things from the future as long as you don't try to change them"