Hmmm, I hadn't thought of delay...The only problem with what you suggest
is the fact that some fields will have to be deref-ed and some
don't...this slightly obscures what the map represents in my case...the
map represents a game along with all its predefined characteristics...if
I have to deref some it seems as if there is more going on than what it
actually is...constantly or memoize work great in my case because the
map holds essentially constants...ok the atom is not a constant but it
works just fine (provided that it will be deref-ed outside the map)...
Jim
ps:the original idea was to make the map a record so i could leverage
better access times (60 ms for a single move is not acceptable)...you
see that map is passed around literally everywhere in the core namespace
(depending on the game, the core engine will act differently)...In other
words the functions in core are generic - they don't apply to a specific
game but to any game for which you can supply a similar map...
On 19/06/12 18:32, Mark Engelberg wrote:
I think what you really want to do is use "delay" on specific fields.
This way, you don't need to make a function that builds the map every
time, you just define the map, replacing, for example, the
:north-player-start line with the following:
:north-player-start (delay (starting-checkers true))
And then, instead of:
(:north-player-start my-map), do
@(:north-player-start my-map) to access that field.
This effectively memoizes the specific field that needs it, rather
than the whole map.
--
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 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