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. Bill Smith Austin, TX On Jan 24, 9:28 am, Manfred Lotz <manfred.l...@arcor.de> wrote: > Hi all, > I'm stumbling about the very basics. > > Calling clojure like this: > > rlwrap java > -cp > /home/manfred/clojure/clojure.jar:/home/manfred/clojure/clojure-contrib.jar > clojure.main > > I try: > > user=> (ns my (:require clojure.contrib.classpath)) > nil > my=> > > which to me looks fine. > > But why does this fail? > > my=> (classpath) > java.lang.Exception: Unable to resolve symbol: classpath in this > context (NO_SOURCE_FILE:2) > > -- > Hope it is not too much stupidity on my side, > 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