#clojure logs

2008-09-07

07:53djpowellwhat is #' for? what is the difference between passing a function directly, and using #'something?
08:17parth_mHello. I want to add something to the interactive shell so I try "user=> (add-classpath "file:///home/parth/code/bar/")"
08:17parth_mThen I get: user=> (.. System (getProperties) (get "java.class.path"))
08:17parth_m"/home/parth/install/clojure/clojure.jar:/home/parth/src/clojure-contrib/clojure-contrib.jar:/home/parth/src/clojure/jsr166y.jar:/home/parth/.clj"
08:18parth_mAm I doing this right? Should code/bar be seen on the classpath? I am new to Java so I am not too sure.
08:25djpowellno, i think java.class.path is just the default classpath that was passed in by java -cp, or setting CLASSPATH env variable
08:26parth_mdjpowell: Thanks. Any way to know what the current classpath is?
08:33djpowellin general, in java, probably not, cause java can load classes from things other than paths, eg dynamically or over the network - so it isn't necesarily representable by a simple path. there might be some way of checking clojure's classpath though...
08:34djpowelli dont think there is in clojure either
08:35djpowellare you asking because your classpath change doesn't seem to be working?
08:36parth_mI think so, but I can't be sure yet. Basically I am unable to get a "load-resources" to work.
08:36parth_m (. System (setProperty "java.class.path" "... path ...")) seems to work. Doing a getProperty "java.class.path" shows the new path this way.
08:37djpowellis your bar/ directory full of class files? or jar files?
08:39parth_mI am actually trying to resolve the problem discussed in this thread: http://groups.google.com/group/clojure/browse_thread/thread/bf9672989524a1bf
08:39parth_mIts just clj files.
08:42parth_mSo the "add-classpath" confusion that I have is just a secondary thing but I thought it may be best to understand this behavior as I try to fix my load issues.
08:44djpowellhmm, i dont think you need to add the path of clj files to your classpath, you probably just want to load file them? not sure
08:46parth_mI am working off the HEAD of svn.
08:47parth_mI think the "load-resources" the recommended way. Basically I am trying to use the latest ns/in-ns functionality available in r 1017
08:48parth_mNever mind. Thanks for the help on Java djpowell. I will experiment some more and see if I can get my ns to work :)
08:49kotarakparth_m: you first have to decide for a namespace.
08:50kotarakeg. foo.bar.baz should go to /root/of/cp/foo/bar/baz
08:51kotarakso your URL should be: (add-classpath "file:///root/of/cp")
08:51kotarakJust plain files can be loaded with load-file.
08:51kotarakPlain files in the classpath with load-resources.
08:52kotarak(and absolute paths)
08:53kotarakPlain files for the current namespace with relative paths.
08:53kotarakns, require, use & Co. only help with proper defined namespaces, I think.
08:53parth_mWhen I do a "add-classpath" , is it supposed to reflect in "java.class.path"?
08:55kotarakIt's probably supposed to reflect whatever require and use need. Whether this is the same as for java.class.path... I don't know. But I would suppose so, cause there is also import ...
08:55parth_mSystem.getProperty doesn't show the update. However if I set the classpath using System.setProperty I see the update with getProperty
08:55kotarakThen add-classpath probably sets a Clojure internal variable.
08:56kotarakthen use (load-resources "my/simple/clojure/file.clj") and put it in /root/of/cp/user/my/simple/clojure/file.clj
08:57lisppaste8parth_m pasted "add-classpath and getProperty" at http://paste.lisp.org/display/66444
08:57kotarakor (load-resources "/my/file.clj" ) and in root/of/cp/my/file.clj.
08:57parth_mThats what it looks like. http://paste.lisp.org/display/66444
08:57parth_mIts probably internal state.
08:57rhickeyparth_m: no, you shouldn't expect to see it since it is not a modification of the System classpath. Clojure uses its own classloader which supports classpath extension.
08:58parth_mAh. Thanks.
08:58parth_mrhickey: is there a way to see what the current clojure classpath is?
08:59parth_mThanks kotarak.
08:59kotaraknp :)
09:01rhickeyparth_m: not right now, but remember that classpath resolution delegates, so the true full classpath is a concatenation of Clojure's plus its parent's, and depending on where you are running, its parent is not necessarily the system loader - why do you want to enumerate it?
09:02parth_mIt would be a good debugging aid I think.
09:02rhickeyas a general rule you shouldn't use add-classpath except to continue working in a running repl without having to restart to load a lib. Once you know you need a lib it should go in your classpath
09:04parth_mI agree. I am basically experimenting at the repl trying to update my sources to use ns.
09:04parth_mIts not a big deal, probably a nice-to-have during debug sessions.
09:06rhickeyparth_m: (seq (.. clojure.lang.RT baseLoader getURLs)) will get you the things you added with add-classpath
09:07parth_mWorks perfectly. Thanks Rich.
09:07parth_mThanks everyone for the help. Have a nice day. :)
09:15kotarakSay I have a sorted-set, how do I get the minimum?
09:15kotarakOk. with first.
09:15jgracinkotarak: :-)
09:20jgracinrhickey: considering we have clojure/filter, isn't clojure.set/select redundant?
09:22kotarakwith filter you get a seq, with select maybe a set?
09:22kotarakas the return value, I mean
09:23rhickeyright, filter is a sequence function and select a set function
09:24jgracinI see. Thanks, to both.
13:33meredyddAfternoon, all.
13:34meredyddI'm resurfacing from a month or so of semi-embedded work, so I've lost track of Clojure lately.
13:34meredyddCould anyone tell me what the current state of play is wrt web frameworks?
13:34meredyddGoogle gives me a log of Chouser suggesting that webjure is 'deprecated' - has anything else sprung up to replace it?
13:36joubertHello meredydd: in the project I am working on, I have written my own servlet that I host in Tomcat. So I implement things like respond, doGet, etc.
13:36joubertIn addition to my main servlet/s, I also have a reloadservlet, that, when you point your browser to it, reloads the other servlets to make sure the running code is up to date
13:37meredyddYeah - rolling your own really isn't that bad, as a baseline. But if someone's done something more I can build on, there's no point in reinventing the wheel.
13:37joubertthe server-side code does not build UI's on anything like that; simply implements business logic, data access, and the API for a front-end
13:38jouberton => or
14:05Chousermeredydd: you might look at compojure: http://groups.google.com/group/clojure/browse_frm/thread/448865254f9bd293
14:06ChouserI haven't done anything with it myselft (yet)
14:13meredyddChouser: Sweet!
14:14meredyddHmm...looks like it mixes up presentation and data a fair bit.
14:16blackdogmeredydd, rich seems very pro about google's gxt, but nobody's afaik has done anything with it yet
14:16ChouserI think the Right Way to do presentation will be GXP, but nobody's done the Clojure integration yet (that I know of)
14:17blackdogmeredydd, but he thinks it's a good fit
14:17Chouserhttp://code.google.com/p/gxp/
18:14ChibaPetHey all. Quick question: Does Clojure work under MIDP? Would it be a significant effort to get it to work under MIDP 2.0?
19:19jamiiIs there a way to apply a java method to an &args type argument?
19:30ChouserI think you have to pass a java array to the variatic part of the java method.
19:56rhickeyDetails on my upcoming Boston Lisp talk: http://fare.livejournal.com/134108.html
20:12albinosounds good