transcendental-lisp/src/sexpression/Nil.java

46 lines
745 B
Java

package sexpression;
@DisplayName("nil")
public class Nil extends Cons {
public static final Nil NIL = new Nil();
private Nil() {
super(null, null);
super.setFirst(this);
super.setRest(this);
}
public boolean isNull() {
return true;
}
public boolean isAtom() {
return true;
}
public boolean isCons() {
return false;
}
public boolean isSymbol() {
return true;
}
/**
* The first of NIL can not be changed.
*/
public void setFirst(SExpression first) {}
/**
* The rest of NIL can not be changed.
*/
public void setRest(SExpression rest) {}
public String toString() {
return "NIL";
}
}