#clojure logs

2008-09-25

00:30avidais there an identity function such that (identity x) = x ?
00:31avidadude, there is such a function, named identity :) duh
02:50yangsxin explore-clojure.clj from unit-test, there is (apply and '(true false)), but Clojure seems to have changed in this respect
09:56ChouserHm, Rhino appears to have continuations, so if people *really* want that in Clojure... ;-)
12:23drewrCan I undo the effects of defonce?
12:23drewrOr do I need to restart the JVM?
12:24drewrI used it on a database conn that went away and I need to bind the symbol to a new one.
12:28ChouserI think you can, hang on.
12:30Chouserns-unmap
12:30drewrAh, OK.
12:31drewrAnother q.
12:32drewrI have /path/to/foo on the classpath and a file /path/to/foo/foo.clj exists with (ns foo ...) in it.
12:33drewr(ns bar (:require (foo))) tells me "No such namespace: foo."
12:33Chouserthe "standard" diretory layout would be to have /some/path/foo/foo.clj, and to put /some/path in your classpath
12:34drewrI mistyped, sorry. /path/to is on the classpath.
12:36Chouser(ns bar (:require foo))
12:36drewrSo you only use parens when you're importing multiple symbols.
12:37drewrI mean multiple symbols in a particular namespace.
12:37drewrLike (import (package class class ...)).
13:52Chouserdrewr: yeah, I guess you're right.
13:52Chouser(ns bar (:require (clojure.contrib [mmap :as mmap] zip-filter)))
14:02Chouserrhickey: I imagine you're busy -- do you have time for me to quiz you a bit on some BitmapIndexedNode details?
14:03rhickeyyou could try me, might be a gap till reply
14:03Chouserok, my implementation is failing, so there's some discrepency between your java and my js that I'm not seeing.
14:04Chouserare any of these assertions false? 1. the nodes array is always full (no nulls)
14:05rhickeyalways full
14:05Chouser2. if a new node needs to be added at a given level, it's inserted at the index produced by the index method, possibly scooting some older ones on down the array.
14:08rhickeyyes
14:08ChouserI guess (2) is the crux. Looking at the code it seems it has to be true, but if so I don't understand how the older values are ever found.
14:08Chouser*sigh*
14:09ChouserI guess I can try stepping through the java. :-/
14:10Chouseroh!
14:17avidaChouser: your ClojureScript uses Rhino?
14:18Chouseravida: ClojureScript generates "standard" JS, so as long as you're not trying to use the browser's DOM, you can use it in Rhino.
14:19ChouserWhy you would (other than for testing) I can't imagine -- if you've got Rhino, you've got the JVM; if you've got the JVM, use Clojure for goodness' sake.
14:20avidaI'm embedding rhino in and jetty in my clojure program for a javascript app server. one langage on the backend and client
14:22Chouserwoo! over that hurdle. rhickey: thanks for the hand.
14:22Chouseravida: that makes sense, but I don't see why anyone would use clojurescript in that scenario.
14:23Chouseravida: yours is for if you want to use JS in both browser and server, right?
14:23Chouserclojurescript would allow you to use clojure (or something very like it) in both browser and server.
14:26avidamine is for JS; was just curious about clojurescript since you mention it with rhino earlier
14:30avidaactually you just mentond rhino and clojure by itself (continutations)
14:34Chouseryeah, that was a joke. That would be one very goofy reason for using ClojureScript on Rhino -- continuations might work, at the cost of a lot of speed and several other clojure features (STM, agents, etc.)
14:38abrooks_Chouser: Aside from Rhino there's also SpiderMonkey which can be used standalone and built into other systems which don't use DOM.
14:39Chouserabrooks: indeed.
14:39Chouseralso qtscript
14:39abrooksHm. I'm guessing the proxy.pac environment is probably too restricted for ClojureScript.
14:40abrooksNot that I really nead Clojure to write my proxy files...
16:41abrooksShouldn't (import '(DOESNOTEXIST)) raise an exception?
16:41abrooksThis happens in the latest trunk as well as the 20080916 release.
16:43Chouserwell, you're asking it to load nothing from a package named DOESNOTEXIST
16:44Chouser(import 'DOESNOTEXIST) is asking to load a non-existant lib, and does throw an exception
16:45Chouserin your example, it successfully does the nothing you ask for.
16:45abrooksOh, for some reason I thought it would load everything from that package.
16:45abrooksHrm. Is there a wildcard?
16:46Chousergah, I keep forgetting the difference between import and require
16:47Chouserreplace "lib" with "class" in my above statements. :-)
16:47Chouserthere is "by design" no wildcard import
16:47abrooksCan one introspect on a package to see what classes are in there?
16:48ChouserI think I asked that once...
17:02Chouserabrooks: http://groups.google.com/group/clojure/msg/f9c20b5878cd7d13
17:05abrooksHm. How does Java support "import foo.bar.*;"? Outside of java.lang.reflect, apparently.
17:05abrooksChouser: Thanks, BTW.
17:06abrooksThis is so opaque.
17:06abrooksI haven't found any verbose or debug options that can even tell me where it's looking to determine how I'm failing.
17:09ChouserJava does that kind of resolution at compile time. For all I know it could walk the entire directory tree for each wildcard import and index all the class files it finds.
17:11abrooksOh, right, gross... I forgot Java was so... static. :)
17:14drewrIs connection pooling built into JDBC yet?
17:14drewrI started to reinvent the wheel in clojure but I might not need to.
17:15Chouserit's built into some servlet containers. not sure about jdbc.
17:15abrooksArg. All of this is moot. The jar file I downloaded from jna.dev.java.net was apparently not loadable like that.
17:15abrooksI would still like better transparency on class loading but I'm rolling now.
17:16Chouserloadable like what?
17:17abrooksIf I new better jargon I may not be having issues here... :)
17:17Chouser:-)
17:18abrooksI downloaded linux-amd64.jar and put it in my classpath and no contortions of import could load the classes.
17:18abrooksDownloading jna.jar works as expected: (ns user (:import (com.sun.jna Library Native Platform)))
17:18Chouserhuh.
17:22Chouserdoes apply work lazily on multimethods?
17:27Chouserno, apparently it does not.
19:17brweber2awesome talk at jvm lang summit!
19:48Chouserbrweber2: rhickey talked?
19:48brweber2yes
19:48brweber2was excellent
19:49Chousercool. well received?
19:49brweber2I hope so
19:49Chouser:-)
19:49brweber2very techie crowd and I think they liked it
19:49fyuryuI hope he'll be able to lobby for changes useful to Clojure ;-)
19:49brweber2he had fewer changes necessary than most
19:49brweber2he just listed 2 things
19:50brweber2fortress and others lobbied for much more
19:53brweber2what changes would you have lobbied for?
19:53fyuryuTCO, tagged numbers
19:53ChouserI bet tagged numbers was on his list
19:54brweber2tail calls and fixnums I think were the two if I recall correctly
19:54brweber2I assume fixnums and tagged numbers are the same thing?
19:56fyuryubrweber2: probably. What I mean is: no boxing on nums
19:56brweber2yup, same concept
20:28ChouserThe new print multimethod really increased the amount of runtime support required by boot.clj.
20:42shooverChouser: Because of all the clojure.lang.* names in defmethods?
21:46Chousershoover: those, plus defmulti itself which requires sets and hashes at boot.clj-load time.