by bobjones2013 · 6y ago · 0 comments
See also the Haskell Sieve of Eratosthenes, which isn't a Sieve of Eratosthenes, and is in fact even slower than naive trial division: https://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf
partition p xs = foldr (select p) ([],[]) xs
select p x ~(ts,fs) | p x = (x:ts,fs)
| otherwise = (ts, x:fs)
That is the entirety of `partition` in the standard library.