COP 4020: Programming Languages I (Summer 2006)
Writing a Basic
Function in Lispworks
It is assumed that you’ve installed Lispworks. If not, then please see “Setting up your programming environment.”
When the program loads, you should get this:
The current tab is the Listener tab. This is where you can write a simple function and test it. It’s very simple. To write it, just type your function. When you hit enter after the last parentheses it will compile your program, display the name of the function, and give you a blank prompt. Here’s an example:
I’ve created a function that first cars a list and then cdrs it. You can now run your function like a normal function. When you are writing a function for your homework that is already implemented in LISP, just run the same list with both functions and make sure they match, like this:
Using a file is just as easy. Just click File -> Load and point it to your .lisp file and click Open. Then hit the spacebar when prompted, and your file will be compiled and loaded. Now you can go ahead and use your functions.
If you need more help please email me or visit me during my office hours.