#clojure log - Sep 25 2008

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

0:30 avida: is there an identity function such that (identity x) = x ?

0:31 dude, there is such a function, named identity :) duh

2:50 yangsx: in explore-clojure.clj from unit-test, there is (apply and '(true false)), but Clojure seems to have changed in this respect

9:56 Chouser: Hm, Rhino appears to have continuations, so if people *really* want that in Clojure... ;-)

12:23 drewr: Can I undo the effects of defonce?

12:23 Or do I need to restart the JVM?

12:24 I used it on a database conn that went away and I need to bind the symbol to a new one.

12:28 Chouser: I think you can, hang on.

12:30 ns-unmap

12:30 drewr: Ah, OK.

12:31 Another q.

12:32 I have /path/to/foo on the classpath and a file /path/to/foo/foo.clj exists with (ns foo ...) in it.

12:33 (ns bar (:require (foo))) tells me "No such namespace: foo."

12:33 Chouser: the "standard" diretory layout would be to have /some/path/foo/foo.clj, and to put /some/path in your classpath

12:34 drewr: I mistyped, sorry. /path/to is on the classpath.

12:36 Chouser: (ns bar (:require foo))

12:36 drewr: So you only use parens when you're importing multiple symbols.

12:37 I mean multiple symbols in a particular namespace.

12:37 Like (import (package class class ...)).

13:52 Chouser: drewr: yeah, I guess you're right.

13:52 (ns bar (:require (clojure.contrib [mmap :as mmap] zip-filter)))

14:02 rhickey: I imagine you're busy -- do you have time for me to quiz you a bit on some BitmapIndexedNode details?

14:03 rhickey: you could try me, might be a gap till reply

14:03 Chouser: ok, my implementation is failing, so there's some discrepency between your java and my js that I'm not seeing.

14:04 are any of these assertions false? 1. the nodes array is always full (no nulls)

14:05 rhickey: always full

14:05 Chouser: 2. 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:08 rhickey: yes

14:08 Chouser: I 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:08 *sigh*

14:09 I guess I can try stepping through the java. :-/

14:10 oh!

14:10 * Chouser digs into it again.

14:17 avida: Chouser: your ClojureScript uses Rhino?

14:18 Chouser: avida: 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:19 Why 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:20 avida: I'm embedding rhino in and jetty in my clojure program for a javascript app server. one langage on the backend and client

14:22 Chouser: woo! over that hurdle. rhickey: thanks for the hand.

14:22 avida: that makes sense, but I don't see why anyone would use clojurescript in that scenario.

14:23 avida: yours is for if you want to use JS in both browser and server, right?

14:23 clojurescript would allow you to use clojure (or something very like it) in both browser and server.

14:26 avida: mine is for JS; was just curious about clojurescript since you mention it with rhino earlier

14:30 actually you just mentond rhino and clojure by itself (continutations)

14:34 Chouser: yeah, 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:38 abrooks_: Chouser: Aside from Rhino there's also SpiderMonkey which can be used standalone and built into other systems which don't use DOM.

14:39 Chouser: abrooks: indeed.

14:39 also qtscript

14:39 abrooks: Hm. I'm guessing the proxy.pac environment is probably too restricted for ClojureScript.

14:40 Not that I really nead Clojure to write my proxy files...

16:41 Shouldn't (import '(DOESNOTEXIST)) raise an exception?

16:41 This happens in the latest trunk as well as the 20080916 release.

16:43 Chouser: well, you're asking it to load nothing from a package named DOESNOTEXIST

16:44 (import 'DOESNOTEXIST) is asking to load a non-existant lib, and does throw an exception

16:45 in your example, it successfully does the nothing you ask for.

16:45 abrooks: Oh, for some reason I thought it would load everything from that package.

16:45 Hrm. Is there a wildcard?

16:46 Chouser: gah, I keep forgetting the difference between import and require

16:47 replace "lib" with "class" in my above statements. :-)

16:47 there is "by design" no wildcard import

16:47 abrooks: Can one introspect on a package to see what classes are in there?

16:48 Chouser: I think I asked that once...

17:02 abrooks: http://groups.google.com/group/clojure/msg/f9c20b5878cd7d13

17:05 abrooks: Hm. How does Java support "import foo.bar.*;"? Outside of java.lang.reflect, apparently.

17:05 Chouser: Thanks, BTW.

17:06 * abrooks continues to be baffled by class loading, particularly with regard to JNA.

17:06 abrooks: This is so opaque.

17:06 I haven't found any verbose or debug options that can even tell me where it's looking to determine how I'm failing.

17:09 Chouser: Java 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:11 abrooks: Oh, right, gross... I forgot Java was so... static. :)

17:14 drewr: Is connection pooling built into JDBC yet?

17:14 I started to reinvent the wheel in clojure but I might not need to.

17:15 Chouser: it's built into some servlet containers. not sure about jdbc.

17:15 abrooks: Arg. All of this is moot. The jar file I downloaded from jna.dev.java.net was apparently not loadable like that.

17:15 I would still like better transparency on class loading but I'm rolling now.

17:16 Chouser: loadable like what?

17:17 abrooks: If I new better jargon I may not be having issues here... :)

17:17 Chouser: :-)

17:18 abrooks: I downloaded linux-amd64.jar and put it in my classpath and no contortions of import could load the classes.

17:18 Downloading jna.jar works as expected: (ns user (:import (com.sun.jna Library Native Platform)))

17:18 Chouser: huh.

17:22 does apply work lazily on multimethods?

17:27 no, apparently it does not.

19:17 brweber2: awesome talk at jvm lang summit!

19:48 Chouser: brweber2: rhickey talked?

19:48 brweber2: yes

19:48 was excellent

19:49 Chouser: cool. well received?

19:49 brweber2: I hope so

19:49 Chouser: :-)

19:49 brweber2: very techie crowd and I think they liked it

19:49 fyuryu: I hope he'll be able to lobby for changes useful to Clojure ;-)

19:49 brweber2: he had fewer changes necessary than most

19:49 he just listed 2 things

19:50 fortress and others lobbied for much more

19:53 what changes would you have lobbied for?

19:53 fyuryu: TCO, tagged numbers

19:53 Chouser: I bet tagged numbers was on his list

19:54 brweber2: tail calls and fixnums I think were the two if I recall correctly

19:54 I assume fixnums and tagged numbers are the same thing?

19:56 fyuryu: brweber2: probably. What I mean is: no boxing on nums

19:56 brweber2: yup, same concept

20:28 Chouser: The new print multimethod really increased the amount of runtime support required by boot.clj.

20:42 shoover: Chouser: Because of all the clojure.lang.* names in defmethods?

21:46 Chouser: shoover: those, plus defmulti itself which requires sets and hashes at boot.clj-load time.

Logging service provided by n01se.net