Skip to content

Instantly share code, notes, and snippets.

@loganhasson
Last active August 29, 2015 14:18
Show Gist options
  • Save loganhasson/3d4f43d3afdbf601693b to your computer and use it in GitHub Desktop.
Save loganhasson/3d4f43d3afdbf601693b to your computer and use it in GitHub Desktop.
gross
;;;; 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