/* Interface for elements of D in Jones, Chapter 2 Written by: Kim Bruce, 9/16/2002 */ public interface D { // Constants representing nil, true, and false; D nil = new Atom("nil"); D dTrue = new Composite(nil,nil); D dFalse = nil; // create new list with other as head and this as tail D cons(D other); // return head of this D hd(); // return tail of this D tl(); // return dTrue if this equals other and dFalse otherwise D eq(D other); // return true iff this equals other boolean booleq(D other); // return true iff this represents a legal list boolean isList(); // If this represents a legal list, e.g., (a.(b.(c.nil))), then it // returns the list representation of the element, e.g. "(a,b,c)" String asList(); }