Add good old factorial.
This commit is contained in:
parent
df33263fcd
commit
17c5486551
12
programs/factorial.lily
Normal file
12
programs/factorial.lily
Normal file
|
@ -0,0 +1,12 @@
|
|||
defn if c t e = {
|
||||
case c of {
|
||||
True -> { t }
|
||||
False -> { e }
|
||||
}
|
||||
}
|
||||
|
||||
defn fact n = {
|
||||
if (eq n 0) 1 (n * fact (n - 1))
|
||||
}
|
||||
|
||||
defn main = { fact 6 }
|
Loading…
Reference in New Issue
Block a user