aboutsummaryrefslogtreecommitdiff
path: root/src/example/test1.lang
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/example/test1.lang7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/example/test1.lang b/src/example/test1.lang
index da3d3fa87..43f3111fa 100644
--- a/src/example/test1.lang
+++ b/src/example/test1.lang
@@ -7,3 +7,10 @@
(#Cons [val (repeat (-' n 1) val)])))
(repeat 5 5)
+
+(def (fold f init inputs)
+ (case inputs
+ (#Nil []) init
+ (#Cons [head tail]) (fold f (f init head) tail)))
+
+(fold * 1 (repeat 5 5))