Simple function definitions, like square, are easily typed directly at the interpreter's prompt. However, for longer functions this soon becomes inadequate, because you will want to slightly modify definitions without having to completely retype them, not to mention the likelihood that you will make typographic errors when typing them in.
The solution is to write your functions in a program editor and then transfer them to the interpreter for evaluation. Exactly how you do this will vary from system to system and editor to editor. One of the most popular editors for writing Lisp code on UNIXtm systems is emacs, since it provides convenient methods for transferring code between editor to interpreter. Additionally, most Lisp interpreters allow you to directly call an editor from the interpreter prompt by typing (ed ``filename'').
If you have lots of function definitions, they will need to be stored in a file and then loaded into the interpreter using the instruction (load ``filename''). Once again, the details on how to save files and specify their names for loading will vary from system to system.
When typing code in an editor, two elements of good programming practice should be followed.
© Colin Allen & Maneesh Dhagat