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);
    }

    @Override
    public boolean isNull() {
        return true;
    }

    @Override
    public boolean isAtom() {
        return true;
    }

    @Override
    public boolean isCons() {
        return false;
    }

    @Override
    public boolean isSymbol() {
        return true;
    }

    /**
     * The first of NIL can not be changed.
     */
    @Override
    public void setFirst(SExpression first) {}

    /**
     * The rest of NIL can not be changed.
     */
    @Override
    public void setRest(SExpression rest) {}

    @Override
    public String toString() {
        return "NIL";
    }

}
