Hi,

On Jan 21, 11:01 am, "C. Florian Ebeling" <florian.ebel...@gmail.com>
wrote:

> This is actually a very cool approach and it fits my ideas quite well.
> The only problem I have with it is that it constructs a whole new map
> from keyvals. Maybe it is possible do something similar which just wraps
> over an existing map.

I think you misread the source of fnmap. Of course it creates a new
map in the beginning just as hash-map does. Then assoc/dissoc/etc.
just delegates to the underlying map with the appropriate fiddling
with the setter/getter.

If you already have a map you can do something like:

(require '[clojure.contrib.fnmap.PersistentMap :as fnmap])

(defn to-fnmap
  [the-map setter getter]
  (clojure.contrib.fnmap.PersistentFnMap. (assoc the-map ::fnmap/
setter setter ::fnamp/getter getter)))

> That sounds a bit expensive.

Did you try? "sounds" is not the best advisor.

Sincerely
Meikel
-- 
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