|
Jatha Software | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jatha.dynatype.StandardLispValue
org.jatha.dynatype.StandardLispConsOrNil
org.jatha.dynatype.StandardLispCons
public class StandardLispCons
| Field Summary | |
|---|---|
protected LispValue |
carCell
|
protected LispValue |
cdrCell
|
static boolean |
DEBUG
|
static long |
serialVersionUID
|
| Fields inherited from class org.jatha.dynatype.StandardLispValue |
|---|
f_lisp |
| Constructor Summary | |
|---|---|
StandardLispCons()
|
|
StandardLispCons(Jatha lisp)
|
|
StandardLispCons(Jatha lisp,
LispValue theCar,
LispValue theCdr)
|
|
| Method Summary | |
|---|---|
LispValue |
append(LispValue otherList)
Append two lists together. |
LispValue |
assoc(LispValue index)
Look up a value in an association list. |
boolean |
basic_consp()
Returns Java true if the object is a CONS cell. |
boolean |
basic_constantp()
Returns Java true if the object is a constant. |
int |
basic_length()
Returns the Java length of a list or string. |
LispValue |
car()
Returns the first element of a list. |
LispValue |
cdr()
Returns all but the first element of a list. |
LispValue |
consp()
Returns T if the object is a CONS cell. |
boolean |
contains(LispValue object)
Wrapper for member(). |
LispValue |
copy_list()
Returns a copy of the top level of a list. |
LispValue |
copy()
Returns a full copy of any list, tree, array or table, copying all the leaf elements. |
LispValue |
eighth()
Returns the 8th element of a list. |
LispValue |
equal(LispValue value)
Returns T if the argument is EQL or if two strings are STRING= or if two trees have EQUAL subtrees. |
LispValue |
fifth()
Returns the fifth element of a list, or NIL if the list is shorter than 5 elements. |
LispValue |
first()
Returns the first element of a list. |
LispValue |
fourth()
Returns the 4th element of a list, or NIL if the list is shorter than 4 elements. |
void |
internal_prin1_as_cdr(PrintStream os)
|
void |
internal_prin1(PrintStream os)
|
void |
internal_princ_as_cdr(PrintStream os)
|
void |
internal_princ(PrintStream os)
|
void |
internal_print_as_cdr(PrintStream os)
|
void |
internal_print(PrintStream os)
|
LispValue |
last()
Returns the last cons cell in a list. |
LispValue |
length()
Returns a LispInteger containing the length of the list. |
LispValue |
member(LispValue elt)
Returns the tail of the list starting at the given element. |
LispValue |
ninth()
Returns the ninth element of a list, or NIL if the list is shorter than nine elements. |
LispValue |
pop()
Pops a list and returns the first element. |
LispValue |
push(LispValue value)
Pushes an element onto a list and returns the list. |
LispValue |
rassoc(LispValue index)
Like ASSOC except it matches the CDR of the cell instead of the CAR. |
LispValue |
remove(LispValue elt)
Returns a copy of a list without all copies of the given element. |
LispValue |
rest()
Synonym for CDR. |
LispValue |
rplaca(LispValue newCar)
Replaces the CAR of a CONS cell. |
LispValue |
rplacd(LispValue newCdr)
Replaces the CDR of a CONS cell. |
LispValue |
second()
Returns the second element of a list or NIL if the list is shorter than two elements. |
LispValue |
seventh()
Returns the seventh element of a list or NIL if the list is shorter than seven elements. |
LispValue |
sixth()
Returns the sixth element of a list or NIL if the list is shorter than six elements. |
LispValue |
subst(LispValue newValue,
LispValue oldValue)
Replaces all oldValues in a tree with newValue. |
LispValue |
tenth()
Returns the tenth element of a list or NIL if the list is less than ten elements long. |
LispValue |
third()
Returns the third element of a list or NIL if the list is less than three elements long. |
Collection |
toCollection()
Returns the Lisp value as a Collection. |
String |
toString()
toString() returns a printed representation
of the form (as printed by (prin1)) in
a Java string. |
String |
toStringAsCdr_internal(long index)
Counts cdrs so as not to have runaway lists. |
String |
toStringAsCdr()
|
LispValue |
type_of()
|
LispValue |
typep(LispValue type)
|
| Methods inherited from class org.jatha.dynatype.StandardLispConsOrNil |
|---|
basic_listp, butlast, elt, iterator, listp, nconc, nreverse, position, reverse |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final long serialVersionUID
public static boolean DEBUG
protected LispValue carCell
protected LispValue cdrCell
| Constructor Detail |
|---|
public StandardLispCons()
public StandardLispCons(Jatha lisp,
LispValue theCar,
LispValue theCdr)
public StandardLispCons(Jatha lisp)
| Method Detail |
|---|
public void internal_princ(PrintStream os)
internal_princ in interface LispValueinternal_princ in class StandardLispValuepublic void internal_princ_as_cdr(PrintStream os)
internal_princ_as_cdr in interface LispValueinternal_princ_as_cdr in class StandardLispValuepublic void internal_prin1(PrintStream os)
internal_prin1 in interface LispValueinternal_prin1 in class StandardLispValuepublic void internal_prin1_as_cdr(PrintStream os)
internal_prin1_as_cdr in interface LispValueinternal_prin1_as_cdr in class StandardLispValuepublic void internal_print(PrintStream os)
internal_print in interface LispValueinternal_print in class StandardLispValuepublic void internal_print_as_cdr(PrintStream os)
internal_print_as_cdr in interface LispValueinternal_print_as_cdr in class StandardLispValuepublic boolean basic_consp()
LispValue
basic_consp in interface LispValuebasic_consp in class StandardLispConsOrNilpublic boolean basic_constantp()
LispValue
basic_constantp in interface LispValuebasic_constantp in class StandardLispValuepublic int basic_length()
LispValue
basic_length in interface LispValuebasic_length in class StandardLispValuepublic String toString()
toString() returns a printed representation
of the form (as printed by (prin1)) in
a Java string.
toString in interface LispValuetoString in class StandardLispValuepublic String toStringAsCdr_internal(long index)
toStringAsCdr_internal in interface LispValuetoStringAsCdr_internal in class StandardLispValuepublic String toStringAsCdr()
toStringAsCdr in interface LispValuetoStringAsCdr in class StandardLispValuepublic boolean contains(LispValue object)
contains in interface LispValuecontains in class StandardLispValuepublic Collection toCollection()
toCollection in interface LispValuetoCollection in class StandardLispValuepublic LispValue append(LispValue otherList)
LispValue
append in interface LispValueappend in class StandardLispValuepublic LispValue assoc(LispValue index)
LispValue
assoc in interface LispValueassoc in class StandardLispValuepublic LispValue car()
LispValue
car in interface LispValuecar in class StandardLispValuepublic LispValue cdr()
LispValue
cdr in interface LispValuecdr in class StandardLispValuepublic LispValue consp()
LispValue
consp in interface LispValueconsp in class StandardLispValuepublic LispValue copy_list()
LispValue
copy_list in interface LispValuecopy_list in class StandardLispValuepublic LispValue copy()
copy in interface LispValuecopy in class StandardLispValuepublic LispValue equal(LispValue value)
LispValue
equal in interface LispValueequal in class StandardLispValuepublic LispValue first()
LispValue
first in interface LispValuefirst in class StandardLispValuepublic LispValue second()
LispValue
second in interface LispValuesecond in class StandardLispValuepublic LispValue third()
LispValue
third in interface LispValuethird in class StandardLispValuepublic LispValue fourth()
LispValue
fourth in interface LispValuefourth in class StandardLispValuepublic LispValue fifth()
LispValue
fifth in interface LispValuefifth in class StandardLispValuepublic LispValue sixth()
LispValue
sixth in interface LispValuesixth in class StandardLispValuepublic LispValue seventh()
LispValue
seventh in interface LispValueseventh in class StandardLispValuepublic LispValue eighth()
LispValue
eighth in interface LispValueeighth in class StandardLispValuepublic LispValue ninth()
LispValue
ninth in interface LispValueninth in class StandardLispValuepublic LispValue tenth()
LispValue
tenth in interface LispValuetenth in class StandardLispValuepublic LispValue last()
LispValue
last in interface LispValuelast in class StandardLispValuepublic LispValue length()
length in interface LispValuelength in class StandardLispConsOrNilpublic LispValue member(LispValue elt)
LispValue
member in interface LispValuemember in class StandardLispValuepublic LispValue pop()
StandardLispValueLispValue l1 = lisp.makeList(A, B); l1.pop(); // works correctly, l1 is now (B) l1.pop(); // doesn't work correctly. l1 is now (NIL . NIL)Jatha can't reassign l1 as expected.
However, the following does work:
LispValue l1 = new LispSymbol(lisp, "L1"); l1.setq(lisp.makeList(A, B)); l1.pop(); // works correctly. The value of L1 is now (B). l1.pop(); // works correctly. The value of L1 is now NIL. l1.push(A); // works correctly. The value of L1 is now (A). assert(l1.symbol_value().equal(lisp.makeList(A)) == lisp.T);
pop in interface LispValuepop in class StandardLispConsOrNilpublic LispValue push(LispValue value)
StandardLispValueLispValue l1 = LispValue.NIL; l1.push(A); // doesn't work correctly. l1 is still NIL. l1 = l1.push(A); // works correctly.Jatha can't reassign l1 as expected.
However, the following does work:
LispValue l1 = new LispSymbol("L1");
l1.setq(LispValue.NIL);
l1.push(B); // works correctly. The value of L1 is now (B).
l1.push(A); // works correctly. The value of L1 is now (A B).
assert(l1.symbol_value().equal(LispValueFactory.makeList(A, B)) == LispValue.T);
push in interface LispValuepush in class StandardLispValuepublic LispValue rassoc(LispValue index)
LispValue
rassoc in interface LispValuerassoc in class StandardLispValuepublic LispValue rest()
StandardLispValue
rest in interface LispValuerest in class StandardLispValuepublic LispValue remove(LispValue elt)
LispValue
remove in interface LispValueremove in class StandardLispValuepublic LispValue rplaca(LispValue newCar)
LispValue
rplaca in interface LispValuerplaca in class StandardLispValuepublic LispValue rplacd(LispValue newCdr)
LispValue
rplacd in interface LispValuerplacd in class StandardLispValue
public LispValue subst(LispValue newValue,
LispValue oldValue)
LispValue
subst in interface LispValuesubst in class StandardLispValuepublic LispValue type_of()
type_of in interface LispValuetype_of in class StandardLispValuepublic LispValue typep(LispValue type)
typep in interface LispValuetypep in class StandardLispValue
|
Jatha Software | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||