Skip to content

Instantly share code, notes, and snippets.

@radixm46
Created May 15, 2023 03:29
Show Gist options
  • Save radixm46/14205b50879f4300a892ce012a1eabd3 to your computer and use it in GitHub Desktop.
Save radixm46/14205b50879f4300a892ce012a1eabd3 to your computer and use it in GitHub Desktop.
fizzbuzz with emacs lisp
#!/usr/bin/env emacs --script
(defun fizzbuzz (num)
(princ (mapconcat
#'(lambda (i)
(cond
((= 0 (% i 3)
(% i 5)) "FizzBuzz")
((= 0 (% i 3)) "Fizz")
((= 0 (% i 5)) "Buzz")
(t (number-to-string i))))
(number-sequence 1 (1+ num)) "\n")))
(fizzbuzz 500000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment