For my use-case both memoize and constantly have the same effect with memoize being slightly faster [1]...since the atom is not being dereferenced in the map all is good! new states are being updated and logged just fine...

Jim


[1] --> without anything a move takes roughly 50-70 ms
     --> with memoization it takes roughly 0.8 -1.2 ms
    --> with constantly it takes roughly 3 - 5 ms

On 19/06/12 13:37, Jim - FooBar(); wrote:
On the other hand I am not dereferencing the atom inside the map so i'm not 'inspecting it' as you said before...just returning the var...dereferencing happens elsewhere (when moving for example)...

Jim



On 19/06/12 13:31, Jim - FooBar(); wrote:
On 19/06/12 13:27, Jim - FooBar(); wrote:
On 19/06/12 13:06, Tassilo Horn wrote:
But I don't think the above applies to your usecase. Can it be that the
function constructs the returned map by inspecting the value of some
ref/atom or the current-phase-of-moon or so?  In that case, you can't
memoize the fn.

yes actually a particular slot returns a var that holds an atom...do you mean that the same atom value will be returned forever even though the actual atom will have been swapped! or resetted! ?

Jim

hmmmm I see what you mean...that specific atom slot indeed stops me from memoizing...all the rest return essentially constants... how about if wrap current-checkers with a fn literal #(current-checkers) ?

Jim


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