Skip to content

Instantly share code, notes, and snippets.

@gigawhitlocks
Created September 18, 2013 10:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gigawhitlocks/6607410 to your computer and use it in GitHub Desktop.
Save gigawhitlocks/6607410 to your computer and use it in GitHub Desktop.
fizzbuzz
(define fizzbuzz
; this is a default-args wrapper
(lambda ()
(fizzbuzz-iter 1)))
(define fizzbuzz-iter
(lambda (iter)
; the actual meat of fizzbuzz
(cond [(and (= (remainder iter 5) 0)
(= (remainder iter 3) 0)) (printf "FizzBuzz\n")]
[(= (remainder iter 5) 0) (printf "Buzz\n")]
[(= (remainder iter 3) 0) (printf "Fizz\n")]
[else (printf "~a\n" iter)])
; call the iterator
(if (< iter 100)
(fizzbuzz-iter (+ 1 iter))
(printf "\n"))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment