aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-02-23 01:08:16 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2023-02-23 02:53:54 +0100
commit96d35184bae81888352645ad28efa279c3d5e322 (patch)
tree8c5f14233e27b7b689031384bf05e0e3c52fce76 /tests
parentAllow shorter byday when constructing recurrence rules. (diff)
downloadcalp-96d35184bae81888352645ad28efa279c3d5e322.tar.gz
calp-96d35184bae81888352645ad28efa279c3d5e322.tar.xz
Extend `for'-macro to allow improper list elements.
Diffstat (limited to 'tests')
-rw-r--r--tests/test/util.scm10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test/util.scm b/tests/test/util.scm
index c91017fc..2a171d12 100644
--- a/tests/test/util.scm
+++ b/tests/test/util.scm
@@ -49,6 +49,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 "procedure label"
120
((label factorial (lambda (n)