Created
September 18, 2013 10:39
-
-
Save gigawhitlocks/6607410 to your computer and use it in GitHub Desktop.
fizzbuzz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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