From 192ab9c4e21bab8c08a640b349fa9630a9a672df Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Sun, 24 Jul 2022 19:07:17 -0700 Subject: Fix a bug in loop with nested collect statements. --- csc/loop.csc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'csc/loop.csc') diff --git a/csc/loop.csc b/csc/loop.csc index 10e634b..69f9201 100644 --- a/csc/loop.csc +++ b/csc/loop.csc @@ -274,7 +274,7 @@ (set-cdr! acc-last p) (set! list-acc p)) (set! acc-last p))) - finally (return list-acc) clause* ...)) + clause* ... finally (return list-acc))) ((loop-aux "accumulation" (continuation ...) (compound ...) append x into l clause* ...) (let ((l '()) (last #f)) @@ -294,7 +294,7 @@ (set-cdr! acc-last p) (set! list-acc p)) (set! acc-last p))) - finally (return list-acc) clause* ...)) + clause* ... finally (return list-acc))) ((loop-aux "accumulation" (continuation ...) (compound ...) count x into n clause* ...) (let ((n 0)) (loop-aux continuation ... @@ -305,7 +305,7 @@ (loop-aux continuation ... (compound ... (when x (set! number-acc (+ 1 number-acc)))) - finally (return number-acc) clause* ...)) + clause* ... finally (return number-acc))) ((loop-aux "accumulation" (continuation ...) (compound ...) sum x into n clause* ...) (let ((n 0)) (loop-aux continuation ... @@ -314,7 +314,7 @@ ((loop-aux "accumulation" (continuation ...) (compound ...) sum x clause* ...) (loop-aux continuation ... (compound ... (set! number-acc (+ x number-acc))) - finally (return number-acc) clause* ...)) + clause* ... finally (return number-acc))) ((loop-aux "accumulation" (continuation ...) (compound ...) maximize x into n clause* ...) (let ((n 0) (set #f)) @@ -334,7 +334,7 @@ (begin (set! acc-last #t) (set! number-acc temp))))) - finally (return number-acc) clause* ...)) + clause* ... finally (return number-acc))) ((loop-aux "accumulation" (continuation ...) (compound ...) minimize x into n clause* ...) (let ((n 0) (set #f)) @@ -354,7 +354,7 @@ (begin (set! acc-last #t) (set! number-acc temp))))) - finally (return number-acc) clause* ...)) + clause* ... finally (return number-acc))) ((loop-aux "accumulation-main-continuation" ((body ...) fin) (compound ...) clause* ...) (loop-aux "main-clause-collector" ((body ... compound ...) fin) clause* ...)) ((loop-aux "conditional" continuation compound if condition clause* ...) -- cgit v1.3.1