Search code examples
loadlispcommon-lispclisp

File loading difficulties in clisp


So I am trying to learn Lisp, and I downloaded GNU CLISP 2.49 on my Windows 10 PC. I wrote some code in a file already, and I want to load it from the CLISP terminal with the (load "example.lisp") command.

Where should I put the file to be able to load it like this in clisp?

I have the clisp installed in C:\clisp-2.49.


Solution

  • You should start with the docs for the load function, and the bottom of the page will give you the answer:

    Variable CUSTOM:*LOAD-PATHS*. The variable CUSTOM:*LOAD-PATHS* contains a list of directories where the files are looked for - in addition to the specified or current directory - by LOAD, REQUIRE, COMPILE-FILE and LOAD-LOGICAL-PATHNAME-TRANSLATIONS.

    So, you should examine the variable custom:*load-paths* and add your directory there:

    (pushnew #p"c:/home/lisp/" custom:*load-paths* :test #'equalp)
    

    or you can run clisp in the directory where your sources are located.

    PS. You now owe me 1 zorkmid. :-)