#clojure logs

2008-10-01

00:56abrooksCool. I've not SEGV'd the JVM before.
01:00abrooksBTW, that was not using JNA or any non-stock Sun JNI.
01:00arohnerimpressive.
06:33H4nshi. i'm looking at clojure-contrib/src/clojure/contrib/zip_filter/xml/ and the example shows that i'd want to call (zip/xml-zip (xml/parse ...)) to turn some xml into a data structure that zip_filter can handle. zip/xml-zip does not seem to exist anymore, though. can anyone help? i'll also email the maintainer, but i'd like to progress.
06:48H4nsah. never mind me again.
11:38ChouserH4ns: so is zip-filter behaving for you now?
11:46H4nsChouser: yes - to the extent that i can run the example. i have not yet figured out how i can collect multiple sub-elements of an element that i have found. is there something that i could read to learn more, text or code?
11:49ChouserI thought it was self-documenting. ha ha.
11:50Chousereach step of the filtering process creates a seq of zip-trees, and expects to consume a seq of zip-trees.
11:51Chouserso you're always dealing with multiple sub-elements. Do you mean you've found one specific element and you're want to pull data from a few different kinds of sub-elements beneath it?
11:53H4nscorrect - i am in fact parsing a rss document and want to extract certain elements out of each item for processing. i might even do the processing while walking the tree, but currently i'm trying to bend my head around the syntax and the basic functionality.
11:53Chouserin that case, you'll want to store the element you've got (using let or by passing it to another fn or whatever), and then use a new xml-> expression on that for each of the sub-elements you want.
11:54Chouserperhaps something like (for [e (xml-> doc ... :item)] {:author (xml-> e ... :author text), :title (xml-> e ... :title text)})
11:55Chousersomething like that would return to you a seq of hash-maps with the details you want.
11:55H4nsah, ok - so you say i would basically traverse the subtree multiple times. i think i was trying to traverse it from within the initial traversal.
11:56H4nsthat makes a lot of sense, thank you very much!
11:56Chouserwell, any common traversal can be done once, but then if you want to "branch" and follow different sub-paths, yeah, you'll want to traverse each of them separately.
11:57ChouserBTW, you might also look at clojure.contrib.lazy-xml which you can drop in as a replacement for clojure.xml
11:58H4nsi have looked at that, but i first need to learn some basics.
11:58Chouser:-) ok
11:59H4nswhat is a "java.lang.IncompatibleClassChangeError"? i get that when trying to execute a slightly (!) edited version of the for loop
12:00H4ns(for [e [1 2 3]] ...) works, (for [ e (xml -> ...)] ...) gives me the error
12:00H4ns(xml-> ...) works
12:01H4nsah. no. never mind me.
12:01H4nsthe error message is kind of, well, uhm, disconnected from what i typed.
12:03H4ns(xml-> :foo) creates a java.lang.IncompatibleClassChangeError, which strikes me as odd.
12:06Chouserwell, it's expecting an zip xml node, not a keyword. I guess the error could be more specific.
12:07H4nsi'm not complaining. i was just mislead. i think i'll get used to the error messages once i can read clojure code better.
14:41H4nsis there a print friendly version of the documentation available somewhere? i can certainly walk the site and then create my own css, but maybe that has been done
14:42ChouserH4ns: I'm not aware of anything like that.
14:43ChouserIt's been mentioned before, though, so if you go to any kind of effort people on the google group would probably be happy to know about it.
14:44H4nsChouser: ok, thanks. i'll look into that and post to the group if i have anything usable
14:45Chouseryou might even ask on the group first as well. Maybe somebody's got something and either hasn't mentioned it or I missed it.
14:45H4nsgood idea. will do.
15:21danlarkinclojure errors are not yet very helpful to me :-/
15:25drewrdanlarkin: You're not alone.
15:29danlarkinI've got the syntax for cond wrong, but I can't figure out why
15:30drewr(cond pred ... pred ...)
15:31drewrNo extra parens.
15:32danlarkind'oh!
15:33danlarkinthese slight differences with CL are throwing totally me off
15:33drewr;-)
15:33danlarkinespecially with no examples on the API page
15:33danlarkin*hint hint*
15:33drewrThere is much to be done in Clojureland.
15:34H4nsthere is this "clojure for scheme/cl programmers" page that would propably deserve an entry for cond
15:34H4ns"differences with lisps" it is.
15:38danm_hey guys, anyone familiar with the translation of the PCL simple database example to clojure?
15:39danm_just curious about the sync form, is that just to ensure that nothing happens to *db* if an exception is generated or somesuch?
15:42Chouserdanm_: I'm not finding that page, but dosync is about changing refs more than exceptions. Documented here: http://clojure.org/refs
15:42danm_oh, ok
15:42danm_rtfm
15:44danm_thanks
15:44Chousersure
17:21ericthorsenwhat are people doing for readable namespaces?
17:22rhickeyericthorsen: what do you mean?
17:23ericthorsenrhickey: I'm attempting to use the printed output of a namespace for input to the reader
17:23rhickeyyou mean all the vars?
17:24ericthorsen#<Namespace: clojure>
17:24ericthorsenjust the namespace
17:24rhickeyah
17:24ericthorsenI have it as a reference in a map
17:24ericthorsen{:ns (find-ns 'clojure)}
17:25ericthorsenThe printed output of that read in
17:25rhickeythere's no reader format for namespaces yet
17:25ericthorsenrhickey: bummer
17:56blackdogclojure the jvm answer to f#? http://lambda-the-ultimate.org/node/3032
17:57waltershttp://ocamljava.x9c.fr/ is probably closer to F#
17:57blackdogwell of course
17:57blackdogbut he's going on about F# being unique functional language on a industrial strenght platform etc
17:58blackdogoh, scuse me, i didn't notice ocamljava there :)
17:59blackdoganyway clojure with ericthorsen work i think probably rains on the parade
19:44qmrwrhickey: do you have your talk from the other day on the web?
19:44qmrwslides or video
19:59rhickeyqmrw: uploading now
20:21danlarkinqmrw: last night he was encoding the video to flash for upload
20:28rhickeypart 1 is up: http://clojure.blip.tv/file/1313398
20:39selloutan excellent talk, too ... both in content and presentation
20:40rhickeypart 2 is uploading...
20:40selloutNot often do you get people to sit down for a 90 minute talk and then get excited when it runs to 180 minutes.
20:42rhickeythe audience was a key part, I hope the questions are semi-audible...
20:45danlarkinrhickey: any plans for a presentation near the NY capital region?
20:47rhickeydanlarkin: not so far
20:48danlarkinyou should :-D
20:50rhickeydanlarkin: are there sizable groups up there?
20:52danlarkinTBH I'm not sure... just being greedy
21:00H4nsok, i have uploaded a pdf version of the website to the Google group. happy printing!
21:24H4ns(let [foo #((if % (recur nil)))] (foo true)) complains that recur can only be used in the tail position, but (let [foo (fn [a] (when a (recur nil)))] (foo true)) does not. why?
21:26Chouseryou have extra parens on your #()
21:27H4nsah. thanks!
21:28rhickeypart 2 is up: http://clojure.blip.tv/file/1313503
21:49H4nsdid anyone come up with an emacs tweak that automatically makes a closing paren into the matching open curly/bracket? it's kind of annoying having to do that by hand and i could not adopt to paredit.
21:51drewrTakes some getting used to but it's invaluable.
21:52H4nsdoes it automatically indent if you remove, say, a with- form?
21:52H4ns(that could get me sold)
21:52drewrIt doesn't, but that's only a C-M-q away.
21:53H4nsdrewr: there is 1036 WITH-DATABASE-CONNECTIONS form i need to kill, so the C-M-q actually would matter :)
21:53drewrKbd macro. :-)
21:53H4nsyup. no paredit needed for that.
22:00H4nshas there been a function spit that is now gone?
22:01H4nsor, asked the other way round, is there a function that i can call to write a string to a file?
22:16H4nsah, duck_streams.
23:19Chouserunfortunately most of the questions on this recording are inaudible.