From: Jorge Gorbe Date: Fri, 10 Jan 2014 11:32:39 +0000 (+0100) Subject: Added fact.l missing from previous commit X-Git-Url: http://slack.codemaniacs.com/git/?a=commitdiff_plain;h=9f2f7ab8ee031935cc206c8a23d680d2f7cdc8a7;p=mylisp.git Added fact.l missing from previous commit --- diff --git a/fact.l b/fact.l new file mode 100644 index 0000000..11cac4b --- /dev/null +++ b/fact.l @@ -0,0 +1,9 @@ +(defun fact_rec (x accum) + (if (= x 1) + accum + (fact_rec (- x 1) (* accum x)))) + +(defun fact(x) (fact_rec x 1)) + +(display (fact 10)) +(display (fact 1000))