aboutsummaryrefslogtreecommitdiff
path: root/src/boot/ast.boot
diff options
context:
space:
mode:
Diffstat (limited to 'src/boot/ast.boot')
-rw-r--r--src/boot/ast.boot11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/boot/ast.boot b/src/boot/ast.boot
index e7a6f85e..0e485759 100644
--- a/src/boot/ast.boot
+++ b/src/boot/ast.boot
@@ -371,7 +371,7 @@ bfCollect(y,itl) ==
y is ["COLON",a] => bfListReduce('APPEND,['reverse,a],itl)
y is ["TUPLE",:.] =>
bfListReduce('APPEND,['reverse,bfConstruct y],itl)
- bfListReduce('CONS,y,itl)
+ bfDoCollect(['CONS,y,'NIL],itl,'CDR)
bfListReduce(op,y,itl)==
g := bfGenSymbol()
@@ -379,6 +379,15 @@ bfListReduce(op,y,itl)==
extrait := [[[g],[nil],[],[],[],[['reverse!,g]]]]
bfLp2(extrait,itl,body)
+bfDoCollect(expr,itl,adv) ==
+ head := bfGenSymbol() -- pointer to the result
+ prev := bfGenSymbol() -- pointer to the previous cell
+ body :=
+ ['COND,[['NULL,head],['SETQ,head,['SETQ,prev,expr]]],
+ ["T",bfMKPROGN [['RPLACD,prev,expr],['SETQ,prev,[adv,prev]]]]]
+ extrait := [[[head,prev],['NIL,'NIL],nil,nil,nil,[head]]]
+ bfLp2(extrait,itl,body)
+
bfLp1(iters,body)==
[vars,inits,sucs,filters,exits,value] := bfSep bfAppend iters
nbody :=