I'm aware of clojure-dev group, but being new to clojure, i thought I
should start here first.
These are two methods I've needed in my project and I didn't found
better way to accomplish these tasks. First function returns vector of
leaf nodes in a map, and second dissociates in nested map. First
question would be is there already a way in clojure to do this? If
not, does these kind of functions deserve place in contrib, and third,
what should I do to make this functions production ready, as in if
they were really part of contrib?

(defn leafs [m]
  (loop [vs (vals m), accum []]
    (if (empty? vs)
      accum
      (let [v (first vs)]
        (if (map? v)
          (recur (rest vs) (into accum (leafs v)))
          (recur (rest vs) (conj accum v)))))))

(defn dissoc-in [m v]
  (let [len (count v)
        cur (get-in m v)]
    (cond
      (nil? cur) m
      (= len 0) m
      (= len 1) (dissoc m (first v))
      true (update-in m (butlast v) #(dissoc % (last v))))))

Other thing I would like to ask is how can I see what is different in
40 github clones of clojure.contrib without clicking on every clone?

Cheers,
Luka

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