Lurker News

Comments (491) 209 threads

Earlier comments
senozhatsky#
Agreed. +1 for "Floyd's Tortoise and Hare".

-ss

ridiculous_fish#
Myers Diff. It hits the trifecta:

1. An irrefutable improvement over the state of the art.
2. A short paper which can be understood after only a dozen readings or so. I mean really understood, with visualizations and everything.
3. A practical algorithm which can be implemented by nearly anyone (even me).

squirrelicus1 reply#
I'm by no means a Haskell evangelist, but I believe it's a great educational tool for devs.

You've made a Fibonacci number algorithm. Recursive it's slow, iterative it's nasty. There's another way
> let fib = 0 : 1 : zipWith (+) fib (tail fib)
Then to get the 10kth Fibonacci number you can
> fib !! 10000
It's fast. It's tiny. It has no risk of stack overflow because it's not a recursive function. It illustrates how and why lazy evaluation is important and even better than eager evaluation in many cases. I use this principle in my C#/Java work a lot.
It's my favorite.

tromp1 reply#
Or the even more succinct

    fibs = 0 : scanl (+) 1 fibs
scanl is similar to a fold, but returns a list of successive reduced values from the left.
squirrelicus#
That's fantastic!
mtreis862 replies#
My favorite is the FLAC algorithm. It's fairly simple to explain - take a signal input, pattern match a generative signal that closely matches the original or part of it, and the output is a combination of that generative code and the difference between it and it and the input.

Second favorite is the LISP REPL. Specifically the Eval function, thanks to this classic video of Sussman https://www.youtube.com/watch?v=0m6hoOelZH8

teddyh#
That video, appropriately enough, also contains a definition and explanation of what the Y Combinator is.

Load more comments