RosettaCodeData/Task/Factorial/FunL/factorial-2.funl

6 lines
146 B
Text
Raw Permalink Normal View History

2016-12-05 23:44:36 +01:00
def
factorial( (0|1) ) = 1
factorial( n )
| n > 0 = n*factorial( n - 1 )
| otherwise = error( 'factorial: n should be non-negative' )