From fed28363fb60266c030a0f6b30d5a9d697774ee0 Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Tue, 28 Jun 2022 15:58:36 -0700 Subject: Improve CPS. Goodbye soup. Thanks to "Compiling with Continuations" by Appel. --- csc/macros-test.csc | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'csc/macros-test.csc') diff --git a/csc/macros-test.csc b/csc/macros-test.csc index fd9d1ae..db78324 100644 --- a/csc/macros-test.csc +++ b/csc/macros-test.csc @@ -8,7 +8,6 @@ lexical-set-expression lexical-set? make-constant - make-lambda-case make-letrec make-lexical-ref make-library-ref @@ -177,28 +176,30 @@ builtins-environment))) -(test builtin-case-lambda-cases +(test builtin-lambda-rest (assert-equal ir1=? - (make-lambda-case '(x y z) #f #f (make-sequence (make-constant #f) (make-constant 5)) - (make-lambda-case '(a b c) 'd #f (make-sequence (make-constant #f) (make-constant 6)) '())) + (make-lambda (list + (make-lexical-ref 'a #f) + (make-lexical-ref 'b #f) + (make-lexical-ref 'c #f)) + (make-lexical-ref 'd #f) + (make-sequence (make-constant #f) (make-constant 5))) (expand - '(case-lambda - ((x y z) (quote 5)) - ((a b c . d) (quote 6))) + '(lambda + (a b c . d) (quote 5)) builtins-environment))) (test builtin-case-lambda-defines (assert-equal ir1=? - (make-lambda-case '(x) #f #f + (make-lambda (list (make-lexical-ref 'x #f)) #f (make-letrec #t '(a b) #f (list (make-constant 6) (make-lexical-ref 'a #f)) - (make-sequence (make-constant #f) (make-constant 7))) '()) + (make-sequence (make-constant #f) (make-constant 7)))) (expand - '(case-lambda - ((x) - (builtin-define a (quote 6)) - (builtin-define b a) - (quote 7))) + '(lambda (x) + (builtin-define a (quote 6)) + (builtin-define b a) + (quote 7)) builtins-environment))) -- cgit v1.3.1