aboutsummaryrefslogtreecommitdiff
path: root/src/primitives.c
diff options
context:
space:
mode:
authorMistivia <i@mistivia.com>2025-06-24 16:47:52 +0800
committerMistivia <i@mistivia.com>2025-06-24 16:55:20 +0800
commitec5910bea4db98b40db374a2484380fe1892c563 (patch)
tree120cca8628be7868e0eafdac33b89f885f79a0cb /src/primitives.c
parent65cd835954825568a432c2e62d8019269dcafd74 (diff)
tailcalll on let block
Diffstat (limited to 'src/primitives.c')
-rw-r--r--src/primitives.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/primitives.c b/src/primitives.c
index 5f70f09..8e56bf9 100644
--- a/src/primitives.c
+++ b/src/primitives.c
@@ -198,6 +198,11 @@ SExpRef primitive_let(Interp *interp, SExpRef args, bool istail) {
}
body = CDR(args);
+ if (istail) {
+ SExpRef closure = new_lambda(interp, NIL, body, env);
+ ret = new_tailcall(interp, closure, NIL);
+ goto end;
+ }
iter = body;
while (!NILP(iter)) {
exp = CAR(iter);