About Lisp

The environment necessary to program and run Lisp programs is provided on all ITS Unix hosts. ITS supports the use of the Lisp program. However, programmiong syntax and program debugging is not supported.

Setting up Lisp on Unix

It is fairly easy to use Lisp because it does not require a compiler or any other special tools. All that is required is the Lisp executable that is found in /usr/usc/lisp/default/config.

To make sure that Lisp is in your path, type source /usr/usc/lisp/default/setup.csh in your Unix prompt. To avoid typing this every time you wish to use Lisp, add this command to a new line at the end of your ~/.login file.

Using Lisp

To begin running a Lisp program, type lisp in your Unix prompt. The Lisp interpreter will then be loaded. The Lisp prompt will begin with a >. To execute a simple expression, type the expression at the prompt and press Enter. Upon pressing Enter, the interpreter will evaluate the expression and print the result.

If you have entered code into a text document, you can load the program into Lisp. At the Lisp prompt, enter (load “myprogram.lisp”), where myprogram.lisp is the name of the file containing your Lisp program. Once you have entered this command, press Enter to run your program.

Sample Program

The following is a sample Lisp program. This will be executed by entering the code directly into the Lisp interpreter.


aludra.usc.edu(1): lisp
> (format t "~A / ~A equals ~A." 5 3 (- 5 3))
5 / 3 equals 2.
NIL
>

You can also load code from files into the Lisp interpreter. The following is an example of code contained in the file myprogram.lisp.


(defun displaynumber(x)
(format t "You entered: ~A" x)
)

The following is an example of loading myprogram.lisp and calling the function defined in this file.

aludra.usc.edu(1): lisp
> (load "myprogram.lisp")
;;; Loading source file "myprogram.lisp"
;;; Warning: File "myprogram.lisp" does not begin with IN-PACKAGE.
;;; Loading into package "USER".
#P"/auto/scf-00/consult/myprogram.lisp"
> (displaynumber 5)
You entered: 5
NIL
>

Getting Help

If you need help launching Lisp or to report a problem with the installed package, please contact the ITS Customer Support Center. ITS does not help support programming syntax or debugging. If you are learning Lisp for a class, please consult your TA or professor for help regarding this language.