[ prog / sol / mona ]

prog


Fizz Buzz using infinite streams

1 2018-10-28 03:38
(import (srfi srfi-41))    
(define fizzbuzz
  (stream-map
    (lambda (x y) (or x y)) 
    (stream-constant #f #f "fizz" #f "buzz" "fizz" #f #f "fizz" "buzz" #f "fizz" #f #f "fizzbuzz" )
    (stream-from 1)))

; print only the 100 first
(stream-for-each (lambda (x) (format  #t "~A\n" x)) (stream-take 100 fizzbuzz))
4


VIP:

do not edit these