LENGTH no longer creates a new instance
This commit is contained in:
parent
1301e0a227
commit
a8d8d6696c
|
@ -3,6 +3,7 @@ package function.builtin.cons;
|
|||
import static function.builtin.cons.LIST.makeList;
|
||||
import static recursion.TailCalls.done;
|
||||
import static recursion.TailCalls.tailCall;
|
||||
import static table.FunctionTable.lookupFunction;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
|
@ -17,12 +18,15 @@ import sexpression.LispNumber;
|
|||
public class LENGTH extends LispFunction {
|
||||
|
||||
public static BigInteger getLength(Cons list) {
|
||||
LENGTH lengthFunction = new LENGTH("LENGTH");
|
||||
LispNumber length = lengthFunction.callWithoutArgumentValidation(makeList(list));
|
||||
LispNumber length = lookupLength().callWithoutArgumentValidation(makeList(list));
|
||||
|
||||
return length.getValue();
|
||||
}
|
||||
|
||||
private static LENGTH lookupLength() {
|
||||
return (LENGTH) lookupFunction("LENGTH");
|
||||
}
|
||||
|
||||
private ArgumentValidator argumentValidator;
|
||||
|
||||
public LENGTH(String name) {
|
||||
|
|
Loading…
Reference in New Issue