Page 1 of 1

REPL - loading a file

Posted: Mon Dec 05, 2011 9:59 am
by Bdunbar
Is there a way to load code from a file in REPL?

I am new to LISP, have not programmed for a living in a long time.

I am working my way through 'Land of LISP'. Typed the code for the text game engine from Chapter 5. My computer crashed - the typing was gone like it never existed.

Now, it's easy enough to bang out the code in emacs, copy/paste it in. But that seems a little awkward.

Is it best to exec long chunks of code from emacs? Or is there a way to load a file in REPL?

I am new at this: feel free to hit me with a clue-bat.

Re: REPL - loading a file

Posted: Mon Dec 05, 2011 11:50 am
by ramarren
You can load a file from REPL using LOAD function. This also works anywhere, although directly loading files is fairly rare, since for programmatic uses you would use a system definition facility.

The typical way to develop Common Lisp code with Emacs is to use slime (which is best installed using Quicklisp). Slime includes commands for compiling and loading a file associated with a buffer, or evaluating single function definitions Practical Common Lisp describes some of that workflow in early chapters.