Programming-Idioms

History of Idiom 31 > diff from v15 to v16

Edit summary for version 16 :

Version 15

2015-09-04, 16:01:34

Version 16

2015-09-05, 19:00:54

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