Need help understanding load-image #1274
-
I'm trying to understand how to load an image saved to disk, in order to restore a repl session. (load-image (slurp "someFile.jimage")) returns a table...and I'm not sure what to do after that. I'm not able to grasp how to access the data loaded, if this can be used to restore a new repl to the saved state in what was loaded, or if I've just misunderstood the use of load-image. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Images operate on environment tables (just like (def a :a)
(curenv) # demo to show :a got defined
(spit "env" (make-image (curenv))) Demo to load the state: # merge with no prefix like with "use", do not re-export
(merge-module (curenv) (load-image (slurp "env")) "" false)
a # => :a |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
Images operate on environment tables (just like
import
), so you need to merge it in.Example to save a repl:
Demo to load the state: