Re: Threads and Functions Question

2008-09-09 Thread noahr
The binding trick seems to work. I had already tried using (in-ns) before, but didn't realize about needing the binding, so got a nasty error of course. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group

Re: Threads and Functions Question

2008-09-09 Thread noahr
The ` for ' trick definitely worked. Unfortunately that solves my example problem but not my real one, since I cant quote the actual function because its in the form of an incoming stream fed to read. I looked for some sort of 'qualify-all' function that would act similar to ` but didnt see one.

Re: Threads and Functions Question

2008-09-08 Thread MikeM
You can try the following: (defn trd[] (let [f #(binding [*ns* *ns*] (in-ns 'user) (eval '(tst)))] (. (Thread. f) start) )) This sets the namespace for your new thread before it evals. You also might want to take a look at clojure.lang.Repl for an example of how to create a REPL, also repl

Re: Threads and Functions Question

2008-09-08 Thread Meikel Brandmeyer
Hello, Am 08.09.2008 um 20:37 schrieb noahr: (defn tst[] (pr 4)) (defn trd[] (let [f #(eval '(tst))] (. (Thread. f) start) )) The eval executes the code in the clojure namespace. You have to fully qualify your tst function. The easiest way to do this to use ` instead of '. So using `

Threads and Functions Question

2008-09-08 Thread noahr
I've hit another mystery (to me), that I hope someone can explain. Why doesn't the following work? (defn tst[] (pr 4)) (defn trd[] (let [f #(eval '(tst))] (. (Thread. f) start) )) It seems that a separate thread can not EVAL any defined functions. If I change the above to remove the thr