summaryrefslogtreecommitdiff
path: root/tests/stdlib.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/stdlib.lisp')
-rw-r--r--tests/stdlib.lisp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/stdlib.lisp b/tests/stdlib.lisp
index 88af2a1..9acee4b 100644
--- a/tests/stdlib.lisp
+++ b/tests/stdlib.lisp
@@ -86,6 +86,10 @@
(rec (cdr l2) (cons (car l2) rest))))))
(helper l '())))
+(define map (f l)
+ (if (null? l) l
+ (cons (f (car l)) (map f (cdr l)))))
+
(define stdin (sys-stdin))
(define stdout (sys-stdout))
(define stderr (sys-stderr))
@@ -120,3 +124,15 @@
(< num 0)
(concat "-" (number->string (- 0 num)))
(helper num ""))))
+
+(define concat-list (l)
+ (if (null? l) ""
+ (concat (car l) (concat-list (cdr l)))))
+
+(define intercalate (sep l)
+ (cond
+ (null? l)
+ ""
+ (null? (cdr l))
+ (car l)
+ (concat (concat (car l) sep) (intercalate sep (cdr l)))))