diff options
| author | Mistivia <i@mistivia.com> | 2025-06-24 16:47:52 +0800 |
|---|---|---|
| committer | Mistivia <i@mistivia.com> | 2025-06-24 16:55:20 +0800 |
| commit | ec5910bea4db98b40db374a2484380fe1892c563 (patch) | |
| tree | 120cca8628be7868e0eafdac33b89f885f79a0cb /src/primitives.c | |
| parent | 65cd835954825568a432c2e62d8019269dcafd74 (diff) | |
tailcalll on let block
Diffstat (limited to 'src/primitives.c')
| -rw-r--r-- | src/primitives.c | 5 |
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); |
