package sexpression;

@DisplayName("nil")
public class Nil extends Cons {

    private static Nil uniqueInstance = new Nil();

    public static Nil getInstance() {
        return uniqueInstance;
    }

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

}
