On Sun, 24 Jan 2010 12:33:11 -0800 (PST) ".Bill Smith" <william.m.sm...@gmail.com> wrote:
> Manfred, > > The (:require clojure.contrib.classpath) tuple tells the ns function > to load the clojure.contrib.classpath library if it has not already > been loaded. Clojure looks for clojure/contrib/classpath.clj (or the > equivalent class file) somewhere in your classpath, which in your > case would be inside /home/manfred/clojure/clojure-contrib.jar. The > library is loaded into the clojure.contrib.classpath namespace, so if > you want to reference something in the library, you need to precede > the symbol with the namespace name, e.g. (clojure.contrib.classpath/ > WHATEVER). So that's one problem. > > Here is the second problem. Coincidently, the function you want to > invoke is also called classpath, so to invoke it you need to do this: > (clojure.contrib.classpath/classpath). To call the classpath- > directories function in the classpath library, you do this: > (clojure.contrib.classpath/classpath-directories). > > If you don't want to prefix every reference to classpath with > clojure.contrib.classpath, you can replace ":require" with ":use" in > your call to ns, like this: (ns my (:use clojure.contrib.classpath)). > The ":use" directive says "load the specified library if it hasn't > already been loaded, and then add its contents to my namespace". If > you use :use, you can call classpath like this: (classpath). > > I apologize if that seemed overly verbose, but I hope it gets the > point across. > It was verboses but very helpful. Thanks for making the effort to explain it to me. -- Manfred -- 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