This is experimental implementation of the Sieve of Eratosthenes in functional style in clojure programming language. I was inspired by the paper [1].
This code is released under MIT License.
Copyright (c) 2016 Peter Cerman (https://github.com/pcerman)
(load-file "esieve.clj")
;; Take 100 first prime numbers.
(take 100 primes)
;; alternatively, but prime numbers are computed again and advantage of lazy
;; sequence is not exploited.
(take 100 (esieve))
- O'Neill, Melissa E., "The Genuine Sieve of Eratosthenes", Journal of Functional Programming, Published online by Cambridge University Press 09 Oct 2008 doi:10.1017/S0956796808007004.