Maybe sth like that
(defn assoc-in-maybe-creating [coll keys creator-fns value] ...)
so it can be used:
(assoc-in-maybe-creating
[ {:a (sorted-map :X 1, :Y 2, :Z 3)
:c (sorted-map :X 1, :Z 3)}
{:b (sorted-map :X 1, :Y 2, :Z 3)}
{:f (sorted-map :X 1, :Y 2)}]
[0 :b :X]
[vector hashmap sorted-map]
1)
returning
[ {:a (sorted-map :X 1, :Y 2, :Z 3)
:b (sorted-map :X 1)
:c (sorted-map :X 1, :Z 3)}
{:b (sorted-map :X 1, :Y 2, :Z 3)}
{:f (sorted-map :X 1, :Y 2)}]
or like that
(assoc-in-maybe-creating
[]
[0 :a :Y]
[vector hashmap (fn []
(struct-map CustomStruct
:required-field1 value1 :required-field2 value2))]
2)
Name is temporary, I couldn't think of better one.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en