diff options
| author | Rose Hogenson <rhogenson@posteo.net> | 2022-06-28 15:58:36 -0700 |
|---|---|---|
| committer | Rose Hogenson <rhogenson@posteo.net> | 2022-06-28 15:58:36 -0700 |
| commit | fed28363fb60266c030a0f6b30d5a9d697774ee0 (patch) | |
| tree | 50ed1ec9663371220559e4d4bfc7b1cd1bcb7117 /csc/loop.csc | |
| parent | Finish CPS. (diff) | |
| download | chromatopelma-fed28363fb60266c030a0f6b30d5a9d697774ee0.tar.zst | |
Improve CPS.
Goodbye soup. Thanks to "Compiling with Continuations" by Appel.
Diffstat (limited to 'csc/loop.csc')
| -rw-r--r-- | csc/loop.csc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/csc/loop.csc b/csc/loop.csc index a323495..dbd6200 100644 --- a/csc/loop.csc +++ b/csc/loop.csc @@ -88,12 +88,13 @@ clause* ...))) ((loop-aux "variable-clause-collector" ((body ...) fin) for x = init then subseq clause* ...) (let ((first #t) + (init-value (lambda () init)) ; put the body of init outside the scope of x. (x #f)) (loop-aux "variable-clause-collector" ((body ... (if first (begin (set! first #f) - (set! x init)) + (set! x (init-value))) (set! x subseq))) fin) clause* ...))) |
