Search code examples
compiler-errorscommon-lispclisp

Run a Common Lisp file from the CLISP interface (Error)


Everywhere I looked, it says, you can run a CLISP file with the command

"$ clisp file.lisp" from the CLISP terminal. I tried it with a simple (print "Hello World!"), saved it as lisp1.lisp. It doesn't work if I type in "$ clisp lisp1.lisp" and I get the error message: enter image description here

I tried to find my mistake and looked everywhere on the internet, but others type it in and it just works. I already the path variable to the clisp directory. Where is my mistake?


Solution

  • In the example you saw, they ran the command from a terminal, and the $ is just an indication that it is running a shell command as a user, this is a common practice when writing shell commands for UNIX-like environments (such as Linux or Mac).

    So to execute a lisp file from the command line/terminal you would open the terminal (cmd.exe on windows) and type clisp lisp1.lisp.

    Alternatively, if you want to load a file inside the clisp interpreter you would type (load "lisp1.lisp")