diff --git a/src/main/kotlin/function/builtin/Apply.kt b/src/main/kotlin/function/builtin/Apply.kt index 37ecd32..c830bb4 100644 --- a/src/main/kotlin/function/builtin/Apply.kt +++ b/src/main/kotlin/function/builtin/Apply.kt @@ -7,7 +7,7 @@ import function.builtin.Eval.Companion.applyFunction import function.builtin.Eval.Companion.lookupFunctionOrLambda import sexpression.Cons import sexpression.SExpression -import table.FunctionTable +import table.FunctionTable.lookupFunction @FunctionNames("APPLY") class Apply(name: String) : LispFunction() { @@ -31,7 +31,7 @@ class Apply(name: String) : LispFunction() { companion object { fun apply(argumentList: Cons): SExpression { - return FunctionTable.lookupFunction("APPLY")!!.call(argumentList) + return lookupFunction("APPLY")!!.call(argumentList) } } } diff --git a/src/main/kotlin/function/builtin/Eval.kt b/src/main/kotlin/function/builtin/Eval.kt index 6b8233f..93aad4c 100644 --- a/src/main/kotlin/function/builtin/Eval.kt +++ b/src/main/kotlin/function/builtin/Eval.kt @@ -16,7 +16,7 @@ import sexpression.SExpression import sexpression.Symbol import sexpression.Symbol.Companion.T import table.ExecutionContext -import table.FunctionTable +import table.FunctionTable.lookupFunction @FunctionNames("EVAL") class Eval(name: String) : LispFunction() { @@ -99,7 +99,7 @@ class Eval(name: String) : LispFunction() { companion object { - private fun lookupEval() = FunctionTable.lookupFunction("EVAL") as Eval + private fun lookupEval() = lookupFunction("EVAL") as Eval @JvmStatic fun eval(sExpression: SExpression): SExpression { @@ -128,7 +128,7 @@ class Eval(name: String) : LispFunction() { @JvmStatic fun lookupFunctionOrLambda(functionExpression: SExpression): LispFunction { - val function = FunctionTable.lookupFunction(functionExpression.toString()) + val function = lookupFunction(functionExpression.toString()) return function ?: createLambdaFunction(functionExpression) } diff --git a/src/main/kotlin/function/builtin/Set.kt b/src/main/kotlin/function/builtin/Set.kt index 131e842..f14e2d7 100644 --- a/src/main/kotlin/function/builtin/Set.kt +++ b/src/main/kotlin/function/builtin/Set.kt @@ -7,7 +7,7 @@ import sexpression.Cons import sexpression.SExpression import sexpression.Symbol import table.ExecutionContext -import table.FunctionTable +import table.FunctionTable.lookupFunction import table.SymbolTable @FunctionNames("SET") @@ -47,6 +47,6 @@ class Set(name: String) : LispFunction() { companion object { @JvmStatic - fun set(argumentList: Cons) = FunctionTable.lookupFunction("SET")!!.call(argumentList) + fun set(argumentList: Cons) = lookupFunction("SET")!!.call(argumentList) } } diff --git a/src/main/kotlin/function/builtin/SymbolFunction.kt b/src/main/kotlin/function/builtin/SymbolFunction.kt index 3b5688a..82cc631 100644 --- a/src/main/kotlin/function/builtin/SymbolFunction.kt +++ b/src/main/kotlin/function/builtin/SymbolFunction.kt @@ -9,7 +9,7 @@ import function.UserDefinedFunction import sexpression.Cons import sexpression.SExpression import sexpression.Symbol -import table.FunctionTable +import table.FunctionTable.lookupFunction @FunctionNames("SYMBOL-FUNCTION") class SymbolFunction(name: String) : LispFunction() { @@ -23,7 +23,7 @@ class SymbolFunction(name: String) : LispFunction() { argumentValidator.validate(argumentList) val symbol = argumentList.first - val function = FunctionTable.lookupFunction(symbol.toString()) + val function = lookupFunction(symbol.toString()) if (function != null) return createRepresentation(symbol, function) diff --git a/src/main/kotlin/function/builtin/cons/Append.kt b/src/main/kotlin/function/builtin/cons/Append.kt index a5cfd53..1868c54 100644 --- a/src/main/kotlin/function/builtin/cons/Append.kt +++ b/src/main/kotlin/function/builtin/cons/Append.kt @@ -5,7 +5,7 @@ import function.FunctionNames import function.LispFunction import sexpression.Cons import sexpression.Nil -import table.FunctionTable +import table.FunctionTable.lookupFunction @FunctionNames("APPEND") class Append(name: String) : LispFunction() { @@ -58,6 +58,6 @@ class Append(name: String) : LispFunction() { return lookupAppend().appendLists(firstList, secondList) } - private fun lookupAppend() = FunctionTable.lookupFunction("APPEND") as Append + private fun lookupAppend() = lookupFunction("APPEND") as Append } } diff --git a/src/main/kotlin/function/builtin/cons/Length.kt b/src/main/kotlin/function/builtin/cons/Length.kt index c21d050..79fc1b8 100644 --- a/src/main/kotlin/function/builtin/cons/Length.kt +++ b/src/main/kotlin/function/builtin/cons/Length.kt @@ -5,7 +5,6 @@ import function.FunctionNames import function.LispFunction import sexpression.Cons import sexpression.LispNumber -import table.FunctionTable import table.FunctionTable.lookupFunction import java.math.BigInteger.ZERO