On Dec 5, 7:51 am, Krukow <[EMAIL PROTECTED]> wrote:
> Looks useful as a kind of high-level interface to
> java.util.concurrent.AtomicReference. Am I correct
to think of this as being (semantically) equivalent to combining send-
off and await with agents?
E.g.,
(defn memoize [f]
(let [mem (agent {})]
(fn [& args]
(if-let [e (find @mem args)]
(val e)
(let [ret (apply f args)] (send-off mem assoc args ret)
(await mem)
ret)))))
under the hood, the first is running of a queue in a separate thread
and the other is doing a in-thread spin-wait?
- Karl
(sorry for making two post, I accidentally triggered a send-message
shortcut ;-))
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---