Saving lisp state

I am new to lisp and ask a question. When I write some code directly in REPL (without any .lisp file!), How can I save my work / interpreter state to restore it next time and continue working?

(I am using ECL)

Thanx! And sorry for my broken english;)

+4
source share
2 answers

From the ECL manual:

Tratidionally, the generic Lisp functions provided a function to save a dump of all data from running the Lisp process to a file. The result is called Lisp, and can be sent to another compatible version. Currently, having less control over the systems that it runs in, the Lisp implementation must work very hard to flush memory images and be able to load and execute them later.

ECL decided to avoid this process completely . Instead, we think of five different portable models for creating and translating your programs. The models described in table 1.1 list the various kinds of files that the ECL can produce with the possibility of transferring. To get one or more of the products mentioned in the table, you can refer to the low-level API described in part III. However, we recommend a simpler method based on using system definition files to describe the structure of your project and let the ECL build the desired goal for you. This approach is described in the following sections.

(my emphasis), so it seems you are out of luck with ECL. However, CLISP , CCL and SBCL supports this feature, so if you want it, and if switching is an option ... Try one of the attempts.

+6
source

As Dirk mentions, you can save the image in many Lisp implementations. However, although this meets your stated requirements, it is not recommended to store the code only in the image, because it is more difficult or impossible to edit. The ability to get the source code of a function is an optional function (and even if it exists, you lose comments and formatting), and many other types of definitions cannot be restored in standard ways at all.

On the other hand, it’s great to use an image to save and resume work if you have a difficult setup in your REPL or a long compilation time.

(Some systems, in particular Smalltalk, facilitate editing code inside an image, and also have editing and export features to support this, but Common Lisp, as standardized, does not know and does not know any modern CL implementation.)

+1
source

All Articles