#clojure log - Dec 15 2008

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

1:21 Fennec: ello

1:21 i'm looking for a little getting-started/java-interop assistance

2:03 zakwilson: Fennec: What do you need to know?

2:04 Fennec: I've found+hacked up something to instantiate a few basic Swing components. right now I'm trying to figure out how to override the paint(Graphics g) method of a JPanel.

2:04 looks like 'proxy' has something to do with it likely

2:05 zakwilson: proxy is for subclassing or implementing interfaces.

2:06 So yes, you should be able to do that with proxy.

2:06 Fennec: graphicFrame (proxy [JPanel] [] (paint [g] (code goes here ...

2:07 zakwilson: Right

2:07 I think

2:11 * Fennec already got ##java to answer his java library questions :)

2:20 zakwilson: Fennec: Did proxy do what you expected?

2:20 Fennec: I think so (I think)

2:20 * Fennec is currently chasing down a paren-balance issue.

2:21 Fennec: ah, there's the problem. i was chasing down a ) when the problem was a missing ]. :P

2:23 huangjs: Is clojure suitable for numerical computing programs? is it possible to use unbox arrays, inlining functions and avoid runtime dispatching?

2:24 Fennec: okay, now I have an issue. :) http://pastebin.ca/1285744 -- Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: sun.java2d.SunGraphics2D cannot be cast to clojure.lang.IFn.

2:24 hiredman: it is possible to use unboxed arrays

2:25 zakwilson: I don't know if it's possible to unbox arrays. You can use Java arrays. You can inline functions with definline. You can avoid runtime reflection using type hints as metadata on function args.

2:25 hiredman: (doc make-array)

2:25 clojurebot: Creates and returns an array of instances of the specified class of the specified dimension(s). Note that a class object is required. Class objects can be obtained by using their imported or fully-qualified name. Class objects for the primitive types can be obtained using, e.g., Integer/TYPE.; arglists ([type len] [type dim & more-dims])

2:25 hiredman: definline you say, hmmmm

2:26 huangjs: i see. thanks.

2:26 is there any available benchmark result?

2:26 zakwilson: Fennec: The formatting of your code goes against generally accepted style rules for Lisp - specifically, the closing parens should be on the same line.

2:27 Fennec: noted

2:27 some time soon I shall get a decent editor that'll fix it for me :)

2:27 zakwilson: And there's some strange indentation there.

2:27 Fennec: oh, it's a complete mess, I agree :)

2:28 zakwilson: As a rule, Lispers use Emacs. This is a bit of a problem because it means learning a new editor and language at the same time for a lot of people. I'm not sure what the other options are for Clojure.

2:28 Fennec: ..... normally I'd use some emacs mode but I'm temporarily separated from my normal Linux SSH environment (vacationing, which is also why I get to look into this :)

2:28 the problem with Emacs is that I use emacs at work.

2:28 .... we have a lot of customizations at work.

2:28 ..... I'm used to F4 being magic and taking me to wherever something is defined.

2:29 hiredman: clojurebot: emacs?

2:29 clojurebot: emacs is hard, lets go shopping!

2:29 Fennec: also, shift-F5 should take me to the .t file for my current .pl script. :P

2:30 in the meantime, I've got this casting issue. :|

2:31 zakwilson: You should keep a copy of your .emacs file, but you're still probably better off with vanilla emacs for Clojure than just about anything else.

2:32 hiredman: Fennec: casting?

2:32 Fennec: Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: sun.java2d.SunGraphics2D cannot be cast to clojure.lang.IFn.

2:32 * hiredman scrolls up for the paste

2:32 Fennec: http://pastebin.ca/1285744

2:33 hiredman: are you using the latest svn?

2:33 Fennec: probably-not.

2:34 I'm using the lastest download-link thingy.

2:34 hiredman: hmmm

2:34 Fennec: as I've not bothered setting up svn on Windoze.

2:34 september 16 release? yeah, trifle old :|

2:34 zakwilson: You can download the latest svn version from the project site.

2:34 hiredman: (BufferedImage/TYPE_BYTE_GRAY) <-- this could be a problem

2:34 zakwilson: clojurebot: svn

2:34 clojurebot: svn is https://clojure.svn.sourceforge.net/svnroot/clojure/

2:34 * Fennec tracks that down

2:35 hiredman: I would remove the parens

2:35 Fennec: noted. but in my REPL, user=> (BufferedImage/TYPE_BYTE_GRAY) just says 10

2:36 hiredman: ok

2:36 well

2:36 *shrug*

2:36 Lau_of_DK: Good morning all

2:36 hiredman: preffered method call syntax is (.method object args)

2:37 zakwilson: Fennec: in graphicPoke, where you have (doto getGraphics ...) I think you might mean (doto g ...)

2:37 Fennec: hmm!

2:37 Chousuke: though for static methods, use /

2:38 Fennec: zakwilson- wait, I have (let [g (. image (getGraphics))] (doto g

2:39 cgrand: Good morning Lau_of_DK!

2:40 Fennec: well, I've tweaked it per some of those suggestions and now I'm getting a boolean cast issue so it might be betterish

2:40 Chousuke: Fennec: Note that if you update to SVN your dotos will break. The syntax now requires a dot for methods

2:41 Fennec: k

2:41 i saw a list of renamed thingies somewhere

2:41 i'll check that when I upgrade

2:41 zakwilson: http://pastebin.ca/1285755 <-- this doesn't throw any exceptions and displays a giant button, but doesn't do what I think you want it to do.

2:41 Note that it uses the new doto method syntax (with dots).

2:42 Chousuke: so instead of (doto frame (setLayout ...)) you need to (doto frame (.setLayout ...)) -- this change was done to allow mixing in clojure functions (they never have a . in front of them, because those mark java methods)

2:43 Fennec: zakwilson- yeah, that don't work for me :)

2:44 what I want => giant button; when you push it, a red line shows up Somewhere on the space above it.

2:44 zakwilson: Does it work if you remove the dots from the method names in the dotos?

2:45 Fennec: no, it keeps complaining it can't cast a java.lang.Boolean to clojure.lang.IFn at line 17

2:45 i'll try that svn upgrade

2:46 dhaya: Hey guys, I have a question regarding keyword equality, http://paste.lisp.org/display/72184 (in the above paste, why is the last hash different from the rest)

2:46 hiredman: Fennec: too many parens on line 17

2:47 Lau_of_DK: cgrand: oh my. Does this mean that youre back with us again? :)

2:47 hiredman: ((. g ....

2:47 ^- double wrapped

2:47 Chousuke: dhaya: hm

2:48 Fennec: ah :)

2:48 Chousuke: dhaya: keywords do not care about namespaces

2:48 dhaya: That seems to be causing problems during multimethod dispatch for me. I wonder changed that broke this behaviour.

2:49 Chousuke: dhaya: so :t/testkey is different from :my.test/testkey no matter what your namespace configuration is.

2:50 cgrand: Lau_of_DK: yup!

2:50 zakwilson: Fennec: this version works, but the line is grey, not red: http://pastebin.ca/1285759

2:50 Fennec: doh

2:50 i'm using a greyscale image mode :P

2:51 haha. anyway. awesome. *busy extracting clojure-svn*

2:51 zakwilson: What are you using for an editor?

2:52 Fennec: umm.... :)

2:52 notepad++ :P

2:52 Chousuke: emacs!

2:52 cgrand: dhaya: (= ::t/testkey ::my.test/testkey)

2:52 hiredman: clojurebot: emacs is also <reply>but I like using notepad++!

2:52 clojurebot: Alles klar

2:53 Fennec: hiredman- no I don't, not really :P

2:53 Chousuke: cgrand: ... that gives me a nullpointer exception

2:53 dhaya: crand: Thanks! That was it.

2:54 Chousuke: are you sure you're not abusing keywords there? :(

2:54 Fennec: shoot

2:54 where the heck did I put ant?

2:55 dhaya: Chousuke: I am following this : http://groups.google.com/group/clojure/msg/7be41dbb95a7cfdd

2:55 zakwilson: Fennec: http://dept-info.labri.u-bordeaux.fr/~strandh/Teaching/Langages-Enchasses/Common/Strandh-Tutorial/indentation.html

2:56 Fennec: :P

2:56 noted

2:56 will learn that

2:57 zakwilson: It's one of the few things that nearly all Lispers agree on.

2:57 And it will help you spot problems like the one you just had.

2:57 hiredman: vimclojure seems to indent if's differently than what is described there

2:58 Fennec: awesome.

2:58 aha! there is ant. knew I had a copy somewhere.

2:58 zakwilson: Does it line up the then and else clauses with each other and not with the test?

2:58 hiredman: yes

2:58 zakwilson: That's still readable.

2:58 hiredman: it puts the clauses under the f in the if

2:59 very much so

2:59 Fennec: awesome! it workses!

3:00 thanks a bundle. I shall now go play with this / learn syntax.

3:00 indentation. stuffs.

3:00 zakwilson: So does emacs. I'm not sure I agree with the article on some of the special forms.

3:00 hiredman: "It's one of the few things that nearly all Lispers agree on."

3:00 well, there goes that

3:01 zakwilson: General indentation for functions and special forms is standardized as described in the article.

3:55 Fennec: (defn sinfun [x] (cons x (cons (. Math (sin x)) nil))) ;; surely there's a smarter way to make a 2-element list?

3:56 cgrand: Fennec: (list a b)

3:56 but do you really want a list?

3:57 Fennec: what else is there? vector?

3:57 cgrand: yes

3:59 Fennec: my goal is to pass these to Graphics2D.drawLine(startX, startY, endX, endY).

3:59 * Fennec reads the data_structures page

4:07 cgrand: Fennec: does sinfun return a point?

4:07 Fennec: something like that.

4:07 yes.

4:11 holy cow it's 1am.

4:11 night all.

4:11 cgrand: I guess you have the choice between destructuring or indexed adressing:

4:11 (let [a (sinfun xa) b (sinfun xb)] (.drawLine g (a 0) (a1) (b 0) (b1))) ; works only with vectors

4:11 (let [[x1 y1] (sinfun xa) [[x2 y2] (sinfun xb)] (.drawLine g x1 y1 x2 y2)) ; works with lists or vectors

4:11 night

8:46 AWizzArd: How again can I see the classpath from within Clojure? It must be something similar to (.getProperty System "java.class.path")

8:47 Lau_of_DK: (System/getProperty "java.class.path")

8:47 AWizzArd: good, that works

8:48 Btw, why does the other version don't work?

8:48 Lau_of_DK: also try (.replace "good, that works" "Thanks")

8:48 AWizzArd: the replace also does not work

8:49 Lau_of_DK: The other one works here, but Im on an old rev., so maybe they removed the syntax

8:49 AWizzArd: I just checked out 1160

8:49 Could that be it?

8:49 Lau_of_DK: Yes sir

8:54 AWizzArd: Is there somewhere the description of the new syntax?

8:54 Lau_of_DK: Description: (Namespace/Method arguments)

8:54 :)

8:54 Chousuke: AWizzArd: it was recently changed

8:54 AWizzArd: i see

8:55 Chousuke: clojurebot: svn rev 1158

8:55 clojurebot: svn is https://clojure.svn.sourceforge.net/svnroot/clojure/

8:55 Chousuke: eh

8:55 AWizzArd: so, (String/replace "abc" "xyz") should work?

8:55 Chousuke: svn rev 1158

8:55 clojurebot: svn rev 1158; force instance member interpretation of (.method ClassName), e.g. (.getMethods String) works

8:55 Lau_of_DK: clojurebot: svn rev 1157

8:55 clojurebot: svn is https://clojure.svn.sourceforge.net/svnroot/clojure/

8:55 Chousuke: that was the change that broke (.getProperty System ...)

8:56 AWizzArd: hmm

8:56 Chousuke: it was intentional; you're supposed to use / with static methods

8:56 AWizzArd: okay

8:56 Chousuke: (.foo Classname) is now interpreted as Classname being an object of type Class

8:56 rhickey_: (.getProperty System) was always wrong, as (.foo bar) is for instance, not static, methods

8:57 AWizzArd: good to know

8:59 Chousuke: rhickey_: what about (. System getProperty "foo")?

8:59 rhickey_: Chousuke: nothing has changed about that

9:01 Chousuke: okay

9:01 rhickey_: latest doc: http://clojure.org/java_interop

9:04 Lau_of_DK: rhickey_: Im really very interested in the outcome of the work in regards to the problems Cliff Click pointed out, is this something that will be shared within the community at some point?

9:05 rhickey_: Lau_of_DK: which problems?

9:06 Lau_of_DK: Primarily the STMs performance problems, but also the byte-code "holes" that Clojure emits (this being completely secondary)

9:06 @ rhickey_

9:07 rhickey_: Lau_of_DK: what STM performance problems? He had good things to say about the STM

9:07 RSchulz: Lau_of_DK: One thing I think we can expect from the Sun JVM is the application on (the already-existing) escape analysis to allocate many local values on the stack, not the heap.

9:07 blackdog: Lau_of_DK, i sent you the link the last time you mentioned this

9:08 rsynnott: this? : http://blogs.azulsystems.com/cliff/2008/05/clojure-stms-vs.html

9:08 Lau_of_DK: Some of it was good, but he mentioned that when you increased the amounts of threads when there was contention for initially yield a little better throughput, and then crater (as he put it)

9:08 rhickey_: He also wrote his loop benchmark before bitops were inlined - I sent him a subsequent drop and he acknowledged to-the-metal perf from Clojure too on his blog

9:08 rsynnott: he doesn't seem to demonstrate that it is actually worse than locking, whne it comes ot it

9:08 Lau_of_DK: rhickey_: Cool

9:08 blackdog: I dont remember :(

9:09 rsynnott: Ok :)

9:09 rhickey_: Lau_of_DK: the crash and burn test he had ? about whether it was the code or some JVM bug - in non-conclusive analysis it looked like a JVM library reentrant read/write lock leak

9:09 i.e. not Clojure

9:10 Lau_of_DK: rhickey_: Ok, but that still makes it pretty interesting. But I think the link to his blog actually answers all my questions, I see he's echoed the entire conversation regarding the STM

9:10 rhickey_: the TSP Ant Colony Optimization came up and ran fine- full use of 600 cores

9:11 Lau_of_DK: uuuh

9:11 :)

9:12 rsynnott: rhickey_: do you have any plans to add a more extensive (CLOS-like?) object system?

9:13 Chousuke: I hear it generated an insane amounts of garbage though, but apparently for that system it amounted to almost nothing :P

9:13 -an

9:14 Lau_of_DK: Im not completely turned of by OOP, if I can be handled in a concurrent-friendly manner it'd be a welcome addition to Clojure

9:14 rhickey_: Chousuke: generating garbage is not a problem, the while poiunt was to demonstrate how cheap that has become - this is a test that churns constantly, so, the faster you can handle GC the faster it goes.

9:14 whole point

9:15 Chousuke: there's always room for improvement though. :)

9:15 but is it something you can do on the clojure side, or will you need JVM improvements?

9:16 rhickey_: Chousuke: I don;t understand your point, if you have a benchmark program that calls new at all, it will generate garbage, there's nothing to improve except not to call new, which would be a different program

9:17 the point is 600 cores calling new in a tight loop can handle gigs of garbage per second

9:18 Lau_of_DK: Impressive

9:21 Chousuke: certainly is

9:23 it's interesting how java has a reputation of being "slow"

9:23 rsynnott: does it?

9:24 Chousuke: maybe it's just the desktop apps.

9:24 rsynnott: I'd guess that's much the same as the Common Lisp reputation for being slow

9:24 duck1123: I think people have bad memories of applets trying to load

9:24 rsynnott: (that is a 'reputation' perpetuated by people who have either never used it, or last used it some decades ago)

9:24 Lau_of_DK: Java is slow in regards to desktop adds and those pesty applets

9:25 Chousuke: the jvm often takes a while to start and that gets interpreted as "slowness" and then generalised to the entire app

9:25 Lau_of_DK: .Net is fast though

9:25 Chousuke: or maybe the most common java desktop apps are just bloted and slow. :P

9:25 rsynnott: swing was not too fast, certainly

9:36 RSchulz: Chousuke: Something like IDEA proves that very large Swing applications can be very responsive.

9:36 I'd say the most pervasive remaining performance issue for Java is the very long JVM start-up time.

9:38 Chousuke: They seem to be working on that too

9:57 RSchulz: Chousuke: When I implemented my simple-minded interface that allows me to invoke from a Clojure REPL things that used to be run from the command line, the feeling of responsiveness was astounding by comparison to what I was used to.

10:39 duck1123: Does anyone know how to shut down a swank server? I'm not seeing a function for it.

10:41 deklund: duck1123: you mean above and beyond slime-quit-lisp ?

10:41 duck1123: I mean from within clojure, not emacs

10:42 drewr: duck1123: (System/exit 0)

10:42 duck1123: My problem is, I'm spawning a slime server within Tomcat, but when I shut down the server, it's not releasing the port

10:48 danlarkin: oh you want to use non exclusive ports

10:48 or whatever they're called

10:49 duck1123: I just want swank to shutdown/release the port when tomcat shuts down

11:22 danlarkin: duck1123: http://hea-www.harvard.edu/~fine/Tech/addrinuse.html

11:26 daswerth: Hi everybody. Does anyone know if there is a way to get at the xml that the API pages are generated from? Is there a place to download the API or the xml?

11:26 duck1123: danlarkin: thanks. It looks like that will help. (I need to read it again in full)

11:28 Chouser: daswerth: the API pages are generated from var metadata -- I don't know that they go through an XML stage

11:29 RSchulz: As I understand it, the Clojure.org Wiki software has its own mark-up format that they generate from the Var metadata.

11:35 daswerth: Oh, I see. What exactly is the "var metadata"

11:36 RSchulz: Evaluate ^var for some var and you'll see it.

11:36 There's lots of interesting stuff put there by the compiler, including doc strings.

11:36 Chouser: derefernced var: filter

11:36 var itself: (var filter) or #'filter

11:37 var metadata: (meta (var filter) or ^#'filter

11:38 RSchulz: Sorry. I got that wrong. I need to keep the Read documentation page open all the time. I should have checked first.

11:38 Chouser: and I forgot a paren. Don't beat yourself up. :-)

11:38 hiredman: RSchulz: what is this email about?

11:39 RSchulz: Eh?

11:39 hiredman: I don't understand what you are asking about the multiple defs in a macro

11:39 RSchulz: Which email?

11:39 daswerth: Great, thanks for your help. :)

11:39 RSchulz: I have a macro that yields three (def ...) forms and I was wondering if that was a good idea or not.

11:39 hiredman: don't see why not

11:39 RSchulz: It synthesizes two of the names from one of the arguments to the macro.

11:40 I guess I don't, either, but I wanted to check. As I mentioned, the first thing I noticed is that only one Var is returned, that of the last (def ...) form.

11:41 That was what I didn't like. In my case, there's potentially a lot of computation including disk and network I/O entailed by the extra defs, and that's probably a bigger issue but also what's making me uneasy about this particular case.

11:47 mfredrickson: RSchulz: could you do what you want with a destructuring form: e.g. (mydef [sym1 sym2 sym3] ...)

11:47 that way you are not introducing symbols the user didn't specifically name

11:48 RSchulz: Sure, I could let the user choose all the symbols. In fact, that's probably much better than what I did.

11:48 mfredrickson: as I understand it, automagically making symbols is (anaphoric macros?) is frowned upon in some camps

11:48 RSchulz: I think also in my particular case, the magnitude of the potential side-effect (on "legacy" Java classes) that are implied by that "all-in-one" macro are it's most troubling charcteristic.

11:49 mfredrickson: RSchulz: i see. i did not entirely understand the concern

11:49 RSchulz: Well, there's a camp for every frowny-face out there...

11:49 Probably I'm just making it up. I'm concerned about style and possible bad practices, but that doesn't mean everything I write will actually _be_ bad...

11:50 mfredrickson: and what a camp it would be: sad campfire songs, crying yourself to sleep in your bunk, making very morose handy crafts

12:20 replaca: RSchulz: I just did a similar thing for unit tests with my simple-tests macro: http://github.com/tomfaulhaber/unit_test/tree/master/unit_test.clj

12:20 Makes certain kinds of unit test sequences *much* easier to read

12:21 RSchulz: Github sure is overtaxed... Anyway, I think you can probably justify a lower standard of cleanliness in test code than in main-line code. Or is that heresy?

12:22 replaca: Well, that depends. You don't want test code to become a drag on your development

12:22 Also, gross code is gross wherever you find it :-)

12:22 RSchulz: What do you mean by overtaxed? Slow?

12:23 RSchulz: Yes. It takes forever for their pages to load.

12:23 replaca: Hmmm, I'm not having that problem. I wonder if that's just cause I'm a few blocks from them :-)

12:24 I know they were doing a hardware upgrade last night

12:24 hiredman: comes up fast here

12:25 duck1123: even when github is slow, I can usually load 2-3 pages to sourceforge's 1

12:25 hiredman: ugh

12:25 sf

12:25 replaca: Another argument in favor of multiply defining tests is that it makes them easier to *write* so I'm more inclined to write more cases

12:26 sf is *sooo* 2002 (insert 13-year-old girl eye roll here) :-)

12:29 gnuvince: Any math buffs in here? This is a rather simple question which is not properly explained in my text book. The notation f : x -> y = f(x), does that mean that f is a function from the domain x to the codomain y where the image of the function is f(x) ?

12:32 fogus: I am building keywords in my macros, but at the moment the way it's done is (keyword (str `~s))... Is there a better way?

13:06 Lau_of_DK: Good evening gents

13:16 durka: Chouser: show and source are great, but can I suggest a feature for show

13:16 namely some way to show the "interesting" methods, i.e. filter out methods that are just inherited from (say) Object

13:17 Chousuke: maybe add some optional :filter argument?

13:22 durka: hmm, (source show) doesn't look too scary

13:22 maybe i'll take some blind stabs later

13:22 now i really do have to go

13:38 Chouser: fogus: I can't think of a better way to get from a symbol to a keyword.

13:39 fogus: Chouser: I was afraid of that

13:40 Is there any reason why :~s is illegal?

13:46 RSchulz: fogus: It seems you're thinking that some kind of string concatenation will take place there, but that's not how it works.

13:48 I'm not entirely sure what happens, but probably the keyword parsing triggered by colon is interrupted by the reader macro character ~ yielding a "degenerate" keyword, which is not allowed:

13:48 Chouser: symbols and keywords are unrelated types, so I'd expect any "conversion" to have to go through a string.

13:48 RSchulz: user=> :

13:48 java.lang.Exception: Invalid token: :

13:48 fogus: RSchulz: '~s that does what I would expect, but :~s does not.

13:48 RSchulz: Because ' just wraps whatever reader entity comes next in (quote ...)

13:49 :, however, initiates the reading of a single reader entity, a keyword.

13:49 Chouser: fogus: you're sure you don't want to pass in keywords from higher upstream?

13:49 fogus: RSchulz: Understood

13:49 Chouser: Pretty sure

13:53 I'm working on a stupid little DSL that was poo-pooed on when passing in keywords... but is praised when my macros do the wrapping/unwrapping :)

13:54 Chouser: heh

13:54 good enough, then.

13:55 hm, that's not good: (namespace (keyword (str 'user/foo))) ==> nil

13:56 Chousuke: isn't that expected?

13:56 Chouser: fogus: and you also don't want to leave them as symbols internally?

13:56 Chousuke: you wouldn't expect a namespace of "user" and name "foo"?

13:56 Chousuke: keywords don't care about namespaces AFAIK.

13:56 Chouser: Chousuke: not true

13:56 (namespace ::foo) ==> "user"

13:57 (namespace :one/two) ==> "one"

13:57 fogus: I could do that... but the problem is that changing the top-level macros are a lot easier than changing the backend

13:58 Chouser: (keyword "one" "two") ==> :one/two

13:58 fogus: ok, just asking. what you've got seems fine, modulo that namespace issue I just mentioned.

13:58 fogus: Chouser: Thanks for the heads up

13:58 Chouser: fogus: you can of course put that little snippet in a 'to-keyword' function or something.

13:59 Lau_of_DK: Chouser: Did you check out that little something something I passed along? :)

13:59 fogus: Chouser: done. :)

13:59 Chousuke: hm.

13:59 interesting indeed

14:01 :user/user/foo has namespace user/user (is that valid?) but (keyword "user" (str 'user/foo)) has namespace user... they print the same, but are unequal

14:01 RSchulz: fogus: Does it actually matter whether the Key Words are actually Clojure keywords?

14:01 If you're writing a DSL, then you're using macros, presumably.

14:02 And if you're using macros, you control evaluation.

14:02 So the self-evaluating nature of keywords is less critical

14:03 Of course, their identity as functions (of Maps) may still be important, if you're using that aspect.

14:03 Chouser: Chousuke: It's ok to have / in namespace names, but not (I think) in symbol and keyword names

14:03 fogus: RSchulz: It does for that reason (identity as functions)

14:03 Chouser: There's an open issue about validating symbols and keywords created programmatically (instead of via the reader)

14:03 RSchulz: fogus: "It?"

14:03 Chouser: fogus: symbols also are functions of maps

14:04 fogus: RSchulz: Using keywords is kinda critical to the way that the DSL works.

14:04 RSchulz: Yes. I understand. I'm asking if that aspect of Clojure is essential to your use.

14:04 ...that aspect of Clojure keywords... that is.

14:04 fogus: RSchulz: yes

14:04 RSchulz: Well, OK.

14:04 Chouser: ('b '{a 1, b 2, c 3}) ==> 2

14:04 RSchulz: Hmmm... Did I know that already??

14:05 (Just musing, of course)

14:05 fogus: I didn't

14:05 Chouser: RSchulz: maybe -- it comes up as an issue on the group pretty often

14:05 fogus: Where were you about a week ago?

14:05 ;)

14:05 RSchulz: Uh-oh. I hear a proposition...

14:05 jawolfe: Hi, does anyone have tips on debugging? At runtime, I keep getting cryptic error messages like NullPointerException or ClassCastExceptions, where clojure.lang.Compiler.eval is at the top of the stack and the proper source file / line number is nowhere to be found in the stack trace.

14:05 Chouser: an issue because people mis-quote things: ('+ 1 2) ==> 2

14:06 Chousuke: heh

14:06 RSchulz: jawolfe: I wrote a function (pst2) ("printStackTrace 2nd") that does (.printStackTrace (.getCasue e)) to get at the nested exception.

14:06 I overloaded it with a zero-arity version that just goes straight to *e

14:07 jawolfe: RSchulz: hmmm, I don't understand but I'd like to try it out ...

14:09 RSchulz: jawolfe: Check it out:

14:09 (defn pst2

14:09 "Print the stack trace of the \"cause\" of the specified exception or *e if none passed"

14:09 ([] (.printStackTrace (.getCause *e)))

14:09 ([e] (.printStackTrace (.getCause e)))

14:09 )

14:10 fogus: Chouser: Thanks for the tips. I'm off to do some refactoring.

14:10 Chouser: fogus: ok, have fun!

14:10 jawolfe: RSchulz: thanks, I'm trying now

14:11 Chouser: jawolfe: you could paste the whole stack trace

14:11 RSchulz: Is paste.lisp.org still in melt-down mode?

14:12 Chouser: when the bot's not here, that's usually a clear sign

14:12 Choosing 'none' for the channel usually works though

14:12 RSchulz: It doesn't seem to allow specifying a channel, and of course if you don't, the bot can't post here (or anywhere)

14:12 jawolfe: Chouser: I don't have a specific bug right now, just the past few have been very hard to hunt down

14:13 Chouser: ah

14:13 RSchulz: jawolfe: Note, too, that sometimes there's a chain longer than two of exceptions. My function could be generalized to look deeper for those cases, but they seem less common.

14:13 Chouser: If it's a runtime bug, I can usually find my .clj in the stack trace *somewhere*.

14:14 jawolfe: RSchulz: Thanks! I'm still trying to figure out how to use this ... how do you catch exceptions again?

14:14 Chouser: If it's a compile-time bug, my .clj is often nowhere in the stack trace, but maybe in the top-level exception itself.

14:14 RSchulz: There's a special form try, but you dont' need to do that.

14:14 When you get an exception in the REPL, it binds *e to that exception.

14:14 jawolfe: Chouser: try this

14:14 (defn stupid [seq] (seq seq))

14:14 put that in your source file

14:15 compiles fine

14:15 when you run, no mention of the source file in the exception

14:15 RSchulz: You can't apply seq to a function. And seq is a function.

14:15 jawolfe: yes i know :)

14:15 i was rebinding seq by mistake and ran into this (not used to lisp-1)

14:16 Chouser: Both when I call (stupid) and (stupid 1), I get a correct file name and line number in the stack trace.

14:17 jawolfe: RShulz: in this example pst2 prints nil

14:17 RSchulz: You have to call it immediately after you get the exception in the REPL or else save an excpetion object to pass to the 1-arg version.

14:18 jawolfe: RShulz: oh, i probably cancelled the exception first

14:18 Chouser: try (stupid '(1 2 3))

14:18 Chouser: http://paste.lisp.org/display/72201 -- note lines 9, 20, and 21

14:19 that looks the about the same as the second trace in my paste -- different class name, but same filenames and line numbers.

14:20 jawolfe: are you using emacs/slime/swank?

14:20 jawolfe: hmmm, maybe it's something about how i'm testing then

14:20 Chouser: yes

14:20 Chouser: I'm not at all sure that particular development stack is doing Clojure and great service.

14:20 jawolfe: are you seeing stack traces like I pasted?

14:21 jawolfe: Chouser: my stack traces are different

14:21 Chouser: similar but with no useful file names, or completely different?

14:21 jawolfe: when I put the definition and invocation into seqs.clj, i get

14:21 RSchulz: When in doubt, quite and restart your Clojure REPL.

14:21 jawolfe: java.lang.ClassCastException: clojure.lang.PersistentList (seqs.clj:0)

14:21 [Thrown class clojure.lang.Compiler$CompilerException]

14:21 Restarts:

14:21 0: [ABORT] Return to SLIME's top level.

14:21 1: [CAUSE] Throw cause of this exception

14:21 Backtrace:

14:21 0: clojure.lang.Compiler.eval(Compiler.java:4153)

14:21 1: clojure.lang.Compiler.load(Compiler.java:4470)

14:21 2: clojure.lang.RT.loadResourceScript(RT.java:327)

14:21 3: clojure.lang.RT.loadResourceScript(RT.java:316)

14:21 4: clojure.lang.RT.load(RT.java:406)

14:21 5: clojure.lang.RT.load(RT.java:376)

14:21 6: clojure.core$load__1838$fn__1840.invoke(core.clj:3427)

14:21 7: clojure.core$load__1838.doInvoke(core.clj:3426)

14:21 8: clojure.lang.RestFn.invoke(RestFn.java:413)

14:21 9: clojure.core$load_one__1801.invoke(core.clj:3271)

14:22 10: clojure.core$load_lib__1821.doInvoke(core.clj:3308)

14:22 11: clojure.lang.RestFn.applyTo(RestFn.java:147)

14:22 12: clojure.core$apply__144.doInvoke(core.clj:374)

14:22 13: clojure.lang.RestFn.invoke(RestFn.java:443)

14:22 14: clojure.core$load_libs__1825.doInvoke(core.clj:3338)

14:22 15: clojure.lang.RestFn.applyTo(RestFn.java:142)

14:22 (sorry for flood)

14:22 this is consistently what i see, i tried updating to newest svn of clojure and same deal

14:22 if i do the invocation at the REPL, i don't get any mention of seqs.clj at all

14:22 Chouser: please use http://paste.lisp.org/ next time

14:22 Lau_of_DK: jawolfe: In emacs there's a nice mode, where with you can paste along stacktrace, and emacs will automatically make it an online Lisp paste and send that to the channel isntead

14:23 jawolfe: OK, sorry about that, will do

14:24 Chouser: jawolfe: yeah, I have no idea. My only guess is that slime/swank is somehow obscuring the true error

14:24 drewr: jawolfe: Hit 1 until you get there.

14:24 jawolfe: drewr: oh, wow

14:24 drewr: thanks

14:25 drewr: That shows the CAUSE. :-)

14:25 jawolfe: drewr: I never read that line, since with SBCL that says "Abort lisp procesS" or some such

14:25 drewr: Heh. I didn't either for the longest time.

14:26 jawolfe: wow, that will make my life much easier

14:26 thanks!

14:40 kotarak: Does anyone know, what the main differences between CPL and EPL are?

14:41 hiredman: kotarak: there is an faq, I forget where it is, my take away was "nothing"

14:41 but Iguess that cannot be right

14:43 drewr: Did the semantics change recently with import?

14:43 For some reason I can't do (import '(org.apache.commons.logging Log)).

14:44 danlarkin: too many licenses imo

14:44 drewr: Tells me java.lang.ClassNotFoundException: org/apache/commons/logging/Log

14:44 The jar shows up on the command line from ps.

14:44 -cp ...:/path/to/commons-loggin-1.1.1.jar:...

14:45 logging

14:45 I can't think of what else I'm doing wrong.

14:46 $ jar tvf ~/tmp/src/jar/commons-logging-1.1.1.jar | grep logging/Log.class

14:46 479 Thu Nov 22 00:28:06 CST 2007 org/apache/commons/logging/Log.class

14:46 Chouser: drewr: I don't think anything about that has changed recently.

14:47 drewr: Odd.

14:47 This has completely killed my productivity today.

14:50 Chouser: drewr: works for me.

14:51 drewr: trunk@1160?

14:51 Chouser: yep

14:51 you might do "ant clean" and rebuild clojure if you haven't

14:52 drewr: Yeah, that's how I rebuild.

14:52 Chouser: the error is coming from the import line?

14:52 drewr: Yeah, that's just an example though. None of my jars works for some reason.

14:52 I can (import '(java.io File)) though.

14:52 Chouser: oh my.

14:55 drewr: the output of this looks right?

14:55 (dorun (map println (.getURLs (ClassLoader/getSystemClassLoader))))

14:55 drewr: Hm, yep. All the stuff from -cp.

14:59 AWizzArd: 115 people in here, nice. What was the record so far?

15:00 hiredman: does your clojurebot keep track of the max number of visitors?

15:00 hiredman: no

15:01 lemme check if pircbot gives me an easy way to track that

15:02 oooh

15:07 clojurebot: max people?

15:07 clojurebot: max people is 116

15:07 AWizzArd: nice

15:08 hiredman: not done

15:15 now it's done

15:15 can't be bothered to figure out how to update the proxy live

15:15 AWizzArd: grats

15:17 hiredman: hmmm

15:20 drewr: No matching method found: sleep for class java.lang.Class

15:20 That's screwed up.

15:20 AWizzArd: drewr: you updated your clojure.jar?

15:21 You must say: (Thread/sleep ...)

15:21 hiredman: that just bit me

15:21 AWizzArd: I had the same, it was svn 1158. Rich explained that (.sleep Thread ...) always was wrong. Clojure was just so nice to allow it for a while.

15:22 hiredman: I hope I got all the static methods

15:24 drewr: AWizzArd: Ah, thanks!

15:27 hiredman: clojurebot: *

15:27 clojurebot: * is just for when you are lazy and sloppy

15:27 hiredman: clojurebot: * is also <reply>http://en.wikibooks.org/wiki/Java_Programming/StarImports

15:27 clojurebot: In Ordnung

15:28 kotarak: Is there a way to unquote things in a normal quote? (def bar 5) (quote (foo ~bar baz)) => (foo 5 baz)?

15:30 danlarkin: kotarak: no I think you'll need to use syntax-quote for that

15:30 Chouser: kotarak: I don't think so. The reader gets mad when it sees ~ outside of a `

15:31 kotarak: And there is no (quasiquote ....) for `, as is (quote ...) for '...

15:33 Chouser: kotarak: I think that's right.

15:33 drewr: (use [clojure.contrib.str-utils :as s]) => java.lang.ClassNotFoundException: clojure.contrib.str-utils

15:34 kotarak: drewr: you must quote the vector

15:34 drewr: Hm.

15:34 Why does this give me a different error? (use '(clojure.contrib.str-utils :as s))

15:35 Don't know how to create ISeq from Keyword.

15:35 kotarak: Because you use a list and not a vector

15:35 Chouser: drewr: that's trying to use a list of libs, str-utils, :as, and s

15:35 drewr: They're both seqs.

15:35 hm.

15:35 Chouser: vectors in 'use' and 'require' are for options on a particular lib, lists are for lists of libs

15:36 drewr: OK.

15:36 kotarak: drewr: hmmm.. I think a list is a list and a vector is a vector. You can both ask for seq, which is a view on them. But they on themselves are collections, not seqs.

15:36 Chouser: I find it pretty hard to use correctly, but I haven't complained much because I haven't come up with anything better

15:37 drewr: I know.

15:37 I normally use (ns) anyway, but I'm trying to figure out this importing mess.

15:37 Chouser: kotarak: almost. lists are one of the few (the only) collections which is its own seq

15:38 kotarak: Chouser: for lists, yes. But for general collections this is not the case.

15:40 Chouser: kotarak: right

15:40 drewr: There's nothing syntactically wrong with this, right? (import '(org.apache.poi.hssf.usermodel HSSFSheet))

15:41 It produces java.lang.ClassNotFoundException: org/apache/poi/hssf/usermodel/HSSFSheet. That doesn't smell like a syntax problem though.

15:42 user> (filter #(re-find #".*poi.*" (str %)) (into [] (.getURLs (ClassLoader/getSystemClassLoader))))

15:42 (#<URL file:/Users/aar/tmp/src/jar/poi-3.2-FINAL-20081019.jar>)

15:42 Chouser: (import '(foo.bar Baz)) ==> java.lang.ClassNotFoundException: foo.bar.Baz

15:42 My exception has dots instead of slashes

15:43 drewr: OS X did a Java update on me. What's your java -version?

15:43 java version "1.5.0_16" here.

15:43 Chouser: 1.6.0_0-b11

15:44 that could explain the different message

15:45 drewr: (.getProperty System "java.version")

15:46 "1.6.0_07"

15:46 Chouser: heh: No matching method found: getProperty for class java.lang.Class

15:46 drewr: Yeah, sorry.

15:46 (System/getProperty "java.version")

15:46 Chouser: "1.6.0_0"

15:46 drewr: Anyway, I still get java.lang.ClassNotFoundException: org/apache/poi/hssf/usermodel/HSSFSheet!

15:47 Chouser: can you slap together a little Java program to use that class and make sure that works?

15:49 drewr: How about this:

15:49 user=> (org.apache.poi.hssf.usermodel.HSSFWorkbook.)

15:49 #<HSSFWorkbook org.apache.poi.hssf.usermodel.HSSFWorkbook@609903f4>

15:49 user=> (import '(org.apache.poi.hssf.usermodel HSSFWorkbook))

15:49 java.lang.ClassNotFoundException: org/apache/poi/hssf/usermodel/HSSFWorkbook (NO_SOURCE_FILE:0)

15:49 How is that possible?

15:49 Chouser: wow

15:54 galdor: hi!

15:54 I'd like to use clojure for a school project

15:54 it must run as a java applet

15:55 so I think it would be a way to use lisp and stay on the requirements

15:55 I didn't see a lot of thing about applet programming in clojure

15:55 Chouser: galdor: It doesn't quite work yet.

15:55 RSchulz: Whence the requirement for execution as an applet?

15:56 Java applets in browsers are just a dead-end, if you ask me.

15:56 galdor: the teacher wants a web-based end-user interface

15:56 drewr: Is there a file limit to -cp?

15:56 galdor: BUT it's a language processing application

15:56 so I need sound input

15:57 Chousuke: galdor: can't you write the backend separately from the frontend?

15:57 galdor: it's flash or java

15:57 Chouser: galdor: I've got a small patch to Clojure which allows appletviewer to load a compiled Clojure app, but I've so far failed to get it to draw anything.

15:57 galdor: Chousuke: if I need java for the applet, what's the problem ?

15:57 RSchulz: drewr: None that matters, I don't think.

15:57 galdor: I read http://groups.google.com.sg/group/clojure/browse_thread/thread/f0c69735c5a9bd03/1e0dced366af9077?lnk=gst&q=webstart&fwc=1

15:58 if I can compile a clojure application to java bytecode, it should work, nop ?

15:58 Chousuke: galdor: applets run in a restricted environment and clojure doesn't quite like that. :/

15:58 there are things you can't do even with java if you're running as an applet

15:58 Chouser: galdor: you can sign the applet and that'll wor

15:58 galdor: your user has to click through a permissions step

15:59 RSchulz: Chousuke: What about WebStart / JLP? (It's JLP, right Java Launching Protocol or some such)? There you get to control the degree of sandboxing-style restriction, right?

15:59 JNLP, maybe?

15:59 Yeah, JNLP: http://java.sun.com/developer/JDCTechTips/2001/tt0530.html

16:00 galdor: Chouser: honestly, I don't care, I do not sell this application, I've to do it to get my diploma, that's it

16:00 as long as the teacher can click on a link, see the application running and test it, it's fine for me

16:00 RSchulz: If I was under deadline in a class, I wouldn't pin my hopes on Clojure in an applet right now...

16:01 galdor: it's clojure or bare-java

16:01 I know some lisp

16:01 RSchulz: Can't you make the case to your teacher that the browser is a non-essential element of the exercise?

16:01 galdor: I don't know java

16:01 RSchulz: Is this a programming class?

16:02 galdor: it's a computer science master, and a spoken language processing course

16:02 RSchulz: What languages are you comfortable with? What's the time-frame for completion?

16:02 galdor: if the user needs to download a jar, perhaps it will be ok

16:02 I'm a C programmer

16:02 RSchulz: Either way, Java would have to be installed on the system.

16:02 If you're a C programmer, I'd say Java is closer than Clojure.

16:03 galdor: but honestly, 2 months for a voip network with audio processing with C...

16:03 Guest38653: Can anyone tell me how to do if __name__ == "__main__" in clojure?

16:03 galdor: yep, but I hate C++ and java, and discovered lisp some months ago

16:03 love it

16:03 Guest38653: coming from python

16:03 RSchulz: (= __name__ "__main__")

16:03 Guest38653: Are you asking about pattern matching?

16:04 frodwith: it's a python idiom

16:04 zakwilson: Clojure is not the only option for a Lisp on the JVM. I believe Kawa makes it pretty easy to make applets.

16:04 Guest38653: In python, that would detect if the current module is the main module

16:04 frodwith: here's a package - if it's being run a script, do:

16:04 RSchulz: I know no Python.

16:04 danlarkin: Guest38653: you don't need the if __name__ == "__main__" idiom in clojure

16:05 Guest38653: Sorry, i'm new to irc, I think people are whispering at me? How do I whisper?

16:05 seraph: zakwilson: kawa is a scheme impl in java, just like sisc. there is also a new lisp impl in java called armedbear

16:06 zakwilson: seraph: Yes, I've heard of ABCL. I don't know if it's any good.

16:06 seraph: dunno if they can run java-applets, but i think all of them create bytecode at runtime and i dont think its allowed in an applet

16:07 galdor: zakwilson: I don't know, I googled for lisp on jvm, found clojure

16:07 seems used a lot recently

16:07 lot of resources, doc, people

16:07 zakwilson: Clojure is growing very fast right now.

16:07 Kawa, on the other hand has been around a while. I don't think it ever got a huge amount of attention.

16:08 http://www.gnu.org/software/kawa/Applet-compilation.html

16:08 galdor: if I have to learn a new thing, I'd like something I could reuse

16:08 clojure allow me to do concurrency, etc.

16:08 you link shows a nice example though

16:09 zakwilson: I think Clojure is more useful in general. On the other hand, Kawa will make it easy to do what you said you want to do.

16:11 mchurch: What is the best way to make arbitrary Unix/command-line calls in Clojure?

16:12 gnuvince: You mean like system()?

16:12 AWizzArd: Chouser: any news about Applets written in Clojure? Do you know what components are missing to make that work?

16:16 danlarkin: mchurch: (.exec (Runtime/getRuntime) "ls")

16:17 mchurch: danlarkin: Great. Thanks.

16:24 Chouser: galdor: someone did a signed applet in Clojure ages ago, so it should still be possible.

16:24 (where "ages" == "months")

16:25 I don't know how to go about doing that, but that's a directly you could look.

16:33 replaca: Guest38653: clojure works a little differently than python here because it's based on the jvm

16:34 seraph: replaca: i think Guest48653 already left

16:34 hiredman: clojurebot: max people?

16:34 clojurebot: max people is 116

16:34 replaca: Ahh, gave up, did he?

16:34 oh well/

16:41 AWizzArd: Chouser: do you mean galdor or AWizzArd?

16:41 Chouser: he does raise a good point. The closest we've got is (defn -main ...), which may be close enough.

16:42 AWizzArd: I meant galdor. My work with unsigned applets hasn't progressed much.

16:42 I think I've got a (very rough) patch that addresses the dynamic classloader issue, but I can't be sure because something else is failing and I'm not sure what.

16:57 danlarkin: Chouser: you better not move on to another language, we'll suffer too much :'(

17:02 Chouser: danlarkin: aw, what a sweet thing to say!

17:02 danlarkin: which should tell you something, since I am certainly not known for being sweet

17:04 drewr: To what is Chouser moving??

17:06 Chouser: I'm much more concerned about what happens in rhickey gets busy doing something else.

17:08 abrooks: Yes, at this point, Clojure seems quite vulnerable to "bus accidents". rhickey has a lot of the long term vision in his head. We should keep him very, very safe. :)

17:08 ... safe AND happy. :-D

17:09 Chouser: yes, and while I don't think I can do much about the former, we can all help with the latter.

17:10 ...one of the reasons I'm a big advocate of not whining about revision control choices, license choices, etc.

17:25 danlarkin: we could all chip in for a safety bubble

17:26 http://fashionindie.com/wp-content/uploads/2008/03/bubble_boy2.jpg ... even looks like rhickey's hair

17:26 drewc: danlarkin: i'd contribute :)

17:42 drewr: Chouser: It was -Xbootclasspath/a:clojure.jar!

17:44 hiredman: clojurebot: haskell?

17:44 clojurebot: No entiendo

17:44 hiredman: clojurebot: haskell is <reply>Yo dawg, I heard you like Haskell, so I put a lazy thunk inside a lazy thunk so you don't have to compute while you compute.

17:44 clojurebot: In Ordnung

18:32 Chouser: drewr: all your class-visibility weirdness?

18:32 drewr: just removed -Xbootpath and it worked?

18:33 drewr: Yep.

18:34 It seems to occur only with the poi jar in the mix. I was tired of investigating.

18:36 Chouser: yep. well, good to know.

19:29 RT/load uses baseLoader() which currently requires the custom dynamic classloader.

19:30 RT/load needs this apparently just to check timestamps to see if the .clj needs to be recompiled.

19:30 I would if it would be appropriate to allways use the contextClassLoader forthis.

19:30 rhickey: Chouser: probably

19:34 dreish: Has anyone else seen ridiculously bad threading performance running Clojure on Mac OS X? Like, pmap taking about ten times longer than map and only 140% CPU on a machine with 8 cores, whereas the same code on an 8-core Linux box runs about twice as fast as pmap?

19:34 rhickey: Chouser: I think we may need to have some explicit way to declare - No dynamic classloader please

19:34 dreish: (twice as fast _with_ pmap, I meant)

19:36 On Linux, with both IcedTea 1.7.0 and Sun's 1.5, I managed to squeeze roughly another 40% out of the benchmark discussed at http://groups.google.com/group/clojure/browse_thread/thread/972bab614b27c6f8?hl=en

19:37 Chouser: we have USE_CONTEXT_LOADER

19:38 if everything used RT/baseLoader instead of RT/ROOT_CLASSLOADER, then *use-context-classloader* would be sufficient.

19:39 ...assuming there was some way to set that value early enough.

19:40 rhickey: Chouser: yes, moving away from direct references to ROOT_CLASSLOADER is part of this change

19:48 drewr: If I need to keep an index looping through a seq, is (loop [x xs i 0] ... (recur (rest xs) (inc i))) the only way?

19:48 That there was a way to do it with doseq, but I'm not getting it.

19:49 mfredrickson: (doc indexed)

19:49 clojurebot: It's greek to me.

19:49 mfredrickson: (doc index)

19:49 clojurebot: Excuse me?

19:49 drewr: Er, "I thought that.."

19:50 mfredrickson: clojure bot is going senile: http://clojure.org/api#toc590

19:50 clojurebot: clojurebot is senile

19:50 clojurebot: Ack. Ack.

19:50 mfredrickson: though that may not be what i think it is

19:51 the function might be in clojure-contrib

19:52 drewr: i think what you want is (indexed ...) in clojure.contrib.seq-utils

19:53 wipewindows: anym americans here? can you drink tapwater in USA? everywhere?

19:53 in california?

19:54 mfredrickson: wipewindows: certainly in CA, but ironically they all drink bottled water

19:54 wipewindows: why?

19:54 mfredrickson: pretension

19:54 (says a former CA resident)

19:55 wipewindows: is your showerwater drinkable?

19:55 * drewr drinks tap water after filtering it for taste

19:55 mfredrickson: i always drink my showerwater when done. ;-)

19:56 slangan: which definition of pretension? 4?

19:57 mfredrickson: it was a joke. If my memory serves, the city of San Francisco forbids government agencies from buying bottled water. The state is getting it's act together

19:57 s/it's/its

19:57 arg

19:58 slangan: is bottled less wsteful?

19:58 mfredrickson: precisely

19:59 wipewindows: just thinking of it now watching a movie referencing it, im scandanivan and we are spoiled with it here

20:00 * drewr is interested how this conversation is going to end up being about clojure

20:00 * mfredrickson is confident knowing how IRC is always on topic

20:00 Chouser: clojure and tapwater are both free and highly recommended in the U.S.

20:01 wipewindows: programmabale nanotech -> clojure -> pure water -> profit

20:01 drewr: Clojure is way more free than tap water. :-)

20:01 Chouser: both have alternatives (java and bottled water, respectively) that amount to roughly the same thing, but require more work for everyone involved.

20:01 mfredrickson: a tap is like a lazy infinite sequence

20:02 wipewindows: lol

20:02 Chouser: while a bottle is definitely an Object.

20:03 dreish: Oh, wow, java -server makes a ginormous difference on the Mac.

20:04 mfredrickson: the help on java -server is great 'to select the "server" VM'

20:04 * mfredrickson is enlightened

20:04 dreish: I guess client programs need to run slowly so users don't get scared.

20:06 mfredrickson: they should have called it -enterprise

20:06 we all know adding the word enterprise makes things faster, better, stronger

20:12 RSchulz: svn 1160

20:12 svn rev 1160

20:12 clojurebot: svn rev 1160; Moved to Eclipse Public License - see epl-v10.html or http://opensource.org/licenses/eclipse-1.0.php

20:13 dreish: That one isn't GPL-compatible either.

20:15 rhickey: GPL isn't that one compatible either

20:15 mfredrickson: GPL isn't GPL compatible. ;-)

20:16 dreish: Why not BSD or LGPL?

20:17 rhickey: dreish: non-reciprocal

20:17 RSchulz: Take it outside, guys. (;-)

20:17 dreish: I'm not complaining, promise.

20:19 clojure-contrib will move too, right?

20:20 mfredrickson: i wonder if anyone has ever done a study of license effects. could that be feasibly measured?

20:20 rhickey: dreish: yes, EPL is not different from CPL in any significant way, the move is just to stay with the latest version of that license tree

20:21 mfredrickson: (can you tell I'm writing up a lab experiment paper right now?)

20:21 hiredman: hah!

20:21 dreish: From what I'm reading it just removes some of the more severe patent-retaliation terms of the CPL.

20:21 hiredman: then I was right

20:22 I knew there was no difference!

20:22 RSchulz: Is this supported: (into-array CLASS collection) where CLASS is an instance of java.lang.Class? If not, is the removal of the CLASS argument a recent change?

20:23 hiredman: You know what would be a cool feature for clojurebot? The ability to "grep" through SVN commit comments.

20:23 rhickey: user=> (into-array Class [])

20:23 #<Class[] [Ljava.lang.Class;@6237e0>

20:23 RSchulz: I ask because the docs on the Java interop page don't list the form with class first, but I have some (slightly) older code that does.

20:23 hiredman: RSchulz: ugh, yeah, but, blarg

20:23 RSchulz: Absolutely. Blarg on it all!

20:24 rhickey: (doc into-array)

20:24 clojurebot: Returns an array with components set to the values in aseq. The array's component type is type if provided, or the type of the first value in aseq if present, or Object. All values in aseq must be compatible with the component type. Class objects for the primitive types can be obtained using, e.g., Integer/TYPE.; arglists ([aseq] [type aseq])

20:24 RSchulz: (find-commit "made splorg extra spiffy")

20:24 hiredman: I am more interested in getting sandboxed code execution

20:24 RSchulz: Ah. So I put a bug in your brain, eh?

20:24 hiredman: you and a few others

20:25 RSchulz: rhickey: OK. I must have written that code from the (doc ...) string, but just now was looking at the Java Interop page, which doesn't mention the Class argument.

20:25 hiredman: hanging in #java now, getting bot envy for javabot

20:34 bradbev: As I'm starting to leverage some of Java's libraries I am finding that my class path is getting huge. Is there some convention that Java/ANT has where I can tell Java packages to install to a particular location & just have that in my classpath? Sorry for the Java rather than Clojure question.

20:35 hmm, actually I'll ask in #java also...

20:35 RSchulz: Q: Is there something one must do to / with an Agent so the JVM does not hang at shut-down?

20:36 rhickey: bradbev: -Djava.ext.dirs

20:36 setthat to some dir and dump jars in it

20:37 bradbev: awesome, that's exactly what I was wanting

20:37 thanks much!

20:40 RSchulz: Q...: Aside from calling (await ...) on those agents, of course.

20:41 rhickey: RSchulz: (find-doc "agent")

20:41 will yield:

20:41 (doc shutdown-agents)

20:41 clojurebot: Initiates a shutdown of the thread pools that back the agent system. Running actions will complete, but no new actions will be accepted; arglists ([])

20:42 RSchulz: I see...

20:42 Is there a good way to unburden the use of a function that itself uses Agents under the hood from remembering to call this function?

20:42 (...the _user_ of a function...)

20:46 dreish: RSchulz: are you using Script.java?

20:46 RSchulz: No. I'm just running in a REPL.

20:46 dreish: Trying to exit with Ctrl-D?

20:47 RSchulz: Yes.

20:48 dreish: Maybe main() should call that after the for (;;) loop.

20:48 Can't really think of any good reason not to do that.

20:48 RSchulz: rhickey: What do you think about that suggestion? Should (shutdown-agents) be implicit in exiting the REPL?

20:50 dreish: (It must be one of my better ideas if it's taking him this long to figure out what's wrong with it.)

20:52 hiredman: http://gist.github.com/36217 <-- sandbox

20:53 RSchulz: Epiphany?

20:54 Oh, that's too easy... Scratch that... Too simple. As wel all know, "simple isn't the same as easy."

20:55 hiredman: it will need some tuning

20:55 I am sure

20:55 that just sort of blocks IO right now

21:03 RSchulz: hiredman: Interesting. I just dealt with conveying I/O from a sub-process (OS-level) to *out*. A simple copy loop sent to an agent works well.

21:06 hiredman: I think I misinterpreted "blocks". I thought you mean "blocks" as in "stalls".

21:06 You mean it prevents I/O entirely, yes?

21:10 bradbev: if I use gen-interface, will it be loaded & ready to go as soon as I evaluate it?

21:10 I'm trying to basically do http://groups.google.com/group/clojure/browse_thread/thread/77e626c5440bf1a0/487327209b633451?lnk=gst&q=gen-interface#487327209b633451 - but I can't load contrib.gen-interface due to a name conflict

21:15 Chouser: bradbev: clojure.core/gen-interface is for generating interfaces at AOT compile time

21:16 hiredman: RSchulz: yes

21:17 RSchulz: bradbev: Did you look at (proxy ...)?

21:17 bradbev: ok - is there a way to gen the interface that JNA appears to need to fill out? (I'm guessing that JNA constructs a class adhering to your Interface when it does the load)

21:17 Chouser: bradbev: if you're sure you want the less-supported runtime loading behavior of clojure.contrib.gen-interface, you can alias the function you need, and still useit.

21:18 bradbev: well, I'm not _sure_ - but I do want to poke around with JNA from clojure

21:19 RSchulz: Q Re shutdown-agents: Is there a way to "put individual agents to rest?"

21:20 bradbev: Chouser: sorry to be daft - how do I alias like that? I thought (ns test

21:20 (:require [clojure.contrib.gen-interface :as gi])

21:20 (:import (com.sun.jna Library Native Platform))) would do the trick, but I have a name conflict

21:20 Chouser: bradbev: for playing around in a repl, it's probably appropriate to use gen-and-load-interface

21:21 bradbev: yeah, that's what I figured

21:22 RSchulz: Chouser: Does gen-and-load-interface still exist? Thought all the gen stuff was unified under (gen-class ...)?

21:23 Chouser: bradbev: sorry, working on the alias line. this still doesn't come naturally to me

21:23 RSchulz: yes, it's still in clojure-contrib

21:24 bradbev: np Chouser - I'm glad for any help.

21:24 RSchulz: Ah. But is it advisable? Or just a matter of clinging to the past?

21:25 bradbev: RSchulz: the clojure/core stuff looks to only be useful when compiling a module too. I just want to mess around from slime for right now

21:26 - although using compile file isn't getting be there with gen-interface either :(

21:26 RSchulz: OK, but as a Vimmer, I have no insight to offer to Emacsians...

21:26 Chouser: yeah, I'd recommend not using gen-and-load-anything except for "playing"

21:26 RSchulz: Frankly, I anxiously away the next release of Enclojure.

21:27 ___ANXIOUSLY___

21:28 You out there Eric T? Give Us Our ENCLOJURE!!

21:28 ...Sorry... Lost my composure there.

21:29 Chouser: at least you still have your compojure

21:30 RSchulz: And eventually I'll get my composure back, too! What a deal.

21:31 No... Time for supper.

21:31 Gah. "Now... Time for supper."

21:31 Who invented the keyboard, anyway?

21:32 Chouser: oh! figgin' bug in gen-interface.

21:33 RSchulz: And by a guy whose name is a near homophone to my own, actually, and from the town of my own birth! ... None of it helps...

21:34 Christopher Sholes.

21:34 bradbev: Chouser: bug?

21:40 Chouser: bradbev: update to clojure-contrib rev 308 and then:

21:40 (use '[clojure.contrib.gen-interface :only (gen-and-load-interface) :rename {gen-and-load-interface load-iface}])

21:40 bradbev: yesh

21:40 ok :)

21:41 Chouser: heh. or just (use 'clojure.contrib.gen-interface)

21:41 I've renamed things so they no longer conflict.

21:41 bradbev: cool

21:42 thanks man, at least I can use the gen-interface stuff now! will let you know how I get on...

21:43 Chouser: great

21:46 bradbev: errr. I don't spose gen-interface handles varargs at all? No matter if it doesn't - I just won't wrap printf

21:47 Chouser: bradbev: i think java varargs are always just an Object[] as the last arg.

21:47 bradbev: ah

21:47 so the Object... syntax just won't work

21:50 Chouser: right

21:50 bradbev: yah - JNA works. Thanks a bunch Chouser. Though it did have a cow with the printf decl - ['printf [String Object[]] Void]

21:50 Chouser: yeah, that won't work either -- I'm not sure how to specify an array

21:51 bradbev: hmm, so does that mean that clojure-core/gen-interface also can't specify arrays?

21:53 Chouser: there's got to be a way

21:53 bradbev: yeah - well it doesn't bother me too much :)

21:53 thanks again for all the help

21:53 Chouser: well, it bother me, now.

22:01 oh, wait, you don't need specify methods that are provided by base classes.

22:01 slangan: If I want tocall octave or C++ code from Clojure, how do I do?

22:03 Chouser: slangan: that's what my conversation with bradbev was just about.

22:10 alphazero: Hi all.

22:11 Chouser: Well, there's got to be a better way, but this works: (gen-and-load-interface 'x.Foo8 [] ['m [Integer (class (make-array Object 1))] Void/TYPE])

22:11 alphazero: hi!

22:12 alphazero: chouser: was that issue with arrays related to the jvm's naming of array classes?

22:15 (.getName (.getClass (.getMethods (.getClass (new Object)))))

22:15 * alphazero wonders if clojurebot is sleeping on the job?

22:16 durka: "[Ljava.lang.reflect.Method;"

22:17 alphazero: durka: yep. that leading [ .. is that the problem?

22:17 durka: sorry, what problem?

22:18 clojurebot: are you asleep?

22:18 clojurebot: Pardon?

22:19 alphazero: durka: something about not being able to spec arrays bother Chouser earlier.

22:19 bothering

22:19 * alphazero steps out for a bit to drink some bottled water ...

22:20 gnuvince_: How would you get a bunch of agents to write into a ref?

22:22 (and know when all agents are done)

22:23 durka: Chouser: why does ('+ '1 '2 '3) give an illegal arg exception?

22:23 i understand the example after that, with the map

22:24 gnuvince_: durka: you cannot call a symbol

22:25 Hmmm

22:25 durka: well, => ('+ {'+ "plus" '- "minus"})

22:25 "plus"

22:25 gnuvince_: apparently you can.

22:25 durka: you can sometimes

22:25 gnuvince_: Yeah, sorry

22:25 I guess they work like keywords then

22:25 durka: (fn? '+) false, but (ifn? '+) true

22:26 hiredman: the '+ , the symbol + is not a function

22:27 but symbols are callable

22:27 durka: it looks like clojure.lang.Symbol has invoke methods with one and two Objects

22:27 the one-arg would be the map usage

22:27 hiredman: two arg is also for map

22:27 map and default

22:28 durka: ah

22:28 thanks

22:32 Chouser: sorry guys, stepped out. Glad you figured it out. :-)

22:33 durka: question on idioms

22:33 since map is lazy i've been wrapping it in doall at the REPL

22:33 does that make sense

22:33 i.e. (doall (map prn <seq>))

22:34 Chouser: at the repl there's no need, as the Print part of REPL will print the whole thing

22:35 ...unless you set *print-length*, which you should

22:38 * durka sets *print-length*, and notices that asking for a value such as => *print-length* causes Gorilla to hang

22:39 Chouser: :-(

22:42 slangan: anyone into nanotech here?

22:44 gnuvince_: going to bed

22:44 Later all

22:44 Chouser: gnuvince_: g'night

22:45 slangan: if by nanotech you mean very small programs, I'm all over it.

22:46 slangan: lol

22:47 im thinking I should study materials science and nanotech

22:47 perhaps, im into computer games and machine learning but the rest of CS doesnt interes t me that much

22:47 and nanotech seems supercool

22:47 and useful

22:48 * Chouser begins studying classloaders

23:55 durka: Chouser: I was playing with clojure.contrib.repl-utils::show

23:56 i don't know much about reflection, but sometimes the output is "cleaner" (to my eyes) using .getDeclared{Fields,Methods,Constructors} instead of .get{Fields,Methods,Constructors}

23:57 for example, with clojure.lang.Symbol you avoid printing the 22 different variations of .invoke()

Logging service provided by n01se.net