From b200f025ccb0b684ff63844dbdddb3f4fa8048df Mon Sep 17 00:00:00 2001 From: Gabriel Dos Reis Date: Thu, 24 Dec 2015 19:11:45 -0800 Subject: Tidy uses of apply. --- src/boot/parser.boot | 6 +++--- src/boot/translator.boot | 4 ++-- src/interp/c-util.boot | 2 +- src/interp/cparse.boot | 50 ++++++++++++++++++++++---------------------- src/interp/g-opt.boot | 2 +- src/interp/g-util.boot | 4 ++-- src/interp/lisp-backend.boot | 2 +- src/interp/lisplib.boot | 2 +- src/interp/spad-parser.boot | 6 +++--- src/interp/sys-driver.boot | 4 ++-- 10 files changed, 41 insertions(+), 41 deletions(-) (limited to 'src') diff --git a/src/boot/parser.boot b/src/boot/parser.boot index e390894b..3864fc13 100644 --- a/src/boot/parser.boot +++ b/src/boot/parser.boot @@ -208,7 +208,7 @@ bpListof(ps,f,str1,g)== parserTrees(ps) := nil while bpEqKey(ps,str1) and bpRequire(ps,f) repeat nil parserTrees(ps) := [reverse! parserTrees ps,:a] - bpPush(ps,FUNCALL(g, [bpPop3 ps,bpPop2 ps,:bpPop1 ps])) + bpPush(ps,apply(g,[[bpPop3 ps,bpPop2 ps,:bpPop1 ps]])) true false @@ -221,7 +221,7 @@ bpListofFun(ps,f,h,g)== parserTrees(ps) := nil while apply(h,[ps]) and bpRequire(ps,f) repeat nil parserTrees(ps) := [reverse! parserTrees ps,:a] - bpPush(ps,FUNCALL(g, [bpPop3 ps,bpPop2 ps,:bpPop1 ps])) + bpPush(ps,apply(g,[[bpPop3 ps,bpPop2 ps,:bpPop1 ps]])) true false @@ -255,7 +255,7 @@ bpAnyNo(ps,s) == -- AndOr(k,p,f)= k p bpAndOr(ps,keyword,p,f)== bpEqKey(ps,keyword) and bpRequire(ps,p) - and bpPush(ps,FUNCALL(f,parserLoadUnit ps,bpPop1 ps)) + and bpPush(ps,apply(f,[parserLoadUnit ps,bpPop1 ps])) bpConditional(ps,f) == bpEqKey(ps,"IF") and bpRequire(ps,function bpWhere) and (bpEqKey(ps,"BACKSET") or true) => diff --git a/src/boot/translator.boot b/src/boot/translator.boot index 17aab40c..b98f3b30 100644 --- a/src/boot/translator.boot +++ b/src/boot/translator.boot @@ -604,8 +604,8 @@ associateRequestWithFileType(Option '"compile", '"boot", ++ Load native dynamically linked module loadNativeModule m == %hasFeature KEYWORD::SBCL => - FUNCALL(bfColonColon("SB-ALIEN","LOAD-SHARED-OBJECT"),m, - KEYWORD::DONT_-SAVE, true) + apply(bfColonColon("SB-ALIEN","LOAD-SHARED-OBJECT"), + [m,KEYWORD::DONT_-SAVE,true]) %hasFeature KEYWORD::CLISP => EVAL [bfColonColon("FFI","DEFAULT-FOREIGN-LIBRARY"), m] %hasFeature KEYWORD::ECL => diff --git a/src/interp/c-util.boot b/src/interp/c-util.boot index a81d043e..77d0dcca 100644 --- a/src/interp/c-util.boot +++ b/src/interp/c-util.boot @@ -1322,7 +1322,7 @@ middleEndExpand x == atomic? x => x [op,:args] := x ident? op and (fun := getOpcodeExpander op) => - middleEndExpand apply(fun,x,nil) + middleEndExpand apply(fun,[x]) a := middleEndExpand op b := middleEndExpand args sameObject?(a,op) and sameObject?(b,args) => x diff --git a/src/interp/cparse.boot b/src/interp/cparse.boot index ee7e1c99..9e28504d 100644 --- a/src/interp/cparse.boot +++ b/src/interp/cparse.boot @@ -141,7 +141,7 @@ npParenthesized f == npParenthesize (open,close,f)== a := $stok npEqKey open => - apply(f,nil) and (npEqKey close or npMissingMate(close,a)) => true + apply(f,[]) and (npEqKey close or npMissingMate(close,a)) => true npEqKey close => npPush [] npMissingMate(close,a) false @@ -153,7 +153,7 @@ npEnclosed(open,close,fn,f)== a := $stok npEqKey open => npEqKey close => npPush apply(fn,[a,pfTuple pfListOf []]) - apply(f,nil) and (npEqKey close or npMissingMate(close,a)) => + apply(f,[]) and (npEqKey close or npMissingMate(close,a)) => npPush apply(fn,[a,pfEnSequence npPop1()]) false false @@ -190,7 +190,7 @@ npBracketed f== npPileBracketed f== npEqKey "SETTAB" => npEqKey "BACKTAB" => npPush pfNothing() -- never happens - apply(f,nil) and (npEqKey "BACKTAB" or npMissing "backtab") => + apply(f,[]) and (npEqKey "BACKTAB" or npMissing "backtab") => npPush pfPile npPop1() false false @@ -199,11 +199,11 @@ npPileBracketed f== ++ of syntax `f' separated by syntax `g'. In case of a sequence, use ++ `g' to build the resulting parse tree. npListofFun(f,h,g)== - apply(f,nil) => - apply(h,nil) and (apply(f,nil) or npTrap()) => + apply(f,[]) => + apply(h,[]) and (apply(f,[]) or npTrap()) => a := $stack $stack := nil - while apply(h,nil) and (apply(f,nil) or npTrap()) repeat 0 + while apply(h,[]) and (apply(f,[]) or npTrap()) repeat 0 $stack := [reverse! $stack,:a] npPush apply(g, [[npPop3(),npPop2(),:npPop1()]]) true @@ -212,13 +212,13 @@ npListofFun(f,h,g)== ++ Parse combinator: parse a sequence of syntax `f' separated by ++ token `str1'. Build the resulting parse tree with `g'. npList(f,str1,g)== -- always produces a list, g is applied to it - apply(f,nil) => + apply(f,[]) => npEqKey str1 and (npEqKey "BACKSET" or true) - and (apply(f,nil) or npTrap()) => + and (apply(f,[]) or npTrap()) => a := $stack $stack := nil while npEqKey str1 and (npEqKey "BACKSET" or true) and - (apply(f,nil) or npTrap()) repeat 0 + (apply(f,[]) or npTrap()) repeat 0 $stack := [reverse! $stack,:a] npPush apply(g,[[npPop3(),npPop2(),:npPop1()]]) npPush apply(g,[[npPop1()]]) @@ -258,13 +258,13 @@ npPC(f) == ++ it is possible. Note that `s' transforms the the top of the ++ parse tree stack. npAnyNo s == - while apply(s,nil) repeat 0 + while apply(s,[]) repeat 0 true ++ Parser combinator: parse `keyword' followed by the syntax `p', ++ and build the resulting parse tree with `f'. npAndOr(keyword,p,f)== - npEqKey keyword and (apply(p,nil) or npTrap()) and + npEqKey keyword and (apply(p,[]) or npTrap()) and npPush apply(f,[npPop1()]) ++ Parser combinator: parse a right-associative syntax with operand @@ -273,7 +273,7 @@ npAndOr(keyword,p,f)== ++ p o p o = (p o p) o npRightAssoc(o,p)== a := npState() - apply(p,nil) => + apply(p,[]) => while npInfGeneric o and (npRightAssoc(o,p) or (npPush pfApplication(npPop2(),npPop1());false)) repeat npPush pfInfApplication(npPop2(),npPop2(),npPop1()) @@ -286,9 +286,9 @@ npRightAssoc(o,p)== ++ p o p o p o p = (((p o p) o p) o p) ++ p o p o = (p o p) o npLeftAssoc(operations,parser) == - apply(parser,nil) => + apply(parser,[]) => while npInfGeneric(operations) and - (apply(parser,nil) or + (apply(parser,[]) or (npPush pfApplication(npPop2(),npPop1());false)) repeat npPush pfInfApplication(npPop2(),npPop2(),npPop1()) true @@ -343,16 +343,16 @@ npConditional f == (npEqKey "BACKSET" or true) => npEqKey "SETTAB" => npEqKey "THEN" => - (apply(f,nil) or npTrap()) and npElse f and npEqKey "BACKTAB" + (apply(f,[]) or npTrap()) and npElse f and npEqKey "BACKTAB" npMissing "then" - npEqKey "THEN" => (apply(f,nil) or npTrap()) and npElse f + npEqKey "THEN" => (apply(f,[]) or npTrap()) and npElse f npMissing "then" false npElse f == a := npState() npBacksetElse() => - (apply(f,nil) or npTrap()) and + (apply(f,[]) or npTrap()) and npPush pfIf(npPop3(),npPop2(),npPop1()) npRestore a npPush pfIfThenOnly(npPop2(),npPop1()) @@ -372,7 +372,7 @@ npQuantified f == npEqPeek "EXIST" => npQuantifierVariable "EXIST" and npQuantified f and npPush %Exist(npPop2(), npPop1()) - apply(f,nil) + apply(f,[]) -- Parsing functions @@ -456,7 +456,7 @@ npPrefixColon() == -- silly npEncAp f == - apply(f,nil) and npAnyNo function npEncl and npFromdom() + apply(f,[]) and npAnyNo function npEncl and npFromdom() npEncl()== npBDefinition() and npPush pfApplication(npPop2(),npPop1()) @@ -476,7 +476,7 @@ npPrimary()== npPrimary1() or npPrimary2() npDotted f == - apply(f,nil) and npAnyNo function npSelector + apply(f,[]) and npAnyNo function npSelector npSelector()== npEqKey "DOT" and (npPrimary() or npTrap()) and @@ -624,10 +624,10 @@ npExpress()== npPush pfCollect (npPop2(),pfListOf npPop1()) or true) npZeroOrMore f== - apply(f,nil)=> + apply(f,[])=> a := $stack $stack := nil - while apply(f,nil) repeat 0 + while apply(f,[]) repeat 0 $stack := [reverse! $stack,:a] npPush [npPop2(),:npPop1()] npPush nil @@ -668,10 +668,10 @@ npStatement() == npBackTrack(p1,p2,p3) == a := npState() - apply(p1,nil) => + apply(p1,[]) => npEqPeek p2 => npRestore a - apply(p3,nil) or npTrap() + apply(p3,[]) or npTrap() true false @@ -1050,7 +1050,7 @@ npListAndRecover(f)== done := false c := $inputStream while not done repeat - found:=CATCH("TRAPPOINT",apply(f,nil)) + found:=CATCH("TRAPPOINT",apply(f,[])) if found="TRAPPED" then $inputStream:=c npRecoverTrap() diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot index 2548cb53..0cf42d43 100644 --- a/src/interp/g-opt.boot +++ b/src/interp/g-opt.boot @@ -554,7 +554,7 @@ optCall (x is ['%call,:u]) == fn is ['%external,op] => x.first := op x.rest := a - opt := op has OPTIMIZE => resetTo(x,apply(opt,x,nil)) + opt := op has OPTIMIZE => resetTo(x,apply(opt,[x])) x fn is ['ELT,:.] => emitIndirectCall(fn,a,x) fn is ['CONST,R,n] => ['spadConstant,R,n] diff --git a/src/interp/g-util.boot b/src/interp/g-util.boot index 25ec813d..dc73604a 100644 --- a/src/interp/g-util.boot +++ b/src/interp/g-util.boot @@ -155,11 +155,11 @@ walkWith!(x,f) == x for ys in tails x | not atomic? first ys repeat ys.first := walkWith!(first ys,f) - apply(f,x,nil) + apply(f,[x]) prefixWalk!(x,f) == atomic? x => x - x := apply(f,x,nil) + x := apply(f,[x]) atomic? x => x for xs in tails x | not atomic? first xs repeat xs.first := prefixWalk!(first xs,f) diff --git a/src/interp/lisp-backend.boot b/src/interp/lisp-backend.boot index a2d89607..d036d240 100644 --- a/src/interp/lisp-backend.boot +++ b/src/interp/lisp-backend.boot @@ -755,7 +755,7 @@ expandToVMForm x == ident? x and (x' := x has %Rename) => x' atomic? x => x [op,:args] := x - ident? op and (fun:= getOpcodeExpander op) => apply(fun,x,nil) + ident? op and (fun:= getOpcodeExpander op) => apply(fun,[x]) op' := expandToVMForm op args' := expandToVMForm args sameObject?(op,op') and sameObject?(args,args') => x diff --git a/src/interp/lisplib.boot b/src/interp/lisplib.boot index d708eb3f..c0b341bc 100644 --- a/src/interp/lisplib.boot +++ b/src/interp/lisplib.boot @@ -300,7 +300,7 @@ genericLoadDB(db,f) == dbLoaded? db => db ctor := dbConstructor db builtinConstructor? ctor => nil - lib := apply(f,db,nil) or return nil + lib := apply(f,[db]) or return nil loadModule(lib,ctor) dbLoadPath(db) := lib db diff --git a/src/interp/spad-parser.boot b/src/interp/spad-parser.boot index 2c37ee6e..028a30b9 100644 --- a/src/interp/spad-parser.boot +++ b/src/interp/spad-parser.boot @@ -317,7 +317,7 @@ macro compulsorySyntax(rd,s) == repeatedSyntax(rd,l,p) == n := stackSize $reduceStack once := false - while apply(p,rd,nil) repeat + while apply(p,[rd]) repeat once := true not once => nil x := nil @@ -594,7 +594,7 @@ parseRightBindingPowerOf(x,p) == parseGetSemanticForm(rd,x,p,y) == z := y = nil => nil - apply(y,rd,nil) + apply(y,[rd]) z ~= nil => z p = "Nud" => parsePrefix rd p = "Led" => parseInfix rd @@ -1030,7 +1030,7 @@ parseSpecialCommand rd == pushReduction('parseSpecialCommand,["show",popStack1()]) compulsorySyntax(rd,parseCommandTail rd) symbolMember?(currentSymbol rd,$noParseCommands) => - apply(currentSymbol rd,nil) + apply(currentSymbol rd,[]) true symbolMember?(currentSymbol rd,$tokenCommands) and parseTokenList rd => compulsorySyntax(rd,parseTokenCommandTail rd) diff --git a/src/interp/sys-driver.boot b/src/interp/sys-driver.boot index 4fb8611c..5abf11fd 100644 --- a/src/interp/sys-driver.boot +++ b/src/interp/sys-driver.boot @@ -353,8 +353,8 @@ systemMain() == restart() )if %hasFeature KEYWORD::ECL SI::_*LISP_-INITIALIZED_* : local := true - apply($originalLispTopLevel,nil) + apply($originalLispTopLevel,[]) )elseif %hasFeature KEYWORD::SBCL - apply($originalLispTopLevel,nil) + apply($originalLispTopLevel,[]) )endif fatalError '"fell off systemMain" -- cgit v1.2.3