Anonymous user
Factorial: Difference between revisions
no edit summary
(→Insitux: implementation) |
imported>Rowsety Moid No edit summary |
||
Line 362:
endif.
endform.</syntaxhighlight>
=={{header|Acornsoft Lisp}}==
===Recursive===
<syntaxhighlight lang="lisp">(defun factorial (n)
(cond ((zerop n) 1)
(t (times n (factorial (sub1 n))))))
</syntaxhighlight>
===Iterative===
<syntaxhighlight lang="lisp">(defun factorial (n (result . 1))
(loop
(until (zerop n) result)
(setq result (times n result))
(setq n (sub1 n))))
</syntaxhighlight>
=={{header|Action!}}==
|