Hacker News new | past | comments | ask | show | jobs | submit login

Haskell (and some other pure FP langs) produces a lot of code that is basically technical poetry, at the cost of performance.

just look at the fib example:

>> fib = 1 : 1 : [a + b | (a, b) <- zip fib (tail fib)]




Also the two-line "quicksort":

  qsort [] = []
  qsort pivot : xs = qsort [x <- xs, x < pivot] : pivot : qsort [x <- xs, x >= pivot]


I prefer

    fib = f 0 1 where f a b = a : f b (a+b)
which needs neither zip nor tail.


I like this paper on the sieve of Eratosthenes in Haskell https://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf by Melissa O’Neill (of PCG fame)




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: