Control flow and binding (Closes #157) #166

Open
Winnie wants to merge 1 commit from 157-control into master
Owner

Language: let*, named let, while/foreach/for with break and continue, return with a value, and dotted variadic params (defun f (a b . rest)) across defun/define/define-hook/lambda. Control transfers ride a typed error caught by the owning construct, so they unwind through nested forms.

Brains: super's last recursive walkers are gone — count-face is count-if with a lambda, book-scan is filter/map, sort-shelf is sort-by.

Verified byte-identical on a full seeded spectate against master.

Language: let*, named let, while/foreach/for with break and continue, return with a value, and dotted variadic params (defun f (a b . rest)) across defun/define/define-hook/lambda. Control transfers ride a typed error caught by the owning construct, so they unwind through nested forms. Brains: super's last recursive walkers are gone — count-face is count-if with a lambda, book-scan is filter/map, sort-shelf is sort-by. Verified byte-identical on a full seeded spectate against master.
Control flow and binding (Closes #157)
All checks were successful
build / build (push) Successful in 27s
aeccf20d34
Language additions:
- let*: sequential bindings, each seeing the previous
- named let: (let name (bindings) body...) — a local recursive
  function with the bindings as initial values
- while, foreach, for: C/Scheme-style loops with break and continue
- return: early exit from a function, propagating a value
- dotted variadic params: (defun f (a b . rest) ...) — rest collects
  the tail as a list; the same in define, define-hook, and lambda
- local define already worked through the per-call env chain

The control transfers are carried by a typed ctlFlow error caught by
the owning construct (apply catches return, the loops catch
break/continue), so they unwind through nested forms cleanly without
touching the panic machinery.

Brains: super's remaining recursive walkers rewritten — count-face is
now count-if with a lambda, book-scan is filter/map, and the
insertion sort-shelf is sort-by. The hand-rolled recursive scans are
gone from the shipped brains.

Behavior-preserving: a full seeded spectate against master produces
byte-identical output.
All checks were successful
build / build (push) Successful in 27s
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 157-control:157-control
git switch 157-control

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch master
git merge --no-ff 157-control
git switch 157-control
git rebase master
git switch master
git merge --ff-only 157-control
git switch 157-control
git rebase master
git switch master
git merge --no-ff 157-control
git switch master
git merge --squash 157-control
git switch master
git merge --ff-only 157-control
git switch master
git merge 157-control
git push origin master
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Winnie/bankwars!166
No description provided.