Expressions

When LISP-STAT comes up, it opens the Listener window. The listener is the part of the program that waits (listens) for your commands in order to evaluate them and produce results. The listener window - in addition to the commands you are typing and possible error messages - will receive all textual output. Only graphical commands open additional windows to contain the graph.

Everything you are typing in is an expression that is evaluated by the listener. There are very simple expression and compound expressions containing symbols, functions and lists.

A few commented examples should give you a general idea, whilst explaining a few additional things....

12
This is the simplest form of an expression. The number will simply be displayed.
pi
Pi is a defined symbol; therefore you get the value of pi.
(+ 10 20)
This asks Lisp to add the two numbers. This is a compound expression, therefore you need to use parentheses. LISP uses what is called a prefix notation, i.e. instead of writing 10+20 (this is called the infix notation) you have to write + 10 20.
(histogram area)
calls the histogram function; area is a symbol that refers to a list. We could also write (histogram (list 34 12 43 34 34 3 12 31 32 23 )), i.e. the list of numbers directly with the command (more on lists below)
(histogram area :title "Area (km2)" )
Options to functions are always specified with a : followed by the corresponding keyword, i.e. here you give the histogram window a title reflecting its contents.
(help 'histogram)
If you do not know what the options of a function are, use the help function. Please note the quote, needed to tell the listener that what follows is to be taken literally as a string (i.e. not to be evaluated). Do not expect a fully developed help system; you will only find dense, sometimes rather cryptic information.
(apropos 'histo) could be used to lookup any command or option that contains the string "histo";
help* 'histo) Is similar but produces more. Please note that not everything the help facility finds are actual functions that you can use. LISP-STAT is a full programming environment with everything a sophisticated programmer needs.

Some additional functions

LISP-STAT has many built-in functions, but as we shall see later, it is very simple to add new functions. Below you will find some examples, that should speak for themselves.

(mean urb)
(median urb)
(standard-deviation infmor)
(log infmor)

(- (mean urb) (median urb))

The last expression being an easy check for symmetry of a variable, i.e. the difference between the mean and the median.

Defining lists

As LISP uses lists all the time: variables are lists of numbers; for instance in order to produce a parallel boxplot you gave a list of variables:

(boxplot (list urb infmor))
(boxplot (list (list 10 11 20 30 21 2)(list 5 4 3 1 2 6)))

in fact you could also have written the second form, i.e. writing out the data as two distinct lists, combined into a single list.

It is useful to know that you can define lists, using the def function.

(def myfirstvariable (list 12 21 3 32 23 4 34 43 34 34 23 23))

creates the variable myfirstvariable you might use as in:

(histogram myfirstvariable)

which of course - in this example - is the same as writing

(histogram (list 12 21 3 32 23 4 34 43 34 34 23 23))

This can also be used to create lists of lists. In fact you could write

(def twovars (list urb infmor))
(boxplot twovars)

instead of

(boxplot (list urb infmor))

If you intend to use these variables quite often in that combination it would be much easier to define a list and then use the name of the list.

Please note for later, that entering data into LISP-STAT is defining a list for each variable; to define a data matrix would mean to create a list containing all lists of individual variables.

Correcting typos/reuse of commands

If you mistype a command or would like to edit it to change e.g. a variable name, you can select the command in the listener window and use the normal copy/paste option from the EDIT menu (or the corresponding keyboard shortcuts). There is a special keyboard short-cut ALT-V, doing this in one step; to make it work

  1. Select the command string to copy
  2. Hit Alt-V: This will insert the selected string at the end of the listener window
  3. Now you can edit that string
  4. Hit the return key to execute.