Starting to Work with Lisp


Allegro by Franz

(You can find the files below in this zip file.)

Details for obtaining Allegro can be found on this website. I have Allegro Common Lisp Personal Edition, version 5.0, for Windows. I don't know whether the following information is relevant to more recent versions:

  1. After you install Allegro, open C:\Program Files\acl50\doc\cl\introduction.htm. This is the main documentation file. Make a shortcut for it in the Allegro CL part of Programs under the start menu.
  2. Copy startup.cl and ext-toolbar.cl to the main Allegro directory (such as C:\Program Files\acl50\). This will put the "extended toolbar" with its useful buttons as part of the main toolbar.

LispWorks by Xanalys

(You can find the files below in this zip file.)

Details for obtaining LispWorks can be found on this website. The instructions here refer to LispWorks Professional Edition for Windows version 4.2 (but may be relevant to later versions too). After installing LispWorks, follow these steps:

  1. Put init.lispworks in the main LispWorks directory (such as C:\Program Files\Xanalys\LispWorks\). Now run LispWorks, go to the menu: Tools | Global Preferences, and change the Initialization File to be this file. This file makes a few things more comfortable (read inside the file).

  2. The default key-binds in LispWorks is Emacs-style. If you want it to be Windows-style (ctrl+c for copy, ctrl+v for paste, etc.) then go to the menu: Tools | Preferences | Emulation, and select Editor keys like MS Windows.

  3. In addition, it is convenient to add the following lines at the end of the file \Xanalys\LispWorks\lib\4-2-0-0\config\msw-key-binds.lisp:
    (editor:bind-key "Indent New Line" #\Return)
    (editor:bind-key "Kill Buffer" "Shift-F4")
    (editor:bind-key "Comment Region" "Control-:")
    
    The first line causes the return key to move the cursor to next line and indent it. (The original line in msw-key-binds.lisp binds #\Return to "New Line" without indenting). The second line is instead of the original that binds "Kill Buffer" to "control-F4", which is problematic because control-F4 closes the editor window and not the buffer. The third line is added for convenience, to put a region in a comment.

  4. Put clean_fsl.bat and clean_lisp~.bat in the same directory as your lisp code. These are cleaning files that recursively delete inside the subdirectories all the compiled lisp files (.fsl files), and backup lisp files (.lisp~ files) created by the editor.

  5. If your program spreads on more than one file, it is easiest the work with defsystem. Use the following file as a basis: defsys.lisp. Every time you want to compile and load your code, open the defsys.lisp file in the editor, right-click with the mouse on it, and choose File | Compile and Load.

  6. Note the "(:optimize ((debug 3)))" option in the defsys file. This is not mentioned in the defsystem documentation, and was mentioned to me in an email from Xanalys support. This option is needed if you want to prevent the compiler from optimizing tail function-calls, so that you can see all the function calls in the debugger window (the default in LispWorks is debug=2, and this optimization sometimes makes it hard to see what's going on during debugging). Another possibility is to add
    (proclaim '(optimize (debug 3)))
    to the init.lispworks file.

Back to the Smart Programming Page