Jatha Software

org.jatha.dynatype
Class StandardLispValue

java.lang.Object
  extended by org.jatha.dynatype.StandardLispValue
All Implemented Interfaces:
Comparable, LispValue
Direct Known Subclasses:
LispConsIterator, LispPrimitive, StandardLispAtom, StandardLispConsOrNil, StandardLispForeignObject, StandardLispFunction, StandardLispHashTable, StandardLispPackage

public abstract class StandardLispValue
extends Object
implements LispValue, Comparable

LispValue is the root of all of the dynamically-typed LISP-like structures. It contains definitions of all methods that operate on Lisp values. This class is not instantiated directly. Instead, use a LispValueFactory instance to create the instances.

See Also:
LispValueFactory

Field Summary
protected  Jatha f_lisp
           
 
Constructor Summary
StandardLispValue()
           
StandardLispValue(Jatha lisp)
           
 
Method Summary
 LispValue abs()
          Returns the absolute value of any number, including complex.
 LispValue acos()
          Arccos function, argument in radians.
 LispValue add(LispValue args)
          Returns the sum of the object and the object(s) in the argument list.
 void adjustSpecialCount(int amount)
           
 LispValue append(LispValue otherList)
          Append two lists together.
 LispValue apply(LispValue args)
          Apply a function to an argument list.
 void apropos_print(PrintWriter out)
          Prints information for the APROPOS function
 LispValue asin()
          Arcsin function, argument in radians.
 LispValue assoc(LispValue index)
          Look up a value in an association list.
 LispValue atan()
          Arctan function, argument in radians.
 LispValue atan2(LispValue x)
          Arctan function, argument in radians.
 LispValue atom()
          Returns T if the object is an atom.
 boolean basic_atom()
          Returns Java true if the object is an atom.
 boolean basic_bignump()
          Returns Java true if the object is a Bignum.
 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.
 boolean basic_floatp()
          Returns Java true if the object is a floating-point number.
 boolean basic_foreignp()
          Returns Java true if the object is a reference to an object in a foreign computer language.
 boolean basic_functionp()
          Returns Java true if the object is a function.
 boolean basic_integerp()
          Returns Java true if the object is an integer.
 boolean basic_keywordp()
          Returns Java true if the object is a keyword.
 int basic_length()
          Returns the Java length of a list or string.
 boolean basic_listp()
          Returns Java true if the object is a CONS cell or NIL.
 boolean basic_macrop()
          Returns Java true if the object is a macro.
 boolean basic_null()
          Returns Java true if the object is NIL.
 boolean basic_numberp()
          Returns Java true if the object is a number.
 boolean basic_stringp()
          Returns Java true if the object is a string.
 boolean basic_symbolp()
          Returns Java true if the object is a symbol.
 LispValue bignump()
          Returns T if the object is a Bignum.
 LispValue boundp()
          Returns T if the symbol has been assigned a value.
 LispValue butlast()
          Returns all but the last of the elements of a list.
 LispValue car()
          Returns the first element of a list.
 LispValue cdr()
          Returns all but the first element of a list.
 LispValue ceiling()
          Returns the smallest integer greater than or equal to the input number.
 LispValue characterp()
          Returns T if the object is a Character.
 LispValue clrhash()
          Clears a hash table.
 int compareTo(Object o)
           
 LispValue concatenate(LispValue values)
          Concatenate a string or symbol to other strings or symbols.
 LispValue consp()
          Returns T if the object is a CONS cell.
 LispValue constantp()
          Returns T if the object is a constant.
 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 cos()
          Cosine function, argument in radians.
 LispValue cot()
          Cotangent function, 1/tan(x), argument in radians.
 LispValue csc()
          Cosecant function, 1/sin(x), argument in radians.
 LispValue degreesToRadians()
          Converts a numeric value from degrees to radians.
 LispValue divide(LispValue args)
          Returns the quotient of the object and the object(s) in the argument list.
 LispValue documentation(LispValue type)
          Returns the documentation string for this symbol, of the type specified.
 LispValue eighth()
          Returns the 8th element of a list.
 LispValue elt(int index)
           
 LispValue elt(LispValue index)
          Returns the nth element of a list.
 LispValue eq(LispValue val)
          Returns T if the argument is exactly identical to the object.
 LispValue eql(LispValue val)
          Returns T if the argument is EQ to the object or if the arguments and object are numbers with equal values.
 LispValue equal(LispValue val)
          Returns T if the argument is EQL or if two strings are STRING= or if two trees have EQUAL subtrees.
 LispValue equalNumeric(LispValue arg)
          Returns T if the object is EQUAL to its argument.
 LispValue factorial()
          Compute the factorial of a non-negative integer.
 LispValue fboundp()
          Returns T if the symbol has an assigned function.
 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 floatp()
          Returns T if the object is a floating-point number.
 LispValue floor()
          Returns the largest integer less than or equal to the input number.
 LispValue fourth()
          Returns the 4th element of a list, or NIL if the list is shorter than 4 elements.
 LispValue funcall(LispValue args)
          Calls a functio non a list of arguments.
 LispValue functionp()
           
 int get_specialCount()
           
 LispValue gethash(LispValue key)
          Retrieves values from a hash table.
 LispValue gethash(LispValue key, LispValue defawlt)
          Retrieves values from a hash table, returning a default value if the key is not in the table.
 Jatha getLisp()
           
 LispValue greaterThan(LispValue arg)
          Returns T if the object prepended to the argument list is in strictly decreasing order.
 LispValue greaterThanOrEqual(LispValue arg)
          Returns T if the object prepended to the argument list is in non-increasing order.
 LispValue hash_table_count()
          Returns the number of items in the hash table.
 LispValue hash_table_rehash_size()
          Returns a floating-point number that indicates how large the hash table will be after rehashing, as a percentage of the current size.
 LispValue hash_table_rehash_threshold()
          Returns a floating-point number that indicates how full the table gets before it will expand and rehash its contents.
 LispValue hash_table_size()
          Returns the total size of the hash table, including empty slots.
 LispValue hash_table_test()
          Returns the function used when comparing keys in the hash table.
 LispValue hashtablep()
          Returns T if the object is a floating-point number.
 LispValue integerp()
          Returns T if the object is an Integer.
 String internal_getName()
           
 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)
           
 Iterator iterator()
           
 LispValue keywordp()
          Returns T if the object is a keyword.
 LispValue last()
          Returns the last cons cell in a list.
 LispValue length()
          Returns the length of a list or string.
 LispValue lessThan(LispValue arg)
          Returns T if the object prepended to the argument list is in strictly increasing order.
 LispValue lessThanOrEqual(LispValue arg)
          Returns T if the object prepended to the argument list is in strictly non-decreasing order.
 LispValue lisp_null()
          Returns T if the object is NIL.
 LispValue list()
          Creates a list from the object.
 LispValue listp()
          Returns T if the object is a list.
 LispValue max(LispValue args)
          Returns the maximum element of a list of numbers.
 LispValue member(LispValue elt)
          Returns the tail of the list starting at the given element.
 LispValue min(LispValue args)
          Returns the minimum element of a list of numbers.
 LispValue multiply(LispValue args)
          Returns the product of the object and the object(s) in the argument list.
 LispValue nconc(LispValue arg)
          Destructively appends a list to the end of the given list.
 LispValue negate()
          Return the negative of a number.
 LispValue neql(LispValue val)
          Returns NIL if eql returns T, and vice versa.
 LispValue ninth()
          Returns the ninth element of a list, or NIL if the list is shorter than nine elements.
 LispValue nreverse()
          Destructively reverses the given list.
 LispValue nstringCapitalize()
          For Common LISP compatibility, but identical to stringCapitalize.
 LispValue nstringDowncase()
          For Common LISP compatibility, but identical to stringDowncase.
 LispValue nstringUpcase()
          For Common LISP compatibility, but identical to stringUpcase.
 LispValue numberp()
          Returns T if the object is any kind of number.
 LispValue pop()
          Pops a list and returns the first element.
 LispValue position(LispValue element)
          Returns the index of an element in a sequence.
 LispValue prin1()
          Prints the value to standard output with *print-escape* bound to T.
 LispValue princ()
          Prints the output so that it is readable to a person.
 LispValue print()
          Prints using prin1, except the output is preceded by a newline and terminated by a space.
 LispValue push(LispValue value)
          Pushes an element onto a list and returns the list.
 LispValue radiansToDegrees()
          Converts a numeric value from radians to degrees.
 LispValue rassoc(LispValue index)
          Like ASSOC except it matches the CDR of the cell instead of the CAR.
 LispValue readFromString()
          Reads a value from the given string.
 LispValue reciprocal()
          Computes 1/x of the given number.
 LispValue remhash(LispValue key)
          Removes an element from a hash table.
 LispValue remove(LispValue elt)
          Returns a copy of a list without all copies of the given element.
 LispValue rest()
          Synonym for CDR.
 LispValue reverse()
          Returns the reversed value of a list.
 LispValue rplaca(LispValue newCar)
          Replaces the CAR of a CONS cell.
 LispValue rplacd(LispValue newCdr)
          Replaces the CDR of a CONS cell.
 LispValue sec()
          Secant function, 1/cos(x), argument in radians.
 LispValue second()
          Returns the second element of a list or NIL if the list is shorter than two elements.
 void set_special(boolean value)
           
 LispValue setf_documentation(LispValue type, LispValue value)
          Sets the documentation string for this symbol of the type specified.
 LispValue setf_gethash(LispValue key, LispValue value)
          Sets a value in a hash table.
 LispValue setf_symbol_function(LispValue newFunction)
          Sets the function of a symbol.
 LispValue setf_symbol_plist(LispValue newPlist)
          Sets the property list of a symbol.
 LispValue setf_symbol_value(LispValue newValue)
          Sets the value of a symbol.
 void setLisp(Jatha lisp)
           
 void setPackage(LispPackage newPackage)
           
 LispValue setq(LispValue newValue)
          Assigns a value to a symbol.
 LispValue seventh()
          Returns the seventh element of a list or NIL if the list is shorter than seven elements.
 void showStackTrace()
           
 LispValue sin()
          Sine trigonometric function.
 LispValue sixth()
          Returns the sixth element of a list or NIL if the list is shorter than six elements.
 boolean specialP()
           
 LispValue sqrt()
          Square root.
 LispValue string()
          Converts a String, Symbol or Character to a string.
 LispValue stringCapitalize()
          Capitalizes the first character of a string and converts the remaining characters to lower case.
 LispValue stringDowncase()
          Converts all of the characters to lower case.
 LispValue stringEndsWith(LispValue arg)
          Not in Common LISP, but useful.
 LispValue stringEq(LispValue arg)
          Returns T if the argument is an identical string to the object.
 LispValue stringEqual(LispValue arg)
          Returns T if the argument is an identical string to the object.
 LispValue stringGreaterP(LispValue arg)
          This is the LISP string-greaterp function.
 LispValue stringGreaterThan(LispValue arg)
          This is the LISP string> function.
 LispValue stringGreaterThanOrEqual(LispValue arg)
          This is the LISP string>= function.
 LispValue stringLeftTrim()
          Trims the left end of the string by deleting whitespace on both ends.
 LispValue stringLeftTrim(LispValue deleteBag)
          Trims the left end of the string by deleting characters in the input string on both ends.
 LispValue stringLessP(LispValue arg)
          This is the LISP string-lessp function.
 LispValue stringLessThan(LispValue arg)
          This is the LISP string< function.
 LispValue stringLessThanOrEqual(LispValue arg)
          This is the LISP string<= function.
 LispValue stringNeq(LispValue arg)
          Returns T if the argument is not STRING= the given string.
 LispValue stringNotGreaterP(LispValue arg)
          This is the LISP string-not-greaterp function.
 LispValue stringNotLessP(LispValue arg)
          This is the LISP string-not-lessp function.
 LispValue stringp()
          Returns T if the object is a string.
 LispValue stringRightTrim()
          Trims the right end of the string by deleting whitespace on both ends.
 LispValue stringRightTrim(LispValue deleteBag)
          Trims the right end of the string by deleting characters in the input string on both ends.
 LispValue stringStartsWith(LispValue arg)
          Not in Common LISP, but useful.
 LispValue stringTrim()
          Trims the string by deleting whitespace on both ends.
 LispValue stringTrim(LispValue deleteBag)
          Trims the string by deleting characters in the input string on both ends.
 LispValue stringUpcase()
          Converts all the characters to upper case.
 LispValue subst(LispValue newValue, LispValue oldValue)
          Replaces all oldValues in a tree with newValue.
 LispValue substring(LispValue start)
          Returns the substring of a string starting with the nth element.
 LispValue substring(LispValue start, LispValue end)
          Returns the substring of a string starting with the start element and ending just before the end element.
 LispValue subtract(LispValue args)
          Returns the difference of the object and the object(s) in the argument list.
 LispValue symbol_function()
          Returns the function assigned to a symbol.
 LispValue symbol_name()
          Returns a string containing the name of a symbol.
 LispValue symbol_package()
          Returns the package of a symbol.
 LispValue symbol_plist()
          Returns the property list of a symbol.
 LispValue symbol_value()
          Returns the value of a symbol.
 LispValue symbolp()
          Returns T if the object is a symbol.
 LispValue tan()
          Tangent trigonometric function.
 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.
 Object toJava()
          Returns a Java equivalent of the object.
 Object toJava(String typeHint)
          Returns a Java equivalent of the object.
 String toString()
          toString() returns a printed representation of the form (as printed by (prin1)) in a Java string.
 String toString(String columnSeparator)
          Same as toString unless you are getting a String representation of an array.
 String toStringAsCdr_internal(long index)
          Counts cdrs so as not to have runaway lists.
 String toStringAsCdr()
           
 String toStringShort()
          Prints a short version of the item.
 String toStringShort(int numberOfElements)
          Prints out a short version of the value.
 String toStringSimple()
          Strips double-quotes from a LispString value.
 LispValue type_of()
           
 LispValue typep(LispValue type)
           
 boolean uses(LispValue pkg)
          Returns true if this package uses the given package
 LispValue zerop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

f_lisp

protected Jatha f_lisp
Constructor Detail

StandardLispValue

public StandardLispValue()

StandardLispValue

public StandardLispValue(Jatha lisp)
Method Detail

getLisp

public Jatha getLisp()
Specified by:
getLisp in interface LispValue

setLisp

public void setLisp(Jatha lisp)
Specified by:
setLisp in interface LispValue

internal_getName

public String internal_getName()
Specified by:
internal_getName in interface LispValue

internal_princ

public void internal_princ(PrintStream os)
Specified by:
internal_princ in interface LispValue

internal_princ_as_cdr

public void internal_princ_as_cdr(PrintStream os)
Specified by:
internal_princ_as_cdr in interface LispValue

internal_prin1

public void internal_prin1(PrintStream os)
Specified by:
internal_prin1 in interface LispValue

internal_prin1_as_cdr

public void internal_prin1_as_cdr(PrintStream os)
Specified by:
internal_prin1_as_cdr in interface LispValue

internal_print

public void internal_print(PrintStream os)
Specified by:
internal_print in interface LispValue

internal_print_as_cdr

public void internal_print_as_cdr(PrintStream os)
Specified by:
internal_print_as_cdr in interface LispValue

apropos_print

public void apropos_print(PrintWriter out)
Description copied from interface: LispValue
Prints information for the APROPOS function

Specified by:
apropos_print in interface LispValue

basic_atom

public boolean basic_atom()
Description copied from interface: LispValue
Returns Java true if the object is an atom.

Specified by:
basic_atom in interface LispValue

basic_bignump

public boolean basic_bignump()
Description copied from interface: LispValue
Returns Java true if the object is a Bignum.

Specified by:
basic_bignump in interface LispValue

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

basic_constantp

public boolean basic_constantp()
Description copied from interface: LispValue
Returns Java true if the object is a constant.

Specified by:
basic_constantp in interface LispValue

basic_floatp

public boolean basic_floatp()
Description copied from interface: LispValue
Returns Java true if the object is a floating-point number.

Specified by:
basic_floatp in interface LispValue

basic_foreignp

public boolean basic_foreignp()
Description copied from interface: LispValue
Returns Java true if the object is a reference to an object in a foreign computer language.

Specified by:
basic_foreignp in interface LispValue

basic_integerp

public boolean basic_integerp()
Description copied from interface: LispValue
Returns Java true if the object is an integer.

Specified by:
basic_integerp in interface LispValue

basic_functionp

public boolean basic_functionp()
Description copied from interface: LispValue
Returns Java true if the object is a function.

Specified by:
basic_functionp in interface LispValue

basic_keywordp

public boolean basic_keywordp()
Description copied from interface: LispValue
Returns Java true if the object is a keyword.

Specified by:
basic_keywordp in interface LispValue

basic_length

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

Specified by:
basic_length in interface LispValue

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

basic_macrop

public boolean basic_macrop()
Description copied from interface: LispValue
Returns Java true if the object is a macro.

Specified by:
basic_macrop in interface LispValue

basic_null

public boolean basic_null()
Description copied from interface: LispValue
Returns Java true if the object is NIL.

Specified by:
basic_null in interface LispValue

basic_numberp

public boolean basic_numberp()
Description copied from interface: LispValue
Returns Java true if the object is a number.

Specified by:
basic_numberp in interface LispValue

basic_stringp

public boolean basic_stringp()
Description copied from interface: LispValue
Returns Java true if the object is a string.

Specified by:
basic_stringp in interface LispValue

basic_symbolp

public boolean basic_symbolp()
Description copied from interface: LispValue
Returns Java true if the object is a symbol.

Specified by:
basic_symbolp in interface LispValue

uses

public boolean uses(LispValue pkg)
Description copied from interface: LispValue
Returns true if this package uses the given package

Specified by:
uses in interface LispValue

contains

public boolean contains(LispValue object)
Wrapper for member().

Specified by:
contains in interface LispValue
Returns:
true if the object is in the list.

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable
Specified by:
compareTo in interface LispValue

iterator

public Iterator iterator()
Specified by:
iterator in interface LispValue

toJava

public Object toJava()
Returns a Java equivalent of the object. For example, the number 3 is returned as an instance of new Integer(3). If it can't be converted to a more useful Java object, it returns a String representation.

Specified by:
toJava in interface LispValue

toJava

public Object toJava(String typeHint)
Returns a Java equivalent of the object. For example, the number 3 is returned as an instance of new Integer(3). If it can't be converted to a more useful Java object, it returns a String representation. You can optionally send in a hint as to what type is preferred.

Specified by:
toJava in interface LispValue

toCollection

public Collection toCollection()
Returns the Lisp value as a Collection. Most useful for lists, which are turned into Collections. But also works for single values.

Specified by:
toCollection in interface LispValue

toString

public String toString()
toString() returns a printed representation of the form (as printed by (prin1)) in a Java string.

Specified by:
toString in interface LispValue
Overrides:
toString in class Object
Returns:
String The value in a string.

toString

public String toString(String columnSeparator)
Same as toString unless you are getting a String representation of an array. Then it uses the columnSeparator variable to separate columns in the output.

Specified by:
toString in interface LispValue
Parameters:
columnSeparator - optional column separator string, defaults to a single space.
Returns:
a String containing a printed representation of the value.

toStringShort

public String toStringShort()
Prints a short version of the item. Can optionally send in the number of elements to print. Most useful for arrays or long lists.

Specified by:
toStringShort in interface LispValue

toStringShort

public String toStringShort(int numberOfElements)
Prints out a short version of the value. Defaults to 5 elements

Specified by:
toStringShort in interface LispValue
Parameters:
numberOfElements - the maximum number of elements to print.

toStringSimple

public String toStringSimple()
Strips double-quotes from a LispString value.

Specified by:
toStringSimple in interface LispValue

toStringAsCdr

public String toStringAsCdr()
Specified by:
toStringAsCdr in interface LispValue

toStringAsCdr_internal

public String toStringAsCdr_internal(long index)
Counts cdrs so as not to have runaway lists.

Specified by:
toStringAsCdr_internal in interface LispValue

set_special

public void set_special(boolean value)
Specified by:
set_special in interface LispValue

specialP

public boolean specialP()
Specified by:
specialP in interface LispValue

adjustSpecialCount

public void adjustSpecialCount(int amount)
Specified by:
adjustSpecialCount in interface LispValue

get_specialCount

public int get_specialCount()
Specified by:
get_specialCount in interface LispValue

setPackage

public void setPackage(LispPackage newPackage)
Specified by:
setPackage in interface LispValue

abs

public LispValue abs()
Returns the absolute value of any number, including complex. The result is always a real number.

Specified by:
abs in interface LispValue

acos

public LispValue acos()
Arccos function, argument in radians. Also called Inverse Cosine, this is the angle whose cosine is the argument.

Specified by:
acos in interface LispValue

asin

public LispValue asin()
Arcsin function, argument in radians. Also called Inverse Sine, this is the angle whose sine is the argument.

Specified by:
asin in interface LispValue

atan

public LispValue atan()
Arctan function, argument in radians. Also called Inverse Tangent, this is the angle whose tangent is the argument.

Specified by:
atan in interface LispValue

atan2

public LispValue atan2(LispValue x)
Arctan function, argument in radians. Also called Inverse Tangent, this is the angle whose tangent is y/x, where y is the first argument and x is the second argument.

Specified by:
atan2 in interface LispValue

append

public LispValue append(LispValue otherList)
Description copied from interface: LispValue
Append two lists together. The first list is copied.

Specified by:
append in interface LispValue

apply

public LispValue apply(LispValue args)
Description copied from interface: LispValue
Apply a function to an argument list.

Specified by:
apply in interface LispValue

assoc

public LispValue assoc(LispValue index)
Description copied from interface: LispValue
Look up a value in an association list.

Specified by:
assoc in interface LispValue

atom

public LispValue atom()
Description copied from interface: LispValue
Returns T if the object is an atom.

Specified by:
atom in interface LispValue

bignump

public LispValue bignump()
Description copied from interface: LispValue
Returns T if the object is a Bignum.

Specified by:
bignump in interface LispValue

boundp

public LispValue boundp()
Description copied from interface: LispValue
Returns T if the symbol has been assigned a value.

Specified by:
boundp in interface LispValue

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

car

public LispValue car()
Description copied from interface: LispValue
Returns the first element of a list. CAR of NIL is NIL.

Specified by:
car in interface LispValue

cdr

public LispValue cdr()
Description copied from interface: LispValue
Returns all but the first element of a list. CDR of NIL is NIL.

Specified by:
cdr in interface LispValue

ceiling

public LispValue ceiling()
Description copied from interface: LispValue
Returns the smallest integer greater than or equal to the input number.

Specified by:
ceiling in interface LispValue

characterp

public LispValue characterp()
Description copied from interface: LispValue
Returns T if the object is a Character.

Specified by:
characterp in interface LispValue

clrhash

public LispValue clrhash()
Description copied from interface: LispValue
Clears a hash table.

Specified by:
clrhash in interface LispValue

concatenate

public LispValue concatenate(LispValue values)
Concatenate a string or symbol to other strings or symbols. This does not have all the functionality of concatenate in Common LISP. Pass in a list of values, the first of which must be the symbol STRING. All values (except the first) are converted to strings and appended to the end of the string. This returns a new LispString.

Specified by:
concatenate in interface LispValue

consp

public LispValue consp()
Description copied from interface: LispValue
Returns T if the object is a CONS cell. This is equivalent to asking whether it has a CAR and a CDR and is not NIL.

Specified by:
consp in interface LispValue

constantp

public LispValue constantp()
Description copied from interface: LispValue
Returns T if the object is a constant.

Specified by:
constantp in interface LispValue

copy_list

public LispValue copy_list()
Description copied from interface: LispValue
Returns a copy of the top level of a list. Does not copy the interior branches.

Specified by:
copy_list in interface LispValue

copy

public LispValue copy()
Returns a full copy of any list, tree, array or table, copying all the leaf elements. Atoms like symbols, and numbers are not copied. In Java, a string is not mutable so strings are also not copied.

Specified by:
copy in interface LispValue

cos

public LispValue cos()
Cosine function, argument in radians.

Specified by:
cos in interface LispValue

cot

public LispValue cot()
Cotangent function, 1/tan(x), argument in radians.

Specified by:
cot in interface LispValue

csc

public LispValue csc()
Cosecant function, 1/sin(x), argument in radians.

Specified by:
csc in interface LispValue

degreesToRadians

public LispValue degreesToRadians()
Converts a numeric value from degrees to radians.

Specified by:
degreesToRadians in interface LispValue
Returns:
The value in radians.

eighth

public LispValue eighth()
Description copied from interface: LispValue
Returns the 8th element of a list. If the list is shorter than 8 elements, returns NIL.

Specified by:
eighth in interface LispValue

elt

public LispValue elt(int index)
Specified by:
elt in interface LispValue

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

eq

public LispValue eq(LispValue val)
Description copied from interface: LispValue
Returns T if the argument is exactly identical to the object. That is, it must be exactly the same memory reference.

Specified by:
eq in interface LispValue

eql

public LispValue eql(LispValue val)
Description copied from interface: LispValue
Returns T if the argument is EQ to the object or if the arguments and object are numbers with equal values.

Specified by:
eql in interface LispValue

equal

public LispValue equal(LispValue val)
Description copied from interface: LispValue
Returns T if the argument is EQL or if two strings are STRING= or if two trees have EQUAL subtrees.

Specified by:
equal in interface LispValue

factorial

public LispValue factorial()
Compute the factorial of a non-negative integer. Reals are truncated to the nearest integer.

Specified by:
factorial in interface LispValue

fboundp

public LispValue fboundp()
Description copied from interface: LispValue
Returns T if the symbol has an assigned function.

Specified by:
fboundp in interface LispValue

floatp

public LispValue floatp()
Description copied from interface: LispValue
Returns T if the object is a floating-point number.

Specified by:
floatp in interface LispValue

fifth

public LispValue fifth()
Description copied from interface: LispValue
Returns the fifth element of a list, or NIL if the list is shorter than 5 elements.

Specified by:
fifth in interface LispValue

first

public LispValue first()
Description copied from interface: LispValue
Returns the first element of a list. Identical to the CAR function.

Specified by:
first in interface LispValue

floor

public LispValue floor()
Description copied from interface: LispValue
Returns the largest integer less than or equal to the input number.

Specified by:
floor in interface LispValue

fourth

public LispValue fourth()
Description copied from interface: LispValue
Returns the 4th element of a list, or NIL if the list is shorter than 4 elements.

Specified by:
fourth in interface LispValue

funcall

public LispValue funcall(LispValue args)
Description copied from interface: LispValue
Calls a functio non a list of arguments.

Specified by:
funcall in interface LispValue

functionp

public LispValue functionp()
Specified by:
functionp in interface LispValue

gethash

public LispValue gethash(LispValue key)
Description copied from interface: LispValue
Retrieves values from a hash table.

Specified by:
gethash in interface LispValue

gethash

public LispValue gethash(LispValue key,
                         LispValue defawlt)
Description copied from interface: LispValue
Retrieves values from a hash table, returning a default value if the key is not in the table.

Specified by:
gethash in interface LispValue

setf_gethash

public LispValue setf_gethash(LispValue key,
                              LispValue value)
Description copied from interface: LispValue
Sets a value in a hash table.

Specified by:
setf_gethash in interface LispValue

hashtablep

public LispValue hashtablep()
Description copied from interface: LispValue
Returns T if the object is a floating-point number.

Specified by:
hashtablep in interface LispValue

hash_table_count

public LispValue hash_table_count()
Description copied from interface: LispValue
Returns the number of items in the hash table.

Specified by:
hash_table_count in interface LispValue

hash_table_size

public LispValue hash_table_size()
Description copied from interface: LispValue
Returns the total size of the hash table, including empty slots.

Specified by:
hash_table_size in interface LispValue

hash_table_rehash_size

public LispValue hash_table_rehash_size()
Description copied from interface: LispValue
Returns a floating-point number that indicates how large the hash table will be after rehashing, as a percentage of the current size.

Specified by:
hash_table_rehash_size in interface LispValue

hash_table_rehash_threshold

public LispValue hash_table_rehash_threshold()
Description copied from interface: LispValue
Returns a floating-point number that indicates how full the table gets before it will expand and rehash its contents.

Specified by:
hash_table_rehash_threshold in interface LispValue

hash_table_test

public LispValue hash_table_test()
Description copied from interface: LispValue
Returns the function used when comparing keys in the hash table. Default is EQL.

Specified by:
hash_table_test in interface LispValue

integerp

public LispValue integerp()
Description copied from interface: LispValue
Returns T if the object is an Integer.

Specified by:
integerp in interface LispValue

keywordp

public LispValue keywordp()
Description copied from interface: LispValue
Returns T if the object is a keyword.

Specified by:
keywordp in interface LispValue

last

public LispValue last()
Description copied from interface: LispValue
Returns the last cons cell in a list. LAST of NIL is NIL.

Specified by:
last in interface LispValue

length

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

Specified by:
length in interface LispValue

lisp_null

public LispValue lisp_null()
Description copied from interface: LispValue
Returns T if the object is NIL.

Specified by:
lisp_null in interface LispValue

list

public LispValue list()
Description copied from interface: LispValue
Creates a list from the object. Creates a CONS cell and assigns the original object to the CAR and NIL to the CDR.

Specified by:
list in interface LispValue

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

max

public LispValue max(LispValue args)
Description copied from interface: LispValue
Returns the maximum element of a list of numbers.

Specified by:
max in interface LispValue

min

public LispValue min(LispValue args)
Description copied from interface: LispValue
Returns the minimum element of a list of numbers.

Specified by:
min in interface LispValue

member

public LispValue member(LispValue elt)
Description copied from interface: LispValue
Returns the tail of the list starting at the given element. Uses EQL as the comparator.

Specified by:
member in interface LispValue

nconc

public LispValue nconc(LispValue arg)
Description copied from interface: LispValue
Destructively appends a list to the end of the given list.

Specified by:
nconc in interface LispValue

negate

public LispValue negate()
Description copied from interface: LispValue
Return the negative of a number.

Specified by:
negate in interface LispValue

neql

public LispValue neql(LispValue val)
Returns NIL if eql returns T, and vice versa.

Specified by:
neql in interface LispValue
Parameters:
val -

ninth

public LispValue ninth()
Description copied from interface: LispValue
Returns the ninth element of a list, or NIL if the list is shorter than nine elements.

Specified by:
ninth in interface LispValue

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

numberp

public LispValue numberp()
Description copied from interface: LispValue
Returns T if the object is any kind of number.

Specified by:
numberp in interface LispValue

pop

public LispValue pop()
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
Returns:
the first element of the list
Throws:
LispValueNotASymbolException

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

prin1

public LispValue prin1()
Description copied from interface: LispValue
Prints the value to standard output with *print-escape* bound to T. It will print escape characters in order to make the input readable by a computer.

Specified by:
prin1 in interface LispValue

princ

public LispValue princ()
Description copied from interface: LispValue
Prints the output so that it is readable to a person.

Specified by:
princ in interface LispValue

print

public LispValue print()
Description copied from interface: LispValue
Prints using prin1, except the output is preceded by a newline and terminated by a space.

Specified by:
print in interface LispValue

push

public LispValue push(LispValue value)
Pushes an element onto a list and returns the list. NOTE: Because Java's variable values aren't accessible to Jatha, the following doesn't work as expected:
   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);
 

Specified by:
push in interface LispValue
Returns:
the new list.
Throws:
LispValueNotASymbolException

radiansToDegrees

public LispValue radiansToDegrees()
Converts a numeric value from radians to degrees.

Specified by:
radiansToDegrees in interface LispValue
Returns:
The value in degrees.

rassoc

public LispValue rassoc(LispValue index)
Description copied from interface: LispValue
Like ASSOC except it matches the CDR of the cell instead of the CAR.

Specified by:
rassoc in interface LispValue

readFromString

public LispValue readFromString()
Reads a value from the given string.

Specified by:
readFromString in interface LispValue
Returns:
a LispValue as read by the LISP Reader

reciprocal

public LispValue reciprocal()
Computes 1/x of the given number. Only valid for numbers.

Specified by:
reciprocal in interface LispValue
Returns:
a LispReal

remhash

public LispValue remhash(LispValue key)
Description copied from interface: LispValue
Removes an element from a hash table.

Specified by:
remhash in interface LispValue

remove

public LispValue remove(LispValue elt)
Description copied from interface: LispValue
Returns a copy of a list without all copies of the given element.

Specified by:
remove in interface LispValue

rest

public LispValue rest()
Synonym for CDR.

Specified by:
rest in interface LispValue

reverse

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

Specified by:
reverse in interface LispValue

rplaca

public LispValue rplaca(LispValue newCar)
Description copied from interface: LispValue
Replaces the CAR of a CONS cell.

Specified by:
rplaca in interface LispValue

rplacd

public LispValue rplacd(LispValue newCdr)
Description copied from interface: LispValue
Replaces the CDR of a CONS cell.

Specified by:
rplacd in interface LispValue

sec

public LispValue sec()
Secant function, 1/cos(x), argument in radians.

Specified by:
sec in interface LispValue

second

public LispValue second()
Description copied from interface: LispValue
Returns the second element of a list or NIL if the list is shorter than two elements.

Specified by:
second in interface LispValue

setf_symbol_function

public LispValue setf_symbol_function(LispValue newFunction)
Description copied from interface: LispValue
Sets the function of a symbol.

Specified by:
setf_symbol_function in interface LispValue

setf_symbol_plist

public LispValue setf_symbol_plist(LispValue newPlist)
Description copied from interface: LispValue
Sets the property list of a symbol.

Specified by:
setf_symbol_plist in interface LispValue

setf_symbol_value

public LispValue setf_symbol_value(LispValue newValue)
Description copied from interface: LispValue
Sets the value of a symbol.

Specified by:
setf_symbol_value in interface LispValue

setq

public LispValue setq(LispValue newValue)
Description copied from interface: LispValue
Assigns a value to a symbol.

Specified by:
setq in interface LispValue

seventh

public LispValue seventh()
Description copied from interface: LispValue
Returns the seventh element of a list or NIL if the list is shorter than seven elements.

Specified by:
seventh in interface LispValue

sixth

public LispValue sixth()
Description copied from interface: LispValue
Returns the sixth element of a list or NIL if the list is shorter than six elements.

Specified by:
sixth in interface LispValue

sin

public LispValue sin()
Sine trigonometric function. Argument is in radians.

Specified by:
sin in interface LispValue

sqrt

public LispValue sqrt()
Square root. Accepts negative numbers.

Specified by:
sqrt in interface LispValue

stringp

public LispValue stringp()
Description copied from interface: LispValue
Returns T if the object is a string.

Specified by:
stringp in interface LispValue

nstringCapitalize

public LispValue nstringCapitalize()
For Common LISP compatibility, but identical to stringCapitalize.

Specified by:
nstringCapitalize in interface LispValue

nstringDowncase

public LispValue nstringDowncase()
For Common LISP compatibility, but identical to stringDowncase.

Specified by:
nstringDowncase in interface LispValue

nstringUpcase

public LispValue nstringUpcase()
For Common LISP compatibility, but identical to stringUpcase.

Specified by:
nstringUpcase in interface LispValue

string

public LispValue string()
Converts a String, Symbol or Character to a string.

Specified by:
string in interface LispValue

stringCapitalize

public LispValue stringCapitalize()
Capitalizes the first character of a string and converts the remaining characters to lower case.

Specified by:
stringCapitalize in interface LispValue

stringDowncase

public LispValue stringDowncase()
Converts all of the characters to lower case.

Specified by:
stringDowncase in interface LispValue

stringEndsWith

public LispValue stringEndsWith(LispValue arg)
Not in Common LISP, but useful. This is case-sensitive.

Specified by:
stringEndsWith in interface LispValue

stringEq

public LispValue stringEq(LispValue arg)
Returns T if the argument is an identical string to the object. Character comparison is case-sensitive. This is the LISP string= function.

Specified by:
stringEq in interface LispValue

stringEqual

public LispValue stringEqual(LispValue arg)
Returns T if the argument is an identical string to the object. Character comparison is case-insensitive. STRING-EQUAL.

Specified by:
stringEqual in interface LispValue

stringGreaterP

public LispValue stringGreaterP(LispValue arg)
This is the LISP string-greaterp function. Case-insensitive comparison for ordering.

Specified by:
stringGreaterP in interface LispValue

stringGreaterThan

public LispValue stringGreaterThan(LispValue arg)
This is the LISP string> function. Case-sensitive comparison for ordering.

Specified by:
stringGreaterThan in interface LispValue

stringGreaterThanOrEqual

public LispValue stringGreaterThanOrEqual(LispValue arg)
This is the LISP string>= function. Case-sensitive comparison for ordering.

Specified by:
stringGreaterThanOrEqual in interface LispValue

stringLeftTrim

public LispValue stringLeftTrim()
Trims the left end of the string by deleting whitespace on both ends.

Specified by:
stringLeftTrim in interface LispValue

stringLeftTrim

public LispValue stringLeftTrim(LispValue deleteBag)
Trims the left end of the string by deleting characters in the input string on both ends.

Specified by:
stringLeftTrim in interface LispValue

stringLessP

public LispValue stringLessP(LispValue arg)
This is the LISP string-lessp function. Case-insensitive comparison for ordering.

Specified by:
stringLessP in interface LispValue

stringLessThan

public LispValue stringLessThan(LispValue arg)
This is the LISP string< function. Case-sensitive comparison for ordering.

Specified by:
stringLessThan in interface LispValue

stringLessThanOrEqual

public LispValue stringLessThanOrEqual(LispValue arg)
This is the LISP string<= function. Case-sensitive comparison for ordering.

Specified by:
stringLessThanOrEqual in interface LispValue

stringNeq

public LispValue stringNeq(LispValue arg)
Returns T if the argument is not STRING= the given string.

Specified by:
stringNeq in interface LispValue

stringNotGreaterP

public LispValue stringNotGreaterP(LispValue arg)
This is the LISP string-not-greaterp function. Case-insensitive comparison for ordering.

Specified by:
stringNotGreaterP in interface LispValue

stringNotLessP

public LispValue stringNotLessP(LispValue arg)
This is the LISP string-not-lessp function. Case-insensitive comparison for ordering.

Specified by:
stringNotLessP in interface LispValue

stringRightTrim

public LispValue stringRightTrim()
Trims the right end of the string by deleting whitespace on both ends.

Specified by:
stringRightTrim in interface LispValue

stringRightTrim

public LispValue stringRightTrim(LispValue deleteBag)
Trims the right end of the string by deleting characters in the input string on both ends.

Specified by:
stringRightTrim in interface LispValue

stringStartsWith

public LispValue stringStartsWith(LispValue arg)
Not in Common LISP, but useful. This is case-sensitive.

Specified by:
stringStartsWith in interface LispValue

stringTrim

public LispValue stringTrim()
Trims the string by deleting whitespace on both ends.

Specified by:
stringTrim in interface LispValue

stringTrim

public LispValue stringTrim(LispValue deleteBag)
Trims the string by deleting characters in the input string on both ends.

Specified by:
stringTrim in interface LispValue

stringUpcase

public LispValue stringUpcase()
Converts all the characters to upper case.

Specified by:
stringUpcase in interface LispValue

subst

public LispValue subst(LispValue newValue,
                       LispValue oldValue)
Description copied from interface: LispValue
Replaces all oldValues in a tree with newValue. The default test is EQL.

Specified by:
subst in interface LispValue

substring

public LispValue substring(LispValue start)
Description copied from interface: LispValue
Returns the substring of a string starting with the nth element. Substring(0) returns a copy of the string.

Specified by:
substring in interface LispValue

substring

public LispValue substring(LispValue start,
                           LispValue end)
Description copied from interface: LispValue
Returns the substring of a string starting with the start element and ending just before the end element. Substring(3,5) returns a two-character string.

Specified by:
substring in interface LispValue

symbolp

public LispValue symbolp()
Description copied from interface: LispValue
Returns T if the object is a symbol.

Specified by:
symbolp in interface LispValue

symbol_function

public LispValue symbol_function()
                          throws LispException
Description copied from interface: LispValue
Returns the function assigned to a symbol.

Specified by:
symbol_function in interface LispValue
Throws:
LispException

symbol_name

public LispValue symbol_name()
Description copied from interface: LispValue
Returns a string containing the name of a symbol.

Specified by:
symbol_name in interface LispValue

symbol_package

public LispValue symbol_package()
Description copied from interface: LispValue
Returns the package of a symbol.

Specified by:
symbol_package in interface LispValue

symbol_plist

public LispValue symbol_plist()
Description copied from interface: LispValue
Returns the property list of a symbol.

Specified by:
symbol_plist in interface LispValue

symbol_value

public LispValue symbol_value()
                       throws LispException
Description copied from interface: LispValue
Returns the value of a symbol.

Specified by:
symbol_value in interface LispValue
Throws:
LispException

tan

public LispValue tan()
Tangent trigonometric function. Argument is in radians.

Specified by:
tan in interface LispValue

tenth

public LispValue tenth()
Description copied from interface: LispValue
Returns the tenth element of a list or NIL if the list is less than ten elements long.

Specified by:
tenth in interface LispValue

third

public LispValue third()
Description copied from interface: LispValue
Returns the third element of a list or NIL if the list is less than three elements long.

Specified by:
third in interface LispValue

type_of

public LispValue type_of()
Specified by:
type_of in interface LispValue

typep

public LispValue typep(LispValue type)
Specified by:
typep in interface LispValue

zerop

public LispValue zerop()
Specified by:
zerop in interface LispValue

add

public LispValue add(LispValue args)
Description copied from interface: LispValue
Returns the sum of the object and the object(s) in the argument list. This is the + function in LISP.

Specified by:
add in interface LispValue

divide

public LispValue divide(LispValue args)
Description copied from interface: LispValue
Returns the quotient of the object and the object(s) in the argument list. This is the / function in LISP.

Specified by:
divide in interface LispValue

multiply

public LispValue multiply(LispValue args)
Description copied from interface: LispValue
Returns the product of the object and the object(s) in the argument list. This is the * function in LISP.

Specified by:
multiply in interface LispValue

subtract

public LispValue subtract(LispValue args)
Description copied from interface: LispValue
Returns the difference of the object and the object(s) in the argument list. This is the - function in LISP.

Specified by:
subtract in interface LispValue

greaterThan

public LispValue greaterThan(LispValue arg)
Description copied from interface: LispValue
Returns T if the object prepended to the argument list is in strictly decreasing order.

Specified by:
greaterThan in interface LispValue

greaterThanOrEqual

public LispValue greaterThanOrEqual(LispValue arg)
Description copied from interface: LispValue
Returns T if the object prepended to the argument list is in non-increasing order.

Specified by:
greaterThanOrEqual in interface LispValue

lessThan

public LispValue lessThan(LispValue arg)
Description copied from interface: LispValue
Returns T if the object prepended to the argument list is in strictly increasing order.

Specified by:
lessThan in interface LispValue

lessThanOrEqual

public LispValue lessThanOrEqual(LispValue arg)
Description copied from interface: LispValue
Returns T if the object prepended to the argument list is in strictly non-decreasing order.

Specified by:
lessThanOrEqual in interface LispValue

equalNumeric

public LispValue equalNumeric(LispValue arg)
Description copied from interface: LispValue
Returns T if the object is EQUAL to its argument.

Specified by:
equalNumeric in interface LispValue

documentation

public LispValue documentation(LispValue type)
Description copied from interface: LispValue
Returns the documentation string for this symbol, of the type specified. The type may be any symbol, but the most common ones are:

Specified by:
documentation in interface LispValue
Parameters:
type - a symbol
Returns:
a LispString or NIL

setf_documentation

public LispValue setf_documentation(LispValue type,
                                    LispValue value)
Description copied from interface: LispValue
Sets the documentation string for this symbol of the type specified. The type may be any symbol, but the most common ones are:

Specified by:
setf_documentation in interface LispValue
Parameters:
type - a symbol
value - a lispstring
Returns:
value

showStackTrace

public void showStackTrace()

Jatha Software