Jatha Software

org.jatha.dynatype
Class StandardLispConsOrNil

java.lang.Object
  extended by org.jatha.dynatype.StandardLispValue
      extended by org.jatha.dynatype.StandardLispConsOrNil
All Implemented Interfaces:
Comparable, LispConsOrNil, LispValue
Direct Known Subclasses:
StandardLispCons, StandardLispNIL

public abstract class StandardLispConsOrNil
extends StandardLispValue
implements LispConsOrNil

An abstract class for the CONS and NIL data types.

See Also:
LispValue, LispInteger, LispReal

Field Summary
 
Fields inherited from class org.jatha.dynatype.StandardLispValue
f_lisp
 
Constructor Summary
StandardLispConsOrNil()
           
StandardLispConsOrNil(Jatha lisp)
           
 
Method Summary
 boolean basic_consp()
          Returns Java true if the object is a CONS cell.
 boolean basic_listp()
          Returns Java true if the object is a CONS cell or NIL.
 LispValue butlast()
          Returns all but the last of the elements of a list.
 LispValue elt(LispValue index)
          Returns the nth element of a list.
 Iterator iterator()
          Returns an iterator over the clauses of the path.
 LispValue length()
          Returns the length of a list or string.
 LispValue listp()
          Returns T if the object is a list.
 LispValue nconc(LispValue arg)
          If this object is NIL, returns the argument.
 LispValue nreverse()
          Destructively reverses the given list.
 LispValue pop()
          Pops a list and returns the first element.
 LispValue position(LispValue element)
          Returns the index of an element in a sequence.
 LispValue reverse()
          Returns the reversed value of a list.
 
Methods inherited from class org.jatha.dynatype.StandardLispValue
abs, acos, add, adjustSpecialCount, append, apply, apropos_print, asin, assoc, atan, atan2, atom, basic_atom, basic_bignump, basic_constantp, basic_floatp, basic_foreignp, basic_functionp, basic_integerp, basic_keywordp, basic_length, basic_macrop, basic_null, basic_numberp, basic_stringp, basic_symbolp, bignump, boundp, car, cdr, ceiling, characterp, clrhash, compareTo, concatenate, consp, constantp, contains, copy_list, copy, cos, cot, csc, degreesToRadians, divide, documentation, eighth, elt, eq, eql, equal, equalNumeric, factorial, fboundp, fifth, first, floatp, floor, fourth, funcall, functionp, get_specialCount, gethash, gethash, getLisp, greaterThan, greaterThanOrEqual, hash_table_count, hash_table_rehash_size, hash_table_rehash_threshold, hash_table_size, hash_table_test, hashtablep, integerp, internal_getName, internal_prin1_as_cdr, internal_prin1, internal_princ_as_cdr, internal_princ, internal_print_as_cdr, internal_print, keywordp, last, lessThan, lessThanOrEqual, lisp_null, list, max, member, min, multiply, negate, neql, ninth, nstringCapitalize, nstringDowncase, nstringUpcase, numberp, prin1, princ, print, push, radiansToDegrees, rassoc, readFromString, reciprocal, remhash, remove, rest, rplaca, rplacd, sec, second, set_special, setf_documentation, setf_gethash, setf_symbol_function, setf_symbol_plist, setf_symbol_value, setLisp, setPackage, setq, seventh, showStackTrace, sin, sixth, specialP, sqrt, string, stringCapitalize, stringDowncase, stringEndsWith, stringEq, stringEqual, stringGreaterP, stringGreaterThan, stringGreaterThanOrEqual, stringLeftTrim, stringLeftTrim, stringLessP, stringLessThan, stringLessThanOrEqual, stringNeq, stringNotGreaterP, stringNotLessP, stringp, stringRightTrim, stringRightTrim, stringStartsWith, stringTrim, stringTrim, stringUpcase, subst, substring, substring, subtract, symbol_function, symbol_name, symbol_package, symbol_plist, symbol_value, symbolp, tan, tenth, third, toCollection, toJava, toJava, toString, toString, toStringAsCdr_internal, toStringAsCdr, toStringShort, toStringShort, toStringSimple, type_of, typep, uses, zerop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jatha.dynatype.LispValue
abs, acos, add, adjustSpecialCount, append, apply, apropos_print, asin, assoc, atan, atan2, atom, basic_atom, basic_bignump, basic_constantp, basic_floatp, basic_foreignp, basic_functionp, basic_integerp, basic_keywordp, basic_length, basic_macrop, basic_null, basic_numberp, basic_stringp, basic_symbolp, bignump, boundp, car, cdr, ceiling, characterp, clrhash, compareTo, concatenate, consp, constantp, contains, copy_list, copy, cos, cot, csc, degreesToRadians, divide, documentation, eighth, elt, eq, eql, equal, equalNumeric, factorial, fboundp, fifth, first, floatp, floor, fourth, funcall, functionp, get_specialCount, gethash, gethash, getLisp, greaterThan, greaterThanOrEqual, hash_table_count, hash_table_rehash_size, hash_table_rehash_threshold, hash_table_size, hash_table_test, hashtablep, integerp, internal_getName, internal_prin1_as_cdr, internal_prin1, internal_princ_as_cdr, internal_princ, internal_print_as_cdr, internal_print, keywordp, last, lessThan, lessThanOrEqual, lisp_null, list, max, member, min, multiply, negate, neql, ninth, nstringCapitalize, nstringDowncase, nstringUpcase, numberp, prin1, princ, print, push, radiansToDegrees, rassoc, readFromString, reciprocal, remhash, remove, rest, rplaca, rplacd, sec, second, set_special, setf_documentation, setf_gethash, setf_symbol_function, setf_symbol_plist, setf_symbol_value, setLisp, setPackage, setq, seventh, sin, sixth, specialP, sqrt, string, stringCapitalize, stringDowncase, stringEndsWith, stringEq, stringEqual, stringGreaterP, stringGreaterThan, stringGreaterThanOrEqual, stringLeftTrim, stringLeftTrim, stringLessP, stringLessThan, stringLessThanOrEqual, stringNeq, stringNotGreaterP, stringNotLessP, stringp, stringRightTrim, stringRightTrim, stringStartsWith, stringTrim, stringTrim, stringUpcase, subst, substring, substring, subtract, symbol_function, symbol_name, symbol_package, symbol_plist, symbol_value, symbolp, tan, tenth, third, toCollection, toJava, toJava, toString, toString, toStringAsCdr_internal, toStringAsCdr, toStringShort, toStringShort, toStringSimple, type_of, typep, uses, zerop
 

Constructor Detail

StandardLispConsOrNil

public StandardLispConsOrNil()

StandardLispConsOrNil

public StandardLispConsOrNil(Jatha lisp)
Method Detail

basic_consp

public boolean basic_consp()
Description copied from interface: LispValue
Returns Java true if the object is a CONS cell.

Specified by:
basic_consp in interface LispValue
Overrides:
basic_consp in class StandardLispValue

basic_listp

public boolean basic_listp()
Description copied from interface: LispValue
Returns Java true if the object is a CONS cell or NIL.

Specified by:
basic_listp in interface LispValue
Overrides:
basic_listp in class StandardLispValue

butlast

public LispValue butlast()
Description copied from interface: LispValue
Returns all but the last of the elements of a list. Butlast is the mirror image of CDR.

Specified by:
butlast in interface LispValue
Overrides:
butlast in class StandardLispValue

elt

public LispValue elt(LispValue index)
Description copied from interface: LispValue
Returns the nth element of a list. The zeroth element is the first element.

Specified by:
elt in interface LispValue
Overrides:
elt in class StandardLispValue

length

public LispValue length()
Description copied from interface: LispValue
Returns the length of a list or string.

Specified by:
length in interface LispValue
Overrides:
length in class StandardLispValue

listp

public LispValue listp()
Description copied from interface: LispValue
Returns T if the object is a list. True if it is a CONS cell or NIL.

Specified by:
listp in interface LispValue
Overrides:
listp in class StandardLispValue

nconc

public LispValue nconc(LispValue arg)
If this object is NIL, returns the argument. Otherwise, destructively appends the argument to this one.

Specified by:
nconc in interface LispValue
Overrides:
nconc in class StandardLispValue

nreverse

public LispValue nreverse()
Description copied from interface: LispValue
Destructively reverses the given list. May or may not return the same pointer.

Specified by:
nreverse in interface LispValue
Overrides:
nreverse in class StandardLispValue

pop

public LispValue pop()
Description copied from class: StandardLispValue
Pops a list and returns the first element. NOTE: Because Java's variable values aren't accessible to Jatha, the following doesn't work as expected:
   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);
 

Specified by:
pop in interface LispValue
Overrides:
pop in class StandardLispValue
Returns:
the first element of the list

position

public LispValue position(LispValue element)
Returns the index of an element in a sequence. Currently works for lists and strings. Comparison is by EQL for lists and CHAR= for lists. Returns NIL if the element is not found in the sequence.

Specified by:
position in interface LispValue
Overrides:
position in class StandardLispValue

reverse

public LispValue reverse()
Description copied from interface: LispValue
Returns the reversed value of a list.

Specified by:
reverse in interface LispValue
Overrides:
reverse in class StandardLispValue

iterator

public Iterator iterator()
Returns an iterator over the clauses of the path. Each element type is a Clause.

Specified by:
iterator in interface LispValue
Overrides:
iterator in class StandardLispValue

Jatha Software