Store Data Records in Files
How to save multiple data records to a file and load them back again.
Let’s say you have a block of name records sort of like this:
group: [ [1 "Bob" "Smith" 12-Aug-1965 "Seattle" WA member] [2 "Tom" "Able" 20-Feb-1955 "San Jose" CA author] [3 "Jen" "Jones" 16-Jun-1972 "New York" NY leader] [4 "Sal" "Baker" 25-Oct-1975 "Boston" MA member] ]
To save all of these to a file:
save/all %group.r group
Take a look at the group.r file in an editor, and you’ll be able to see the same records as above.
To load back the records you saved above:
group: load/all %group.r
Don’t forget to use the /all refinement or you’ll have some problems at times.
Now you have an easy way to save and access data from your programs. This technique even works well for files of more than 100 thousand records!