Re: Problem importing JOptionPane from a string evaluated by load-string

2010-09-10 Thread Paul D. Fernhout
On 9/10/10 9:03 AM, Laurent PETIT wrote: Got it. You cannot invoke (import) (or (ns)) from within the function definition. The function is already being evaluated, and it's "too late". This works fine for me: (do (import '(javax.swing JOptionPane)) ((fn [] (println "Hello World")

Re: Problem importing JOptionPane from a string evaluated by load-string

2010-09-10 Thread Sean Devlin
I've also used the with-ns package in contrib to fix this. On Sep 10, 9:03 am, Laurent PETIT wrote: > Got it. You cannot invoke (import) (or (ns)) from within the function > definition. The function is already being evaluated, and it's "too > late". > > This works fine for me: > > (do >   (import

Re: Problem importing JOptionPane from a string evaluated by load-string

2010-09-10 Thread Laurent PETIT
Got it. You cannot invoke (import) (or (ns)) from within the function definition. The function is already being evaluated, and it's "too late". This works fine for me: (do (import '(javax.swing JOptionPane)) ((fn [] (println "Hello World") (println (+ 2 2)) (JOptionPane/showMess

Re: Problem importing JOptionPane from a string evaluated by load-string

2010-09-10 Thread Sean Devlin
Try printing out the *ns* variable in the fn. Chances are your code is being created in a different *ns* than it is being run. You can also try using the fully qualified path to get to JOptionPane, that may help too. On Sep 9, 9:43 pm, "Paul D. Fernhout" wrote: > I'm just trying out Clojure a b