Logo

Programming-Idioms

History of Idiom 31 > diff from v11 to v12

Edit summary for version 12 by :

Version 11

2015-09-04, 13:36:56

Version 12

2015-09-04, 15:43:53

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
factorial n = if n > 1 then n * factorial (n-1) else 1