kernel: multi-expression body for $vau/$lambda + 5 tests [nothing]
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 31s

:body slot holds a LIST of forms now (was single expression). New
knl-eval-body in eval.sx evaluates each form in sequence, returning
the last. $vau and $lambda accept (formals env-param body...) /
(formals body...). No $sequence dependency. 223 tests total.
This commit is contained in:
2026-05-11 21:04:19 +00:00
parent c21eb9d5ad
commit af8d10a717
4 changed files with 44 additions and 9 deletions

View File

@@ -40,13 +40,13 @@
(fn
(args dyn-env)
(cond
((not (= (length args) 3))
(error "$vau: expects (formals env-param body)"))
((< (length args) 3)
(error "$vau: expects (formals env-param body...)"))
(:else
(let
((formals (first args))
(eparam-raw (nth args 1))
(body (nth args 2)))
(body-forms (rest (rest args))))
(cond
((not (knl-formals-ok? formals))
(error "$vau: formals must be a list of symbols"))
@@ -56,7 +56,7 @@
(kernel-make-user-operative
formals
(knl-eparam-sentinel eparam-raw)
body
body-forms
dyn-env))))))))
(define
@@ -70,17 +70,21 @@
(fn
(args dyn-env)
(cond
((not (= (length args) 2))
(error "$lambda: expects (formals body)"))
((< (length args) 2)
(error "$lambda: expects (formals body...)"))
(:else
(let
((formals (first args)) (body (nth args 1)))
((formals (first args)) (body-forms (rest args)))
(cond
((not (knl-formals-ok? formals))
(error "$lambda: formals must be a list of symbols"))
(:else
(kernel-wrap
(kernel-make-user-operative formals :knl-ignore body dyn-env)))))))))
(kernel-make-user-operative
formals
:knl-ignore
body-forms
dyn-env)))))))))
(define
kernel-lambda-operative