Thanks. That is a good solution. There's also some work in dev being done on trans and trans* functions, as Sean Devlin pointed out. see:
explanation of trans: http://groups.google.com/group/clojure-dev/browse_thread/thread/4b20e40d83095c67# Chouser commenting on trans: http://groups.google.com/group/clojure-dev/browse_thread/thread/9a518c853bfbba8b# for an interesting read, although it makes my head spin a bit trying to follow it. And attagart - you are right, there is a bit of an OO smell on it, which comes from me using hash-maps as both individuals and viruses in agent-based modeling. I'll think about it. On Dec 9, 10:16 pm, Richard Newman <holyg...@gmail.com> wrote: > > However, if you would want to do something like an evolvable trade-off > > between epitopes and mutations in viruses, you would like to be able > > to store the functions inside each virus. > > And you can do that if you change how you retrieve values. > > (defn get-fn > "Like `get`, but handles returned functions by > calling them with the map itself." > [m k] > (let [x (get m k)] > (if (fn? x) > (x m) > x))) > > (def my-map {:a 1 :b 2 :c #(+ (:a %) (:b %))}) > > (get-fn my-map :a) > => 1 > > (get-fn my-map :c) > => 3 -- 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