22 lines
457 B
Scheme
22 lines
457 B
Scheme
(def each-integer-aux
|
|
(fn (n i thunk)
|
|
(if (= n 0)
|
|
'()
|
|
(progn
|
|
(thunk (- (+ i 1) n))
|
|
(each-integer-aux (- n 1) i thunk)))))
|
|
|
|
(def each-integer
|
|
(fn (n thunk)
|
|
(each-integer-aux n n thunk)))
|
|
|
|
(each-integer 30
|
|
(fn (x)
|
|
(if (or (= 0 (% x 3)) (= 0 (% x 5)))
|
|
(progn
|
|
(if (= 0 (% x 3))
|
|
(write "Fizz"))
|
|
(if (= 0 (% x 5))
|
|
(write "Buzz")))
|
|
(print x))
|
|
(write "\n")))
|