Structural Informatics Group (SIG) logo
Home | Projects | Demos | Downloads | Publications | Local Info | About Us | New site
Go to the first, previous, next, last section, table of contents.

Lisp Programming in Slisp

Most programmers will simply want to program in lisp, rather than create new primitive C functions. The simplest way to do this is to simply type the name of an slisp application installed at your site, in a shell. For example type sl, for the basic slisp application that contains the xlisp primitives. Of course, like any other Unix application, sl must be available from your PATH variable.

Slisp (and Xlisp) uses an environment variable called XLPATH, which is a search path for loading lisp files. At our site this path is defined for all users (in applications installed in /usr/local/bin) to be /usr/local/xlisp, so any files in this directory can be loaded just by typing (LOAD-LIBRARY file) in the application.

If you change XLPATH then the search path can be customized. For example, if init.lsp is present in the initial XLPATH then this file will always be loaded at startup, which you may not want. Instead if you set XLPATH to be mypath:$XLPATH, slisp will first search for files in mypath before it searches the original XLPATH. This means you can have your own init.lsp file which will be loaded instead of the system init.lsp file, or you can preferentially load custom copies of lsp files that are part of a larger system.

In order to setup your own XLPATH look at the executable file for the application you are using. For the basic slisp application sl, this file is called sl, and is probably installed in /usr/local/bin. If not ask the person who installed slisp at your site.

The file app (the executable file whose name is the name of the application) is actually a shell script which first sets XLPATH, then executes the binary file, which is app.bin, or in the case of sl, sl.bin. To create your own XLPATH copy app to your own directory, then change XLPATH to be whatever you want it to be.

You can also change the name of this file if you want its name to reflect a specific application that adds lisp files. For example, one application we have is called siserver, which includes c modules to access a database system. To make a special bibliographic retrieval application that uses the database it might be reasonable to rename siserver to bib, set XLPATH within the shell script bib to include any lisp directories containing files you want dynamically loaded, and include on the line that calls siserver.bin any lisp files you want to always load at runtime.

Once the basic structure of an slisp application is set up the rest is simply lisp programming. For a basic tutorial about the xlisp primitive functions and object oriented extensions that are available in every slisp application see Xlisp Tutorial and Xlisp Objects Tutorial. For a complete reference of xlisp functions see Xlisp Reference. For descriptions of additional primitive functions that are added for specific applications see the info node associated with that application.

Go to the first, previous, next, last section, table of contents.