RosettaCodeData/Task/Factorial/Dylan/factorial-1.dylan

8 lines
136 B
Dylan
Raw Permalink Normal View History

2019-09-12 10:33:56 -07:00
define method factorial (n)
if (n < 1)
error("invalid argument");
else
reduce1(\*, range(from: 1, to: n))
end
end method;