```
ADD A MESSAGE TO A CLASS
``` the message symbol
the formal argument list
this list is of the form:
(... [&rest ] [&aux ...])
where
a formal argument
bound to the rest of the arguments
a auxiliary variable
```
a list of executable expressions
returns the object
ivars
``` DEFINE THE LIST OF INSTANCE VARIABLES
the list of instance variable symbols
returns the object
cvars DEFINE THE LIST OF CLASS VARIABLES
the list of class variable symbols
returns the object
When a new instance of a class is created by sending the
message 'new' to an existing class, the message 'isnew'
followed by whatever parameters were passed to the 'new'
message is sent to the newly created object.
When a new class is created by sending the 'new' message to
the object 'Class', an optional parameter may be specified
indicating the superclass of the new class. If this
parameter is omitted, the new class will be a subclass of
'Object'. A class inherits all instance variables, class
variables, and methods from its super-class.
XLISP: An Experimental Object Oriented Language Page 12
SYMBOLS
8.0 SYMBOLS
o self - the current object (within a message
context)
o msgclass - the class in which the current method
was found
o *oblist* - the object list
o *standard-input* - the standard input file
o *standard-output* - the standard output file
o *tracenable* - flag controlling trace back printout
on errors
o *unbound* - indicator for unbound symbols
XLISP: An Experimental Object Oriented Language Page 13
EVALUATION FUNCTIONS
9.0 EVALUATION FUNCTIONS
(eval ) EVALUATE AN XLISP EXPRESSION
the expression to be evaluated
returns the result of evaluating the expression
(apply ) APPLY A FUNCTION TO A LIST OF ARGUMENTS
the function to apply (or function symbol)
the argument list
returns the result of applying the function to the argument list
(funcall ...) CALL A FUNCTION WITH ARGUMENTS
the function to call (or function symbol)
arguments to pass to the function
returns the result of calling the function with the arguments
(quote ) RETURN AN EXPRESSION UNEVALUATED
the expression to be quoted (quoted)
returns unevaluated
XLISP: An Experimental Object Oriented Language Page 14
SYMBOL FUNCTIONS
10.0 SYMBOL FUNCTIONS
(set ) SET THE VALUE OF A SYMBOL
the symbol being set
the new value
returns the new value
(setq ) SET THE VALUE OF A SYMBOL
the symbol being set (quoted)
the new value
returns the new value
(defun ...) DEFINE A FUNCTION WITH EVALUATED ARGS
(ndefun ...) DEFINE A FUNCTION WITH UNEVALUATED ARGS
symbol being defined (quoted)
list of formal arguments (quoted)
this list is of the form:
(... [&rest ] [&aux ...])
where
is a formal argument
bound to the rest of the arguments
is an auxiliary variable
expressions constituting the body of the
function (quoted)
returns the function symbol
(gensym ) GENERATE A SYMBOL
symbol/string/number
returns the new symbol
(intern ) INTERN A SYMBOL ON THE OBLIST
the symbol
returns the interned symbol
(symbol-name ) GET THE PRINT NAME OF A SYMBOL
the symbol
returns the symbol's print name
(symbol-plist ) GET THE PROPERTY LIST OF A SYMBOL
the symbol
returns the symbol's property list
XLISP: An Experimental Object Oriented Language Page 15
PROPERTY LIST FUNCTIONS
11.0 PROPERTY LIST FUNCTIONS
(get ) GET THE VALUE OF A PROPERTY
the symbol
the property symbol
returns the property value or nil
(putprop ) PUT A PROPERTY ONTO A PROPERTY LIST
the symbol
the property value
the property symbol
returns the value
(remprop ) REMOVE A PROPERTY
the symbol
the property symbol
returns nil
XLISP: An Experimental Object Oriented Language Page 16
LIST FUNCTIONS
12.0 LIST FUNCTIONS
(car ) RETURN THE CAR OF A LIST NODE
the list node
returns the car of the list node
(cdr ) RETURN THE CDR OF A LIST NODE
the list node
returns the cdr of the list node
(caar ) == (car (car ))
(cadr ) == (car (cdr ))
(cdar ) == (cdr (car ))
(cddr ) == (cdr (cdr ))
(cons ) CONSTRUCT A NEW LIST NODE
the car of the new list node
the cdr of the new list node
returns the new list node
(list ...) CREATE A LIST OF VALUES
expressions to be combined into a list
returns the new list
(append ...) APPEND LISTS
lists whose elements are to be appended
returns the new list
(reverse ) REVERSE A LIST
the list to reverse
returns a new list in the reverse order
(last ) RETURN THE LAST LIST NODE OF A LIST
the list
returns the last list node in the list
(member ) FIND AN EXPRESSION IN A LIST
the expression to find (equal test)
the list to search
returns the remainder of the list starting with the expression
(memq ) FIND AN EXPRESSION IN A LIST
the expression to find (eq test)
the list to find it in
returns the remainder of the list starting with the expression
XLISP: An Experimental Object Oriented Language Page 17
LIST FUNCTIONS
(assoc ) FIND AN EXPRESSION IN AN ASSOCIATION LIST
the expression to find (equal test)
the association list
returns the alist entry or nil
(assq ) FIND AN EXPRESSION IN AN ASSOCIATION LIST
the expression to find (eq test)
the association list
returns the alist entry or nil
(length ) FIND THE LENGTH OF A LIST
the list
returns the length of the list
(nth ) RETURN THE NTH ELEMENT OF A LIST
the number of the element to return (zero origin)
the list
returns the nth element or nil if the list isn't that long
(nthcdr ) RETURN THE NTH CDR OF A LIST
the number of the element to return (zero origin)
the list
returns the nth cdr or nil if the list isn't that long
(mapcar ...) APPLY FUNCTION TO SUCCESSIVE CARS
the function or function name
a list for each argument of the function
returns the list of values returned by each function invocation
(maplist ...) APPLY FUNCTION TO SUCCESSIVE CDRS
the function or function name
a list for each argument of the function
returns the list of values returned by each function invocation
(subst ) SUBSTITUTE ONE EXPRESSION FOR ANOTHER
the new expression
the old expression
the expression in which to do the substitutions
returns the expression with substitutions
(sublis ) SUBSTITUTE USING AN ASSOCIATION LIST
the association list
the expression in which to do the substitutions
returns the expression with substitutions
XLISP: An Experimental Object Oriented Language Page 18
DESTRUCTIVE LIST FUNCTIONS
13.0 DESTRUCTIVE LIST FUNCTIONS
(rplaca ) REPLACE THE CAR OF A LIST NODE
the list node
the new value for the car of the list node
returns the list node after updating the car
(rplacd ) REPLACE THE CDR OF A LIST NODE
the list node
the new value for the cdr of the list node
returns the list node after updating the cdr
(nconc ...) DESTRUCTIVELY CONCATENATE LISTS
lists to concatenate
returns the result of concatenating the lists
(delete ) DELETE OCCURANCES OF AN EXPRESSION FROM A LIST
the expression to delete (equal test)
the list
returns the list with the matching expressions deleted
(delq ) DELETE OCCURANCES OF AN EXPRESSION FROM A LIST
the expression to delete (eq test)
the list
returns the list with the matching expressions deleted
XLISP: An Experimental Object Oriented Language Page 19
PREDICATE FUNCTIONS
14.0 PREDICATE FUNCTIONS
(atom ) IS THIS AN ATOM?
the expression to check
returns t if the value is an atom, nil otherwise
(symbolp ) IS THIS A SYMBOL?
the expression to check
returns t if the expression is a symbol, nil otherwise
(numberp ) IS THIS A NUMBER?
the expression to check
returns t if the expression is a symbol, nil otherwise
(null ) IS THIS AN EMPTY LIST?
the list to check
returns t if the list is empty, nil otherwise
(not ) IS THIS FALSE?
the expression to check
return t if the expression is nil, nil otherwise
(listp ) IS THIS A LIST?
the expression to check
returns t if the value is a list node or nil, nil otherwise
(consp ) IS THIS A NON-EMPTY LIST?
the expression to check
returns t if the value is a list node, nil otherwise
(boundp ) IS THIS A BOUND SYMBOL?
the symbol
returns t if a value is bound to the symbol, nil otherwise
(eq ) ARE THE EXPRESSIONS IDENTICAL?
the first expression
the second expression
returns t if they are equal, nil otherwise
(equal ) ARE THE EXPRESSIONS EQUAL?
the first expression
the second expression
returns t if they are equal, nil otherwise
XLISP: An Experimental Object Oriented Language Page 20
CONTROL FUNCTIONS
15.0 CONTROL FUNCTIONS
(cond ...) EVALUATE CONDITIONALLY
pair consisting of:
( ...)
where
is a predicate expression
evaluated if the predicate
is not nil
returns the value of the first expression whose predicate
is not nil
(let (...) ...) BIND SYMBOLS AND EVALUATE EXPRESSIONS
the variable bindings each of which is either:
1) a symbol (which is initialized to nil)
2) a list whose car is a symbol and whose cadr
is an initialization expression
... the expressions to be evaluated with the specified bindings
returns the value of the last expression
(and ...) THE LOGICAL AND OF A LIST OF EXPRESSIONS
... the expressions to be ANDed
returns nil if any expression evaluates to nil,
otherwise the value of the last expression
(evaluation of expressions stops after the first
expression that evaluates to nil)
(or ...) THE LOGICAL OR OF A LIST OF EXPRESSIONS
... the expressions to be ORed
returns nil if all expressions evaluate to nil,
otherwise the value of the first non-nil expression
(evaluation of expressions stops after the first
expression that does not evaluate to nil)
(if []) EXECUTE EXPRESSIONS CONDITIONALLY
the test expression
the expression to be evaluated if texpr is non-nil
the expression to be evaluated if texpr is nil
returns the value of the selected expression
(progn ...) EXECUTE EXPRESSIONS SEQUENTIALLY
... the expressions to evaluate
returns the value of the last expression
(while ...) ITERATE WHILE AN EXPRESSION IS TRUE
the test expression evaluated at start of each iteration
... the expressions evaluated as long as evaluates to
non-nil
returns the value of the last expression
XLISP: An Experimental Object Oriented Language Page 21
CONTROL FUNCTIONS
(repeat ...) ITERATE USING A REPEAT COUNT
the integer expression indicating the repeat count
... the expressions evaluated times
returns the value of the last expression
XLISP: An Experimental Object Oriented Language Page 22
ARITHMETIC FUNCTIONS
16.0 ARITHMETIC FUNCTIONS
(+ ...) ADD A LIST OF NUMBERS
... the numbers
returns the result of the addition
(- ...) SUBTRACT A LIST OF NUMBERS
... the numbers
returns the result of the subtraction
(* ...) MULTIPLY A LIST OF NUMBERS
... the numbers
returns the result of the multiplication
(/ ...) DIVIDE A LIST OF NUMBERS
... the numbers
returns the result of the division
(1+ ) ADD ONE TO A NUMBER
the number
returns the number plus one
(1- ) SUBTRACT ONE FROM A NUMBER
the number
returns the number minus one
(rem ...) REMAINDER OF A LIST OF NUMBERS
... the numbers
returns the result of the remainder operation
(minus ) NEGATE A NUMBER
the number
returns the number negated
(min ...) THE SMALLEST OF A LIST OF NUMBERS
... the expressions to be checked
returns the smallest number in the list
(max ...) THE LARGEST OF A LIST OF NUMBERS
... the expressions to be checked
returns the largest number in the list
(abs ) THE ABSOLUTE VALUE OF A NUMBER
the number
returns the absolute value of the number
XLISP: An Experimental Object Oriented Language Page 23
BITWISE LOGICAL FUNCTIONS
17.0 BITWISE LOGICAL FUNCTIONS
(bit-and ...) THE BITWISE AND OF A LIST OF NUMBERS
the numbers
returns the result of the and operation
(bit-ior the numbers
returns the result of the inclusive or operation
(bit-xor the numbers
returns the result of the exclusive or operation
(bit-not ) THE BITWISE NOT OF A NUMBER
the number
returns the bitwise inversion of number
XLISP: An Experimental Object Oriented Language Page 24
RELATIONAL FUNCTIONS
18.0 RELATIONAL FUNCTIONS
The relational functions can be used to compare integers or
strings. The functions '=' and '/=' can also be used to
compare other types. The result of these comparisons is
computed the same way as for 'eq'.
(< ) TEST FOR LESS THAN
the left operand of the comparison