goof-loop/tests.scm
Linus 2c182da570 Racketifying goof-loop
I have racketified goof loops. No :for or :acc needed, and :when, :unless, and :break are no longer parethesised.
:acc blah (in ...) and :for blah (in ...) has been changed to
(blah (folding ...)) and (blah (in ...))
2020-11-09 13:30:02 +01:00

25 lines
563 B
Scheme

;; This is just a file with things that should be written as a test. Dump file.
(loop ((a (in-list '(((1) (2)) ((3) (4)) ((5) (6 7)))))
:when #t
(b (in-list a))
:subloop
(c (in-list b))
(acc (listing c)))
=> acc)
(loop ((a (in-list '((1 2) (3 4) (5 6))))
:subloop
(b (in-list a))
(acc (listing b)))
=> acc)
(loop ((a (in-list '(1 2 3)))
(oa (summing a))
:subloop
(b (up-from a (to (+ a 2))))
(ob (listing b)))
=> (values oa ob))
;; Should return 6 and (1 2 2 3 3 4)