Skip to content

Instantly share code, notes, and snippets.

@loganhasson
Last active August 29, 2015 14:18
Show Gist options
  • Select an option

  • Save loganhasson/3d4f43d3afdbf601693b to your computer and use it in GitHub Desktop.

Select an option

Save loganhasson/3d4f43d3afdbf601693b to your computer and use it in GitHub Desktop.

Revisions

  1. loganhasson revised this gist Apr 1, 2015. 1 changed file with 27 additions and 0 deletions.
    27 changes: 27 additions & 0 deletions fizzbuzz.lisp
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,6 @@
    ;;;; Two very similar versions of fizzbuzz

    ;;; Will break if n is not a number
    (defun fizzbuzz (n)
    (let ((x (read-from-string n)))
    (cond
    @@ -12,4 +15,28 @@
    )
    )
    )
    )

    ;;; 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."
    )
    )
    )
    )
  2. loganhasson created this gist Apr 1, 2015.
    15 changes: 15 additions & 0 deletions fizzbuzz.lisp
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    (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"
    )
    )
    )
    )