Minor cleanup in SYMBOL-FUNCTION
This commit is contained in:
parent
d3e3f52e59
commit
5129f6c17b
|
@ -25,18 +25,18 @@ public class SYMBOL_FUNCTION extends LispFunction {
|
|||
LispFunction function = FunctionTable.lookupFunction(symbol.toString());
|
||||
|
||||
if (function != null)
|
||||
return createSymbolRepresentation(symbol, function);
|
||||
return createRepresentation(symbol, function);
|
||||
|
||||
throw new UndefinedSymbolFunctionException(symbol);
|
||||
}
|
||||
|
||||
private SExpression createSymbolRepresentation(SExpression symbol, LispFunction function) {
|
||||
private SExpression createRepresentation(SExpression symbol, LispFunction function) {
|
||||
if (function instanceof UserDefinedFunction)
|
||||
return ((UserDefinedFunction) function).getLambdaExpression();
|
||||
else if (function instanceof LispSpecialFunction)
|
||||
return new Symbol(MessageFormat.format("#<SPECIAL-FUNCTION {0}>", symbol.toString()));
|
||||
|
||||
return new Symbol(MessageFormat.format("#<FUNCTION {0}>", symbol.toString()));
|
||||
String typeIndicator = function instanceof LispSpecialFunction ? "SPECIAL-FUNCTION" : "FUNCTION";
|
||||
|
||||
return new Symbol(MessageFormat.format("#<{0} {1}>", typeIndicator, symbol));
|
||||
}
|
||||
|
||||
public static class UndefinedSymbolFunctionException extends LispException {
|
||||
|
|
Loading…
Reference in New Issue