Hi Telman, I know *file* is a built-in global. My question is that how the value of *file* is set in the program. It is in the first line of the program so I don't know how it's set.
-sun On Jan 29, 7:44 pm, Telman Yusupov <use...@yusupov.com> wrote: > Hi Sun, > > *file* seems to be one of the built-in global vars (there is more - > vars like *command-line-args*, *compile-path* and others in core.clj > file). > > If you really need to see the source of it, look for SOURCE_PATH in > Compiler.java in Clojure's source code in jvm/clojure/lang directory. > > Cheers, > > Telman > > On Jan 29, 1:00 pm, wubbie <sunj...@gmail.com> wrote: > > > again I don't know how *file* gets current dir value. Maybe some > > magic? > > > -sun > > > On Jan 29, 12:30 pm, Telman Yusupov <use...@yusupov.com> wrote: > > > > I had the same question, that was answered by typing this into REPL: > > > > user=> (doc *file*) > > > > Output: > > > > ------------------------- > > > clojure.core/*file* > > > nil > > > The path of the file being evaluated, as a String. > > > Evaluates to nil when there is no file, eg. in the REPL. > > > > On Jan 29, 7:03 am, wubbie <sunj...@gmail.com> wrote: > > > > > Hello, > > > > > As you see, java.io.File. construct takes path argument but it is the > > > > first line of code and I don't know how *file* gets value of current > > > > directory. > > > > > #!/usr/bin/env clj > > > > > (add-classpath (str "file://" (.getParent (java.io.File. *file*)) > > > > "/")) > > > > > (ns mire > > > > (:use [mire commands player rooms]) > > > > (:use [clojure.contrib server-socket duck-streams])) > > > > .... > > > > > thanks, > > > > sun > > > > > On Jan 28, 8:05 pm, wubbie <sunj...@gmail.com> wrote: > > > > > > Hi, > > > > > > I see > > > > > (add-classpath (str "file://" (.getParent (java.io.File. *file*)) > > > > > "/")) > > > > > in mire.clj. > > > > > What value of *file* is it? I failed to see *file* is assigned at all. > > > > > > -thanks > > > > > sun > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---