goof-loop/tests.scm
Linus be9ac1a55d Intermediate loops
goof.scm
  * Changed cl-next to properly push all intermediate loops
  * Changed emit-many/rest to emit intermediate loops
  * Added loop/list as a shorthand for just accumulating lists.

tests.scm
  * Collected some things I wanted ta have to track regressions.

README.md
  * Reflect above changes
2020-11-04 23:15:32 +01:00

25 lines
623 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))
(:when #t)
(:for c (in-list b))
(:for acc (listing c)))
=> acc)
(loop ((:for a (in-list '((1 2) (3 4) (5 6))))
(:when #t)
(:for b (in-list a))
(:for 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