Hi :

  I would like to simulate a simple database with the STM of clojure.
The rules are
1. There can be many rooms, and each room has its own attirbute
2. One room contains many people, and each person has its own
attribute
3. rooms can be created, and deleted, and people can be added into or
removed from room.

So I made a globle variable *rooms*,
where *rooms* is a reference of a sequence of references of rooms,
where room is a hashmap, with an attribute of reference of a sequence
of references of people.

Just like this,
(def *rooms* (ref {"room_1" (ref {:players (ref [(ref
player)])} ) } ) )

Ouch, it has 4 refs @@
I think it's hard to control, but why did I make that many ref?
If there is fewer refs, the functions that alter might need to see
outer ref to do an alter.

Any one got an idea to make the code easier ?? Thanks
--~--~---------~--~----~------------~-------~--~----~
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