primes = 2:filter isPrime [3,5..] where isPrime x = all (\ y -> x `mod` y /= 0) $ takeWhile (\ p -> p*p <= x) primes DEFER: primes :: is-prime ( n -- ? ) primes [ sq n <= ] lwhile [ n swap mod 0 = not ] lmap f [ and ] foldl ; : primes ( -- list ) [ 2 ] [ odds [ is-prime ] lfilter ] lazy-cons ;