2008-09-07
| 07:53 | djpowell | what is #' for? what is the difference between passing a function directly, and using #'something? |
| 08:17 | parth_m | Hello. I want to add something to the interactive shell so I try "user=> (add-classpath "file:///home/parth/code/bar/")" |
| 08:17 | parth_m | Then I get: user=> (.. System (getProperties) (get "java.class.path")) |
| 08:17 | parth_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:18 | parth_m | Am I doing this right? Should code/bar be seen on the classpath? I am new to Java so I am not too sure. |
| 08: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 |
| 08:26 | parth_m | djpowell: Thanks. Any way to know what the current classpath is? |
| 08: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... |
| 08:34 | djpowell | i dont think there is in clojure either |
| 08:35 | djpowell | are you asking because your classpath change doesn't seem to be working? |
| 08:36 | parth_m | I think so, but I can't be sure yet. Basically I am unable to get a "load-resources" to work. |
| 08:36 | parth_m | (. System (setProperty "java.class.path" "... path ...")) seems to work. Doing a getProperty "java.class.path" shows the new path this way. |
| 08:37 | djpowell | is your bar/ directory full of class files? or jar files? |
| 08: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 |
| 08:39 | parth_m | Its just clj files. |
| 08:42 | parth_m | 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. |
| 08: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 |
| 08:46 | parth_m | I am working off the HEAD of svn. |
| 08:47 | parth_m | I think the "load-resources" the recommended way. Basically I am trying to use the latest ns/in-ns functionality available in r 1017 |
| 08:48 | parth_m | Never mind. Thanks for the help on Java djpowell. I will experiment some more and see if I can get my ns to work :) |
| 08:49 | kotarak | parth_m: you first have to decide for a namespace. |
| 08:50 | kotarak | eg. foo.bar.baz should go to /root/of/cp/foo/bar/baz |
| 08:51 | kotarak | so your URL should be: (add-classpath "file:///root/of/cp") |
| 08:51 | kotarak | Just plain files can be loaded with load-file. |
| 08:51 | kotarak | Plain files in the classpath with load-resources. |
| 08:52 | kotarak | (and absolute paths) |
| 08:53 | kotarak | Plain files for the current namespace with relative paths. |
| 08:53 | kotarak | ns, require, use & Co. only help with proper defined namespaces, I think. |
| 08:53 | parth_m | When I do a "add-classpath" , is it supposed to reflect in "java.class.path"? |
| 08: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 ... |
| 08: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 |
| 08:55 | kotarak | Then add-classpath probably sets a Clojure internal variable. |
| 08:56 | kotarak | then use (load-resources "my/simple/clojure/file.clj") and put it in /root/of/cp/user/my/simple/clojure/file.clj |
| 08:57 | lisppaste8 | parth_m pasted "add-classpath and getProperty" at http://paste.lisp.org/display/66444 |
| 08:57 | kotarak | or (load-resources "/my/file.clj" ) and in root/of/cp/my/file.clj. |
| 08:57 | parth_m | Thats what it looks like. http://paste.lisp.org/display/66444 |
| 08:57 | parth_m | Its probably internal state. |
| 08: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. |
| 08:58 | parth_m | Ah. Thanks. |
| 08:58 | parth_m | rhickey: is there a way to see what the current clojure classpath is? |
| 08:59 | parth_m | Thanks kotarak. |
| 08:59 | kotarak | np :) |
| 09: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? |
| 09:02 | parth_m | It would be a good debugging aid I think. |
| 09: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 |
| 09:04 | parth_m | I agree. I am basically experimenting at the repl trying to update my sources to use ns. |
| 09:04 | parth_m | Its not a big deal, probably a nice-to-have during debug sessions. |
| 09:06 | rhickey | parth_m: (seq (.. clojure.lang.RT baseLoader getURLs)) will get you the things you added with add-classpath |
| 09:07 | parth_m | Works perfectly. Thanks Rich. |
| 09:07 | parth_m | Thanks everyone for the help. Have a nice day. :) |
| 09:15 | kotarak | Say I have a sorted-set, how do I get the minimum? |
| 09:15 | kotarak | Ok. with first. |
| 09:15 | jgracin | kotarak: :-) |
| 09:20 | jgracin | rhickey: considering we have clojure/filter, isn't clojure.set/select redundant? |
| 09:22 | kotarak | with filter you get a seq, with select maybe a set? |
| 09:22 | kotarak | as the return value, I mean |
| 09:23 | rhickey | right, filter is a sequence function and select a set function |
| 09:24 | jgracin | I see. Thanks, to both. |
| 13:33 | meredydd | Afternoon, all. |
| 13:34 | meredydd | I'm resurfacing from a month or so of semi-embedded work, so I've lost track of Clojure lately. |
| 13:34 | meredydd | Could anyone tell me what the current state of play is wrt web frameworks? |
| 13:34 | meredydd | 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 | joubert | 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 | joubert | on => or |
| 14:05 | Chouser | meredydd: you might look at compojure: http://groups.google.com/group/clojure/browse_frm/thread/448865254f9bd293 |
| 14:06 | Chouser | I haven't done anything with it myselft (yet) |
| 14:13 | meredydd | Chouser: Sweet! |
| 14:14 | meredydd | 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 |