Created
September 16, 2012 13:36
-
-
Save mrklein/3732492 to your computer and use it in GitHub Desktop.
factorial
This file contains hidden or 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
(defun factorial (n) | |
(defun i_factorial (n acc) | |
(if (= 0 n) | |
acc | |
(i_factorial (- n 1) (* acc n)))) | |
(i_factorial n 1)) | |
(defun print-factorial (n) | |
(format T "~D~%" (factorial n))) | |
(mapcar 'print-factorial '(1 12 123 1234 12345)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment