3 ms·
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: >>
by proc0 2y ago
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)]
- Sharlin 2y agoAlso the two-line "quicksort": qsort [] = [] qsort pivot : xs = qsort [x <- xs, x < pivot] : pivot : qsort [x <- xs, x >= pivot]
- tromp 2y agoI prefer fib = f 0 1 where f a b = a : f b (a+b) which needs neither zip nor tail.
- fanf2 2y agoI like this paper on the sieve of Eratosthenes in Haskell https://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf https://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf by Melissa O’Neill (of PCG fame)