On Jul 27, 8:15 pm, semperos <[email protected]> wrote:
> Darn tabbing...apologies for the previous post.
>
> Here's my full question:
>
> I have a map of maps, arbitrarily nested. Every individual map has a
> key/value entry that acts as a unique identifier for that map. I need to be
> able to write a function that, given the whole map of maps and the value of
> that unique ID, can dissoc the map with that unique ID.
>
> I feel like I'm missing something basic. I'm aware of things like assoc-in
> and update-in for dealing with nested structures, but those require knowing
> the structure ahead of time. I need to be able to pass in a unique ID which
> could be at any level of maps within the map and dissoc it once it's
> "found."
>
> My question: Is there a method or approach using plain Clojure maps that's
> eluding me? If not and this requires some kind of searching, is there a
> better data structure to use?
There is no efficient way to do this. If you want to be able to do
these sorts of things quickly, you have to maintain an index of
{unique-id [keypath]} that is updated along with the map itself, the
same way a database would do.
--
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