All Packages Class Hierarchy This Package Previous Next Index
Class magician.Four11.List
java.lang.Object
|
+----magician.Four11.List
- public class List
- extends Object
Implements a LISP style list
-
List()
- initializes a null list
-
List(Object, List)
- prepends a list with a new element (the "cons" operation in Lisp).
-
car()
- returns the first element of the list (the "car" in Lisp)
-
cdr()
- returns a pointer to the rest of the list (the "cdr" in Lisp)
-
setCar(Object)
- sets the "car" of the list
-
setCdr(List)
- sets the "cdr" of the list
List
public List()
- initializes a null list
List
public List(Object data,
List next)
- prepends a list with a new element (the "cons" operation in Lisp).
Can be used to create a new list by setting next to null.
- Parameters:
- data - the element
- next - the tail of the list, a pointer to the rest of the list
car
public Object car()
- returns the first element of the list (the "car" in Lisp)
- Returns:
- element at the head
cdr
public List cdr()
- returns a pointer to the rest of the list (the "cdr" in Lisp)
- Returns:
- List object representing the tail
setCar
public void setCar(Object data)
- sets the "car" of the list
- Parameters:
- data - element to set as car
setCdr
public List setCdr(List cdr)
- sets the "cdr" of the list
- Parameters:
- cdr - List object to be set as cdr
All Packages Class Hierarchy This Package Previous Next Index