RosettaCodeData/Task/Factorial/Wart/factorial-4.wart
2016-12-05 23:44:36 +01:00

7 lines
156 B
Text

# a useful helper to generate all the natural numbers until n
def (nums n)
collect+for i 1 (i <= n) ++i
yield i
def (fact n)
(reduce (*) nums.n 1)