diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2013-01-03 08:10:25 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2013-01-03 08:10:25 +0000 |
commit | 2853156a2bce535bcaa440c37cf872916f76c03b (patch) | |
tree | 8e161033a9bac8274dcaca05940964b91cdb2bfc /sca-cpp/trunk/modules/scheme | |
parent | 55607ea78e10832838d52fdb17cbdfe4355c3265 (diff) |
Refactoring, rename isNil to isNull.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1428206 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r-- | sca-cpp/trunk/modules/scheme/driver.hpp | 2 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/scheme/environment.hpp | 12 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/scheme/eval.hpp | 16 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/scheme/io.hpp | 2 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/scheme/primitive.hpp | 14 |
5 files changed, 23 insertions, 23 deletions
diff --git a/sca-cpp/trunk/modules/scheme/driver.hpp b/sca-cpp/trunk/modules/scheme/driver.hpp index c94af7bbf7..015348c9e1 100644 --- a/sca-cpp/trunk/modules/scheme/driver.hpp +++ b/sca-cpp/trunk/modules/scheme/driver.hpp @@ -56,7 +56,7 @@ const bool userPrint(const value val, ostream& out) { const value evalDriverLoop(istream& in, ostream& out, Env& env) { promptForInput(evalInputPrompt, out); const value input = content(readValue(in)); - if (isNil(input)) + if (isNull(input)) return input; const value output = evalExpr(input, env); announceOutput(evalOutputPrompt, out); diff --git a/sca-cpp/trunk/modules/scheme/environment.hpp b/sca-cpp/trunk/modules/scheme/environment.hpp index 1a295c74f4..ee82bc0401 100644 --- a/sca-cpp/trunk/modules/scheme/environment.hpp +++ b/sca-cpp/trunk/modules/scheme/environment.hpp @@ -81,16 +81,16 @@ const bool isDotVariable(const value& var) { } const Frame makeBinding(const Frame& frameSoFar, const list<value>& variables, const list<value> values) { - if (isNil(variables)) { - if (!isNil(values)) + if (isNull(variables)) { + if (!isNull(values)) logStream() << "Too many arguments supplied " << values << endl; return frameSoFar; } if (isDotVariable(car(variables))) return makeBinding(frameSoFar, cdr(variables), mklist<value>(values)); - if (isNil(values)) { - if (!isNil(variables)) + if (isNull(values)) { + if (!isNull(variables)) logStream() << "Too few arguments supplied " << variables << endl; return frameSoFar; } @@ -118,7 +118,7 @@ const value definitionVariable(const value& exp) { const value definitionValue(const value& exp) { const list<value> exps(exp); if(isSymbol(car(cdr(exps)))) { - if (isNil(cdr(cdr(exps)))) + if (isNull(cdr(cdr(exps)))) return nilValue; return car(cdr(cdr(exps))); } @@ -158,7 +158,7 @@ const Env setupEnvironment() { const value lookupEnvLoop(const value& var, const Env& env); const value lookupEnvScan(const value& var, const list<value>& vars, const list<value>& vals, const Env& env) { - if(isNil(vars)) + if(isNull(vars)) return lookupEnvLoop(var, enclosingEnvironment(env)); if(var == car(vars)) return car(vals); diff --git a/sca-cpp/trunk/modules/scheme/eval.hpp b/sca-cpp/trunk/modules/scheme/eval.hpp index 5074471931..17150a7b48 100644 --- a/sca-cpp/trunk/modules/scheme/eval.hpp +++ b/sca-cpp/trunk/modules/scheme/eval.hpp @@ -87,7 +87,7 @@ const list<value> operands(const value& exp) { } const list<value> listOfValues(const list<value> exps, Env& env) { - if(isNil(exps)) + if(isNull(exps)) return list<value> (); return cons(evalExpr(car(exps), env), listOfValues(cdr(exps), env)); } @@ -117,7 +117,7 @@ const Env procedureEnvironment(const value& exp) { } const bool isLastExp(const list<value>& seq) { - return isNil(cdr(seq)); + return isNull(cdr(seq)); } const value firstExp(const list<value>& seq) { @@ -151,7 +151,7 @@ const value applyProcedure(const value& procedure, list<value>& arguments) { } const value sequenceToExp(const list<value> exps) { - if(isNil(exps)) + if(isNull(exps)) return exps; if(isLastExp(exps)) return firstExp(exps); @@ -179,7 +179,7 @@ const value ifConsequent(const value& exp) { } const value ifAlternative(const value& exp) { - if(!isNil(cdr(cdr(cdr((list<value> )exp))))) + if(!isNull(cdr(cdr(cdr((list<value> )exp))))) return car(cdr(cdr(cdr((list<value> )exp)))); return false; } @@ -201,12 +201,12 @@ const value makeIf(value predicate, value consequent, value alternative) { } const value expandClauses(const list<value>& clauses) { - if(isNil(clauses)) + if(isNull(clauses)) return false; const value first = car(clauses); const list<value> rest = cdr(clauses); if(isCondElseClause(first)) { - if(isNil(rest)) + if(isNull(rest)) return sequenceToExp(condActions(first)); logStream() << "else clause isn't last " << clauses << endl; return nilValue; @@ -259,7 +259,7 @@ const value evalExpr(const value& exp, Env& env) { } const list<value> quotedParameters(const list<value>& p) { - if (isNil(p)) + if (isNull(p)) return p; return cons<value>(mklist<value>(quoteSymbol, car(p)), quotedParameters(cdr(p))); } @@ -268,7 +268,7 @@ const list<value> quotedParameters(const list<value>& p) { * Evaluate an expression against a script provided as a list of values. */ const value evalScriptLoop(const value& expr, const list<value>& script, scheme::Env& env) { - if (isNil(script)) + if (isNull(script)) return scheme::evalExpr(expr, env); scheme::evalExpr(car(script), env); return evalScriptLoop(expr, cdr(script), env); diff --git a/sca-cpp/trunk/modules/scheme/io.hpp b/sca-cpp/trunk/modules/scheme/io.hpp index 02f6923c86..c7177b54ae 100644 --- a/sca-cpp/trunk/modules/scheme/io.hpp +++ b/sca-cpp/trunk/modules/scheme/io.hpp @@ -231,7 +231,7 @@ inline const failable<list<string> > writeValue(const value& val) { inline const value readScript(istream& in) { const value val = content(readValue(in)); - if (isNil(val)) + if (isNull(val)) return nilListValue; return cons(val, (list<value>)readScript(in)); } diff --git a/sca-cpp/trunk/modules/scheme/primitive.hpp b/sca-cpp/trunk/modules/scheme/primitive.hpp index 4815e9a497..da0056d6da 100644 --- a/sca-cpp/trunk/modules/scheme/primitive.hpp +++ b/sca-cpp/trunk/modules/scheme/primitive.hpp @@ -118,10 +118,10 @@ inline const value treeSelectAssocProc(const list<value>& args) { inline const value nullProc(const list<value>& args) { const value v(car(args)); - if (isNil(v)) + if (isNull(v)) return true; if (isList(v)) - return isNil(list<value>(v)); + return isNull(list<value>(v)); return false; } @@ -138,13 +138,13 @@ inline const value lesserProc(const list<value>& args) { } inline const value addProc(const list<value>& args) { - if (isNil(cdr(args))) + if (isNull(cdr(args))) return (double)car(args); return (double)car(args) + (double)cadr(args); } inline const value subProc(const list<value>& args) { - if (isNil(cdr(args))) + if (isNull(cdr(args))) return (double)0 - (double)car(args); return (double)car(args) - (double)cadr(args); } @@ -162,7 +162,7 @@ inline const value sqrtProc(const list<value>& args) { } inline const value displayProc(const list<value>& args) { - if (isNil(args)) { + if (isNull(args)) { displayStream() << endl; return true; } @@ -171,7 +171,7 @@ inline const value displayProc(const list<value>& args) { } inline const value logProc(const list<value>& args) { - if (isNil(args)) { + if (isNull(args)) { logStream() << endl; return true; } @@ -225,7 +225,7 @@ inline const bool isPrimitiveProcedure(const value& proc) { } inline const bool isSelfEvaluating(const value& exp) { - if(isNil(exp)) + if(isNull(exp)) return true; if(isNumber(exp)) return true; |