Saving Your Work
Medley's File Manager subsystem (also known as the File Package) manages your code in memory and on disk. As we define and change functions, variables, and data structures, the File Manager keeps track of what we have stored in memory and what has been written to external storage. When we load a file in Medley, it parses all the text in the file as Lisp objects and data structures that are ready in memory for the system to use. As you change your code and data, you can ask the File Manager to show your changes and store them on disk.
For saving and loading our work, essential functions and commands (to be typed in the Exec) are:
(FILES?): Displays the functions, variables, and so on we created or changed and asks for directions for each one: add it to an existing file, add it to a new file, or ignore it.(FILES?)does not update the file on disk, but simply logs what should be saved.
(MAKEFILE 'filename): Saves the changes made to a file by writing it to disk. You can now find the file in your current directory.
We can also call
MAKEFILESto iterate theMAKEFILEoperation over a list of files.MAKEFILEStakes an optional list of files as arguments. Calling it without arguments -(MAKEFILES) -writes all changes to disk.(LOAD 'filename): Loads the filefilenameand its definitions.
FILELST: A variable that contains all files currently loaded in the environment.
filenameCOMS: Gives a list of all definitions contained in the named file. For instance, you can see all definitions associated with the fileADDER-FUNCTIONon the variableADDER-FUNCTIONCOMS.
You can save multiple Lisp objects to the same file. Try saving all our relevant variables and functions from the previous chapter (Build Your First Interactive Program) to a file! We will use and update this file moving forward.
Last updated
Was this helpful?
