Logo

Programming-Idioms

History of Idiom 31 > diff from v50 to v51

Edit summary for version 51 by foobar:
New Lisp implementation by user [foobar]

Version 50

2019-09-26, 14:44:00

Version 51

2019-09-26, 15:02:19

Idiom #31 Recursive factorial (simple)

Create recursive function f which returns the factorial of non-negative integer i, calculated from f(i-1)

Idiom #31 Recursive factorial (simple)

Create recursive function f which returns the factorial of non-negative integer i, calculated from f(i-1)

Code
(defun f (i)
  (if (< i 2)
    1
    (* i (f (- i 1)))))