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

23 lines
553 B
Java

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