Skip to content

Instantly share code, notes, and snippets.

@emdeesee
Created September 25, 2018 17:47
Show Gist options
  • Save emdeesee/7617e5d41686db614186b237266e4d2a to your computer and use it in GitHub Desktop.
Save emdeesee/7617e5d41686db614186b237266e4d2a to your computer and use it in GitHub Desktop.
Inside out FizzBuzz in Common Lisp
(flet ((cycle (list) (setf (cdr (last list)) list)))
(let ((fcyc (cycle (list "" "" "Fizz")))
(bcyc (cycle (list "" "" "" "" "Buzz"))))
(mapcar (lambda (f b n &aux (fb (concatenate 'string f b)))
(if (= 0 (length fb)) n fb))
fcyc bcyc (loop for n from 1 to 100 collect n))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment