Sometimes you don't want assoc-in to create a hash-map.  Sometimes you
wish it could create a sorted map.

Just finished working on something with Alexy Khrabrov & Chouser on
IRC, and the three of us are wondering if the result might be
generally useful.

(defn assoc-in-with
  "supply a default-map instead of a hash-map"
  [m default-map [k & ks] v]
  (if ks
    (assoc m k (assoc-in-as (get m k default-map) default-map ks v))
    (assoc m k v)))

Also, is there room for a sister fn update-in-with?

Thoughts?
Sean

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