transcendental-lisp/src/function/builtin/predicate/LISTP.java

22 lines
515 B
Java

package function.builtin.predicate;
import function.*;
import sexpression.*;
public class LISTP extends LispFunction {
private ArgumentValidator argumentValidator;
public LISTP() {
this.argumentValidator = new ArgumentValidator("LISTP");
this.argumentValidator.setExactNumberOfArguments(1);
}
public SExpression call(Cons argumentList) {
argumentValidator.validate(argumentList);
return argumentList.getFirst().isList() ? Symbol.T : Nil.getInstance();
}
}