Last active
August 29, 2015 14:18
-
-
Save loganhasson/3d4f43d3afdbf601693b to your computer and use it in GitHub Desktop.
gross
This file contains hidden or 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
;;;; Two very similar versions of fizzbuzz | |
;;; Will break if n is not a number | |
(defun fizzbuzz (n) | |
(let ((x (read-from-string n))) | |
(cond | |
((eq (mod x 15) 0) | |
"FizzBuzz" | |
) | |
((eq (mod x 5) 0) | |
"Buzz" | |
) | |
((eq (mod x 3) 0) | |
"Fizz" | |
) | |
) | |
) | |
) | |
;;; Will not break if n is not a number | |
(defun fizzbuzz (n) | |
(let ((x (read-from-string n))) | |
(cond | |
((eq (typep x 'integer) T) | |
(cond | |
((eq (mod x 15) 0) | |
"FizzBuzz" | |
) | |
((eq (mod x 5) 0) | |
"Buzz" | |
) | |
((eq (mod x 3) 0) | |
"Fizz" | |
) | |
) | |
) | |
(t | |
"Not a number." | |
) | |
) | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment