|
Jatha Software | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 LispValue
internal_princ
in class StandardLispValue
public void internal_princ_as_cdr(PrintStream os)
internal_princ_as_cdr
in interface LispValue
internal_princ_as_cdr
in class StandardLispValue
public void internal_prin1(PrintStream os)
internal_prin1
in interface LispValue
internal_prin1
in class StandardLispValue
public void internal_prin1_as_cdr(PrintStream os)
internal_prin1_as_cdr
in interface LispValue
internal_prin1_as_cdr
in class StandardLispValue
public void internal_print(PrintStream os)
internal_print
in interface LispValue
internal_print
in class StandardLispValue
public void internal_print_as_cdr(PrintStream os)
internal_print_as_cdr
in interface LispValue
internal_print_as_cdr
in class StandardLispValue
public boolean basic_consp()
LispValue
basic_consp
in interface LispValue
basic_consp
in class StandardLispConsOrNil
public boolean basic_constantp()
LispValue
basic_constantp
in interface LispValue
basic_constantp
in class StandardLispValue
public int basic_length()
LispValue
basic_length
in interface LispValue
basic_length
in class StandardLispValue
public String toString()
toString()
returns a printed representation
of the form (as printed by (prin1)
) in
a Java string.
toString
in interface LispValue
toString
in class StandardLispValue
public String toStringAsCdr_internal(long index)
toStringAsCdr_internal
in interface LispValue
toStringAsCdr_internal
in class StandardLispValue
public String toStringAsCdr()
toStringAsCdr
in interface LispValue
toStringAsCdr
in class StandardLispValue
public boolean contains(LispValue object)
contains
in interface LispValue
contains
in class StandardLispValue
public Collection toCollection()
toCollection
in interface LispValue
toCollection
in class StandardLispValue
public LispValue append(LispValue otherList)
LispValue
append
in interface LispValue
append
in class StandardLispValue
public LispValue assoc(LispValue index)
LispValue
assoc
in interface LispValue
assoc
in class StandardLispValue
public LispValue car()
LispValue
car
in interface LispValue
car
in class StandardLispValue
public LispValue cdr()
LispValue
cdr
in interface LispValue
cdr
in class StandardLispValue
public LispValue consp()
LispValue
consp
in interface LispValue
consp
in class StandardLispValue
public LispValue copy_list()
LispValue
copy_list
in interface LispValue
copy_list
in class StandardLispValue
public LispValue copy()
copy
in interface LispValue
copy
in class StandardLispValue
public LispValue equal(LispValue value)
LispValue
equal
in interface LispValue
equal
in class StandardLispValue
public LispValue first()
LispValue
first
in interface LispValue
first
in class StandardLispValue
public LispValue second()
LispValue
second
in interface LispValue
second
in class StandardLispValue
public LispValue third()
LispValue
third
in interface LispValue
third
in class StandardLispValue
public LispValue fourth()
LispValue
fourth
in interface LispValue
fourth
in class StandardLispValue
public LispValue fifth()
LispValue
fifth
in interface LispValue
fifth
in class StandardLispValue
public LispValue sixth()
LispValue
sixth
in interface LispValue
sixth
in class StandardLispValue
public LispValue seventh()
LispValue
seventh
in interface LispValue
seventh
in class StandardLispValue
public LispValue eighth()
LispValue
eighth
in interface LispValue
eighth
in class StandardLispValue
public LispValue ninth()
LispValue
ninth
in interface LispValue
ninth
in class StandardLispValue
public LispValue tenth()
LispValue
tenth
in interface LispValue
tenth
in class StandardLispValue
public LispValue last()
LispValue
last
in interface LispValue
last
in class StandardLispValue
public LispValue length()
length
in interface LispValue
length
in class StandardLispConsOrNil
public LispValue member(LispValue elt)
LispValue
member
in interface LispValue
member
in class StandardLispValue
public LispValue pop()
StandardLispValue
LispValue 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 LispValue
pop
in class StandardLispConsOrNil
public LispValue push(LispValue value)
StandardLispValue
LispValue 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 LispValue
push
in class StandardLispValue
public LispValue rassoc(LispValue index)
LispValue
rassoc
in interface LispValue
rassoc
in class StandardLispValue
public LispValue rest()
StandardLispValue
rest
in interface LispValue
rest
in class StandardLispValue
public LispValue remove(LispValue elt)
LispValue
remove
in interface LispValue
remove
in class StandardLispValue
public LispValue rplaca(LispValue newCar)
LispValue
rplaca
in interface LispValue
rplaca
in class StandardLispValue
public LispValue rplacd(LispValue newCdr)
LispValue
rplacd
in interface LispValue
rplacd
in class StandardLispValue
public LispValue subst(LispValue newValue, LispValue oldValue)
LispValue
subst
in interface LispValue
subst
in class StandardLispValue
public LispValue type_of()
type_of
in interface LispValue
type_of
in class StandardLispValue
public LispValue typep(LispValue type)
typep
in interface LispValue
typep
in class StandardLispValue
|
Jatha Software | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |