
:for clauses now have finalizers! This means (in-file "path") now works. This meant I had to do some restructuring of many nasty pieces of code, but I believe it works. cl-next was broken up into cl-next/acc and cl-next/for. Accumulators have to pass :acc to (cl-next/acc ...). I plan for :for clauses to do the same. I fixed tests.scm and README.md to reflect the de-racketification of the for loops.
25 lines
618 B
Scheme
25 lines
618 B
Scheme
;; This is just a file with things that should be written as a test. Dump file.
|
|
|
|
(loop ((:for a (in-list '(((1) (2)) ((3) (4)) ((5) (6 7)))))
|
|
:when #t
|
|
(:for b (in-list a))
|
|
:subloop
|
|
(:for c (in-list b))
|
|
(:acc acc (listing c)))
|
|
=> acc)
|
|
|
|
|
|
(loop ((:for a (in-list '((1 2) (3 4) (5 6))))
|
|
:subloop
|
|
(:for b (in-list a))
|
|
(:acc acc (listing b)))
|
|
=> acc)
|
|
|
|
(loop ((:for a (in-list '(1 2 3)))
|
|
(:acc oa (summing a))
|
|
:subloop
|
|
(:for b (up-from a (to (+ a 2))))
|
|
(:acc ob (listing b)))
|
|
=> (values oa ob))
|
|
;; Should return 6 and (1 2 2 3 3 4)
|
|
|