I'm having a lot of trouble getting an app to work. I'm using agents
in a GUI app. For the sake of discussion I've got the following
things defined:
(def test-coll
[{:a 1 :b 2 :c 3}
{:a 4 :b 5 :c 6}
{:a 7 :b 8 :c 9}
{:a 10 :b 11 :c 12}
])
(def test-query
(agent
'[test-coll
(take 2)]))
(def test-result (agent []))
I want to execute test-query like so:
user=> (eval `(->> ~@(deref test-query)))
({:a 1, :b 2, :c 3}
{:a 4, :b 5, :c 6})
This part works at the REPL fine. Next I wrap it in a closure:
user=> ((fn [& args] (eval `(->> ~@(deref test-query)))))
({:a 1, :b 2, :c 3}
{:a 4, :b 5, :c 6})
Also fine.
Now, I want to send this to the agent test-result
user=> (send test-result (fn [& args](eval `(->> ~@(deref test-
query)))))
#<Agent (...)>
user=> @test-result
#<CompilerException java.lang.Exception: Agent has errors
(NO_SOURCE_FILE:468)>
user=> (agent-errors test-result)
(#<CompilerException java.lang.Exception: Unable to resolve symbol:
test-coll in this context (NO_SOURCE_FILE:459)>)
Blargh.
Why doesn't this work when I use send? I'm at a loss here.
Sean
--
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