Hi All,

I currently have data stored in a hash-map as follows:
(atom
{ [1 2] "value 1",
  [1 3] "value 2",
  [4 5] "value 3"
  [4 6] "value 4"
})

I need to identify entries in this map where *either* the first or the
second value in the key matches a predicate.

(swap! my-map dissoc 1)
=> {
        [4 5] "value 3"
        [4 6] "value 4"
     }

and

(swap! my-map dissoc 6)
=> { [1 2] "value 1",
       [1 3] "value 2",
       [4 5] "value 3"}

What is the best way to handle this?  I could create a map of maps
instead...

{ 1 { 2 "value 1"
       3 "value 2"}
  4 {5 "value 3"
      6 "value 4"}}

but this just doesnt feel right.

I will need to add and remove values regularly and this will be a
large data structure (often 10K entries) and will need to do thousands
of these operations so efficiency will  be key.

Any ideas?

Thanks!
 Base

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