diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-02-23 01:08:16 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-09-11 19:58:54 +0200 |
commit | 7bdc4a32ff775bca0158533c9e9af250f16cceb7 (patch) | |
tree | b5d04869ec8867be717d37af97c1173d2922cd56 /tests/test | |
parent | Change `kvlist->assq` and `group-by` to return pairs. (diff) | |
download | calp-7bdc4a32ff775bca0158533c9e9af250f16cceb7.tar.gz calp-7bdc4a32ff775bca0158533c9e9af250f16cceb7.tar.xz |
Extend `for'-macro to allow improper list elements.
Diffstat (limited to '')
-rw-r--r-- | tests/test/util.scm | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test/util.scm b/tests/test/util.scm index d2fc2d81..41dbd7a3 100644 --- a/tests/test/util.scm +++ b/tests/test/util.scm @@ -51,6 +51,16 @@ (for (x c) in (zip (iota 12) (string->list "Hello, World")) x)) + (test-equal "for with improper list elements" + `(3 7) + (for (a . b) in '((1 . 2) (3 . 4)) + (+ a b))) + + (test-equal "for with longer improper list elements" + '(1 2 4) + (for (a b . c) in '((1 -1 . 1) (2 -2 . 2) (4 -4 . 4)) + (* c (+ 1 a b)))) + (test-equal "for break" 'x (for x in (iota 10) |