14 lines
234 B
Text
14 lines
234 B
Text
|
|
(let factorial (fun (n) {
|
||
|
|
(mut result 1)
|
||
|
|
(mut i 2)
|
||
|
|
(while (< i n) {
|
||
|
|
(set result (* result i))
|
||
|
|
(set i (+ 1 i)) })
|
||
|
|
result }))
|
||
|
|
|
||
|
|
(import std.List)
|
||
|
|
|
||
|
|
(list:forEach
|
||
|
|
(list:iota 0 8)
|
||
|
|
(fun (n) (print n "\t" (factorial n))))
|