Hi, Am 10.02.2010 um 21:05 schrieb Brian Wolf:
> As a beginner, I tried running the first example,changing namespaces > or not, etc ,and I keep getting > > user=> (ns some.Example > (gen-class)) > nil > some.Example=> (defn -toString > [this] > "HI !") > #'some.Example/-toString > > some.Example=> (ns user) > nil > > user=> (-toString (some.Example.)) > java.lang.Exception: Unable to resolve symbol: -toString in this > context (NO_SOU > RCE_FILE:21) gen-class only works with AOT compilation. So you have to compile the namespace. See http://clojure.org/compilation. Then you have to a colon in the ns-clause: :gen-class instead of gen-class. And finally you have to 'use' your namespace if you want to call the clojure function: (in-ns 'user) (use 'some.Example). Or you have to use the dot notation for the method calls. (.toString (some.Example.)). However for this you have to compile the class with 'compile'. Note: ns is used only to setup a namespace. So it should be called only once. To switch namespaces in the Repl use in-ns. Since the repl sets up user for you, you shouldn't use ns. Sincerely Meikel -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en