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/list.csc | |
| parent | 52da9c556a170ed8e5f811c3acd56088baf94c80 (diff) | |
| download | chromatopelma-fed28363fb60266c030a0f6b30d5a9d697774ee0.tar.zst | |
Improve CPS.
Goodbye soup. Thanks to "Compiling with Continuations" by Appel.
Diffstat (limited to 'csc/list.csc')
| -rw-r--r-- | csc/list.csc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/csc/list.csc b/csc/list.csc index cc64168..b1c2298 100644 --- a/csc/list.csc +++ b/csc/list.csc @@ -74,8 +74,12 @@ finally (return (values xs ys)))) - (define (all pred l) - (loop for x in l - unless (pred x) + (define (all pred . ls) + (loop for ls = ls then (map cdr ls) + while (loop for l in ls + if (null? l) + return #f + finally (return #t)) + unless (apply pred (map car ls)) return #f finally (return #t))))) |
