2010/1/22 dodo <[email protected]>:
> Does clojure provide a the possibility to retrieve the data structure
> that represents a function?

You would need to keep a copy, which is quite easy to do. Here is one way:
(def fna-ast '(fn [x] (inc x)))
(def fna (eval fna-ast))
(fna 5) => 6

You could store the ast as meta-data for convenience:
(alter-meta! (var fna) assoc :ast fna-ast)
(:ast (meta (var fna))) => (fn [x] (inc x))

Then when 'saving' and 'loading', use the ast.

If you are thinking about this in relation to genetic algorithms you
might find this past conversation interesting:
http://groups.google.com/group/clojure/browse_thread/thread/436d01f79015bc0c


Regards,
Tim.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to