Post by dukeIs there a way to "clear the decks" or "wipe the slate clean" in a FL top-level - say PolyML or SML/NJ?
I make a few typos in the learning process, and I see that once something is declared - it's there for good. Short of re-starting the interpreter, is there a way to un-bind everything?
Restarting is almost instantaneous so I just do that to fully wipe the slate clean.
A more interesting requirement is to revert back to a previous state. One may want this to avoid waiting for e.g. libraries to be loaded. This is possible with Poly/ML and SML/NJ as they can save the current state of the SML session.
In Poly/ML, the command
PolyML.SaveState.saveState "state";
saves the state to the file state (relative to the current directory, as given by OS.FileSys.getDir) and
PolyML.SaveState.loadState "state";
loads the previously saved state state. States can also be hierarchical. See
http://www.polyml.org/docs/SaveState.html
For SML/NJ, the command
SMLofNJ.exportML "state";
saves the current state to the file state. This is loaded by starting a new session with the command
sml @SMLload=state
See
http://www.cs.cmu.edu/afs/cs/local/sml/common/smlguide/smlnj.htm#export
Phil