mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-06 06:48:48 +00:00
7 lines
283 B
Text
7 lines
283 B
Text
import Fun;
|
|
import List;
|
|
|
|
printf ("Functions are first-class, higher-order.\n");
|
|
|
|
printf ("Factorial: %d\n", fix (fun (f) {fun (n) {if n == 1 then 1 else n * f (n-1) fi}})(5));
|
|
printf ("Function composition: %d\n", foldl (infix #, id, map (fun (i) {fun (x) {x+i}}, {1, 2, 3})) $ 10)
|