Hi,

You could try to do it like this...

Use a hashmap instead of a vector in the atom:
(def room-list (atom {}))

Insert rooms using a hashmap for the user-id's:
(swap! room-list assoc "67890" {:user-list {"id-3" {:name "name-3"}}})

You can now find a user in a room like this:
(get-in @room-list ["67890" :user-list "id-3"])

To remove a user from a room you can use:
(swap! room-list update-in ["67890" :user-list] dissoc "id-3")

Good luck!

On Monday, December 9, 2013 9:46:49 AM UTC+1, 박재혁 wrote:
>
> sorry I can't write English.
>
>
> watch my code.
>
> (def room-list (*atom[]*))
>
> (def rooms-1 {:key "12345" :create-dt "2013-11-22" :user-list[ {:name 
> "name-1" :id "id-1"}  {:name "name-2" :id "id-2"}] })
> (def rooms-2 {:key "67890" :create-dt "2013-12-52" :user-list[ {:name 
> "name-3" :id "id-3"}  {:name "name-3" :id "id-3"}] })
>
> (swap! room-list conj rooms-1)
> (swap! room-list conj rooms-2)
>
> @room-list
>   --> [{:key "12345", :create-dt "2013-11-22", :user-list [{:name 
> "name-1", :id "id-1"    } {:name "name-2", :id "id-2"}]} 
>         {:key "67890", :create-dt "2013-12-52", :user-list [*{:name 
> "name-3", :id "id-3"}* {:name "name-3", :id "id-3"}]}]
>
>
> I want remove red color text. ( red colore )
>
> @room-list
> -->  [{:key "12345", :create-dt "2013-11-22", :user-list [{:name "name-1", 
> :id "id-1"} {:name "name-2", :id "id-2"}]} 
>         {:key "67890", :create-dt "2013-12-52", :user-list [{:name 
> "name-3", :id "id-3"}] }]
>
>
> I don't know how to remove...
>
> dissoc,, pop, peek function can;t not solve.....
>
>
> please help me...
>

-- 
-- 
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/groups/opt_out.

Reply via email to