summaryrefslogtreecommitdiff
path: root/sieve/euler.scm
blob: dfc12def8aba28bdbb1cbea26ad31d3e3715fab7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28



(add-to-load-path (dirname (current-filename)))

(import
    (srfi srfi-41)
    (extra-functional)
    (my-streams))



(define base (stream-from 2))



(define-stream (sieve input)
    (stream-cons
        (stream-car input)
        (sieve (stream-ordered-diff
                    (stream-cdr input)
                    (stream-map ((curry *) (stream-car input)) input)))))



(define euler (sieve base))