aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--stdlib.slip19
1 files changed, 19 insertions, 0 deletions
diff --git a/stdlib.slip b/stdlib.slip
index dcedafc..2568354 100644
--- a/stdlib.slip
+++ b/stdlib.slip
@@ -67,6 +67,25 @@
))
+(let repeat
+ (fn (fun n) ((Int -> Nil) Int) Nil
+
+ ((let repeat-inner (fix
+ (fn repeat-inner' (((Int -> Nil) Int Int) -> Nil)
+ (((Int -> Nil) Int Int) -> Nil)
+ (fn (fun index until) ((Int -> Nil) Int Int) Nil
+ (case (<= index until)
+ (true (discard (fun index) (repeat-inner' fun (++ index) until)))
+ (_ ()))
+ )
+ )
+ ))
+
+ (repeat-inner fun 1 n))
+ )
+)
+
+
(let left-or
(fn (sum def) ((Sum L R) L) L
(case sum