- 1
- The file "2D xlisp.help is optional. If it is not
present interactive help will not be available.
- 2
- In a small Switcher or MultiFinder partition a dialog
warning about memory restrictions may be appear at this point. On a
Mac II it takes about a minute to load these files; on a Mac Plus or
an SE it takes about 3.5 minutes.
- 3
- It is possible to make a
finer distinction. The reader takes a string of characters from
the listener and converts it into an expression. The evaluator
evaluates the expression and the printer converts the result into
another string of characters for the listener to print. For simplicity I
will use evaluator to describe the combination of these
functions.
- 4
- "2D def acts like a special form, rather than a function,
since its first argument is not evaluated (otherwise you would have to
quote the symbol). Technically "2D def is a macro, not a special
form, but I will not worry about this distinction in this document.
"2D def is closely related to the standard Lisp special forms
"2D setf and "2D setq. The advantage of using "2D def is that
it adds your variable name to a list of "2D def'ed variables kept
in the global variable "2D *variables*. If you use
"2D setf or "2D setq there is no easy way to find variables
you have defined, as opposed to ones that are predefined. "2D def
always affects top level symbol bindings, not local bindings. It can
not be used in function definitions to change local bindings.
- 5
- As an aside, a Lisp symbol can be thought of as a ``thing''
with four cells. These cells contain the symbol's print name, its
value, its function definition, and its property list. Lisp symbols
are thus much more like physical entities than variable identifiers in
FORTRAN or C.
- 6
- The generator used is Marsaglia's portable generator from
the Core Math Libraries distributed by the National Bureau of
Standards. A state object is a vector containing the state information of
the generator. ``Random'' reseeding occurs off the system clock.
- 7
- The on line help file may not be available on a single disk
version that includes a system file. Alternatively, there may be a
small help file available that does not contain documentation for all
functions.
- 8
- This process of applying a function elementwise
to its arguments is called mapping.
- 9
- The notation used corresponds to the specification of the argument
lists in Lisp function definitions. See Section
.
- 10
- Note that the keyword "2D :title has not been quoted.
Keyword symbols, symbols starting with a colon, are somewhat
special. When a keyword symbol is created its value is set to itself.
Thus a keyword symbol effectively evaluates to itself and does not
need to be quoted.
- 11
- Actually pi
represents a constant, produced with "2D defconst. Its value can't be changed
by simple assignment.
- 12
-
To support these features the listener checks the current expression
each time you type a return to see if it has a complete
expression. If so, the expression is passed to the reader and the
evaluator. If not, you can continue typing. There are some heuristics
involved here, and an expression with lots of quotes and comments may
cause trouble, but it seems to work. Redefining the read table in
major ways may not work as you think since some knowledge of standard
Lisp syntax is built in to the listener.
- 13
- I have used a quoted list "2D '(purchases precipitation)
in this expression to pass the list of symbols to the save function. A
longer alternative would be the expression "2D (list 'purchases
'precipitation).
- 14
- According
to Stuetzle [13] the idea to link several plots was first
suggested by McDonald [9].
- 15
- The result returned by "2D plot-points is printed something
like "2D #<Object: 2010278, prototype = SCATTERPLOT-PROTO>. This
is not the value returned by the function, just its printed
representation . There are several other data types that are printed
this way; file streams, as returned by the "2D open function,
are one example. For the most part you can ignore these printed
results. There is one unfortunate feature, however: the form
"2D #<...> means that there is no printed form of this data type
that the Lisp reader can understand. As a result, if you forget to give
your plot a name you can't cut and paste the result into a
"2D def expression – you have to redo the plot or use the history
mechanism.
- 16
- To keep things simple I will use the term message
to refer to a message corresponding to a message selector.
- 17
- "2D dotimes is one of several Lisp looping constructs. It is
a special form with the syntax "2D (dotimes (var count) expr ....).
The loop is repeated "2D count times, with "2D var bound to 0, 1,
..., "2D count - 1. Other looping constructs are "2D dolist,
"2D do and "2D do*.
- 18
- Recall from Section
that
"2D #<Object: 1966006, prototype = REGRESSION-MODEL-PROTO> is the
printed representation of the model object returned by
"2D regression-model. Unfortunately you can't cut and paste it
into the "2D def, but of course you can cut and paste the
"2D regression-model expression or use the history mechanism.
- 19
- Ordinarily the entries in the lists returned by these messages
correspond simply to the intercept, if one is included in the model,
followed by the independent variables as they were supplied to
regression-model. However, if degeneracy is detected during computations
some variables will not be used in the fit; they will be marked as
aliased in the printed summary. The indices of the variables used can
be obtained by the "2D :basis message; the entries in the list returned
by "2D :coef-estimates correspond to the intercept, if appropriate,
followed by the coefficients of the elements in the basis. The messages
"2D :x-matrix and "2D :xtxinv are similar in that they use only the
variables in the basis.
- 20
- The / function is used here with three arguments.
The first argument is divided by the second, and the result is then
divided by the third. Thus the result of the expression (/ 6 3 2) is
1.
- 21
- The discussion in this section only scratches the surface of
what you can do with functions in the XLISP language. To see more examples
you can look at the files that are loaded when XLISP-STAT starts up.
For more information on options of function definition, macros, etc. see the
XLISP documentation and the books on Lisp mentioned in the references.
- 22
- "2D mapcar can be given several lists after the function.
The function must take as many arguments as there are lists.
"2D mapcar will apply the function using the first element of
each list, then using the second element, and so on, until one of the lists
is exhausted, and return a list of the results.
- 23
- Recall that the expression "2D #'f is short for
"2D (function f) and is used for obtaining the function definition
associated with the symbol f.