Sorry, (prn frm) should have been (prn form). On Wed, Jun 24, 2009 at 5:33 AM, Adrian Cuthbertson < adrian.cuthbert...@gmail.com> wrote:
> You can use the following; > > (defn frm-save > "Save a clojure form to file." > [#^java.io.File file form] > (with-open [w (java.io.FileWriter. file)] > (binding [*out* w *print-dup* true] (prn frm)))) > > (defn frm-load > "Load a clojure form from file." > [#^java.io.File file] > (with-open [r (java.io.PushbackReader. > (java.io.FileReader. file))] > (let [rec (read r)] > rec))) > > Have a look at clojure.core_print.clj in the clojure source for details on > print-dup. > > Rgds, Adrian. > > > On Tue, Jun 23, 2009 at 4:11 PM, ogcraft <ogcr...@gmail.com> wrote: > >> >> Dear all, >> Is there an inverse function of load or load-file. >> I mean the "save" function which writes the clojure variables or >> entire workspace context (in textual form) to the file? >> That we can load-file on such file and get the same variables as when >> "save" was originally invoked. >> >> >> >> > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---