I need coffee - too many typos.  I meant to say "I am trying to avoid
_typing_ 'x.y.z' twice"

(str (the-ns 'user)) is is even more human-error prone than just
typing "user".

I was look for a way to introspect ns (DRY up the Logger/getLogger
call).  In java you could just Logger.getLogger(this.getClass().getName
()) or something so you are not prone to typos and it's refactor-
friendly.

On Apr 5, 9:13 am, dysinger <dysin...@gmail.com> wrote:
> I am trying to avoid tying "x.y.z" twice it the above code.
>
> On Apr 5, 8:49 am, "Stephen C. Gilardi" <squee...@mac.com> wrote:
>
> > Is this what you're looking for:
>
> >         user=> (doc the-ns)
> >         -------------------------
> >         clojure.core/the-ns
> >         ([x])
> >           If passed a namespace, returns it. Else, when passed a symbol,
> >           returns the namespace named by it, throwing an exception if not
> >           found.
> >         nil
> >         user=> (the-ns 'user)
> >         #<Namespace user>
>
> > If not, please describe what you're after more explicitly.
>
> > --Steve
>
> > On Apr 5, 2009, at 2:29 PM, dysinger wrote:
>
> > > How can I introspect namespaces?  I can once I have some definitions
> > > going it seems but not before (I am noob).  See below example:
>
> > > (ns x.y.z
> > >  (import '(java.util.logging Logger)))
> > > (def log (Logger/getLogger "x.y.z")) ;; <-- how-to introspect this
> > > ns ?
> > > (.addHandler log (FileHandler. (format "/var/log/%s.log" (:ns
> > > ^#'log))))
> > > ;; once I have a def I can introspect the ns from the metadata
> > > ;; is that the only way?
>
> >  smime.p7s
> > 3KViewDownload
>
>
--~--~---------~--~----~------------~-------~--~----~
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