const value evalExpr()

in modules/scheme/eval.hpp [232:259]


const value evalExpr(const value& exp, Env& env) {
    if(isSelfEvaluating(exp))
        return exp;
    if(isQuoted(exp))
        return textOfQuotation(exp);
    if(isDefinition(exp))
        return evalDefinition(exp, env);
    if(isIf(exp))
        return evalIf(exp, env);
    if(isBegin(exp))
        return evalSequence(beginActions(exp), env);
    if(isCond(exp))
        return evalExpr(condToIf(exp), env);
    if(isLambdaExpr(exp))
        return makeProcedure(lambdaParameters(exp), lambdaBody(exp), env);
    if(isVariable(exp))
        return lookupVariableValue(exp, env);
    if(isApply(exp)) {
        list<value> applyOperandValues = evalExpr(applyOperand(exp), env);
        return applyProcedure(evalExpr(applyOperat(exp), env), applyOperandValues);
    }
    if(isApplication(exp)) {
        list<value> operandValues = listOfValues(operands(exp), env);
        return applyProcedure(evalExpr(operat(exp), env), operandValues);
    }
    logStream() << "Unknown expression type " << exp << endl;
    return nilValue;
}