Not at all answering your question, but I would strongly suggest to at least deref `me` before calling the function, so it’s definition would be more like:
(defn svr [me slot]
(when-let [sval (slot me)]
(if (jz-ref sval)
(condp type @sval)
:jzi (:val @sval)
:jzf ((:rule @sval) me)
(error “jz-ref? type unknown”))
sval)))
And I’d probably extract the body of if into a separate function
(defn- body-of-if [me sval]
(if (jz-ref sval)
(condp type sval)
:jzi (:val sval)
:jzf ((:rule sval) me)
(error “jz-ref? type unknown”))
sval))
so that your svr would end up something like
(defn svr [slot me]
(when-let [sval (slot me)]
(body-of-if me @sval))
and then you’d call svr as
(svr @me slot)
This way, your functions don’t need to know that their arguments happen to be atoms/refs, and they fit nicely in with eg
(swap! atom-that-contains-me svr slot)
But I do agree with Timothy that you should probably try to keep your data structure free of atoms, and just use one atom to hold your data structure.
Erik.
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to
clo...@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+u...@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+u...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.