Skip to content

Instantly share code, notes, and snippets.

@brapse
Created May 5, 2009 16:13
Show Gist options
  • Save brapse/107032 to your computer and use it in GitHub Desktop.
Save brapse/107032 to your computer and use it in GitHub Desktop.
(define (fizz-buzz rng)
(let loop ((n 1))
(let ((thr (remainder n 3))
(fiv (remainder n 5)))
(cond
((and (zero? thr) (zero? fiv)) (printf “fizz-buzz~n”))
((zero? thr) (printf “fizz~n”))
((zero? fiv) (printf “buzz~n”))
(else (printf “~a~n” n)))
(if (= rng n)
n
(loop (add1 n))))))
(fizz-buzz 100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment