I'm trying out gcl on Linux. I have two simple questions:
How do I exit the list interpreter? How do I save/load a lisp file from
within the interpreter? Thanks.
Rod Brick <···········@worldnet.att.net> writes:
> I'm trying out gcl on Linux.
You might also try out Allegro CL and CMUCL. GCL is reputably far from
compliant with the ANSI standard.
> I have two simple questions: How do I exit the list interpreter?
This is implementation-dependent, but try (quit) or (exit).
> How do I save/load a lisp file from within the interpreter?
To load a file:
(load #p"/path/to/my/file.lisp")
You can write data to files within the interpreter, but in general you
should write actual programs worth saving in an Emacs buffer and send
expressions from the buffer if you want to test stuff interactively.
Christopher
······@2xtreme.net (Christopher R. Barry) writes:
> > How do I save/load a lisp file from within the interpreter?
>
> To load a file:
> (load #p"/path/to/my/file.lisp")
Actually, while not an incorrect response, cbarry's answer is overly complex.
Just doing:
(load "/path/to/my/file.lisp")
is entirely satisfactory. Nothing is gained by putting #p in front of
the string except obfuscation. LOAD already coerces its argument to a
pathname when it gets it, and is happy to accept a string as an argument,
so suplying a pathname instead of a string just clutters the caller's
program, and to no good end.
JMO.
--Kent
Kent M Pitman <······@world.std.com> writes:
> ······@2xtreme.net (Christopher R. Barry) writes:
>
> > > How do I save/load a lisp file from within the interpreter?
> >
> > To load a file:
> > (load #p"/path/to/my/file.lisp")
>
> Actually, while not an incorrect response, cbarry's answer is overly complex.
> Just doing:
>
> (load "/path/to/my/file.lisp")
>
> is entirely satisfactory. Nothing is gained by putting #p in front of
> the string except obfuscation. LOAD already coerces its argument to a
> pathname when it gets it, and is happy to accept a string as an argument,
> so suplying a pathname instead of a string just clutters the caller's
> program, and to no good end.
It actually crossed my mind to leave out the #p, and I myself leave it
out when using LOAD in the interpreter (but not in code I intend to
save) because it saves typing, but it's important that newbies learn
the difference between what
* (type-of "home:foo.lisp")
(SIMPLE-BASE-STRING 13)
and
* (type-of #p"home:foo.lisp")
PATHNAME
are. If you can remember a few months back to Erik kinda flaming me
for "since when is a SIMPLE-BASE-STRING a PATHNAME???" Not all of the
pathname functions do the (IMO) intuitive thing with a
SIMPLE-BASE-STRING, and until he starts to really dig into the
HyperSpec he might be safer using a #p.
Christopher