On Thu, May 21, 2009 at 3:35 AM, Michael Wood <esiot...@gmail.com> wrote:

>
> On Thu, May 21, 2009 at 9:15 AM, Christophe Grand <christo...@cgrand.net>
> wrote:
> >
> > Cosmin Stejerean a écrit :
> >> On Wed, May 20, 2009 at 7:04 PM, George Jahad
> >> <andr...@blackbirdsystems.net <mailto:andr...@blackbirdsystems.net>>
> >> wrote:
> >>
> >>
> >>     (def s1 (Symbol/create (.intern (first (.split "user/n1" "/")))))
> >>
> >>     will fix your problem.
> >>
> >>
> >> That makes a lot of sense and I guess I should have paid attention to
> >> the function definition for Symbol/create. Thanks!
> >
> > You should also use Symbol/intern instead of Symbol/create.
>
> Is Symbol/create or Symbol/intern necessary?  This seems to work:
>
> user=> (def s1 (symbol (first (.split "user/n1" "/"))))
> #'user/s1
> user=> (def s2 (symbol "user"))
> #'user/s2
> user=> (= s1 s2)
> true
> user=> (class s1)
> clojure.lang.Symbol
> user=> (class s2)
> clojure.lang.Symbol
> user=> (ns-publics s1)
> {s2 #'user/s2, s1 #'user/s1}
> user=> (ns-publics s2)
> {s2 #'user/s2, s1 #'user/s1}
> user=>
>

I don't know how I missed the symbol function in the API. Thanks.

-- 
Cosmin Stejerean
http://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
-~----------~----~----~----~------~----~------~--~---

Reply via email to