loops without subloops can now use :for clauses in final-expr

This commit is contained in:
Linus 2021-05-21 20:42:10 +02:00
parent 9988434554
commit e057a6b8fe
3 changed files with 17 additions and 5 deletions

8
CHANGELOG Normal file
View file

@ -0,0 +1,8 @@
v0.2 [unreleased]
- Made clauses execute in lexical order
- Loops without subloops can use :for clauses in the final expression.
- :final also obeys lexical order, and everything below it will run once
any subloop will run to exhaustion.
v.0.1 First release

View file

@ -298,7 +298,7 @@ $3 = (let loopy-loop ((cursor (read)))
This used to be a pretty vast collection of examples. goof-loof is now different enough from foof loop that you can't expect to carry your foof-loop skills over to goof-loop. There are however two notable regressions.
### Regressions compared to foof-loop
only accumulating clauses are visible in the final-expression. This is due to sequence clauses not being promoted through to outer loops (since they should not keep their state if an inner loop is exited).
only accumulating clauses are guaranteed to be visible in the final-expression. This is due to sequence clauses not being promoted through to outer loops (since they should not keep their state if an inner loop is exited).
Due to clause reordering, positional updates are not supported. If you want to update your loop vars, do so using named update (see below).

View file

@ -306,15 +306,19 @@
(((ff-cur ...) (ff-above ...)))
((us ...))
final-expr . body)
(let* ((final-fun (lambda (final-binding ...) final-expr))
lets ...)
(let* (lets ...)
(let loop ((accvar accinit) ... (var init) ...)
(if (or checks ...)
(begin
ff-above ...
ff-cur ...
(final-fun final-value ...))
(let ((final-binding final-value) ...)
final-expr))
(ref-let (refs ...)
(user (ff-above ... ff-cur ... (final-fun final-value ...))
(user (ff-above ...
ff-cur ...
(let ((final-binding final-value) ...)
final-expr))
(loop accvar ... step ...)
#f
(us ...)