You can use *agent* from inside an agent thread to obtain the
"current" agent.


On Mar 3, 2:02 am, zahardzhan <[email protected]> wrote:
> Sorry my english
>
> I use in my small clojure program one complicated mutually-recursive
> data structure that represents an agent-in-environment. This structure
> is clojure agent which have self-reference inside himself and
> reference to environment, where environment is set of agents:
>
> (let [a (agent {:some state})]
>   (send a assoc
>           :self (delay a)  ;; this is self-reference
>           :env (ref (delay (set a))))  ;; this is reference to
> environment in which agent live
>     (await a)
>     a) ;; my agent
>
> Is there a better way to declare this agent using deftype?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
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

Reply via email to