Created
May 15, 2023 03:29
-
-
Save radixm46/14205b50879f4300a892ce012a1eabd3 to your computer and use it in GitHub Desktop.
fizzbuzz with emacs lisp
This file contains 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
#!/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