Re: Serializing functions

2009-01-05 Thread mehrheit
I think the best way would be to simply store functions as lists (e.g. (fn [] ...)) in the file, use clojure.core/read to read the data structure and store both the list representation and the eval'd function object in the program. This might be implemented by having a memoizing 'call' function,

Serializing functions

2008-12-29 Thread Itay Maman
I want to be able to read and write a clojure object, which contains functions, from/to a file. The structure looks something like this: { :s my-string :f (fn[x] (inc x) } Reading is easy: (load-file ...) works fine. The tricky part is writing it back to the file. (pr ...) gives something like