blob: bff92b3eee97f8ea05de659cb04e08391f5a05c9 (
plain) (
tree)
|
|
(define (divisible? x y) (= (remainder x y) 0))
(define (sieve stream)
(cons-stream
(stream-car stream)
(sieve (stream-filter
(lambda (x) (not (divisible? x (stream-car stream))))
(stream-cdr stream)))))
(define primes (sieve (stream-cdr integers)))
|