|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
A Java interface that parallels lists as defined by John McCarthy in LISP, a list is either empty or it is an ordered pair (head, Tail) where "head" is the object in the list and "Tail" is a, possibly empty, list (sublist).
A RecursiveList is
|
| Method Summary | |
java.lang.Object |
headOf()
Returns reference to the Object at the head of the list. |
void |
insert(RecursiveList L)
Replaces the current list with a new list composed by concatenating the current list to the list in the parameter, this = L+this. |
boolean |
isEmpty()
Returns true if the current list is empty. |
RecursiveList |
remove()
If this = (h, T), remove the current list and replace it by its tail, this' = T, return (h, ()). |
RecursiveList |
tailOf()
Returns reference to the tail of the current list. |
java.lang.String |
toString()
Returns a string representation of the list. |
| Method Detail |
public boolean isEmpty()
| Returns this==()? |
public java.lang.Object headOf()
|
this!=()
this' = this = (h,T) Returns h |
assertion - error when this == ().public RecursiveList tailOf()
|
this!=()
this' = this = (h,T) |
Assertion - When this==().public void insert(RecursiveList L)
| this'= L + this |
L - List that will be prepended to this. public RecursiveList remove()
|
this!=()
this=(h,T) this'=T Return (h, ()) |
Assertion - when this==().public java.lang.String toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||