transcendental-lisp/src/function/builtin/FUNCALL.java

24 lines
603 B
Java

package function.builtin;
import function.*;
import function.builtin.cons.LIST;
import sexpression.*;
public class FUNCALL extends LispFunction {
private ArgumentValidator argumentValidator;
public FUNCALL() {
this.argumentValidator = new ArgumentValidator("FUNCALL");
this.argumentValidator.setMinimumNumberOfArguments(1);
}
public SExpression call(Cons argumentList) {
argumentValidator.validate(argumentList);
Cons applyArgs = new Cons(argumentList.getCar(), LIST.makeList(argumentList.getCdr()));
return APPLY.apply(applyArgs);
}
}