#clojure log - Sep 07 2008

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

7:53 djpowell: what is #' for? what is the difference between passing a function directly, and using #'something?

8:17 parth_m: Hello. I want to add something to the interactive shell so I try "user=> (add-classpath "file:///home/parth/code/bar/")"

8:17 Then I get: user=> (.. System (getProperties) (get "java.class.path"))

8:17 "/home/parth/install/clojure/clojure.jar:/home/parth/src/clojure-contrib/clojure-contrib.jar:/home/parth/src/clojure/jsr166y.jar:/home/parth/.clj"

8:18 Am I doing this right? Should code/bar be seen on the classpath? I am new to Java so I am not too sure.

8:25 djpowell: no, i think java.class.path is just the default classpath that was passed in by java -cp, or setting CLASSPATH env variable

8:26 parth_m: djpowell: Thanks. Any way to know what the current classpath is?

8:33 djpowell: in 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...

8:34 i dont think there is in clojure either

8:35 are you asking because your classpath change doesn't seem to be working?

8:36 parth_m: I think so, but I can't be sure yet. Basically I am unable to get a "load-resources" to work.

8:36 (. System (setProperty "java.class.path" "... path ...")) seems to work. Doing a getProperty "java.class.path" shows the new path this way.

8:37 djpowell: is your bar/ directory full of class files? or jar files?

8:39 parth_m: I am actually trying to resolve the problem discussed in this thread: http://groups.google.com/group/clojure/browse_thread/thread/bf9672989524a1bf

8:39 Its just clj files.

8:42 So 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.

8:44 djpowell: hmm, 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

8:46 parth_m: I am working off the HEAD of svn.

8:47 I think the "load-resources" the recommended way. Basically I am trying to use the latest ns/in-ns functionality available in r 1017

8:48 Never mind. Thanks for the help on Java djpowell. I will experiment some more and see if I can get my ns to work :)

8:49 kotarak: parth_m: you first have to decide for a namespace.

8:50 eg. foo.bar.baz should go to /root/of/cp/foo/bar/baz

8:51 so your URL should be: (add-classpath "file:///root/of/cp")

8:51 Just plain files can be loaded with load-file.

8:51 Plain files in the classpath with load-resources.

8:52 (and absolute paths)

8:53 Plain files for the current namespace with relative paths.

8:53 ns, require, use & Co. only help with proper defined namespaces, I think.

8:53 parth_m: When I do a "add-classpath" , is it supposed to reflect in "java.class.path"?

8:55 kotarak: It'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 ...

8:55 parth_m: System.getProperty doesn't show the update. However if I set the classpath using System.setProperty I see the update with getProperty

8:55 kotarak: Then add-classpath probably sets a Clojure internal variable.

8:56 then use (load-resources "my/simple/clojure/file.clj") and put it in /root/of/cp/user/my/simple/clojure/file.clj

8:57 lisppaste8: parth_m pasted "add-classpath and getProperty" at http://paste.lisp.org/display/66444

8:57 kotarak: or (load-resources "/my/file.clj" ) and in root/of/cp/my/file.clj.

8:57 parth_m: Thats what it looks like. http://paste.lisp.org/display/66444

8:57 Its probably internal state.

8:57 rhickey: parth_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.

8:58 parth_m: Ah. Thanks.

8:58 rhickey: is there a way to see what the current clojure classpath is?

8:59 Thanks kotarak.

8:59 kotarak: np :)

9:01 rhickey: parth_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?

9:02 parth_m: It would be a good debugging aid I think.

9:02 rhickey: as 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

9:04 parth_m: I agree. I am basically experimenting at the repl trying to update my sources to use ns.

9:04 Its not a big deal, probably a nice-to-have during debug sessions.

9:06 rhickey: parth_m: (seq (.. clojure.lang.RT baseLoader getURLs)) will get you the things you added with add-classpath

9:07 parth_m: Works perfectly. Thanks Rich.

9:07 Thanks everyone for the help. Have a nice day. :)

9:15 kotarak: Say I have a sorted-set, how do I get the minimum?

9:15 Ok. with first.

9:15 * kotarak is not very creative....

9:15 jgracin: kotarak: :-)

9:20 rhickey: considering we have clojure/filter, isn't clojure.set/select redundant?

9:22 kotarak: with filter you get a seq, with select maybe a set?

9:22 as the return value, I mean

9:23 rhickey: right, filter is a sequence function and select a set function

9:24 jgracin: I see. Thanks, to both.

13:33 meredydd: Afternoon, all.

13:34 I'm resurfacing from a month or so of semi-embedded work, so I've lost track of Clojure lately.

13:34 Could anyone tell me what the current state of play is wrt web frameworks?

13:34 Google gives me a log of Chouser suggesting that webjure is 'deprecated' - has anything else sprung up to replace it?

13:36 joubert: Hello 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:36 In 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:37 meredydd: Yeah - 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:37 joubert: the 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:38 on => or

14:05 Chouser: meredydd: you might look at compojure: http://groups.google.com/group/clojure/browse_frm/thread/448865254f9bd293

14:06 I haven't done anything with it myselft (yet)

14:13 meredydd: Chouser: Sweet!

14:14 Hmm...looks like it mixes up presentation and data a fair bit.

14:16 blackdog: meredydd, rich seems very pro about google's gxt, but nobody's afaik has done anything with it yet

14:16 Chouser: I think the Right Way to do presentation will be GXP, but nobody's done the Clojure integration yet (that I know of)

14:17 blackdog: meredydd, but he thinks it's a good fit

14:17 Chouser: http://code.google.com/p/gxp/

18:14 ChibaPet: Hey all. Quick question: Does Clojure work under MIDP? Would it be a significant effort to get it to work under MIDP 2.0?

19:19 jamii: Is there a way to apply a java method to an &args type argument?

19:30 Chouser: I think you have to pass a java array to the variatic part of the java method.

19:56 rhickey: Details on my upcoming Boston Lisp talk: http://fare.livejournal.com/134108.html

20:12 albino: sounds good

Logging service provided by n01se.net