diff options
author | dos-reis <gdr@axiomatics.org> | 2011-04-21 05:56:14 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2011-04-21 05:56:14 +0000 |
commit | 97463cc77bbec1c33f46ceb44584a180264682c3 (patch) | |
tree | 61d9cf3e25771fbdd5de776ea989aff622684aa3 | |
parent | 1ca37b944b566ef3f0479d4c2fe6895e9fbd3785 (diff) | |
download | open-axiom-97463cc77bbec1c33f46ceb44584a180264682c3.tar.gz |
* boot/tokens.boot: Don't rename nreverse.
* boot/utility.boot (reverse!): Define.
* boot/parser.boot: Use reverse! instead of NREVERSE.
* boot/ast.boot: Generate reverse! forms instead of NREVERSE.
68 files changed, 378 insertions, 343 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 45d82a45..0e35daa0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2011-04-21 Gabriel Dos Reis <gdr@cs.tamu.edu> + + * boot/tokens.boot: Don't rename nreverse. + * boot/utility.boot (reverse!): Define. + * boot/parser.boot: Use reverse! instead of NREVERSE. + * boot/ast.boot: Generate reverse! forms instead of NREVERSE. + 2011-04-20 Gabriel Dos Reis <gdr@cs.tamu.edu> * interp/sys-utility.boot (substitute): Define. diff --git a/src/boot/Makefile.in b/src/boot/Makefile.in index c223c0b4..dac491f3 100644 --- a/src/boot/Makefile.in +++ b/src/boot/Makefile.in @@ -193,7 +193,7 @@ stage2/%.clisp: %.boot stage1/stamp stage2/.started %/utility.$(LNKEXT): %/utility.clisp %/initial-env.$(LNKEXT) $(DRIVER) --execpath=$(AXIOM_LOCAL_LISP) --output=$@ --compile --load-directory=$* $< -%/tokens.$(LNKEXT): %/tokens.clisp %/initial-env.$(LNKEXT) +%/tokens.$(LNKEXT): %/tokens.clisp %/utility.$(LNKEXT) $(DRIVER) --execpath=$(AXIOM_LOCAL_LISP) --output=$@ --compile --load-directory=$* $< %/includer.$(LNKEXT): %/includer.clisp %/tokens.$(LNKEXT) diff --git a/src/boot/ast.boot b/src/boot/ast.boot index 3e0fdc5d..8913772f 100644 --- a/src/boot/ast.boot +++ b/src/boot/ast.boot @@ -394,13 +394,13 @@ bf0COLLECT(y,itl) == bf0APPEND(y,itl)== g := bfGenSymbol() body := ['SETQ,g,['APPEND,['REVERSE,y],g]] - extrait := [[[g],[nil],[],[],[],[['NREVERSE,g]]]] + extrait := [[[g],[nil],[],[],[],[['reverse!,g]]]] bfLp2(extrait,itl,body) bfListReduce(op,y,itl)== g := bfGenSymbol() body := ['SETQ,g,[op,y,g]] - extrait := [[[g],[nil],[],[],[],[['NREVERSE,g]]]] + extrait := [[[g],[nil],[],[],[],[['reverse!,g]]]] bfLp2(extrait,itl,body) bfLp1(iters,body)== @@ -580,8 +580,8 @@ bfLET2(lhs,rhs) == var1 = "DOT" => [['L%T,g,rev],:l2] last l2 is ['L%T, =var1, val1] => [['L%T,g,rev],:REVERSE rest REVERSE l2, - bfLetForm(var1,['NREVERSE,val1])] - [['L%T,g,rev],:l2,bfLetForm(var1,['NREVERSE,var1])] + bfLetForm(var1,['reverse!,val1])] + [['L%T,g,rev],:l2,bfLetForm(var1,['reverse!,var1])] lhs is ["EQUAL",var1] => ['COND,[bfQ(var1,rhs),var1]] -- The original expression may be one that involves literals as -- sub-patterns, e.g. @@ -680,7 +680,7 @@ bfIS1(lhs,rhs) == l2 := bfIS1(g,patrev) if cons? l2 and atom first l2 then l2 := [l2,:nil] a = "DOT" => bfAND [rev,:l2] - bfAND [rev,:l2,['PROGN,bfLetForm(a,['NREVERSE,a]),'T]] + bfAND [rev,:l2,['PROGN,bfLetForm(a,['reverse!,a]),'T]] bpSpecificErrorHere '"bad IS code is generated" bpTrap() @@ -1185,7 +1185,7 @@ bfHandlers(n,e,hs) == main(n,e,hs,nil) where main(n,e,hs,xs) == hs = nil => ["COND", - :nreverse + :reverse! [[true,["THROW",KEYWORD::OPEN_-AXIOM_-CATCH_-POINT,n]],:xs]] hs is [['%Catch,['%Signature,v,t],s],:hs'] => t := @@ -1521,7 +1521,7 @@ genECLnativeTranslation(op,s,t,op') == args := reverse args rettype := nativeReturnType t [["DEFUN",op, args, - [bfColonColon("FFI","C-INLINE"),args, nreverse argtypes, + [bfColonColon("FFI","C-INLINE"),args, reverse! argtypes, rettype, callTemplate(op',#args,s), KEYWORD::ONE_-LINER, true]]] where callTemplate(op,n,s) == @@ -1639,10 +1639,10 @@ genSBCLnativeTranslation(op,s,t,op') == [makeSymbol('"EXTERN-ALIEN",'"SB-ALIEN"), op', ["FUNCTION",rettype,:argtypes]], :args]]] [["DEFUN",op,args, - [bfColonColon("SB-SYS","WITH-PINNED-OBJECTS"), nreverse unstableArgs, + [bfColonColon("SB-SYS","WITH-PINNED-OBJECTS"), reverse! unstableArgs, [makeSymbol('"ALIEN-FUNCALL",'"SB-ALIEN"), [makeSymbol('"EXTERN-ALIEN",'"SB-ALIEN"), op', - ["FUNCTION",rettype,:argtypes]], :nreverse newArgs]]]] + ["FUNCTION",rettype,:argtypes]], :reverse! newArgs]]]] diff --git a/src/boot/parser.boot b/src/boot/parser.boot index 7bf4bef4..e90d057e 100644 --- a/src/boot/parser.boot +++ b/src/boot/parser.boot @@ -167,7 +167,7 @@ bpListof(f,str1,g)== a:=$stack $stack:=nil while bpEqKey str1 and (apply(f,nil) or bpTrap()) repeat 0 - $stack:=[NREVERSE $stack,:a] + $stack:=[reverse! $stack,:a] bpPush FUNCALL(g, [bpPop3(),bpPop2(),:bpPop1()]) true false @@ -180,7 +180,7 @@ bpListofFun(f,h,g)== a:=$stack $stack:=nil while apply(h,nil) and (apply(f,nil) or bpTrap()) repeat 0 - $stack:=[NREVERSE $stack,:a] + $stack:=[reverse! $stack,:a] bpPush FUNCALL(g, [bpPop3(),bpPop2(),:bpPop1()]) true false @@ -191,7 +191,7 @@ bpList(f,str1)== a:=$stack $stack:=nil while bpEqKey str1 and (apply(f,nil) or bpTrap()) repeat 0 - $stack:=[NREVERSE $stack,:a] + $stack:=[reverse! $stack,:a] bpPush [bpPop3(),bpPop2(),:bpPop1()] bpPush [bpPop1()] bpPush nil @@ -201,7 +201,7 @@ bpOneOrMore f== a:=$stack $stack:=nil while apply(f,nil) repeat 0 - $stack:=[NREVERSE $stack,:a] + $stack:=[reverse! $stack,:a] bpPush [bpPop2(),:bpPop1()] false @@ -310,7 +310,7 @@ bpListAndRecover(f)== c := $inputStream b := [bpPop1(),:b] $stack := a - bpPush NREVERSE b + bpPush reverse! b bpMoveTo n== $inputStream = nil => true @@ -717,9 +717,9 @@ bpTry() == cs := [bpPop1(),:cs] bpHandler "FINALLY" => bpFinally() and - bpPush bfTry(bpPop2(),nreverse [bpPop1(),:cs]) + bpPush bfTry(bpPop2(),reverse! [bpPop1(),:cs]) cs = nil => bpTrap() -- missing handlers - bpPush bfTry(bpPop1(),nreverse cs) + bpPush bfTry(bpPop1(),reverse! cs) nil bpCatchItem() == diff --git a/src/boot/strap/ast.clisp b/src/boot/strap/ast.clisp index 95ca0d0d..0f94abac 100644 --- a/src/boot/strap/ast.clisp +++ b/src/boot/strap/ast.clisp @@ -434,7 +434,7 @@ (PROGN (SETQ |i| (CAR |bfVar#89|)) NIL) (ATOM |bfVar#90|) (PROGN (SETQ |j| (CAR |bfVar#90|)) NIL)) - (RETURN (NREVERSE |bfVar#91|))) + (RETURN (|reverse!| |bfVar#91|))) (T (SETQ |bfVar#91| (CONS (APPEND |i| |j|) |bfVar#91|)))) (SETQ |bfVar#89| (CDR |bfVar#89|)) @@ -519,7 +519,7 @@ (LIST 'SETQ |g| (LIST 'APPEND (LIST 'REVERSE |y|) |g|))) (SETQ |extrait| (LIST (LIST (LIST |g|) (LIST NIL) NIL NIL NIL - (LIST (LIST 'NREVERSE |g|))))) + (LIST (LIST '|reverse!| |g|))))) (|bfLp2| |extrait| |itl| |body|))))) (DEFUN |bfListReduce| (|op| |y| |itl|) @@ -530,7 +530,7 @@ (SETQ |body| (LIST 'SETQ |g| (LIST |op| |y| |g|))) (SETQ |extrait| (LIST (LIST (LIST |g|) (LIST NIL) NIL NIL NIL - (LIST (LIST 'NREVERSE |g|))))) + (LIST (LIST '|reverse!| |g|))))) (|bfLp2| |extrait| |itl| |body|))))) (DEFUN |bfLp1| (|iters| |body|) @@ -573,7 +573,7 @@ (PROGN (SETQ |i| (CAR |bfVar#93|)) NIL)) - (RETURN (NREVERSE |bfVar#94|))) + (RETURN (|reverse!| |bfVar#94|))) (T (SETQ |bfVar#94| (CONS (LIST |v| |i|) |bfVar#94|)))) @@ -874,12 +874,12 @@ (CONS (LIST 'L%T |g| |rev|) (APPEND (REVERSE (CDR (REVERSE |l2|))) (CONS (|bfLetForm| |var1| - (LIST 'NREVERSE |val1|)) + (LIST '|reverse!| |val1|)) NIL)))) (T (CONS (LIST 'L%T |g| |rev|) (APPEND |l2| (CONS (|bfLetForm| |var1| - (LIST 'NREVERSE |var1|)) + (LIST '|reverse!| |var1|)) NIL)))))) ((AND (CONSP |lhs|) (EQ (CAR |lhs|) 'EQUAL) (PROGN @@ -1079,7 +1079,7 @@ (CONS (LIST 'PROGN (|bfLetForm| |a| - (LIST 'NREVERSE |a|)) + (LIST '|reverse!| |a|)) 'T) NIL))))))) (T (|bpSpecificErrorHere| "bad IS code is generated") @@ -1220,7 +1220,7 @@ (COND ((OR (ATOM |bfVar#97|) (PROGN (SETQ |c| (CAR |bfVar#97|)) NIL)) - (RETURN (NREVERSE |bfVar#98|))) + (RETURN (|reverse!| |bfVar#98|))) (T (SETQ |bfVar#98| (APPEND (REVERSE (|bfFlatten| 'OR |c|)) |bfVar#98|)))) @@ -1236,7 +1236,7 @@ (COND ((OR (ATOM |bfVar#99|) (PROGN (SETQ |c| (CAR |bfVar#99|)) NIL)) - (RETURN (NREVERSE |bfVar#100|))) + (RETURN (|reverse!| |bfVar#100|))) (T (SETQ |bfVar#100| (APPEND (REVERSE (|bfFlatten| 'AND |c|)) |bfVar#100|)))) @@ -1311,7 +1311,7 @@ (PROGN (SETQ |i| (CAR |bfVar#101|)) NIL) (ATOM |bfVar#102|) (PROGN (SETQ |j| (CAR |bfVar#102|)) NIL)) - (RETURN (NREVERSE |bfVar#103|))) + (RETURN (|reverse!| |bfVar#103|))) (T (SETQ |bfVar#103| (CONS (CONS |i| |j|) |bfVar#103|)))) (SETQ |bfVar#101| (CDR |bfVar#101|)) @@ -1326,7 +1326,7 @@ (PROGN (SETQ |i| (CAR |bfVar#104|)) NIL) (ATOM |bfVar#105|) (PROGN (SETQ |j| (CAR |bfVar#105|)) NIL)) - (RETURN (NREVERSE |bfVar#106|))) + (RETURN (|reverse!| |bfVar#106|))) (T (SETQ |bfVar#106| (CONS (LIST 'CONS (LIST 'QUOTE |i|) |j|) |bfVar#106|)))) @@ -1343,7 +1343,7 @@ (COND ((OR (ATOM |bfVar#107|) (PROGN (SETQ |d| (CAR |bfVar#107|)) NIL)) - (RETURN (NREVERSE |bfVar#108|))) + (RETURN (|reverse!| |bfVar#108|))) (T (SETQ |bfVar#108| (APPEND (REVERSE (|shoeComps| (|bfDef1| |d|))) @@ -1423,7 +1423,7 @@ (COND ((OR (ATOM |bfVar#110|) (PROGN (SETQ |d| (CAR |bfVar#110|)) NIL)) - (RETURN (NREVERSE |bfVar#111|))) + (RETURN (|reverse!| |bfVar#111|))) (T (SETQ |bfVar#111| (APPEND (REVERSE (|shoeComps| (|bfDef1| |d|))) @@ -1436,7 +1436,7 @@ (COND ((OR (ATOM |bfVar#112|) (PROGN (SETQ |def| (CAR |bfVar#112|)) NIL)) - (RETURN (NREVERSE |bfVar#113|))) + (RETURN (|reverse!| |bfVar#113|))) (T (SETQ |bfVar#113| (CONS (|shoeComp| |def|) |bfVar#113|)))) (SETQ |bfVar#112| (CDR |bfVar#112|))))) @@ -1602,7 +1602,7 @@ ((NULL |b|) (LIST (LIST 'PROG |v|))) (T (SETQ |LETTMP#1| (REVERSE |b|)) (SETQ |blast| (CAR |LETTMP#1|)) - (SETQ |blist| (NREVERSE (CDR |LETTMP#1|))) + (SETQ |blist| (|reverse!| (CDR |LETTMP#1|))) (LIST (CONS 'PROG (CONS |v| (APPEND |blist| @@ -1710,7 +1710,7 @@ (PROGN (SETQ |y| (CAR |bfVar#117|)) NIL)) - (RETURN (NREVERSE |bfVar#118|))) + (RETURN (|reverse!| |bfVar#118|))) (T (AND (NOT (MEMQ |y| |newbindings|)) (SETQ |bfVar#118| (CONS |y| |bfVar#118|))))) @@ -1808,7 +1808,7 @@ (LET ((|bfVar#119| NIL) (|c| |l|)) (LOOP (COND - ((ATOM |c|) (RETURN (NREVERSE |bfVar#119|))) + ((ATOM |c|) (RETURN (|reverse!| |bfVar#119|))) (T (SETQ |bfVar#119| (APPEND (REVERSE (|bfFlattenSeq| |c|)) |bfVar#119|)))) @@ -1835,7 +1835,7 @@ (COND ((OR (ATOM |bfVar#120|) (PROGN (SETQ |i| (CAR |bfVar#120|)) NIL)) - (RETURN (NREVERSE |bfVar#121|))) + (RETURN (|reverse!| |bfVar#121|))) (T (AND (NOT (ATOM |i|)) (SETQ |bfVar#121| (CONS |i| |bfVar#121|))))) @@ -1876,7 +1876,7 @@ (NULL (CDR |ISTMP#5|)) (EQ (CAR |ISTMP#5|) 'T))))))) (PROGN (SETQ |conds| (CDR |ISTMP#2|)) T) - (PROGN (SETQ |conds| (NREVERSE |conds|)) T)))) + (PROGN (SETQ |conds| (|reverse!| |conds|)) T)))) (CONS (CONS 'AND |conds|) (|bfWashCONDBranchBody| (|bfMKPROGN| (LIST |stmt| |b|))))) (T (CONS |a| (|bfWashCONDBranchBody| |b|))))))) @@ -1926,7 +1926,7 @@ (SETQ |b| (CAR |ISTMP#5|)) T)))))))))))))) - (RETURN (NREVERSE |bfVar#123|))) + (RETURN (|reverse!| |bfVar#123|))) (T (SETQ |bfVar#123| (CONS (|bfAlternative| |a| |b|) |bfVar#123|)))) @@ -1967,7 +1967,7 @@ (COND ((OR (ATOM |bfVar#124|) (PROGN (SETQ |d| (CAR |bfVar#124|)) NIL)) - (RETURN (NREVERSE |bfVar#125|))) + (RETURN (|reverse!| |bfVar#125|))) (T (SETQ |bfVar#125| (CONS (LIST (CAR |d|) (CADR |d|) (|bfSUBLIS| |opassoc| (CADDR |d|))) @@ -2062,7 +2062,7 @@ (COND ((OR (ATOM |bfVar#126|) (PROGN (SETQ |i| (CAR |bfVar#126|)) NIL)) - (RETURN (NREVERSE |bfVar#127|))) + (RETURN (|reverse!| |bfVar#127|))) (T (SETQ |bfVar#127| (CONS (|bfGenSymbol|) |bfVar#127|)))) (SETQ |bfVar#126| (CDR |bfVar#126|))))) @@ -2097,7 +2097,7 @@ (COND ((OR (ATOM |bfVar#129|) (PROGN (SETQ |bfVar#128| (CAR |bfVar#129|)) NIL)) - (RETURN (NREVERSE |bfVar#130|))) + (RETURN (|reverse!| |bfVar#130|))) (T (AND (CONSP |bfVar#128|) (PROGN (SETQ |i| (CAR |bfVar#128|)) @@ -2124,7 +2124,7 @@ (COND ((OR (ATOM |bfVar#131|) (PROGN (SETQ |i| (CAR |bfVar#131|)) NIL)) - (RETURN (NREVERSE |bfVar#132|))) + (RETURN (|reverse!| |bfVar#132|))) (T (AND (NOT (EQ |i| 'DOT)) (SETQ |bfVar#132| (CONS @@ -2156,10 +2156,10 @@ (COND ((NULL |hs|) (CONS 'COND - (NREVERSE (CONS (LIST T - (LIST 'THROW - :OPEN-AXIOM-CATCH-POINT |n|)) - |xs|)))) + (|reverse!| (CONS (LIST T + (LIST 'THROW + :OPEN-AXIOM-CATCH-POINT |n|)) + |xs|)))) ((AND (CONSP |hs|) (PROGN (SETQ |ISTMP#1| (CAR |hs|)) @@ -2231,7 +2231,7 @@ (SETQ |f| (CAR |ISTMP#1|)) (SETQ |cs'| (CDR |ISTMP#1|)) T) - (PROGN (SETQ |cs'| (NREVERSE |cs'|)) T) (CONSP |f|) + (PROGN (SETQ |cs'| (|reverse!| |cs'|)) T) (CONSP |f|) (EQ (CAR |f|) '|%Finally|) (PROGN (SETQ |ISTMP#1| (CDR |f|)) @@ -2271,7 +2271,7 @@ (COND ((OR (ATOM |bfVar#133|) (PROGN (SETQ |t| (CAR |bfVar#133|)) NIL)) - (RETURN (NREVERSE |bfVar#134|))) + (RETURN (|reverse!| |bfVar#134|))) (T (SETQ |bfVar#134| (CONS (|backquote| |t| |params|) |bfVar#134|)))) @@ -2481,7 +2481,7 @@ (COND ((OR (ATOM |bfVar#135|) (PROGN (SETQ |x| (CAR |bfVar#135|)) NIL)) - (RETURN (NREVERSE |bfVar#136|))) + (RETURN (|reverse!| |bfVar#136|))) (T (SETQ |bfVar#136| (CONS (|nativeArgumentType| |x|) |bfVar#136|)))) @@ -2508,7 +2508,7 @@ (LOOP (COND ((> |i| |bfVar#144|) - (RETURN (NREVERSE |bfVar#145|))) + (RETURN (|reverse!| |bfVar#145|))) (T (SETQ |bfVar#145| (CONS (|genGCLnativeTranslation,mkCArgName| |i|) @@ -2531,7 +2531,8 @@ ((OR (ATOM |x|) (ATOM |a|)) (RETURN - (NREVERSE |bfVar#139|))) + (|reverse!| + |bfVar#139|))) (T (SETQ |bfVar#139| (CONS @@ -2557,7 +2558,7 @@ ((OR (ATOM |x|) (ATOM |a|)) (RETURN - (NREVERSE + (|reverse!| |bfVar#140|))) (T (SETQ |bfVar#140| @@ -2653,7 +2654,7 @@ (SETQ |rettype| (|nativeReturnType| |t|)) (LIST (LIST 'DEFUN |op| |args| (LIST (|bfColonColon| 'FFI 'C-INLINE) |args| - (NREVERSE |argtypes|) |rettype| + (|reverse!| |argtypes|) |rettype| (|genECLnativeTranslation,callTemplate| |op'| (LENGTH |args|) |s|) :ONE-LINER T))))))) @@ -2673,7 +2674,8 @@ (PROGN (SETQ |x| (CAR |bfVar#148|)) NIL)) - (RETURN (NREVERSE |bfVar#149|))) + (RETURN + (|reverse!| |bfVar#149|))) (T (SETQ |bfVar#149| (CONS @@ -2736,7 +2738,7 @@ (COND ((OR (ATOM |bfVar#153|) (PROGN (SETQ |x| (CAR |bfVar#153|)) NIL)) - (RETURN (NREVERSE |bfVar#154|))) + (RETURN (|reverse!| |bfVar#154|))) (T (SETQ |bfVar#154| (CONS (|nativeArgumentType| |x|) |bfVar#154|)))) @@ -2748,7 +2750,7 @@ (COND ((OR (ATOM |bfVar#155|) (PROGN (SETQ |x| (CAR |bfVar#155|)) NIL)) - (RETURN (NREVERSE |bfVar#156|))) + (RETURN (|reverse!| |bfVar#156|))) (T (SETQ |bfVar#156| (CONS (GENSYM "parm") |bfVar#156|)))) (SETQ |bfVar#155| (CDR |bfVar#155|))))) @@ -2790,7 +2792,7 @@ (PROGN (SETQ |a| (CAR |bfVar#161|)) NIL)) - (RETURN (NREVERSE |bfVar#162|))) + (RETURN (|reverse!| |bfVar#162|))) (T (SETQ |bfVar#162| (CONS (LIST |a| |x|) |bfVar#162|)))) (SETQ |bfVar#160| (CDR |bfVar#160|)) @@ -2812,7 +2814,7 @@ (SETQ |bfVar#163| (CAR |bfVar#164|)) NIL)) - (RETURN (NREVERSE |bfVar#165|))) + (RETURN (|reverse!| |bfVar#165|))) (T (AND (CONSP |bfVar#163|) (PROGN (SETQ |a| (CAR |bfVar#163|)) @@ -2840,7 +2842,8 @@ (PROGN (SETQ |p| (CAR |bfVar#166|)) NIL)) - (RETURN (NREVERSE |bfVar#167|))) + (RETURN + (|reverse!| |bfVar#167|))) (T (SETQ |bfVar#167| (CONS @@ -2861,7 +2864,7 @@ (SETQ |p| (CAR |bfVar#168|)) NIL)) (RETURN - (NREVERSE |bfVar#169|))) + (|reverse!| |bfVar#169|))) (T (AND (NOT @@ -2951,7 +2954,7 @@ (COND ((OR (ATOM |bfVar#173|) (PROGN (SETQ |x| (CAR |bfVar#173|)) NIL)) - (RETURN (NREVERSE |bfVar#174|))) + (RETURN (|reverse!| |bfVar#174|))) (T (SETQ |bfVar#174| (CONS (|nativeArgumentType| |x|) |bfVar#174|)))) @@ -2962,7 +2965,7 @@ (COND ((OR (ATOM |bfVar#175|) (PROGN (SETQ |x| (CAR |bfVar#175|)) NIL)) - (RETURN (NREVERSE |bfVar#176|))) + (RETURN (|reverse!| |bfVar#176|))) (T (SETQ |bfVar#176| (CONS (GENSYM) |bfVar#176|)))) (SETQ |bfVar#175| (CDR |bfVar#175|))))) (SETQ |unstableArgs| NIL) @@ -3002,7 +3005,7 @@ (T (LIST (LIST 'DEFUN |op| |args| (LIST (|bfColonColon| 'SB-SYS 'WITH-PINNED-OBJECTS) - (NREVERSE |unstableArgs|) + (|reverse!| |unstableArgs|) (CONS (INTERN "ALIEN-FUNCALL" "SB-ALIEN") (CONS @@ -3012,7 +3015,7 @@ |op'| (CONS 'FUNCTION (CONS |rettype| |argtypes|))) - (NREVERSE |newArgs|)))))))))))) + (|reverse!| |newArgs|)))))))))))) (DEFUN |genCLOZUREnativeTranslation| (|op| |s| |t| |op'|) (PROG (|call| |p'| |ISTMP#3| |ISTMP#2| |ISTMP#1| |aryPairs| @@ -3026,7 +3029,7 @@ (COND ((OR (ATOM |bfVar#179|) (PROGN (SETQ |x| (CAR |bfVar#179|)) NIL)) - (RETURN (NREVERSE |bfVar#180|))) + (RETURN (|reverse!| |bfVar#180|))) (T (SETQ |bfVar#180| (CONS (|nativeArgumentType| |x|) |bfVar#180|)))) @@ -3037,7 +3040,7 @@ (COND ((OR (ATOM |bfVar#181|) (PROGN (SETQ |x| (CAR |bfVar#181|)) NIL)) - (RETURN (NREVERSE |bfVar#182|))) + (RETURN (|reverse!| |bfVar#182|))) (T (SETQ |bfVar#182| (CONS (GENSYM "parm") |bfVar#182|)))) (SETQ |bfVar#181| (CDR |bfVar#181|))))) @@ -3096,7 +3099,7 @@ (CAR |bfVar#186|)) NIL)) (RETURN - (NREVERSE |bfVar#187|))) + (|reverse!| |bfVar#187|))) (T (SETQ |bfVar#187| (APPEND @@ -3143,7 +3146,7 @@ (PROGN (SETQ |arg| (CAR |bfVar#189|)) NIL)) - (RETURN (NREVERSE |bfVar#190|))) + (RETURN (|reverse!| |bfVar#190|))) (T (SETQ |bfVar#190| (CONS (LIST (CDR |arg|) (CAR |arg|)) diff --git a/src/boot/strap/parser.clisp b/src/boot/strap/parser.clisp index b3ef4b0e..a8a0b811 100644 --- a/src/boot/strap/parser.clisp +++ b/src/boot/strap/parser.clisp @@ -189,7 +189,7 @@ (OR (APPLY |f| NIL) (|bpTrap|)))) (RETURN NIL)) (T 0))) - (SETQ |$stack| (CONS (NREVERSE |$stack|) |a|)) + (SETQ |$stack| (CONS (|reverse!| |$stack|) |a|)) (|bpPush| (FUNCALL |g| (CONS (|bpPop3|) (CONS (|bpPop2|) (|bpPop1|)))))) @@ -211,7 +211,7 @@ (OR (APPLY |f| NIL) (|bpTrap|)))) (RETURN NIL)) (T 0))) - (SETQ |$stack| (CONS (NREVERSE |$stack|) |a|)) + (SETQ |$stack| (CONS (|reverse!| |$stack|) |a|)) (|bpPush| (FUNCALL |g| (CONS (|bpPop3|) (CONS (|bpPop2|) (|bpPop1|)))))) @@ -233,7 +233,7 @@ (OR (APPLY |f| NIL) (|bpTrap|)))) (RETURN NIL)) (T 0))) - (SETQ |$stack| (CONS (NREVERSE |$stack|) |a|)) + (SETQ |$stack| (CONS (|reverse!| |$stack|) |a|)) (|bpPush| (CONS (|bpPop3|) (CONS (|bpPop2|) (|bpPop1|))))) (T (|bpPush| (LIST (|bpPop1|)))))) (T (|bpPush| NIL)))))) @@ -245,7 +245,7 @@ (COND ((APPLY |f| NIL) (SETQ |a| |$stack|) (SETQ |$stack| NIL) (LOOP (COND ((NOT (APPLY |f| NIL)) (RETURN NIL)) (T 0))) - (SETQ |$stack| (CONS (NREVERSE |$stack|) |a|)) + (SETQ |$stack| (CONS (|reverse!| |$stack|) |a|)) (|bpPush| (CONS (|bpPop2|) (|bpPop1|)))) (T NIL))))) @@ -388,7 +388,7 @@ (T (|bpNext|) (SETQ |c| |$inputStream|))))) (SETQ |b| (CONS (|bpPop1|) |b|)))))) (SETQ |$stack| |a|) - (|bpPush| (NREVERSE |b|)))))) + (|bpPush| (|reverse!| |b|)))))) (DEFUN |bpMoveTo| (|n|) (DECLARE (SPECIAL |$bpParenCount| |$bpCount| |$inputStream|)) @@ -783,9 +783,9 @@ (AND (|bpFinally|) (|bpPush| (|bfTry| (|bpPop2|) - (NREVERSE (CONS (|bpPop1|) |cs|)))))) + (|reverse!| (CONS (|bpPop1|) |cs|)))))) ((NULL |cs|) (|bpTrap|)) - (T (|bpPush| (|bfTry| (|bpPop1|) (NREVERSE |cs|)))))) + (T (|bpPush| (|bfTry| (|bpPop1|) (|reverse!| |cs|)))))) (T NIL))))) (DEFUN |bpCatchItem| () diff --git a/src/boot/strap/tokens.clisp b/src/boot/strap/tokens.clisp index 7ec5fb63..c4c075ce 100644 --- a/src/boot/strap/tokens.clisp +++ b/src/boot/strap/tokens.clisp @@ -1,5 +1,5 @@ (PROCLAIM '(OPTIMIZE SPEED)) -(IMPORT-MODULE "initial-env") +(IMPORT-MODULE "utility") (IN-PACKAGE "BOOTTRAN") @@ -228,10 +228,9 @@ (LIST '|nconc| 'NCONC) (LIST '|newString| 'MAKE-STRING) (LIST '|newVector| 'MAKE-ARRAY) (LIST '|nil| NIL) - (LIST '|not| 'NOT) (LIST '|nreverse| 'NREVERSE) - (LIST '|null| 'NULL) (LIST '|or| 'OR) - (LIST '|otherwise| 'T) (LIST '|property| 'GET) - (LIST '|readByte| 'READ-BYTE) + (LIST '|not| 'NOT) (LIST '|null| 'NULL) + (LIST '|or| 'OR) (LIST '|otherwise| 'T) + (LIST '|property| 'GET) (LIST '|readByte| 'READ-BYTE) (LIST '|readInteger| 'PARSE-INTEGER) (LIST '|readLine| 'READ-LINE) (LIST '|readLispFromString| 'READ-FROM-STRING) diff --git a/src/boot/strap/translator.clisp b/src/boot/strap/translator.clisp index f7dbcb13..5aff56f2 100644 --- a/src/boot/strap/translator.clisp +++ b/src/boot/strap/translator.clisp @@ -49,7 +49,8 @@ (CAR |bfVar#1|)) NIL)) (RETURN - (NREVERSE |bfVar#2|))) + (|reverse!| + |bfVar#2|))) (T (SETQ |bfVar#2| (CONS (CADR |d|) @@ -69,7 +70,7 @@ (CAR |bfVar#3|)) NIL)) (RETURN - (NREVERSE |bfVar#4|))) + (|reverse!| |bfVar#4|))) (T (SETQ |bfVar#4| (CONS @@ -623,7 +624,7 @@ (CAR |bfVar#10|)) NIL)) (RETURN - (NREVERSE |bfVar#11|))) + (|reverse!| |bfVar#11|))) (T (SETQ |bfVar#11| (CONS @@ -708,7 +709,7 @@ (PROGN (SETQ |alt| (CAR |bfVar#12|)) NIL)) - (RETURN (NREVERSE |bfVar#13|))) + (RETURN (|reverse!| |bfVar#13|))) (T (SETQ |bfVar#13| (CONS (|bfCreateDef| |alt|) |bfVar#13|)))) @@ -790,7 +791,7 @@ (COND ((OR (ATOM |bfVar#14|) (PROGN (SETQ |i| (CAR |bfVar#14|)) NIL)) - (RETURN (NREVERSE |bfVar#15|))) + (RETURN (|reverse!| |bfVar#15|))) (T (AND (NOT (GETHASH |i| |$bootUsed|)) (SETQ |bfVar#15| (CONS |i| |bfVar#15|))))) (SETQ |bfVar#14| (CDR |bfVar#14|))))) @@ -807,7 +808,7 @@ (COND ((OR (ATOM |bfVar#16|) (PROGN (SETQ |i| (CAR |bfVar#16|)) NIL)) - (RETURN (NREVERSE |bfVar#17|))) + (RETURN (|reverse!| |bfVar#17|))) (T (AND (NOT (GETHASH |i| |$bootDefined|)) (SETQ |bfVar#17| (CONS |i| |bfVar#17|))))) (SETQ |bfVar#16| (CDR |bfVar#16|))))) @@ -1097,7 +1098,7 @@ (PROGN (SETQ |line| (CAR |bfVar#24|)) NIL)) - (RETURN (NREVERSE |bfVar#25|))) + (RETURN (|reverse!| |bfVar#25|))) (T (SETQ |bfVar#25| (CONS (CAR |line|) |bfVar#25|)))) (SETQ |bfVar#24| (CDR |bfVar#24|))))) diff --git a/src/boot/strap/utility.clisp b/src/boot/strap/utility.clisp index dac91a2b..60df1f22 100644 --- a/src/boot/strap/utility.clisp +++ b/src/boot/strap/utility.clisp @@ -6,7 +6,7 @@ (PROVIDE "utility") (EXPORT '(|objectMember?| |symbolMember?| |stringMember?| |charMember?| - |scalarMember?| |listMember?|)) + |scalarMember?| |listMember?| |reverse!|)) (DEFUN |objectMember?| (|x| |l|) (COND @@ -62,3 +62,14 @@ (T (SETQ |l| (CDR |l|))))) (T (RETURN (EQUAL |x| |l|)))))) +(DEFUN |reverse!| (|l|) + (PROG (|l2| |l1|) + (RETURN + (PROGN + (SETQ |l1| NIL) + (LOOP + (COND + ((CONSP |l|) (SETQ |l2| (CDR |l|)) (RPLACD |l| |l1|) + (SETQ |l1| |l|) (SETQ |l| |l2|)) + (T (RETURN |l1|)))))))) + diff --git a/src/boot/tokens.boot b/src/boot/tokens.boot index f87da75f..fb94ff87 100644 --- a/src/boot/tokens.boot +++ b/src/boot/tokens.boot @@ -32,7 +32,7 @@ -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -import initial_-env +import utility namespace BOOTTRAN module tokens @@ -285,7 +285,6 @@ for i in [ _ ["newVector", "MAKE-ARRAY"], _ ["nil" ,NIL ] , _ ["not", "NOT"] , _ - ["nreverse", "NREVERSE"] , _ ["null", "NULL"] , _ ["or", "OR"] , _ ["otherwise", "T"] , _ diff --git a/src/boot/utility.boot b/src/boot/utility.boot index 78e01a97..0ce3362a 100644 --- a/src/boot/utility.boot +++ b/src/boot/utility.boot @@ -33,7 +33,9 @@ import initial_-env namespace BOOTTRAN module utility (objectMember?, symbolMember?, stringMember?, - charMember?, scalarMember?, listMember?) + charMember?, scalarMember?, listMember?, reverse!) + +--% membership operators objectMember?(x,l) == cons? l => sameObject?(x,first l) or objectMember?(x,rest l) @@ -78,3 +80,16 @@ listMember?(x,l) == listEq?(x,first l) => return true l := rest l return listEq?(x,l) + +--% list reversal + +reverse! l == + l1 := nil + repeat + cons? l => + l2 := rest l + l.rest := l1 + l1 := l + l := l2 + return l1 + diff --git a/src/interp/as.boot b/src/interp/as.boot index 9bdaaf85..fba80995 100644 --- a/src/interp/as.boot +++ b/src/interp/as.boot @@ -95,7 +95,7 @@ asyParents(conform) == -- x := SUBLISLIS(IFCDR conform,formalParams,x) -- x := SUBST('Type,'Object,x) acc := [:explodeIfs x,:acc] - nreverse acc + reverse! acc asySubstMapping u == u is [op,:r] => @@ -294,7 +294,7 @@ asGetModemaps(opAlist,oform,kind,modemap) == pred' := MKPF([pred,:catPredList],'AND) mm := [[dc,:sig],[pred']] acc := [[op,:interactiveModemapForm mm],:acc] - nreverse acc + reverse! acc asIsCategoryForm m == m = "BasicType" or getConstructorKindFromDB opOf m = "category" @@ -608,7 +608,7 @@ asytranCategory(form,levels,predlist,local?) == HPUT(catTable,id,[asyWrap(record,predlist),:HGET(catTable,id)]) catList := [asyWrap(dform,predlist),:catList] keys := listSort(function GLESSEQP,HKEYS catTable) - right1 := nreverse catList + right1 := reverse! catList right2 := [[key,:HGET(catTable,key)] for key in keys] right := right2 => [:right1,['Exports,:right2]] diff --git a/src/interp/br-con.boot b/src/interp/br-con.boot index 05a0b57c..bcd0f8e1 100644 --- a/src/interp/br-con.boot +++ b/src/interp/br-con.boot @@ -1020,7 +1020,7 @@ dbConsExposureMessage() == -- kind = 'domain => doms := [x,:doms] -- kind = 'package => paks:= [x,:paks] -- defs := [x,:defs] --- lists := [nreverse cats,nreverse doms,nreverse paks,nreverse defs] +-- lists := [reverse! cats,reverse! doms,reverse! paks,reverse! defs] -- htBeginMenu(2) -- htSayStandard '"\indent{1}" -- kinds := +/[1 for x in lists | #x > 0] diff --git a/src/interp/br-data.boot b/src/interp/br-data.boot index 5df41701..4d20e105 100644 --- a/src/interp/br-data.boot +++ b/src/interp/br-data.boot @@ -269,7 +269,7 @@ dbReadComments(n) == x.(j := j + 1) = char "-" and x.(j := j + 1) = char "-" repeat xtralines := [subString(x,j + 1),:xtralines] SHUT instream - strconc(line, strconc/nreverse xtralines) + strconc(line, strconc/reverse! xtralines) dbSplitLibdb() == instream := MAKE_-INSTREAM '"olibdb.text" @@ -512,7 +512,7 @@ getParentsFor(cname,formalParams,constructorCategory) == x := SUBLISLIS(IFCDR constructorForm,formalParams,x) x := substitute('Type,'Object,x) acc := [:explodeIfs x,:acc] - nreverse acc + reverse! acc $parentsCache := nil @@ -538,7 +538,7 @@ getParentsForDomain domname == --called by parentsOf sublisFormal(IFCDR getConstructorForm domname,x,$TriangleVariableList) sublisFormal(IFCDR getConstructorForm domname,x) acc := [:explodeIfs x,:acc] - nreverse acc + reverse! acc explodeIfs x == main where --called by getParents, getParentsForDomain main() == @@ -625,7 +625,7 @@ computeAncestorsOf(conform,domform) == acc := nil for op in listSort(function GLESSEQP,HKEYS $if) repeat for pair in HGET($if,op) repeat acc := [pair,:acc] - nreverse acc + reverse! acc ancestorsRecur(conform,domform,pred,firstTime?) == --called by ancestorsOf op := opOf conform @@ -696,7 +696,7 @@ transKCatAlist(conform,domname,s) == main where null match? => 'skip npred := sublisFormal(KDR leftForm,pred) acc := [[leftForm,:npred],:acc] - nreverse acc + reverse! acc --conform has no arguments so each pair has form [con,:pred] for pair in s repeat leftForm := getConstructorForm first pair or systemError nil @@ -719,7 +719,7 @@ transKCatAlist(conform,domname,s) == main where ['hasArgs,:subargs] npred := quickAnd(hpred,npred) acc := [[leftForm,:npred],:acc] - nreverse acc + reverse! acc for pair in s repeat --pair has form [con,:pred] leftForm := getConstructorForm first pair pair.first := leftForm @@ -744,7 +744,7 @@ sublisFormal(args,exp,:options) == main where while cons? y repeat acc := [sublisFormal1(args,first y,n),:acc] y := rest y - r := nreverse acc + r := reverse! acc if y then nd := lastNode r nd.rest := sublisFormal1(args,y,n) diff --git a/src/interp/br-op1.boot b/src/interp/br-op1.boot index 5b46256d..25243200 100644 --- a/src/interp/br-op1.boot +++ b/src/interp/br-op1.boot @@ -125,7 +125,7 @@ dbShowOp1(htPage,opAlist,which,key) == acc := nil for x in items | x.3 repeat acc:= [x,:acc] null acc => nil - [op,:nreverse acc] + [op,:reverse! acc] $conformsAreDomains : local := htpProperty(htPage,'domname) opCount := opAlistCount(opAlist, which) branch := @@ -352,7 +352,7 @@ dbGatherData(htPage,opAlist,which,key) == exposureFlag => op [op,nil] acc := [node,:acc] - nreverse acc + reverse! acc data := nil dbExpandOpAlistIfNecessary(htPage,opAlist,which,key in '(origins documentation),false) --create data, a list of the form ((entry,exposeFlag,:entries)...) @@ -407,8 +407,8 @@ dbGatherDataImplementation(htPage,opAlist) == key = 'nowhere => nowheres := [x,:nowheres] key = 'constant =>constants := [x,:constants] others := [x,:others] --add chain domains go here - fn [nowheres,constants,domexports,SORTBY('CDDR,nreverse others),SORTBY('CDDR, - nreverse defexports),SORTBY('CDDR,nreverse unexports)] where + fn [nowheres,constants,domexports,SORTBY('CDDR,reverse! others),SORTBY('CDDR, + reverse! defexports),SORTBY('CDDR,reverse! unexports)] where fn l == alist := nil for u in l repeat @@ -417,7 +417,7 @@ dbGatherDataImplementation(htPage,opAlist) == entries := [[first u,true],:[u and [first u,true] while key = CDDAR (u := rest u)]] alist := [[key,gn key,:entries],:alist] - nreverse alist + reverse! alist gn key == atom key => true isExposedConstructor first key @@ -450,8 +450,8 @@ dbReduceByOpSignature(opAlist,datalist) == for [op,:alist] in opAlist | symbolMember?(op,ops) repeat entryList := [entry for (entry := [sig,:.]) in alist | test] where test() == or/[x for x in datalist | x is [[=op,=sig,:.],:.]] - entryList => acc := [[op,:nreverse entryList],:acc] - nreverse acc + entryList => acc := [[op,:reverse! entryList],:acc] + reverse! acc dbReduceBySignature(opAlist,op,sig) == --reduces opAlist to one with a fixed op and sig @@ -462,14 +462,14 @@ dbReduceByForm(opAlist,form) == for [op,:alist] in opAlist repeat items := [x for x in alist | dbContrivedForm(op,x) = form] => acc := [[op,:items],:acc] - nreverse acc + reverse! acc dbReduceBySelection(opAlist,key,fn) == acc := nil for [op,:alist] in opAlist repeat items := [x for x in alist | FUNCALL(fn,x) = key] => acc := [[op,:items],:acc] - nreverse acc + reverse! acc dbContrivedForm(op,[sig,:.]) == $which = '"attribute" => [op,sig] @@ -756,8 +756,8 @@ dbShowOperationLines(which,linelist) == --branch in with lines pile := [x] while (lines := rest lines) and name = dbName (x := first lines) repeat pile := [x,:pile] - opAlist := [[name,:nreverse pile],:opAlist] - opAlist := listSort(function LEXLESSEQP,nreverse opAlist) + opAlist := [[name,:reverse! pile],:opAlist] + opAlist := listSort(function LEXLESSEQP,reverse! opAlist) if which = '"operation" then htpSetProperty(htPage,'opAlist,opAlist) else htpSetProperty(htPage,'attrAlist,opAlist) @@ -836,7 +836,7 @@ dbExpandOpAlistIfNecessary(htPage,opAlist,which,needOrigins?,condition?) == exposeFlag := dbExposed?(line,char "o") acc := [[sig,predicate,origin,exposeFlag,comments],:acc] --always store the fruits of our labor: - pair.rest := nreverse acc --at least partially expand it + pair.rest := reverse! acc --at least partially expand it condition? and value => return value --early exit value => value condition? => nil diff --git a/src/interp/br-op2.boot b/src/interp/br-op2.boot index 3862174b..9aba11b7 100644 --- a/src/interp/br-op2.boot +++ b/src/interp/br-op2.boot @@ -261,7 +261,7 @@ whoUsesOperation(htPage,which,key) == --see dbPresentOps for [op,:alist] in opAlist repeat for [sig,:.] in alist repeat opl := [[op,:SUBLISLIS($FormalMapVariableList,rest conform,sig)],:opl] - opl := nreverse opl + opl := reverse! opl u := whoUses(opl,conform) prefix := pluralSay(#u,'"constructor uses",'"constructors use") suffix := @@ -378,7 +378,7 @@ koOps(conform,domname,:options) == main where -- for x in relatives repeat -- or/[y for y in CDAR x | isSharpVar y] => 'skip -- acc := [x,:acc] --- relatives := nreverse acc +-- relatives := reverse! acc -- for (pair := [pakform,:.]) in relatives repeat -- $packageItem := sublisFormal(rest conform,pair) -- ours := merge(fn(pakform,nil),ours) @@ -525,7 +525,7 @@ koaPageFilterByCategory1(htPage,i) == newOpAlist := insertAlist(op,newEntry,newOpAlist) falist := nil for [op,:alist] in newOpAlist repeat - falist := [[op,:nreverse alist],:falist] + falist := [[op,:reverse! alist],:falist] htpSetProperty(htPage,'fromcat,['" from category {\sf ",form2HtString ancestor,'"}"]) dbShowOperationsFromConform(htPage,which,falist) diff --git a/src/interp/br-saturn.boot b/src/interp/br-saturn.boot index d2fb762c..82fb5d55 100644 --- a/src/interp/br-saturn.boot +++ b/src/interp/br-saturn.boot @@ -157,7 +157,7 @@ bcHt line == if $saturn then htpAddToPageDescription($saturnPage, text) if $standard then htpAddToPageDescription($curPage, text) cons? line => - $htLineList := NCONC(nreverse mapStringize COPY_-LIST line, $htLineList) + $htLineList := NCONC(reverse! mapStringize COPY_-LIST line, $htLineList) $htLineList := [basicStringize line, :$htLineList] --======================================================================= @@ -173,21 +173,21 @@ htShowPageNoScroll() == -- show the page which has been computed htSayStandard '"\autobuttons" if $standard then - htpSetPageDescription($curPage, nreverse htpPageDescription $curPage) + htpSetPageDescription($curPage, reverse! htpPageDescription $curPage) if $saturn then - htpSetPageDescription($saturnPage, nreverse htpPageDescription $saturnPage) + htpSetPageDescription($saturnPage, reverse! htpPageDescription $saturnPage) $newPage := false ---------------------- if $standard then $htLineList := nil htMakePage htpPageDescription $curPage - if $htLineList then line := apply(function strconc, nreverse $htLineList) + if $htLineList then line := apply(function strconc, reverse! $htLineList) issueHTStandard line ---------------------- if $saturn then $htLineList := nil htMakePage htpPageDescription $saturnPage - if $htLineList then line := apply(function strconc, nreverse $htLineList) + if $htLineList then line := apply(function strconc, reverse! $htLineList) issueHTSaturn line ---------------------- endHTPage() @@ -212,7 +212,7 @@ writeSaturnPrefix() == STRINGIMAGE ($saturnContextMenuIndex := $saturnContextMenuIndex + 1) writeSaturnLines ['"\newmenu{BCM", index, - '"}{",:nreverse $saturnContextMenuLines, + '"}{",:reverse! $saturnContextMenuLines, '"}\usemenu{BCM", index,'"}{\vbox{"] writeSaturnSuffix() == @@ -230,7 +230,7 @@ htMakeErrorPage htPage == if $standard then $curPage := htPage if $saturn then $saturnPage := htPage htMakePage htpPageDescription htPage - line := apply(function strconc, nreverse $htLineList) + line := apply(function strconc, reverse! $htLineList) issueHT line endHTPage() @@ -549,7 +549,7 @@ htMakeButtonSaturn(htCommand, message, func,options) == htpAddToPageDescription(htPage, pageDescrip) == newDescript := string? pageDescrip => [pageDescrip, :htPage.7] - nconc(nreverse COPY_-LIST pageDescrip, htPage.7) + nconc(reverse! COPY_-LIST pageDescrip, htPage.7) htPage.7 := newDescript @@ -885,7 +885,7 @@ dbShowConsKinds cAlist == kind = 'domain => doms := [x,:doms] kind = 'package => paks := [x,:paks] defs := [x,:defs] - lists := [nreverse cats,nreverse doms,nreverse paks,nreverse defs] + lists := [reverse! cats,reverse! doms,reverse! paks,reverse! defs] htBeginMenu 'description htSayStandard '"\indent{1}" kinds := +/[1 for x in lists | #x > 0] diff --git a/src/interp/br-search.boot b/src/interp/br-search.boot index e933bd4b..4c49a8db 100644 --- a/src/interp/br-search.boot +++ b/src/interp/br-search.boot @@ -231,12 +231,12 @@ grepSplit(lines,doc?) == kind = char "-" => 'skip --for now systemError 'kind if doc? then CLOSE instream2 - [['"attribute",:nreverse atts], - ['"operation",:nreverse ops], - ['"category",:nreverse cats], - ['"domain",:nreverse doms], - ['"package",:nreverse paks] --- ['"default_ package",:nreverse defs] -- drop defaults + [['"attribute",:reverse! atts], + ['"operation",:reverse! ops], + ['"category",:reverse! cats], + ['"domain",:reverse! doms], + ['"package",:reverse! paks] +-- ['"default_ package",:reverse! defs] -- drop defaults ] mkUpDownPattern s == recurse(s,0,#s) where @@ -272,7 +272,7 @@ mkGrepPattern1(x,:options) == --called by mkGrepPattern (and grepConstructName?) if not ('w in $options) then if first res ~= '"" then res := ['"`",:res] else if res is [.,p,:r] and p = $wild1 then res := r - strconc/nreverse res + strconc/reverse! res remUnderscores s == (k := charPosition(char $charUnderscore,s,0)) < maxIndex s => strconc(subString(s,0,k),'"[",s.(k + 1),'"]", @@ -997,8 +997,8 @@ dbUnpatchLines lines == --concatenate long lines together, skip blank lines stringChar(line,0) = dash and line.1 = dash => [strconc(first acc,subString(line,2)),:rest acc] [line,:acc] - -- following call to nreverse needed to keep lines properly sorted - nreverse acc ------> added by BMT 12/95 + -- following call to reverse! needed to keep lines properly sorted + reverse! acc ------> added by BMT 12/95 diff --git a/src/interp/br-util.boot b/src/interp/br-util.boot index 79ef2ef4..599584ba 100644 --- a/src/interp/br-util.boot +++ b/src/interp/br-util.boot @@ -459,7 +459,7 @@ splitConTable cons == null pred => 'skip pred = 'T or pred is ['hasArgs,:.] => uncond := [pair,:uncond] cond := [pair,:cond] - [nreverse uncond,:nreverse cond] + [reverse! uncond,:reverse! cond] bcNameTable(u,fn,:option) == --option if * prefix htSay '"\newline" diff --git a/src/interp/c-doc.boot b/src/interp/c-doc.boot index 40055cde..c1421308 100644 --- a/src/interp/c-doc.boot +++ b/src/interp/c-doc.boot @@ -251,7 +251,7 @@ transDoc(conname,doclist) == transformAndRecheckComments('constructor,v or u) transformAndRecheckComments($x,u) acc := [[$x,longline],:acc] --processor assumes a list of lines - nreverse acc + reverse! acc checkExtractItemList l == --items are separated by commas or end of line acc := nil --l is list of remaining lines @@ -261,7 +261,7 @@ checkExtractItemList l == --items are separated by commas or end of line k <= m => return nil acc := [first l,:acc] l := rest l - strconc/[x for x in nreverse acc] + strconc/[x for x in reverse! acc] ++ Translate '%' in signature to '%%' for proper printing. escapePercent x == @@ -346,7 +346,7 @@ checkTexht u == x := IFCAR (u := rest u) --forget right brace: move to next char acc := [x,:acc] u := rest u - nreverse acc + reverse! acc checkRecordHash u == while u repeat @@ -450,7 +450,7 @@ checkGetStringBeforeRightBrace u == acc := nil while u repeat x := first u - x = $charRbrace => return strconc/(nreverse acc) + x = $charRbrace => return strconc/(reverse! acc) acc := [x,:acc] u := rest u @@ -464,7 +464,7 @@ checkGetStringBeforeRightBrace u == -- if x is '"\spadcommand" then x := '"\spadpaste" -- acc := [x,:acc] -- u := rest u --- nreverse acc +-- reverse! acc -- -- checkTranVerbatimMiddle u == -- (y := IFCAR (v := IFCDR u)) = $charLbrace and @@ -504,7 +504,7 @@ checkGetStringBeforeRightBrace u == -- if x is '"\spadcommand" then x := '"\spadpaste" -- acc := [x,:acc] -- u := rest u --- nreverse acc +-- reverse! acc appendOver [head,:tail] == acc := lastNode head @@ -520,7 +520,7 @@ checkRemoveComments lines == line := checkTrimCommented first lines if firstNonBlankPosition line >= 0 then acc := [line,:acc] lines := rest lines - nreverse acc + reverse! acc ++ return the part of `line' that is not a comment. A comment ++ is introduced by a leading percent character (%), or a double @@ -560,7 +560,7 @@ checkAddMacros u == y := LASSOC(x,$HTmacs) => [:y,:acc] [x,:acc] u := rest u - nreverse acc + reverse! acc checkComments(nameSig,lines) == main where main() == @@ -661,7 +661,7 @@ checkGetArgs u == while (k := charPosition($charComma,u,i + 1)) < m repeat acc := [trimString subString(u,i + 1,k - i - 1),:acc] i := k - nreverse [subString(u,i + 1,m - i - 1),:acc] + reverse! [subString(u,i + 1,m - i - 1),:acc] checkGetMargin lines == while lines repeat @@ -745,7 +745,7 @@ checkExtract(header,lines) == (i := charPosition(char " ",line,k+1)) < j => 'skip --blank before colon return nil acc := [line,:acc] - nreverse acc + reverse! acc checkFixCommonProblem u == acc := nil @@ -758,7 +758,7 @@ checkFixCommonProblem u == u := rest rest u acc := [x,:acc] u := rest u - nreverse acc + reverse! acc checkDecorate u == count := 0 -- number of enclosing opening braces @@ -831,7 +831,7 @@ checkDecorate u == [$charRbrace,x,$charLbrace,'"\spad",:acc] [checkAddBackSlashes x,:acc] u := rest u - nreverse acc + reverse! acc hasNoVowels x == max := maxIndex x @@ -894,10 +894,10 @@ checkIeEg u == x is '"\begin{verbatim}" => verbatim := true [x, :acc] - z := checkIeEgfun x => [:nreverse z,:acc] + z := checkIeEgfun x => [:reverse! z,:acc] [x,:acc] u := rest u - nreverse acc + reverse! acc checkIeEgfun x == CHARP x => nil @@ -924,10 +924,10 @@ checkSplit2Words u == x is '"\begin{verbatim}" => verbatim := true [x, :acc] - z := checkSplitBrace x => [:nreverse z,:acc] + z := checkSplitBrace x => [:reverse! z,:acc] [x,:acc] u := rest u - nreverse acc + reverse! acc checkSplitBrace x == CHARP x => [x] @@ -1020,7 +1020,7 @@ checkBalance u == checkDocError ['"Missing left ",checkSayBracket open] u := rest u if stack then - for x in nreverse stack repeat + for x in reverse! stack repeat checkDocError ['"Missing right ",checkSayBracket x] u diff --git a/src/interp/c-util.boot b/src/interp/c-util.boot index 9aba4f1b..e8ebb419 100644 --- a/src/interp/c-util.boot +++ b/src/interp/c-util.boot @@ -215,7 +215,7 @@ down() == displayComp ($level:= $level+1) displaySemanticErrors() == n:= #($semanticErrorStack:= removeDuplicates $semanticErrorStack) n=0 => nil - l:= nreverse $semanticErrorStack + l:= reverse! $semanticErrorStack $semanticErrorStack:= nil sayBrightly bright '" Semantic Errors:" displaySemanticError(l,$OutputStream) @@ -230,7 +230,7 @@ displayWarnings() == n:= #($warningStack:= removeDuplicates $warningStack) n=0 => nil sayBrightly bright '" Warnings:" - l := nreverse $warningStack + l := reverse! $warningStack displayWarning(l,$OutputStream) $warningStack:= nil sayBrightly '" " @@ -546,8 +546,8 @@ TrimCF() == uold:= rest u unew:= nil for v in uold repeat if not ASSQ(first v,unew) then unew:= [v,:unew] - new:= [[first u,:nreverse unew],:new] - $CategoryFrame:= [[nreverse new]] + new:= [[first u,:reverse! unew],:new] + $CategoryFrame:= [[reverse! new]] nil --% @@ -1590,8 +1590,8 @@ transformToBackendCode x == or not CONTAINED("EXIT",stmt)) => body [simplifySEQ ["SEQ",:body]] - $FluidVars := removeDuplicates nreverse $FluidVars - $LocalVars := S_-(S_-(removeDuplicates nreverse $LocalVars,$FluidVars), + $FluidVars := removeDuplicates reverse! $FluidVars + $LocalVars := S_-(S_-(removeDuplicates reverse! $LocalVars,$FluidVars), LISTOFATOMS second x) lvars := [:$FluidVars,:$LocalVars] fluids := S_+($FluidVars,$SpecialVars) diff --git a/src/interp/cattable.boot b/src/interp/cattable.boot index 08d0b181..e79677ba 100644 --- a/src/interp/cattable.boot +++ b/src/interp/cattable.boot @@ -352,7 +352,7 @@ getConstrCat(x) == y is ['CATEGORY,.,:z] => for zz in z repeat cats := makeCatPred(zz, cats, true) cats:= [y,:cats] - cats:= nreverse cats + cats:= reverse! cats cats diff --git a/src/interp/clam.boot b/src/interp/clam.boot index cd7713f0..7b1a8c81 100644 --- a/src/interp/clam.boot +++ b/src/interp/clam.boot @@ -363,7 +363,7 @@ clearCategoryCache catName == setDynamicBinding(mkCacheName catName,nil) displayHashtable x == - l:= nreverse SORTBY('CAR,[[opOf HGET(x,key),key] for key in HKEYS x]) + l:= reverse! SORTBY('CAR,[[opOf HGET(x,key),key] for key in HKEYS x]) for [a,b] in l repeat sayBrightlyNT ['"%b",a,'"%d"] pp b @@ -386,7 +386,7 @@ reportCircularCacheStats(fn,n) == TERPRI() displayCacheFrequency al == - al := nreverse SORTBY('CAR,al) + al := reverse! SORTBY('CAR,al) sayBrightlyNT " #hits/#occurrences: " for [a,:b] in al repeat sayBrightlyNT [a,"/",b," "] TERPRI() @@ -577,7 +577,7 @@ reportInstantiations() == sayBrightly ['"# instantiated/# dropped/domain name", "%l",'"------------------------------------"] nTotal:= mTotal:= rTotal := nForms:= 0 - for [n,m,form] in nreverse SORTBY('CADDR,conList) repeat + for [n,m,form] in reverse! SORTBY('CADDR,conList) repeat nTotal:= nTotal+n; mTotal:= mTotal+m if n > 1 then rTotal:= rTotal + n-1 nForms:= nForms + 1 @@ -676,7 +676,7 @@ globalHashtableStats(x,sortFn) == argList1:= [constructor2ConstructorForm x for x in argList] reportList:= [[n,key,argList1],:reportList] sayBrightly ["%b"," USE NAME ARGS","%d"] - for [n,fn,args] in nreverse SORTBY(sortFn,reportList) repeat + for [n,fn,args] in reverse! SORTBY(sortFn,reportList) repeat sayBrightlyNT [:rightJustifyString(n,6)," ",fn,": "] pp args diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot index ff7f5787..df6c4848 100644 --- a/src/interp/compiler.boot +++ b/src/interp/compiler.boot @@ -339,8 +339,8 @@ finishLambdaExpression(expr is ["LAMBDA",vars,.],env) == slist => SUBLISNQ(slist,CDDR expandedFunction) CDDR expandedFunction if scode ~= nil then - body := [['%bind,nreverse scode,:body]] - vec := ['%vector,:nreverse vec] + body := [['%bind,reverse! scode,:body]] + vec := ['%vector,:reverse! vec] ["LAMBDA",[:vars,"$$"],:body] fname := ["CLOSEDFN",expandedFunction] --Like QUOTE, but gets compiled ["CONS",fname,vec] @@ -2088,7 +2088,7 @@ compMatchScrutinee(form,e) == [x,m,e] := compOrCroak(expr,$EmptyMode,e) Xs := [x,:Xs] Ms := [m,:Ms] - [["%Comma",:nreverse Xs], ["%Cross",:nreverse Ms],e] + [["%Comma",:reverse! Xs], ["%Cross",:reverse! Ms],e] compOrCroak(form,$EmptyMode,e) ++ Subroutine of compMatch. We just finished semantics analysis of @@ -2145,7 +2145,7 @@ compAlternativeGuard(sn,sm,pat,e) == guards := [guard,:guards] inits := [init,:inits] ok := false - ok => [['%and,:nreverse guards],append/nreverse inits,e,originalEnv] + ok => [['%and,:reverse! guards],append/reverse! inits,e,originalEnv] nil compAlternativeGuardItem(sn,sm,pat,e) @@ -2188,9 +2188,9 @@ compMatch(["%Match",subject,altBlock],m,env) == $catchAllCount = 0 => stackAndThrow('"missing %b otherwise %d alternative in case pattern",nil) code := - IDENTP sn => ['%bind,[[sn,se]],['%when,:nreverse altsCode]] + IDENTP sn => ['%bind,[[sn,se]],['%when,:reverse! altsCode]] ["%bind",[[n,e] for n in sn for e in rest se], - ['%when,:nreverse altsCode]] + ['%when,:reverse! altsCode]] [code,m,savedEnv] ++ Compile the form scheme `x'. @@ -2542,7 +2542,7 @@ compUnnamedMapping(parms,source,target,body,env) == gatherParameterList vars == main(vars,nil,nil) where main(vars,parms,source) == - vars = nil => [nreverse parms,nreverse source] + vars = nil => [reverse! parms,reverse! source] atom vars or vars is [":",:.] => [[x] for x in check vars] [v,s] := check first vars main(rest vars,[v,:parms],[s,:source]) diff --git a/src/interp/cparse.boot b/src/interp/cparse.boot index 55990bed..010c84e4 100644 --- a/src/interp/cparse.boot +++ b/src/interp/cparse.boot @@ -204,7 +204,7 @@ npListofFun(f,h,g)== a := $stack $stack := nil while apply(h,nil) and (apply(f,nil) or npTrap()) repeat 0 - $stack := [nreverse $stack,:a] + $stack := [reverse! $stack,:a] npPush FUNCALL(g, [npPop3(),npPop2(),:npPop1()]) true false @@ -219,7 +219,7 @@ npList(f,str1,g)== -- always produces a list, g is applied to it $stack := nil while npEqKey str1 and (npEqKey "BACKSET" or true) and (apply(f,nil) or npTrap()) repeat 0 - $stack := [nreverse $stack,:a] + $stack := [reverse! $stack,:a] npPush FUNCALL(g,[npPop3(),npPop2(),:npPop1()]) npPush FUNCALL(g, [npPop1()]) npPush FUNCALL(g, []) @@ -628,7 +628,7 @@ npZeroOrMore f== a := $stack $stack := nil while apply(f,nil) repeat 0 - $stack := [nreverse $stack,:a] + $stack := [reverse! $stack,:a] npPush [npPop2(),:npPop1()] npPush nil true @@ -1075,7 +1075,7 @@ npListAndRecover(f)== c:=$inputStream b := [npPop1(),:b] $stack := a - npPush nreverse b + npPush reverse! b npMoveTo n== $inputStream = nil => true diff --git a/src/interp/daase.lisp b/src/interp/daase.lisp index 1a72602a..99fadcdc 100644 --- a/src/interp/daase.lisp +++ b/src/interp/daase.lisp @@ -1044,19 +1044,19 @@ ".ao"))) (push (namestring file) asos)) ('else (format t " )library cannot find the file ~a.~%" filename))))) - (dolist (file (nreverse nrlibs)) + (dolist (file (|reverse!| nrlibs)) (setq key (pathname-name (first (last (pathname-directory file))))) (setq object (concatenate 'string (directory-namestring file) "code." |$faslType|)) (localnrlib key file object make-database? noexpose)) - (dolist (file (nreverse asys)) + (dolist (file (|reverse!| asys)) (setq object (concatenate 'string (directory-namestring file) (pathname-name file))) (localasy (|astran| file) object only make-database? noexpose)) - (dolist (file (nreverse asos)) + (dolist (file (|reverse!| asos)) (setq object (concatenate 'string (directory-namestring file) diff --git a/src/interp/database.boot b/src/interp/database.boot index ef523a1f..607e6e39 100644 --- a/src/interp/database.boot +++ b/src/interp/database.boot @@ -439,7 +439,7 @@ modemapPattern(mmPattern,sig) == patvars := rest patvars mmpat := [patvar,:mmpat] patternAlist := [[patvar,:x],:patternAlist] - [nreverse mmpat,patternAlist,partial,patvars] + [reverse! mmpat,patternAlist,partial,patvars] substVars(pred,patternAlist,patternVarList) == --make pattern variable substitutions @@ -725,15 +725,15 @@ dropPrefix(fn) == --++ egFiles := [[n,:object2Identifier x],:egFiles] --++ -- have a new group name --++ if egName then $globalExposureGroupAlist := ---++ [[egName,:nreverse egFiles],:$globalExposureGroupAlist] +--++ [[egName,:reverse! egFiles],:$globalExposureGroupAlist] --++ egFiles := NIL --++ STRPOS('" ",x,1,NIL) => --++ throwKeyedMsg("S2IZ0069C",[namestring egFile,x]) --++ egName := object2Identifier x --++ if egFiles then $globalExposureGroupAlist := ---++ [[egName,:nreverse egFiles],:$globalExposureGroupAlist] +--++ [[egName,:reverse! egFiles],:$globalExposureGroupAlist] --++ SHUT stream ---++ $globalExposureGroupAlist := nreverse $globalExposureGroupAlist +--++ $globalExposureGroupAlist := reverse! $globalExposureGroupAlist --++ 'done isExposedConstructor name == diff --git a/src/interp/debug.lisp b/src/interp/debug.lisp index 1f1b9c5c..c38f8c8e 100644 --- a/src/interp/debug.lisp +++ b/src/interp/debug.lisp @@ -1014,7 +1014,7 @@ EXAMINE (SETQ RECNO (NOTE |$InputStream|)) (PRIN1 /CALLER CURSTRM))) (MONITOR-PRINARGS (if (SPADSYSNAMEP NAME) - (NREVERSE (REVERSE (|coerceTraceArgs2E| + (|reverse!| (REVERSE (|coerceTraceArgs2E| (INTERN NAME1) (INTERN NAME) /ARGS))) diff --git a/src/interp/define.boot b/src/interp/define.boot index c0784042..1d7a12d6 100644 --- a/src/interp/define.boot +++ b/src/interp/define.boot @@ -141,7 +141,7 @@ makeDomainTemplate vec == atom item => item cons? first item => makeGoGetSlot(item,index) item - $byteVec := "append"/nreverse $byteVec + $byteVec := "append"/reverse! $byteVec newVec makeGoGetSlot(item,index) == @@ -165,7 +165,7 @@ makeCompactDirect u == [nam,[addForm,:opList]] := u --pp opList d := [[op,y] for [op,:items] in opList | y := makeCompactDirect1(op,items)] - $byteVec := [:$byteVec,:"append"/nreverse $byteVecAcc] + $byteVec := [:$byteVec,:"append"/reverse! $byteVecAcc] LIST2VEC ("append"/d) makeCompactDirect1(op,items) == @@ -234,7 +234,7 @@ NRTmakeCategoryAlist() == $catAncestorAlist: local := NIL pcAlist := [:[[x,:"T"] for x in $uncondAlist],:$condAlist] $levelAlist: local := depthAssocList [CAAR x for x in pcAlist] - opcAlist := nreverse SORTBY(function NRTcatCompare,pcAlist) + opcAlist := reverse! SORTBY(function NRTcatCompare,pcAlist) newPairlis := [[5 + i,:b] for [.,:b] in $pairlis for i in 1..] slot1 := [[a,:k] for [a,:b] in SUBLIS($pairlis,opcAlist) | (k := predicateBitIndex b) ~= -1] @@ -1042,7 +1042,7 @@ compFunctorBody(body,m,e,parForm) == [bootStrapError($functorForm, _/EDITFILE),m,e] clearCapsuleDirectory() -- start collecting capsule functions. T:= compOrCroak(body,m,e) - $capsuleFunctionStack := nreverse $capsuleFunctionStack + $capsuleFunctionStack := reverse! $capsuleFunctionStack -- ??? Don't resolve default definitions, yet. if $insideCategoryPackageIfTrue then backendCompile $capsuleFunctionStack @@ -1254,7 +1254,7 @@ orderByDependency(vl,dl) == | symbolMember?(x,vl')] vl := vl' dl := dl' - removeDuplicates nreverse orderedVarList --ordered so ith is indep. of jth if i < j + removeDuplicates reverse! orderedVarList --ordered so ith is indep. of jth if i < j compDefineCapsuleFunction(df is ['DEF,form,signature,specialCases,body], m,$e,$prefix,$formalArgList) == @@ -1875,8 +1875,8 @@ doItIf(item is [.,p,x,y],$predl,$e) == ans:=[["%LET",gv,u],:ans] nils:=[gv,:nils] n:=n+1 - $functorLocalParameters:=[:oldFLP,:nreverse nils] - nreverse ans + $functorLocalParameters:=[:oldFLP,:reverse! nils] + reverse! ans --% CATEGORY AND DOMAIN FUNCTIONS diff --git a/src/interp/format.boot b/src/interp/format.boot index 722d8c8a..0be7cf3d 100644 --- a/src/interp/format.boot +++ b/src/interp/format.boot @@ -105,7 +105,7 @@ canRemoveIsDomain? pred == findSubstitutionOrder? alist == fn(alist,nil) where -- returns NIL or an appropriate substituion order fn(alist,res) == - null alist => nreverse res + null alist => reverse! res choice := or/[x for (x:=[a,:b]) in alist | null containedRight(a,alist)] => fn(delete(choice,alist),[choice,:res]) nil diff --git a/src/interp/fortcall.boot b/src/interp/fortcall.boot index 17e99819..a4ed15dd 100644 --- a/src/interp/fortcall.boot +++ b/src/interp/fortcall.boot @@ -115,7 +115,7 @@ writeCFile(name,args,fortranArgs,dummies,decls,results,returnType,asps,fp) == for a in args repeat argList := [[a, getCType getFortranType(a,decls)], :argList] printDec(second first argList,a,asps,fp) - argList := nreverse argList; + argList := reverse! argList; -- read in the data writeLine('" xdrstdio__create(&xdrs, stdin, XDR__DECODE);",fp) for a in argList repeat @@ -462,10 +462,10 @@ spadify(l,results,decls,names,actual) == for c in 0..(second(dims) - 1) repeat offset := 2*(c*first(dims)+r) innerEls := [[fort.offset,:fort.(offset+1)],:innerEls] - els := [makeVector(nreverse innerEls,nil),:els] + els := [makeVector(reverse! innerEls,nil),:els] else error ['"Can't cope with complex output dimensions higher than 2"] - spadForms := [makeResultRecord(name,ty,makeVector(nreverse els,nil)), + spadForms := [makeResultRecord(name,ty,makeVector(reverse! els,nil)), :spadForms] -- Result is a Boolean vector or array LISTP(ty) and first(ty)="logical" and #ty=2 => @@ -480,10 +480,10 @@ spadify(l,results,decls,names,actual) == innerEls := nil for c in 0..(second(dims) - 1) repeat innerEls := [int2Bool fort.(c*first(dims)+r),:innerEls] - els := [nreverse innerEls,:els] + els := [reverse! innerEls,:els] else error ['"Can't cope with logical output dimensions higher than 2"] - spadForms := [makeResultRecord(name,ty,nreverse els), :spadForms] + spadForms := [makeResultRecord(name,ty,reverse! els), :spadForms] -- Result is a vector or array VECTORP fort => dims := [getVal(u,names,actual) for u in rest ty] @@ -498,7 +498,7 @@ spadify(l,results,decls,names,actual) == innerEls := nil for c in 0..(second(dims) - 1) repeat innerEls := [fort.(c*first(dims)+r),:innerEls] - els := [makeVector(nreverse innerEls,nil),:els] + els := [makeVector(reverse! innerEls,nil),:els] else if #dims=3 then iDim := first(dims) jDim := second dims @@ -510,11 +510,11 @@ spadify(l,results,decls,names,actual) == for p in 0..(kDim - 1) repeat offset := p*jDim + c*kDim + r innerEls := [fort.offset,:innerEls] - middleEls := [makeVector(nreverse innerEls,nil),:middleEls] - els := [makeVector(nreverse middleEls,nil),:els] + middleEls := [makeVector(reverse! innerEls,nil),:middleEls] + els := [makeVector(reverse! middleEls,nil),:els] else error ['"Can't cope with output dimensions higher than 3"] - if not scalarMember?(0,dims) then els := makeVector(nreverse els,nil) + if not scalarMember?(0,dims) then els := makeVector(reverse! els,nil) spadForms := [makeResultRecord(name,ty,els), :spadForms] -- Result is a Boolean Scalar atom fort and ty="logical" => @@ -523,7 +523,7 @@ spadify(l,results,decls,names,actual) == atom fort => spadForms := [makeResultRecord(name,ty,fort),:spadForms] error ['"Unrecognised output format: ",fort] - nreverse spadForms + reverse! spadForms lispType u == -- Return the lisp type equivalent to the given Fortran type. @@ -587,7 +587,7 @@ prepareResults(results,args,dummies,values,decls) == type = "complex" => makeVector([shortZero,shortZero],"%SingleFloat") type = "double complex" => makeVector([longZero,longZero],"%DoubleFloat") error ['"Unrecognised Fortran type: ",type] - nreverse data + reverse! data -- TTT this is dead code now -- transposeVector(u,type) == @@ -604,7 +604,7 @@ prepareResults(results,args,dummies,values,decls) == -- else -- for j in 0..cols repeat for i in 0..rows repeat -- els := [u.i.j,:els] --- makeVector(nreverse els,type) +-- makeVector(reverse! els,type) writeData(tmpFile,indata) == diff --git a/src/interp/functor.boot b/src/interp/functor.boot index 48d3277f..2b71c72f 100644 --- a/src/interp/functor.boot +++ b/src/interp/functor.boot @@ -497,7 +497,7 @@ DescendCode(code,flag,viewAssoc,EnvToPass) == code is ['PROGN,:codelist] => ['PROGN,: --Two REVERSEs leave original order, but ensure last guy wins - nreverse [v for u in reverse codelist | + reverse! [v for u in reverse codelist | (v:= DescendCode(u,flag,viewAssoc,EnvToPass))~=nil]] code is ['%when,:condlist] => c:= [[u2:= ProcessCond first u,:q] for u in condlist] where q() == @@ -517,7 +517,7 @@ DescendCode(code,flag,viewAssoc,EnvToPass) == while (c and (last c is [c1] or last c is [c1,[]]) and (c1 = '%true or c1 is ['HasAttribute,:.])) repeat --strip out some worthless junk at the end - c:=nreverse rest nreverse c + c:=reverse! rest reverse! c null c => '(LIST) ['%when,:c] code is ["%LET",name,body,:.] => diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot index c62882ba..ab1006e9 100644 --- a/src/interp/g-opt.boot +++ b/src/interp/g-opt.boot @@ -132,7 +132,7 @@ groupVariableDefinitions form == expr := stmts = nil => val ['SEQ,:stmts,['EXIT,val]] - ['%bind,nreverse defs,expr] + ['%bind,reverse! defs,expr] optimizeFunctionDef(def) == if $reportOptimization then @@ -667,7 +667,7 @@ optCollectVector form == -- get the actual size of the vector. vecSize := vecSize is [hi] => hi - ["MIN",:nreverse vecSize] + ["MIN",:reverse! vecSize] -- if no suitable loop index was found, introduce one. if index = nil then index := gensym() diff --git a/src/interp/ht-root.boot b/src/interp/ht-root.boot index 563326d9..30bb52b4 100644 --- a/src/interp/ht-root.boot +++ b/src/interp/ht-root.boot @@ -56,7 +56,7 @@ htSystemVariables() == main where $levels : local := '(compiler development interpreter) $heading : local := nil while classlevel ~= first $levels repeat $levels := rest $levels - table := nreverse fn($setOptions,nil,true) + table := reverse! fn($setOptions,nil,true) htInitPage('"System Variables",nil) htSay '"\beginmenu" lastHeading := nil @@ -180,7 +180,7 @@ gatherGlossLines(results,defstream) == (j := charPosition($tick,x,1)) and (nextPointer := subString(x,0,j)) and (nextPointer = pointer) repeat xtralines := [subString(x,j + 1),:xtralines] - acc := [strconc(keyAndTick,def, strconc/nreverse xtralines),:acc] + acc := [strconc(keyAndTick,def, strconc/reverse! xtralines),:acc] reverse acc htGlossSearch(htPage,junk) == htGloss htpLabelInputString(htPage,'filter) @@ -198,8 +198,8 @@ htGreekSearch(filter) == for x in names repeat superMatch?(filter,PNAME x) => matches := [x,:matches] nonmatches := [x,:nonmatches] - matches := nreverse matches - nonmatches := nreverse nonmatches + matches := reverse! matches + nonmatches := reverse! nonmatches htInitPage('"Greek Names",nil) null matches => htInitPage(['"Greek names matching search string {\em ",ss,'"}"],nil) @@ -231,8 +231,8 @@ htTextSearch(filter) == for x in lines repeat superMatch?(filter,x) => matches := [x,:matches] nonmatches := [x,:nonmatches] - matches := nreverse matches - nonmatches := nreverse nonmatches + matches := reverse! matches + nonmatches := reverse! nonmatches htInitPage('"Text Matches",nil) null matches => htInitPage(['"Lines matching search string {\em ",s,'"}"],nil) diff --git a/src/interp/ht-util.boot b/src/interp/ht-util.boot index 7d5e5588..14607077 100644 --- a/src/interp/ht-util.boot +++ b/src/interp/ht-util.boot @@ -211,7 +211,7 @@ iht line == -- issue a single hyperteTeX line, or a group of lines $newPage => nil cons? line => - $htLineList := NCONC(nreverse mapStringize COPY_-LIST line, $htLineList) + $htLineList := NCONC(reverse! mapStringize COPY_-LIST line, $htLineList) $htLineList := [basicStringize line, :$htLineList] bcIssueHt line == @@ -377,7 +377,7 @@ computeDomainVariableAlist() == htpDomainPvarSubstList $curPage] pvarCondList pvar == - nreverse pvarCondList1([pvar], nil, htpDomainConditions $curPage) + reverse! pvarCondList1([pvar], nil, htpDomainConditions $curPage) pvarCondList1(pvarList, activeConds, condList) == null condList => activeConds @@ -543,7 +543,7 @@ makeSpadCommand(:l) == argList := nil for arg in l while arg ~= lastArg repeat argList := [strconc(arg, '", "), :argList] - argList := nreverse [lastArg, :argList] + argList := reverse! [lastArg, :argList] strconc(opForm, apply(function strconc, argList), '")") htMakeInputList stringList == @@ -552,7 +552,7 @@ htMakeInputList stringList == argList := nil for arg in stringList while arg ~= lastArg repeat argList := [strconc(arg, '", "), :argList] - argList := nreverse [lastArg, :argList] + argList := reverse! [lastArg, :argList] bracketString apply(function strconc, argList) diff --git a/src/interp/i-analy.boot b/src/interp/i-analy.boot index f9c9d84c..b44a0ac1 100644 --- a/src/interp/i-analy.boot +++ b/src/interp/i-analy.boot @@ -775,8 +775,8 @@ bottomUpFormRetract(t,op,opName,argl,amsl) == putValue(x,object) putModeSet(x,[objMode(object)]) --insert pulled-back items - a := nreverse a - ms := nreverse ms + a := reverse! a + ms := reverse! ms -- check that we haven't seen these types before typesHad := getAtree(t, 'typesHad) @@ -817,7 +817,7 @@ bottomUpFormAnyUnionRetract(t,op,opName,argl,amsl) == putModeSet(x,[objMode(object)]) putValue(x,object) a := [x,:a] - b and bottomUpForm(t,op,opName,nreverse a,amsl) + b and bottomUpForm(t,op,opName,reverse! a,amsl) bottomUpFormUntaggedUnionRetract(t,op,opName,argl,amsl) == -- see if we have a Union with no tags, if so retract all such guys @@ -840,7 +840,7 @@ bottomUpFormUntaggedUnionRetract(t,op,opName,argl,amsl) == putModeSet(x,[objMode(object)]) putValue(x,object) a := [x,:a] - b and bottomUpForm(t,op,opName,nreverse a,amsl) + b and bottomUpForm(t,op,opName,reverse! a,amsl) bottomUpElt (form:=[op,:argl]) == -- this transfers expressions that look like function calls into diff --git a/src/interp/i-coerce.boot b/src/interp/i-coerce.boot index 910613d3..207d49d1 100644 --- a/src/interp/i-coerce.boot +++ b/src/interp/i-coerce.boot @@ -1231,7 +1231,7 @@ computeTTTranspositions(t1,t2) == towers := [VEC2LIST tower,:towers] towers := [reassembleTowerIntoType tower for tower in towers] if first(towers) ~= t2 then towers := [t2,:towers] - nreverse towers + reverse! towers decomposeTypeIntoTower t == atom t => [t] @@ -1268,7 +1268,7 @@ permuteToOrder(p,n,start) == p.stpos := p.x p.x := t stpos := x - append(nreverse perms,permuteToOrder(p,n,start+1)) + append(reverse! perms,permuteToOrder(p,n,start+1)) coerceIntTest(t1,t2) == -- looks whether there exists a table entry or a coercion function diff --git a/src/interp/i-coerfn.boot b/src/interp/i-coerfn.boot index cfda1e30..fab869b2 100644 --- a/src/interp/i-coerfn.boot +++ b/src/interp/i-coerfn.boot @@ -168,7 +168,7 @@ coerceDmpCoeffs(u,S,T) == null (c' := coerceInt(objNewWrap(c,S),T)) => return (bad := true) u' := [[e,:objValUnwrap(c')],:u'] bad => 'failed - nreverse u' + reverse! u' sortAndReorderDmpExponents(u,vl) == vl' := reverse MSORT vl @@ -287,7 +287,7 @@ Dmp2Up(u, source is [dmp,vl,S],target is [up,var,T]) == -- only one variable in DMP case null vl' => - u' := nreverse SORTBY('CAR,[[e.0,:c] for [e,:c] in u]) + u' := reverse! SORTBY('CAR,[[e.0,:c] for [e,:c] in u]) (u' := coerceInt(objNewWrap(u',[up,var,S]),target)) or coercionFailure() objValUnwrap u' @@ -308,7 +308,7 @@ Dmp2Up(u, source is [dmp,vl,S],target is [up,var,T]) == p.rest := c' zero = objValUnwrap(y) => 'iterate x := [[exp,:objValUnwrap(y)],:x] - y => nreverse SORTBY('CAR,x) + y => reverse! SORTBY('CAR,x) coercionFailure() removeVectorElt(v,pos) == @@ -1267,7 +1267,7 @@ SUP2Up(u,source is [.,S],target is [.,x,T]) == coercionFailure()) c' = zero => 'iterate u' := [[e,:c'],:u'] - nreverse u' + reverse! u' [[0,:objValUnwrap u']] --% SquareMatrix @@ -1497,7 +1497,7 @@ Up2SUP(u,source is [.,x,S],target is [.,T]) == coercionFailure()) c' = zero => 'iterate u' := [[e,:c'],:u'] - nreverse u' + reverse! u' [[0,:objValUnwrap u']] Up2Up(u,source is [.,v1,S], target is [.,v2,T]) == diff --git a/src/interp/i-eval.boot b/src/interp/i-eval.boot index 509b58f9..216e64ad 100644 --- a/src/interp/i-eval.boot +++ b/src/interp/i-eval.boot @@ -195,7 +195,7 @@ evaluateType1 (form is [op,:argl]) == throwKeyedMsgCannotCoerceWithValue(zv,zt,m) if x = $EmptyMode then x := $quadSymbol throwEvalTypeMsg("S2IE0006",[makeOrdinal argnum,m,form]) - [op,:nreverse typeList] + [op,:reverse! typeList] throwEvalTypeMsg(msg, args) == $noEvalTypeMsg => spadThrow() diff --git a/src/interp/i-funsel.boot b/src/interp/i-funsel.boot index 5b5ed3da..71229c9f 100644 --- a/src/interp/i-funsel.boot +++ b/src/interp/i-funsel.boot @@ -201,7 +201,7 @@ selectMms2(op,tar,args1,args2,$Coerce) == -- any Unions, Mapping or Records a' := nil - a := nreverse removeDuplicates a + a := reverse! removeDuplicates a for x in a repeat null x => 'iterate x = '(RationalRadicals) => a' := [$RationalNumber,:a'] @@ -502,7 +502,7 @@ getOpArgTypes1(opname, args) == v.i = 0 => first getModeSet x first getModeSetUseSubdomain x mss := [ms,:mss] - nreverse mss + reverse! mss argCouldBelongToSubdomain(op, nargs) == -- this returns a vector containing 0 or ^0 for each argument. @@ -559,7 +559,7 @@ selectLocalMms(op,name,types,tar) == -- [., targ, :.] := mm -- if tar = targ then matchingMms := [mm,:matchingMms] -- -- if we got some exact matchs on the target, return them --- matchingMms => nreverse matchingMms +-- matchingMms => reverse! matchingMms -- -- obj := getValue op -- obj and (objVal obj is ["%Map",:mapDef]) and @@ -587,7 +587,7 @@ getLocalMms(name,types,tar) == dc = 'interpOnly and not($Coerce)=> mmS := [mm,:mmS] NIL mmS := [mm,:mmS] - nreverse mmS + reverse! mmS mmCost(name, sig,cond,tar,args1,args2) == cost := mmCost0(name, sig,cond,tar,args1,args2) @@ -681,7 +681,7 @@ getFunctionFromDomain(op,dc,args) == --+ --sig := [NIL,:args] domain := evalDomain dc - for mm in nreverse p until b repeat + for mm in reverse! p until b repeat [[.,:osig],nsig,:.] := mm b := compiledLookup(op,nsig,domain) b or throwKeyedMsg("S2IS0023",[op,dc]) @@ -860,10 +860,10 @@ findFunctionInDomain1(omm,op,tar,args1,args2,SL) == y := 'ELT -- if subsumed fails try it again not $SubDom and first sig isnt ['Union,:.] and slot is [tar,:args] and (f := findFunctionInDomain(op,dc,tar,args,args,NIL,NIL)) => f - y='ELT => [[[dc,:sig],osig,nreverse $RTC]] - y='CONST => [[[dc,:sig],osig,nreverse $RTC]] - y='ASCONST => [[[dc,:sig],osig,nreverse $RTC]] - y is ['XLAM,:.] => [[[dc,:sig],y,nreverse $RTC]] + y='ELT => [[[dc,:sig],osig,reverse! $RTC]] + y='CONST => [[[dc,:sig],osig,reverse! $RTC]] + y='ASCONST => [[[dc,:sig],osig,reverse! $RTC]] + y is ['XLAM,:.] => [[[dc,:sig],y,reverse! $RTC]] sayKeyedMsg("S2IF0006",[y]) NIL @@ -889,7 +889,7 @@ findFunctionInCategory(op,dc,tar,args1,args2,$Coerce,$SubDom) == impls := [[b,nil,true,d],:impls] d isnt [k,"$",n] => systemErrorHere ["findFunctionInCategory",d] impls := [[b,n,true,k],:impls] - impls := nreverse impls + impls := reverse! impls if maxargs ~= -1 then SL:= NIL for i in 1..maxargs repeat @@ -1312,7 +1312,7 @@ orderMmCatStack st == havevars := [s,:havevars] if not mem then haventvars := [s,:haventvars] null havevars => st - st := nreverse nconc(haventvars,havevars) + st := reverse! nconc(haventvars,havevars) SORT(st, function mmCatComp) mmCatComp(c1, c2) == diff --git a/src/interp/i-map.boot b/src/interp/i-map.boot index 7ffe222a..ac5dab8b 100644 --- a/src/interp/i-map.boot +++ b/src/interp/i-map.boot @@ -135,7 +135,7 @@ addDefMap(['DEF,lhs,mapsig,.,rhs],pred) == mapmode := [d',:mapmode] else allDecs := false if allDecs then - mapmode := nreverse mapmode + mapmode := reverse! mapmode putHist(op,'mode,mapmode,$e) if not defineeIsConstant then sayKeyedMsg("S2IM0006",[formatOpSignature(op,rest mapmode)]) @@ -177,7 +177,7 @@ addMap(lhs,rhs,pred) == if x is ["SUCHTHAT",s,p] then (predList:= [p,:predList]; x:= s) x mkMapAlias(op,argl) - argPredList:= nreverse predList + argPredList:= reverse! predList finalPred := -- handle g(a,T)==a+T confusion between pred=T and T variable MKPF((pred and (pred ~= 'T) => [:argPredList,SUBLISNQ($sl,pred)]; argPredList),"and") @@ -286,7 +286,7 @@ mkMapAlias(op,argl) == $e:= putHist(op,"alias",newAlias,$e) mkAliasList l == fn(l,nil) where fn(l,acc) == - null l => nreverse acc + null l => reverse! acc not IDENTP first l or first l in acc => fn(rest l,[nil,:acc]) fn(rest l,[first l,:acc]) diff --git a/src/interp/i-output.boot b/src/interp/i-output.boot index d455fad0..c2f53813 100644 --- a/src/interp/i-output.boot +++ b/src/interp/i-output.boot @@ -1185,7 +1185,7 @@ maprinChk x == maprinRows matrixList == newlineIfDisplaying() while matrixList repeat - y:=nreverse matrixList + y := reverse! matrixList --Makes the matrices come out in order, since CONSed on backwards matrixList:=nil firstName := first first y diff --git a/src/interp/i-resolv.boot b/src/interp/i-resolv.boot index b181b769..7a1a223e 100644 --- a/src/interp/i-resolv.boot +++ b/src/interp/i-resolv.boot @@ -48,7 +48,7 @@ resolveTypeList u == nil allVars => null rest allVars => ['Variable, first allVars] - ['OrderedVariableList,nreverse allVars] + ['OrderedVariableList,reverse! allVars] for md in tail repeat a := resolveTT(md,a) @@ -282,7 +282,7 @@ resolveTTEq1(c1,arg1,TL is [c2,arg2,:.]) == arg1 := rest arg1 arg2 := rest arg2 t and null arg1 and null arg2 and - t0 := constructM(c1,nreverse arg) + t0 := constructM(c1,reverse! arg) constructTowerT(t0,TL) resolveTTEq2(c1,arg1,TL is [c,arg,:.]) == @@ -516,7 +516,7 @@ resolveTMRecord(tr,mr) == null ra => ok := NIL tt := [[first ta,second ta,ra],:tt] not ok => NIL - ['Record,nreverse tt] + ['Record,reverse! tt] resolveTMUnion(t, m is ['Union,:ums]) == isTaggedUnion m => resolveTMTaggedUnion(t,m) @@ -656,7 +656,7 @@ resolveTMEq2(cm,argm,TL) == argm := rest argm tt := resolveTM1(x1,x2) => arg := [tt,:arg] - null argt and null argm and tt and constructM(ct,nreverse arg) + null argt and null argm and tt and constructM(ct,reverse! arg) resolveTMRed(t,m) == -- looks for an applicable rewrite rule at any level of t and tries @@ -750,7 +750,7 @@ constructM(c,A) == replaceLast(A,t) == -- replaces the last element of the nonempty list A by t (constructively - nreverse (reverse(A).first := t) + reverse! (reverse(A).first := t) destructT(functor)== -- provides a list of booleans, which indicate whether the arguments diff --git a/src/interp/i-syscmd.boot b/src/interp/i-syscmd.boot index f295d9e9..0ad608b3 100644 --- a/src/interp/i-syscmd.boot +++ b/src/interp/i-syscmd.boot @@ -101,7 +101,7 @@ initializeSystemCommands() == while l repeat $SYSCOMMANDS := [CAAR l,:$SYSCOMMANDS] l := rest l - $SYSCOMMANDS := nreverse $SYSCOMMANDS + $SYSCOMMANDS := reverse! $SYSCOMMANDS systemCommand [[op,:argl],:options] == $options: local:= options @@ -1158,7 +1158,7 @@ displayProperties(option,l) == '" The following functions or rules depend on this:" msg := ["%b",'" "] for y in dependents repeat msg := ['" ",y,:msg] - sayMSG [:nreverse msg,"%d"] + sayMSG [:reverse! msg,"%d"] if dependees := GETALIST($dependeeAlist,x) then null rest dependees => sayMSG ['" This depends on the following function ", @@ -1167,7 +1167,7 @@ displayProperties(option,l) == '" This depends on the following functions or rules:" msg := ["%b",'" "] for y in dependees repeat msg := ['" ",y,:msg] - sayMSG [:nreverse msg,"%d"] + sayMSG [:reverse! msg,"%d"] prop = 'isInterpreterRule => sayMSG '" This is an interpreter rule." sayFunctionDeps v @@ -1388,7 +1388,7 @@ closeInterpreterFrame(name) == found := true not found => throwKeyedMsg("S2IZ0022",[name]) _$ERASE makeHistFileName(name) - $interpreterFrameRing := nreverse ifr + $interpreterFrameRing := reverse! ifr updateFromCurrentInterpreterFrame() previousInterpreterFrame() == @@ -1662,7 +1662,7 @@ writeInputLines(fn,initial) == file := histInputFileName(fn) histFileErase file inp:= DEFIOSTREAM(['(MODE . OUTPUT),['FILE,:file]],255,0) - for x in removeUndoLines nreverse lineList repeat writeLine(x,inp) + for x in removeUndoLines reverse! lineList repeat writeLine(x,inp) -- see file "undo" for definition of removeUndoLines if fn ~= 'redo then sayKeyedMsg("S2IH0014",[namestring file]) SHUT inp @@ -2647,7 +2647,7 @@ diffAlist(new,old) == deltas := [[prop],:deltas] sameObject?(rest oldPropval,val) => 'skip deltas := [oldPropval,:deltas] - deltas => acc := [[name,:nreverse deltas],:acc] + deltas => acc := [[name,:reverse! deltas],:acc] acc := [[name,:[[prop] for [prop,:.] in proplist]],:acc] --record properties absent on new list (say, from a )cl all) for (oldPair := [name,:r]) in old repeat @@ -2659,7 +2659,7 @@ diffAlist(new,old) == -- (b) if the old world does not, record nothing -- (2) if the new world has a proplist for that variable, it has -- been handled by the first loop. - res := nreverse acc + res := reverse! acc if $reportUndo then reportUndo res res @@ -2780,7 +2780,7 @@ removeUndoLines u == --called by writeInputLines nil $IOindex := $IOindex + 1 --referenced by undoCount acc := nil - for y in tails nreverse u repeat + for y in tails reverse! u repeat (x := first y).0 = char ">" => code := x . 1 --code = a,b, or r n := readInteger subString(x,2) --n = number of undo steps @@ -3185,7 +3185,7 @@ splitIntoOptionBlocks str == blockStart := i+1 parenCount := 0 blockList := [stripSpaces subSequence(str, blockStart), :blockList] - nreverse blockList + reverse! blockList dumbTokenize str == -- split into tokens delimted by spaces, taking quoted strings into account @@ -3205,7 +3205,7 @@ dumbTokenize str == previousSpace := true previousSpace := false tokenList := [stripSpaces subSequence(str, tokenStart), :tokenList] - nreverse tokenList + reverse! tokenList handleParsedSystemCommands(unabr, optionList) == restOptionList := [dumbTokenize opt for opt in rest optionList] diff --git a/src/interp/interop.boot b/src/interp/interop.boot index c2bfc566..45019c39 100644 --- a/src/interp/interop.boot +++ b/src/interp/interop.boot @@ -265,7 +265,7 @@ $attributeDispatch := -- Generate Category Level Alist --======================================================================= orderCatAnc x == - nreverse ASSOCLEFT SORTBY(function rest,rest depthAssoc x) + reverse! ASSOCLEFT SORTBY(function rest,rest depthAssoc x) depthAssocList u == u := delete('DomainSubstitutionMacro,u) --hack by RDJ 8/90 @@ -328,7 +328,7 @@ orderedDefaults(conform,domform) == ancestors := ancestorsOf(conform,domform) for x in conList repeat for y in ancestors | x = CAAR y repeat acc := [y,:acc] - nreverse acc + reverse! acc instantiate domenv == -- following is a patch for a bug in runtime.as diff --git a/src/interp/lisp-backend.boot b/src/interp/lisp-backend.boot index e992553c..0fbb0f33 100644 --- a/src/interp/lisp-backend.boot +++ b/src/interp/lisp-backend.boot @@ -163,7 +163,7 @@ expandCollect ['%collect,:iters,body] == -- Initialize the variable holding the result; expand as -- if ordinary loop. But don't forget we built the result -- in reverse order. - expandLoop ['%loop,:iters,["%init",val,nil],body,["NREVERSE",val]] + expandLoop ['%loop,:iters,["%init",val,nil],body,["reverse!",val]] expandList(x is ['%list,:args]) == args := [expandToVMForm arg for arg in args] @@ -563,7 +563,7 @@ for x in [ ['%lfirst, :'CAR], ['%llength, :'LIST_-LENGTH], ['%lreverse, :'REVERSE], - ['%lreverse!, :'NREVERSE], + ['%lreverse!, :'reverse!], ['%lsecond, :'CADR], ['%lthird, :'CADDR], ['%pair?, :'CONSP], diff --git a/src/interp/lisplib.boot b/src/interp/lisplib.boot index e2b84477..3fc01131 100644 --- a/src/interp/lisplib.boot +++ b/src/interp/lisplib.boot @@ -107,8 +107,8 @@ makePredicateBitVector pl == --called by buildFunctor for q in stripOutNonDollarPreds pred repeat firsts := insert(q,firsts) else firsts := insert(pred,firsts) - firstPl := SUBLIS($pairlis,nreverse orderByContainment firsts) - lastPl := SUBLIS($pairlis,nreverse orderByContainment lasts) + firstPl := SUBLIS($pairlis,reverse! orderByContainment firsts) + lastPl := SUBLIS($pairlis,reverse! orderByContainment lasts) firstCode:= ['buildPredVector,0,0,mungeAddGensyms(firstPl,$predGensymAlist)] lastCode := augmentPredCode(# firstPl,lastPl) diff --git a/src/interp/macros.lisp b/src/interp/macros.lisp index 1c013f0c..dfa30086 100644 --- a/src/interp/macros.lisp +++ b/src/interp/macros.lisp @@ -695,7 +695,7 @@ terminals and empty or at-end files. In Common Lisp, we must assume record size (if (> eol bol) (setq line-list (cons (subseq str bol eol) line-list))) (setq bol (+ eol 1))) - (nreverse line-list))) + (|reverse!| line-list))) ; part of the old spad to new spad translator ; these are here because they need to be in depsys diff --git a/src/interp/match.boot b/src/interp/match.boot index 8ca52e2f..b660e72c 100644 --- a/src/interp/match.boot +++ b/src/interp/match.boot @@ -123,7 +123,7 @@ patternCheck pattern == main where acc := nil repeat k := charPosition(c,s,i) - k > n => return nreverse acc + k > n => return reverse! acc acc := [k,:acc] i := k + 1 equal(p,n,c) == diff --git a/src/interp/metalex.lisp b/src/interp/metalex.lisp index bc80c1d6..8ae5de18 100644 --- a/src/interp/metalex.lisp +++ b/src/interp/metalex.lisp @@ -249,7 +249,7 @@ Symbolics read-line returns embedded newlines in a c-m-Y.") "Makes output listings." (if Read-Quietly (stack-push (copy-tree string) Printer-Line-Stack) (progn (mapc #'(lambda (x) (format strm "; ~A~%" x) (terpri)) - (nreverse (stack-store Printer-Line-Stack))) + (|reverse!| (stack-store Printer-Line-Stack))) (stack-clear Printer-Line-Stack) (format strm "~&; ~A~%" string)))) diff --git a/src/interp/modemap.boot b/src/interp/modemap.boot index e338027a..0b93ffaa 100644 --- a/src/interp/modemap.boot +++ b/src/interp/modemap.boot @@ -200,7 +200,7 @@ mergeModemap(entry is [[mc,:sig],[pred,:.],:.],modemapList,e) == return modemapList TruthP pred => mmtail:=rest mmtail --the thing we matched against is useless, by comparison - modemapList:= NCONC(nreverse newmm,[entry,:mmtail]) + modemapList:= NCONC(reverse! newmm,[entry,:mmtail]) entry:= nil return modemapList if entry then [:modemapList,entry] else modemapList diff --git a/src/interp/msgdb.boot b/src/interp/msgdb.boot index 9049c84b..bd3742e8 100644 --- a/src/interp/msgdb.boot +++ b/src/interp/msgdb.boot @@ -132,7 +132,7 @@ segmentedMsgPreprocess x == [t,:tail] := tail member(t, '(%ceoff "%ceoff" %rjoff "%rjoff")) => ok := NIL y := [segmentedMsgPreprocess t,:y] - head1 := [(center => '"%ce"; '"%rj"),:nreverse y] + head1 := [(center => '"%ce"; '"%rj"),:reverse! y] null tail => [head1] [head1,:segmentedMsgPreprocess tail] head1 := segmentedMsgPreprocess head @@ -180,11 +180,11 @@ substituteSegmentedMsg(msg,args) == -- x is a special case (n > 2) and c = char "%" and stringChar(x,1) = char "k" => - l := nconc(nreverse pkey subString(x,2),l) + l := nconc(reverse! pkey subString(x,2),l) -- ?name gets replaced by '"Push PF10" or '"Type >b (enter)" stringChar(x,0) = char "?" and n > 1 and - (v := pushOrTypeFuture(makeSymbol x,nil)) => l := nconc(nreverse v,l) + (v := pushOrTypeFuture(makeSymbol x,nil)) => l := nconc(reverse! v,l) -- x requires parameter substitution stringChar(x,0) = char "%" and n > 1 and digit? stringChar(x,1) => @@ -234,7 +234,7 @@ substituteSegmentedMsg(msg,args) == l := [fillerSpaces(DIG2FIX stringChar(x,2), '" "),:l] --x is a plain word l := [x,:l] - addBlanks nreverse l + addBlanks reverse! l addBlanks msg == -- adds proper blanks @@ -257,7 +257,7 @@ addBlanks msg == else msg1 := [y,blank,:msg1] x := y - nreverse msg1 + reverse! msg1 $msgdbPrims =='( %b %d %l %i %u %U %n %x %ce %rj "%U" "%b" "%d" "%l" "%i" "%u" "%U" "%n" "%x" "%ce" "%rj") @@ -492,7 +492,7 @@ flowSegmentedMsg(msg, len, offset) == lnl := -1 + offset + sbl nl := [f,off,'"%l",:nl] lnl := offset + sbl - concat nreverse nl + concat reverse! nl concat('"%l",off,msg) --% Other handy things @@ -729,7 +729,7 @@ brightPrintCenter(x,out == $OutputStream) == if member(first(x),'(%l "%l")) then ok := NIL else y := [first x, :y] x := rest x - y := nreverse y + y := reverse! y wid := sayBrightlyLength y if wid < $LINELENGTH then f := DIVIDE($LINELENGTH - wid,2) @@ -753,7 +753,7 @@ brightPrintCenterAsTeX(x, out == $OutputStream) == lst := rest lst if lst then lst := rest lst sayString('"\centerline{",out) - words := nreverse words + words := reverse! words for zz in words repeat brightPrint0(zz,out) sayString('"}",out) @@ -776,7 +776,7 @@ brightPrintRightJustify(x, out == $OutputStream) == if member(first(x),'(%l "%l")) then ok := NIL else y := [first x, :y] x := rest x - y := nreverse y + y := reverse! y wid := sayBrightlyLength y if wid < $LINELENGTH then y := [fillerSpaces($LINELENGTH-wid,'" "),:y] @@ -840,7 +840,7 @@ say2Split(l,short,long,width) == l is [x,:l'] => sayWidth x < width => say2Split(l',[x,:short],long,width) say2Split(l',short,[x,:long],width) - [nreverse short,nreverse long] + [reverse! short,reverse! long] sayLongOperation x == sayWidth x > $LINELENGTH and (splitListOn(x,"if") is [front,back]) => @@ -854,7 +854,7 @@ splitListOn(x,key) == while first x ~= key repeat y:= [first x,:y] x:= rest x - [nreverse y,x] + [reverse! y,x] nil say2PerLineThatFit l == @@ -944,14 +944,14 @@ splitSayBrightly u == while u and (width:= width + sayWidth first u) < $LINELENGTH repeat segment:= [first u,:segment] u := rest u - null u => nreverse segment - segment => [:nreverse segment,"%l",:splitSayBrightly(u)] + null u => reverse! segment + segment => [:reverse! segment,"%l",:splitSayBrightly(u)] u splitSayBrightlyArgument u == atom u => nil while splitListSayBrightly u is [head,:u] repeat result:= [head,:result] - result => [:nreverse result,u] + result => [:reverse! result,u] [u] splitListSayBrightly u == diff --git a/src/interp/newfort.boot b/src/interp/newfort.boot index 9be74bbb..b799cfff 100644 --- a/src/interp/newfort.boot +++ b/src/interp/newfort.boot @@ -170,12 +170,12 @@ exp2FortOptimize e == atom e => [e] $fortranOptimizationLevel = 0 => e1 := exp2FortOptimizeArray e - nreverse [e1,:$exprStack] + reverse! [e1,:$exprStack] e := minimalise e for e1 in exp2FortOptimizeCS e repeat e2 := exp2FortOptimizeArray e1 $exprStack := [e2,:$exprStack] - nreverse $exprStack + reverse! $exprStack exp2FortOptimizeCS e == @@ -184,7 +184,7 @@ exp2FortOptimizeCS e == $fortCsExprStack : local := NIL $fortCsFuncStack : local := NIL f := exp2FortOptimizeCS1 e - nreverse [f,:$fortCsList] + reverse! [f,:$fortCsList] -- bug fix to beenHere -- Thu Nov 05 12:01:46 CUT 1992 , Author: TTT @@ -290,9 +290,9 @@ fortran2Lines f == fs := [ff,:fs] f := rest f if f and first(f) = '"%l" then f := rest f - lines := append(fortran2Lines1 nreverse fs,lines) + lines := append(fortran2Lines1 reverse! fs,lines) fs := nil - nreverse lines + reverse! lines fortran2Lines1 f == -- f is a list of strings making up 1 FORTRAN statement @@ -362,7 +362,7 @@ fortexp0 x == while p < 0 repeat [t,:f] := f l := [t,:l] - nreverse ['"...",:l] + reverse! ['"...",:l] ++ This formatting routine is essentially used to print ++ values/expressions used to instantiate constructors. @@ -599,19 +599,19 @@ fortFormatIfGoto(switch,label) == changeExprLength(-8) -- Leave room for IF( ... )GOTO $fortError : fluid := nil if first(switch) = "NULL" then switch := second switch - r := nreverse statement2Fortran switch + r := reverse! statement2Fortran switch changeExprLength(8) l := ['")GOTO ",STRINGIMAGE label] while r and not(first(r) = '"%l") repeat l := [first(r),:l] r := rest(r) - checkLines fortran2Lines nreverse [:nreverse l,'"IF(",:r] + checkLines fortran2Lines reverse! [:reverse! l,'"IF(",:r] fortFormatLabelledIfGoto(switch,label1,label2) == changeExprLength(-8) -- Leave room for IF( ... )GOTO $fortError : fluid := nil if LISTP(switch) and first(switch) = "NULL" then switch := second switch - r := nreverse statement2Fortran switch + r := reverse! statement2Fortran switch changeExprLength(8) l := ['")GOTO ",STRINGIMAGE label2] while r and not(first(r) = '"%l") repeat @@ -619,7 +619,7 @@ fortFormatLabelledIfGoto(switch,label1,label2) == r := rest(r) labString := STRINGIMAGE label1 for i in #(labString)..5 repeat labString := strconc(labString,'" ") - lines := fortran2Lines nreverse [:nreverse l,'"IF(",:r] + lines := fortran2Lines reverse! [:reverse! l,'"IF(",:r] lines := [strconc(labString,subSequence(first lines,6)),:rest lines] checkLines lines @@ -627,26 +627,26 @@ fortFormatIf(switch) == changeExprLength(-8) -- Leave room for IF( ... )THEN $fortError : fluid := nil if LISTP(switch) and first(switch) = "NULL" then switch := second switch - r := nreverse statement2Fortran switch + r := reverse! statement2Fortran switch changeExprLength(8) l := ['")THEN"] while r and not(first(r) = '"%l") repeat l := [first(r),:l] r := rest(r) - checkLines fortran2Lines nreverse [:nreverse l,'"IF(",:r] + checkLines fortran2Lines reverse! [:reverse! l,'"IF(",:r] fortFormatElseIf(switch) == -- Leave room for IF( ... )THEN changeExprLength(-12) $fortError : fluid := nil if LISTP(switch) and first(switch) = "NULL" then switch := second switch - r := nreverse statement2Fortran switch + r := reverse! statement2Fortran switch changeExprLength(12) l := ['")THEN"] while r and not(first(r) = '"%l") repeat l := [first(r),:l] r := rest(r) - checkLines fortran2Lines nreverse [:nreverse l,'"ELSEIF(",:r] + checkLines fortran2Lines reverse! [:reverse! l,'"ELSEIF(",:r] fortFormatHead(returnType,name,args) == $fortError : fluid := nil diff --git a/src/interp/nruncomp.boot b/src/interp/nruncomp.boot index f2eec13e..71b401bc 100644 --- a/src/interp/nruncomp.boot +++ b/src/interp/nruncomp.boot @@ -89,7 +89,7 @@ NRTaddDeltaCode() == vectorRef($template,i) := deltaTran(item,compItem) vectorRef($template,5) := $NRTaddForm => - $NRTaddForm is ["%Comma",:y] => nreverse y + $NRTaddForm is ["%Comma",:y] => reverse! y NRTencode($NRTaddForm,$addForm) nil diff --git a/src/interp/nrunfast.boot b/src/interp/nrunfast.boot index 19d7a4df..40df2592 100644 --- a/src/interp/nrunfast.boot +++ b/src/interp/nrunfast.boot @@ -78,7 +78,7 @@ getDomainCompleteCategories dom == cats := nil for i in 0..maxIndex vec repeat cats := [newExpandLocalType(vectorRef(vec,i),dom,dom), :cats] - nreverse cats + reverse! cats getOpCode(op,vec,max) == --search Op vector for "op" returning code if found, nil otherwise diff --git a/src/interp/pf2atree.boot b/src/interp/pf2atree.boot index 8bbd29be..58b8e68e 100644 --- a/src/interp/pf2atree.boot +++ b/src/interp/pf2atree.boot @@ -197,7 +197,7 @@ pf2Atree1 pf == idList, pf2Atree1 (pfAssignRhs)(pf)] decls => [mkAtreeNodeWithSrcPos("SEQ",pf), - :[pf2Atree1 decl for decl in nreverse decls], x] + :[pf2Atree1 decl for decl in reverse! decls], x] x -- (pfDefinition?)(pf) => @@ -364,11 +364,11 @@ pfApplication2Atree pf == -- argTypeList := [nil, :argTypeList] -- argTypeList := [pf2Atree1 pfTypedType arg, :argTypeList] -- systemError '"definition args should be typed" --- argList := nreverse argList +-- argList := reverse! argList -- retType := -- pfNothing? pfLambdaRets pf => nil -- pf2Atree1 pfLambdaRets pf --- argTypeList := [retType, :nreverse argTypeList] +-- argTypeList := [retType, :reverse! argTypeList] -- [argList, :[argTypeList, [nil for arg in argTypeList], -- pf2Atree1 pfLambdaBody pf]] -- ['id, :['(()), '(()), pf2Atree1 pf]] @@ -411,7 +411,7 @@ pfSequence2Atree0(seqList, pf) == seqTranList := [item ,:seqTranList] seqList := rest seqList #seqTranList = 1 => first seqTranList - [mkAtreeNodeWithSrcPos("SEQ",pf), :nreverse seqTranList] + [mkAtreeNodeWithSrcPos("SEQ",pf), :reverse! seqTranList] -- -- float2Atree num == @@ -455,7 +455,7 @@ loopIters2Atree iterList == newIter := ["IN", var, mkAtree1 s] result := [newIter, :result] result := [pf2Atree1(iter), :result] - nreverse result + reverse! result pfCollect2Atree pf == atree := [mkAtree1WithSrcPos("COLLECT",pf), diff --git a/src/interp/pf2sex.boot b/src/interp/pf2sex.boot index 8629a746..306c4d48 100644 --- a/src/interp/pf2sex.boot +++ b/src/interp/pf2sex.boot @@ -296,7 +296,7 @@ hasOptArgs? argSex == opt := [[lhs, rhs], :opt] nonOpt := [arg, :nonOpt] null opt => nil - NCONC (nreverse nonOpt, [["construct", :nreverse opt]]) + NCONC (reverse! nonOpt, [["construct", :reverse! opt]]) pfDefinition2Sex pf == $insideApplication > $insideQuasiquotation => @@ -332,11 +332,11 @@ pfLambdaTran pf == argTypeList := [nil, :argTypeList] argTypeList := [pf2Sex1 pfTypedType arg, :argTypeList] systemError '"definition args should be typed" - argList := nreverse argList + argList := reverse! argList retType := pfNothing? pfLambdaRets pf => nil pf2Sex1 pfLambdaRets pf - argTypeList := [retType, :nreverse argTypeList] + argTypeList := [retType, :reverse! argTypeList] [argList, :[argTypeList, [nil for arg in argTypeList], pf2Sex1 pfLambdaBody pf]] ['id, :['(()), '(()), pf2Sex1 pf]] @@ -380,7 +380,7 @@ pfSequence2Sex0 seqList == seqTranList := [item ,:seqTranList] seqList := rest seqList #seqTranList = 1 => first seqTranList - ["SEQ", :nreverse seqTranList] + ["SEQ", :reverse! seqTranList] float2Sex num == eIndex := SEARCH('"e", num) @@ -413,7 +413,7 @@ loopIters2Sex iterList == sex is ['IN, var, ['SEGMENT, i, j]] => result := [['STEP, var, i, 1, j], :result] result := [sex, :result] - nreverse result + reverse! result pfCollect2Sex pf == sex := ["COLLECT", :loopIters2Sex pfParts pfCollectIterators pf, diff --git a/src/interp/postpar.boot b/src/interp/postpar.boot index cf5f60e7..602732d9 100644 --- a/src/interp/postpar.boot +++ b/src/interp/postpar.boot @@ -61,7 +61,7 @@ postTransform y == u displayPreCompilationErrors() == - n:= #($postStack:= removeDuplicates nreverse $postStack) + n:= #($postStack:= removeDuplicates reverse! $postStack) n=0 => nil errors:= 1<n => '"errors" diff --git a/src/interp/preparse.lisp b/src/interp/preparse.lisp index 488afcba..586bca51 100644 --- a/src/interp/preparse.lisp +++ b/src/interp/preparse.lisp @@ -123,8 +123,8 @@ (COND ((NULL LINES) (RETURN NIL)) (NCOMBLOCK (FINCOMBLOCK NIL NUMS LOCS NCOMBLOCK NIL))) - (RETURN (PAIR (NREVERSE NUMS) - (PARSEPILES (NREVERSE LOCS) (NREVERSE LINES)))))) + (RETURN (PAIR (|reverse!| NUMS) + (PARSEPILES (|reverse!| LOCS) (|reverse!| LINES)))))) (cond ((and (NULL LINES) (> (LENGTH A) 0) (EQ (CHAR A 0) #\) )) ; this is a command line, don't parse it (PREPARSE-ECHO LineList) @@ -184,9 +184,9 @@ (FINCOMBLOCK NUM NUMS LOCS NCOMBLOCK linelist)) (IF (NOT (IS-CONSOLE in-stream)) (setq $preparse-last-line - (nreverse $echolinestack))) - (RETURN (PAIR (NREVERSE NUMS) - (PARSEPILES (NREVERSE LOCS) (NREVERSE LINES))))) + (|reverse!| $echolinestack))) + (RETURN (PAIR (|reverse!| NUMS) + (PARSEPILES (|reverse!| LOCS) (|reverse!| LINES))))) (cond ((> PARENLEV 0) (PUSH NIL LOCS) (setq SLOC PSLOC) (GO REREAD))) (COND (NCOMBLOCK (FINCOMBLOCK NUM NUMS LOCS NCOMBLOCK linelist) @@ -198,8 +198,8 @@ (setq PARENLEV (+ PARENLEV PCOUNT)) (when (and (is-console in-stream) (not continue)) (setq $preparse-last-line nil) - (RETURN (PAIR (NREVERSE NUMS) - (PARSEPILES (NREVERSE LOCS) (NREVERSE LINES))))) + (RETURN (PAIR (|reverse!| NUMS) + (PARSEPILES (|reverse!| LOCS) (|reverse!| LINES))))) (GO READLOOP))) diff --git a/src/interp/record.boot b/src/interp/record.boot index c23be9ee..8fc3183b 100644 --- a/src/interp/record.boot +++ b/src/interp/record.boot @@ -176,7 +176,7 @@ testInput2Output(lines,n) == evaluateLines lines null n => nil --return from reading trailing system commands typ := $mkTestOutputType - output := nreverse $mkTestOutputStack + output := reverse! $mkTestOutputStack [prefix2String typ,:output] evaluateLines lines == @@ -272,7 +272,7 @@ recordAndPrintTest md == --called by recordAndPrint [strconc(subString(y,0,k),'" ",first u),:rest u] [y,:fn r] x - output := nreverse $mkTestOutputStack -- set by maPrin + output := reverse! $mkTestOutputStack -- set by maPrin PRINT(writify [input,prefix2String md,:output],$testStream) $mkTestInputStack := nil $mkTestOutputStack := nil diff --git a/src/interp/server.boot b/src/interp/server.boot index cf7a6a01..dff51876 100644 --- a/src/interp/server.boot +++ b/src/interp/server.boot @@ -124,21 +124,21 @@ parseAndEvalToString str == $IOindex: local := nil v := CATCH($SpadReaderTag, CATCH($intTopLevel, parseAndEvalStr str)) v = 'restart => ['"error"] - nreverse $outputLines + reverse! $outputLines parseAndEvalToStringForHypertex str == $collectOutput:local := true $outputLines: local := nil v := CATCH($SpadReaderTag, CATCH($intTopLevel, parseAndEvalStr str)) v = 'restart => ['"error"] - nreverse $outputLines + reverse! $outputLines parseAndEvalToStringEqNum str == $collectOutput:local := true $outputLines: local := nil v := CATCH($SpadReaderTag, CATCH($intTopLevel, parseAndEvalStr str)) v = 'restart => ['"error"] - nreverse $outputLines + reverse! $outputLines parseAndInterpToString str == v := applyWithOutputToString('parseAndEvalStr, [str]) diff --git a/src/interp/simpbool.boot b/src/interp/simpbool.boot index b6f33fb3..4c2d2345 100644 --- a/src/interp/simpbool.boot +++ b/src/interp/simpbool.boot @@ -45,7 +45,7 @@ reduceDnf u == x = y => 'skip dnfContains(x,y) => return (ok := false) ok = true => acc := [x,:acc] - nreverse acc + reverse! acc dnfContains([a,b],[c,d]) == fn(a,c) and fn(b,d) where fn(x,y) == and/[member(u,x) for u in y] diff --git a/src/interp/slam.boot b/src/interp/slam.boot index 10754df6..e0ff0c04 100644 --- a/src/interp/slam.boot +++ b/src/interp/slam.boot @@ -115,7 +115,7 @@ isRecurrenceRelation(op,body,minivectorName) == body:= generalTerm for [a,:b] in al repeat body:= substitute(b,a,body) - result:= [body,sharpArg,n-1,:nreverse [LASSOC(i,initList) or + result:= [body,sharpArg,n-1,:reverse! [LASSOC(i,initList) or systemErrorHere('"isRecurrenceRelation") for i in minIndex..(n-1)]] diff --git a/src/interp/spad-parser.boot b/src/interp/spad-parser.boot index e5f9919d..8c61cf97 100644 --- a/src/interp/spad-parser.boot +++ b/src/interp/spad-parser.boot @@ -89,5 +89,5 @@ parseSpadFile sourceFile == IN_-STREAM := savedInStream $InteractiveMode := savedInteractiveMode -- we accumulated the parse trees in reverse order - nreverse asts + reverse! asts diff --git a/src/interp/sys-macros.lisp b/src/interp/sys-macros.lisp index 4b04434b..cda2479d 100644 --- a/src/interp/sys-macros.lisp +++ b/src/interp/sys-macros.lisp @@ -668,9 +668,9 @@ (DO ((X SPL (CDR X))) ((ATOM X) (LIST 'spadDO - (NREVERSE IL) - (LIST (MKPF (NREVERSE XCL) 'OR) XV) - (SEQOPT (CONS 'SEQ (NCONC (NREVERSE RSL) + (|reverse!| IL) + (LIST (MKPF (|reverse!| XCL) 'OR) XV) + (SEQOPT (CONS 'SEQ (NCONC (|reverse!| RSL) (LIST (LIST 'EXIT BD))))))) (COND ((ATOM (CAR X)) (FAIL))) @@ -805,7 +805,7 @@ '(EXIT RESET IN ON GSTEP ISTEP STEP GENERAL UNTIL WHILE SUCHTHAT EXIT)) (REPEAT-TRAN (CDR L) (CONS (CAR L) LP))) - ((CONS (NREVERSE LP) (MKPF L 'PROGN))))) + ((CONS (|reverse!| LP) (MKPF L 'PROGN))))) (defun MK_LEFORM (U) (COND ((IDENTP U) @@ -892,7 +892,7 @@ (defun NREVERSE-N (X AXIS) (COND ((EQL AXIS 0) - (NREVERSE X)) + (|reverse!| X)) ((MAPCAR #'(LAMBDA (Y) (NREVERSE-N Y (1- AXIS))) X)))) @@ -911,7 +911,7 @@ (PROG (L BOD1 ITL) (SETQ L (REVERSE (CDR BOD))) (SETQ BOD1 (CAR L)) - (SETQ ITL (NREVERSE (CDR L))) + (SETQ ITL (|reverse!| (CDR L))) (RETURN (-REDUCE OP1 AXIS IDEN BOD1 ITL)) ) (progn (SETQ U (-REDUCE-OP OP1 AXIS)) @@ -925,9 +925,9 @@ (defun REDUCE-N (OP RIGHT L ACC) (COND (RIGHT (PROG (U L1) - (SETQ L1 (NREVERSE L)) + (SETQ L1 (|reverse!| L)) (SETQ U (REDUCE-N-1 OP 'T L1 ACC)) - (NREVERSE L1) + (|reverse!| L1) (RETURN U) )) ((REDUCE-N-1 OP NIL L ACC)))) @@ -1169,8 +1169,8 @@ (if (SETQ U (GET (CAR L) 'THETA)) (CAR U) (MOAN "NO THETA PROPERTY")) - (CAR (SETQ L (NREVERSE (CDR L)))) - (NREVERSE (CDR L))))))) + (CAR (SETQ L (|reverse!| (CDR L)))) + (|reverse!| (CDR L))))))) (defmacro THETA1 (&rest LL) (let (U (L (copy-list LL))) @@ -1181,8 +1181,8 @@ (if (SETQ U (GET (CAR L) 'THETA)) (CAR U) (MOAN "NO THETA PROPERTY")) - (CAR (SETQ L (NREVERSE (CDR L)))) - (NREVERSE (CDR L)))))) + (CAR (SETQ L (|reverse!| (CDR L)))) + (|reverse!| (CDR L)))))) (defmacro SPADREDUCE (OP AXIS BOD) (REDUCE-1 OP AXIS BOD)) diff --git a/src/interp/topics.boot b/src/interp/topics.boot index ec4bf203..c107aa90 100644 --- a/src/interp/topics.boot +++ b/src/interp/topics.boot @@ -138,7 +138,7 @@ string2OpAlist s == k := 0 while (k := skipBlanks(s,k,m)) repeat acc := [makeSymbol subString(s,k,-k + (k := charPosition(char " ",s,k + 1))),:acc] - acc := nreverse acc + acc := reverse! acc --now add defaults if u := getDefaultProps first acc then acc := [first acc,:u,:rest acc] acc diff --git a/src/interp/trace.boot b/src/interp/trace.boot index 9f4ebaf0..4ea97d24 100644 --- a/src/interp/trace.boot +++ b/src/interp/trace.boot @@ -161,7 +161,7 @@ getTraceOptions options == [key,parms] := first $traceErrorStack throwKeyedMsg(key,['"",:parms]) throwListOfKeyedMsgs("S2IT0017",[# $traceErrorStack], - nreverse $traceErrorStack) + reverse! $traceErrorStack) optionList saveMapSig(funNames) == diff --git a/src/interp/vmlisp.lisp b/src/interp/vmlisp.lisp index 6d10bd30..3023a662 100644 --- a/src/interp/vmlisp.lisp +++ b/src/interp/vmlisp.lisp @@ -218,10 +218,10 @@ (defmacro nreverse0 (x) (if (atom x) - `(if (atom ,x) ,x (nreverse ,x)) + `(if (atom ,x) ,x (|reverse!| ,x)) (let ((xx (gensym))) `(let ((,xx ,x)) - (if (atom ,xx) ,xx (nreverse ,xx)))))) + (if (atom ,xx) ,xx (|reverse!| ,xx)))))) (defmacro nump (n) `(numberp ,n)) @@ -409,7 +409,7 @@ (let* ((body (reverse form)) (val `(return-from seq ,(pop body)))) (nsubstitute '(progn) nil body) ;don't treat NIL as a label - `(block seq (tagbody ,@(nreverse body) ,val)))) + `(block seq (tagbody ,@(|reverse!| body) ,val)))) (defmacro sintp (n) `(typep ,n 'fixnum)) @@ -810,11 +810,11 @@ (defun QSORT (l) (declare (special sortgreaterp)) - (NREVERSE (sort (copy-seq l) SORTGREATERP))) + (|reverse!| (sort (copy-seq l) SORTGREATERP))) (defun SORTBY (keyfn l) (declare (special sortgreaterp)) - (nreverse (sort (copy-seq l) SORTGREATERP :key keyfn))) + (|reverse!| (sort (copy-seq l) SORTGREATERP :key keyfn))) ; 16.0 Operations on Vectors |