RosettaCodeData/Task/Factorial/Wart/factorial-4.wart
2023-07-01 13:44:08 -04: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)