You had:

(defmacro eval-cached [obj]
  (when-not (contains? @cache obj)
    (reset! cache (assoc @cache obj (eval obj))))
  (@cache obj))

and:

(eval-cached fbody)

This results in eval-cached being called with obj bound to the symbol
'fbody rather than to the second argument to def-cached -- probably
not what you intended. It checks the cache for containing a value at
the key 'fbody, fails, and so goes to create the entry -- and calls
(eval 'fbody), rather than (eval the-code-you-passed-to-def-cached).

You really did need a function and not a macro for eval-cached.

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