Does the LISP program need to be in the same folder as the LISP compiler or can I call it from anywhere?
-
1This highly depends on how the program is structured (is it an ASDF system? just a bare function? a single .lisp?) and what lisp compiler you're using.yan– yan2011-04-18 19:20:20 +00:00Commented Apr 18, 2011 at 19:20
-
1My favorite way - Seriously - is to run it within emacs.Cheeso– Cheeso2011-04-18 19:21:36 +00:00Commented Apr 18, 2011 at 19:21
-
It is a basic .lisp file. And I'm not really sure what compiler would be best to use. I have Windows 7 and most of the LISP compilers I have found don't run on Windows.Nick Welki– Nick Welki2011-04-18 19:21:47 +00:00Commented Apr 18, 2011 at 19:21
-
What is emacs? I have never heard of it.Nick Welki– Nick Welki2011-04-18 19:32:19 +00:00Commented Apr 18, 2011 at 19:32
-
Emacs is a powerful text editor and the favourite IDE of many Lisp programmers (especially combined with SLIME, the Superior Lisp Interaction Mode for Emacs). Emacs uses its own Lisp dialect (Emacs Lisp) as extension language, and most of Emacs itself is actually written in Lisp (there's only a small C core providing the Lisp interpreter and some basic functionality). You can run a Lisp file opened in Emacs directly in it, and don't need to worry about its location on disk.Rörd– Rörd2011-04-18 20:40:30 +00:00Commented Apr 18, 2011 at 20:40
1 Answer
The basic operation is to call load with a pathname.
(load #p"/home/user710086/foo.lisp")
Then, you may need to run whatever "main" function is supplied by that file.
The location can also be in the current directory, which is, of course, platform dependent. The current directory usually has nothing to do with the directory the Lisp executable resided in, but is the directory of the shell you called it from. I do not know what the current directory is in Windows when you click on something, but I would guess that it is some home-directory-surrogate.
There are several things that may wrap around that basic operation. Usually, code is organized into an ASDF system, and has defined one or more packages. You would then add the .asd file to asdf:*asdf-registry* and then load the package with
(asdf:load-sys 'foo)
This would load all files defined in the .asd file in a calculated order, thus providing you with the system's functionality.