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

23 lines
568 B
Java
Raw Normal View History

2016-12-19 13:05:53 -05:00
package function.builtin;
2016-12-07 16:38:26 -05:00
import function.*;
import sexpression.*;
2016-12-07 16:38:26 -05:00
public class FUNCALL extends LispFunction {
private ArgumentValidator argumentValidator;
2016-12-07 16:38:26 -05:00
public FUNCALL() {
this.argumentValidator = new ArgumentValidator("FUNCALL");
this.argumentValidator.setMinimumNumberOfArguments(1);
}
2016-12-07 16:38:26 -05:00
public SExpression call(Cons argumentList) {
argumentValidator.validate(argumentList);
Cons applyArgs = new Cons(argumentList.getCar(), LIST.makeList(argumentList.getCdr()));
2016-12-07 16:38:26 -05:00
return APPLY.apply(applyArgs);
}
}