Loops without any clauses now run the body at least once.
Small updates to readme.
This commit is contained in:
parent
06a11fc892
commit
685fe86f36
2 changed files with 26 additions and 24 deletions
|
@ -45,23 +45,27 @@
|
|||
(include "goof/iterators.scm")
|
||||
|
||||
|
||||
|
||||
(define-syntax loop
|
||||
(syntax-rules ()
|
||||
((loop . rest)
|
||||
(%loop (loop . rest) . rest))))
|
||||
|
||||
(define-syntax %loop
|
||||
(syntax-rules (=>)
|
||||
((loop () => expr body ...)
|
||||
(loop ((:for ensure-once (up-from 0 1))) => expr body ...))
|
||||
((loop () body ...)
|
||||
(loop ((:for ensure-once (up-from 0 1))) body ...))
|
||||
((loop name () => expr body ...)
|
||||
(loop name ((:for ensure-once (up-from 0 1))) => expr body ...))
|
||||
((loop name () body ...)
|
||||
(loop name ((:for ensure-once (up-from 0 1))) body ...))
|
||||
((loop (clauses ...) body ...)
|
||||
(ensure-for-clause (loop (clauses ...) body ...)
|
||||
((%loop o () => expr body ...)
|
||||
(%loop o ((:for ensure-once (up-from 0 1))) => expr body ...))
|
||||
((%loop o () body ...)
|
||||
(%loop o ((:for ensure-once (up-from 0 1))) body ...))
|
||||
((%loop o name () => expr body ...)
|
||||
(%loop o name ((:for ensure-once (up-from 0 1))) => expr body ...))
|
||||
((%loop o name () body ...)
|
||||
(%loop o name ((:for ensure-once (up-from 0 1))) body ...))
|
||||
((%loop o (clauses ...) body ...)
|
||||
(ensure-for-clause o
|
||||
loop-name (clauses ...)
|
||||
body ... (loop-name)))
|
||||
((loop name (clauses ...) . body)
|
||||
(ensure-for-clause (loop name (clauses ...) . body)
|
||||
((%loop o name (clauses ...) . body)
|
||||
(ensure-for-clause o
|
||||
name
|
||||
(clauses ...)
|
||||
. body))))
|
||||
|
@ -441,9 +445,7 @@
|
|||
(define-syntax forify
|
||||
(syntax-rules (:for :acc :when :unless :break :final :subloop :let :let* %acc)
|
||||
((forify o n done-clauses () . body)
|
||||
(cl 1 n
|
||||
(()) (()) (()) (()) (()) () ((() ())) (()) (()) (()) ()
|
||||
done-clauses . body))
|
||||
(%loop o n done-clauses . body))
|
||||
((_ o n (s ...) ((:for c-rest ...) clauses ...) . body)
|
||||
(forify o n (s ... (:for c-rest ...)) (clauses ...) . body))
|
||||
((_ o n (s ...) (:when expr clauses ...) . body)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue