/**
 * The most basic building block of Scheme lists.
 *
 * @author Samuel A. Rebelsky
 * @author Yvonne Palm
 * @author "I was here before Sam" Leach
 * @author Jonathan "Back in class" Wellons
 */
public class NullList
  implements SchemeList
{
  // +-----------+-----------------------------------------------
  // | Constants |
  // +-----------+

  // +--------+--------------------------------------------------
  // | Fields |
  // +--------+

  // +--------------+--------------------------------------------
  // | Constructors |
  // +--------------+

  /**
   * Build a new empty list.
   */
  public NullList()
  {
  } // NullList()


  // +------------------+----------------------------------------
  // | Exported Methods |
  // +------------------+

  /** 
   * Determine if this list is empty.
   */
  public boolean isEmpty()
  {
    return true;
  } // isEmpty()

  /**
   * Create a new list by adding something to the front of this list.
   */
  public SchemeList addToFront(Object val)
  {
    return new ConsCell(val, this);
  } // addToFront(Object)
  
  /**
   * Get the initial element of the list.
   */
  public Object car()
    throws EmptyListException
  {
    throw new EmptyListException();
  } // car()

  /**
   * Get a list that contains all but the first element.
   */
  public SchemeList cdr()
    throws EmptyListException
  {
    throw new EmptyListException();
  } // cdr()

  /**
   * Convert this list to a string (often for printing).
   */
  public String toString() 
  {
    return "()";
  } // toString()
} // class NullList
