diff options
author | Tom Smeding <tom.smeding@gmail.com> | 2019-11-21 23:24:09 +0100 |
---|---|---|
committer | Tom Smeding <tom.smeding@gmail.com> | 2019-11-21 23:24:09 +0100 |
commit | fcc4ad30957dc1663a07fe3ad37e937d7466e860 (patch) | |
tree | 17768446eaea018fa531c92c965c6454d9fa54bd /tests | |
parent | 2afa7c1315f4a1b85a1ac6c45f788ed71a5900f0 (diff) |
take-while, drop-while
Diffstat (limited to 'tests')
-rw-r--r-- | tests/stdlib.lisp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/stdlib.lisp b/tests/stdlib.lisp index fd72dd8..e23364c 100644 --- a/tests/stdlib.lisp +++ b/tests/stdlib.lisp @@ -14,6 +14,22 @@ (do (f start) (for (+ start 1) end f)) '())) +(define take-while (f l) + (cond + (null? l) + l + (f (car l)) + (cons (car l) (take-while f (cdr l))) + '())) + +(define drop-while (f l) + (cond + (null? l) + l + (f (car l)) + (drop-while f (cdr l)) + l)) + (define stdin (sys-stdin)) (define stdout (sys-stdout)) (define stderr (sys-stderr)) |