aboutsummaryrefslogtreecommitdiff
path: root/src/interp/compiler.boot
diff options
context:
space:
mode:
Diffstat (limited to 'src/interp/compiler.boot')
-rw-r--r--src/interp/compiler.boot9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot
index a6c3cf02..c4428079 100644
--- a/src/interp/compiler.boot
+++ b/src/interp/compiler.boot
@@ -2392,6 +2392,13 @@ processInlineRequest(t,e) ==
--% ITERATORS
--%
+finishListCollect(iters,body) ==
+ val := gensym() -- result of the list comprehension
+ -- Transform the body to build the list as we go.
+ body := ['%store,val,['%pair,body,val]]
+ -- Don't forget we built the result in reverse order.
+ ['%repeat,:iters,['%init,val,'%nil],body,['%lreverse!,val]]
+
compReduce(form,m,e) ==
compReduce1(form,m,e,$formalArgList)
@@ -2495,7 +2502,7 @@ compRepeatOrCollect(form,m,e) ==
$loopKind = "%CollectV" =>
["%CollectV",localReferenceIfThere(m',e'),:itl',body']
-- We are phasing out use of LISP macros COLLECT and REPEAT.
- $loopKind = "COLLECT" => ['%collect,:itl',body']
+ $loopKind = "COLLECT" => finishListCollect(itl',body')
['%repeat,:itl',body','%nil]
m'' :=
aggr is [c,.] and c in '(List PrimitiveArray Vector) => [c,m']