Using cljdb I was able to step through the code and see that the problem is that symbol create is expecting an interned string.
Changing this: (def s1 (Symbol/create (first (.split "user/n1" "/")))) to this: (def s1 (Symbol/create (.intern (first (.split "user/n1" "/"))))) will fix your problem. g On May 20, 3:27 pm, Cosmin Stejerean <cstejer...@gmail.com> wrote: > I have a feeling I'm doing something wrong bug I can't figure it out and I > can't rule out that it's not some kind of bug. I am trying to get the public > vars exposed by a namespace from a string. I am creating a symbol from the > string using Symbol/create and then calling ns-publics. This works just fine > if I create the symbol directly from a string, but it doesn't appear to work > when I create the symbol from the result of String.split(). I tried to > narrow this down to some problem in my code but I just can't figure it out. > Some help would be appreciated. > Example of reproducing this: > > user=> (import 'clojure.lang.Symbol) > nil > user=> (def s1 (Symbol/create (first (.split "user/n1" "/")))) > #'user/s1 > user=> (def s2 (Symbol/create "user")) > #'user/s2 > user=> (= (first (.split "user/n1" "/")) "user") > true > user=> (class (first (.split "user/n1" "/"))) > java.lang.String > user=> (ns-publics s1) > java.lang.Exception: No namespace: user found (NO_SOURCE_FILE:0) > user=> (ns-publics s2) > {s2 #'user/s2, s1 #'user/s1} > > -- > Cosmin Stejereanhttp://offbytwo.com --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---