> 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

Reply via email to