A slightly cleaner version: (defn- flatten-keys* [a ks m]
(cond ;; Is a map? (map? m) (reduce into (map (fn [[k v]] (flatten-keys* a (str ks "." (name k)) v)) (seq m))) ;; Is an arr/vec/seq? (and (sequential? m) (not (instance? clojure.lang.MapEntry m))) (reduce into (map-indexed (fn [idx itm] (flatten-keys* a (str ks "[" idx "]") itm)) (seq m))) ;; Is not a collection :else (assoc a ks m))) (defn flatten-keys [m] (flatten-keys* {} "$" m)) -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.