26 lines
594 B
Java
26 lines
594 B
Java
package function.builtin.predicate;
|
|
|
|
import static sexpression.Nil.NIL;
|
|
import static sexpression.Symbol.T;
|
|
|
|
import function.*;
|
|
import sexpression.*;
|
|
|
|
@FunctionNames({ "LISTP" })
|
|
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() ? T : NIL;
|
|
}
|
|
|
|
}
|