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.
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.
The following is a sample LISP program. This will be executed by entering the code directly into the LISP interpreter.
> (format t "~A / ~A equals ~A." 5 3 (- 5 3))
5 / 3 equals 2.
You can also load code from files into the LISP interpreter. The following is an example of code contained in the file myprogram.lisp.
(format t "You entered: ~A" x)
The following is an example of loading myprogram.lisp and calling the function defined in this file.
> (load "myprogram.lisp")
;;; Loading source file "myprogram.lisp"
;;; Warning: File "myprogram.lisp" does not begin with IN-PACKAGE.
;;; Loading into package "USER".
> (displaynumber 5)
You entered: 5
Getting HelpIf you need help launching lisp or to report a problem with the installed package, please contact the Custer Support Center at 213-740-5555 or e-mail email@example.com. 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.
February 04, 2011