#clojure log - Jun 11 2009

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

0:17 DTrejo: hiredman: I guess the people who wrote it need more engenuity at turning things into .clj

0:48 cp2: hiredman: it uses pircbot too... :x

1:00 hiredman: pircbot is pretty easy

1:31 replaca: too lazy to explore right now. Can someone online point me to a quick solution for escaping <> etc. in xml strings?

1:33 durka42: knowing xml, it's probably more complicated than &lt;

1:34 replaca: not too much, for this case, but there's a chunk of it

1:34 looks like c.c.lazy-xml has something

2:16 steven is on a roll!

2:21 Cark: who's steven ?

2:24 replaca: steven gilardi

2:24 who's been checking in a ton of stuff the last few days

2:25 Cark: ohhh ok =)

2:25 thanks !

2:27 replaca: looks like good stuff, too

2:28 Cark: i was wondering how this new condition stuff interacts with java

2:28 guess i'll have to test it some day

2:30 replaca: yeah, I haven't dug into it yet

2:31 like *so* many other things

2:31 finally played with xml & zippers tonight. pretty cool, once you've got it going on

6:26 eleftherios: is there a ubuntu package for clojure?

6:30 asbjxrn: yes

6:31 I don't use Ubuntu myself, so I know nothing about it, but: http://packages.ubuntu.com/karmic/clojure

6:34 Looks pretty basic, the clojure jar and some scripts to launch it.

6:34 You may be better off following some guides to get a complete environment set up.

6:35 eleftherios: yes, probably. I need to setup emacs etc. too

6:36 I thought that the package would set up everything

6:36 asbjxrn: yes, looking at it is very basic

6:37 but it is a start, I guess they will improve it over time :-)

6:37 though they have been very slow in picking up Clojure, other apps get packaged in very early versions

6:39 asbjxrn: If you want to use emacs, I think this link is ok: http://technomancy.us/126

6:42 eleftherios: asbjxrn: yes, I use emacs

6:42 thank you

6:44 asbjxrn: what I like in that page is that it has even attracted people like Bertrand Russell

6:44 who says in a comment: "I've been using emacs for 15 years and just discovered ESK a few nights ago..."

6:44 Bertrand Russell uses emacs, cool

6:44 :-)

6:45 plutonas: what is ESK?

6:46 asbjxrn: Emacs starter kit

6:52 eleftherios: I had never heard of it

6:53 asbjxrn: Neither had I. :) I didn't add it, but thinking maybe I should.

6:54 Since it came so highly recommended.

7:09 frodef: any pointers on how to use contrib/swing-utils and swing in general?

7:09 eevar2: frodef: you could start by reading sun's swing tutorial

7:10 asbjxrn: Not really, but thanks for telling me about swing-utils. Just setting up some dialog boxes at the moment :)

7:11 eevar2: frodef: assuming you're new to swing, not just new to swing from clojure

7:11 frodef: eevar2: that's right. I'll have a look. thanks.

7:21 ..but it'd still be nice to see an example of a swing-utils application :)

7:26 eleftherios: frodef: how long have you been using clojure? What's your opinion so far if you don't mind me asking

7:27 frodef: eleftherios: that the documentation is somewhat terse (at least for someone not so familiar with java).. :)

7:27 ..that the square brackets are useless.

7:28 ..that it's much better than using ordinary java.

7:31 eleftherios: frodef: why do you consider the square brackets useless?

7:32 frodef: I don't know that they give me anything, except occationally the hassle of "oh, these parens needs to be squared".

7:32 Chousuke: frodef: I think you're wrong.

7:32 frodef: with square brackets, you know it's not a operator form

7:33 frodef: how so? [1 2 3] is a valid form too?

7:33 Chousuke: yeah, but not confusable with a function or a macro call

7:33 there are only two situation where (foo bar) is not a function/macro call in clojure :/

7:34 +s

7:34 frodef: It's of no value to me, anyways.

7:35 Chousuke: See, that's where I disagree with you :)

7:35 frodef: so you often look at random snippets of code outside their lexical context, then? :)

7:36 Chousuke: you don't need to remember the macros where lists aren't evaluated as function calls because it's more clojurey to just use vectors.

7:36 frodef: so it's a hint that "this form probably isn't evaluated"?

7:37 Chousuke: vectors are evaluated, but not as function calls

7:37 ,(let [x 1] [1 x 2]); can't have a list there

7:37 clojurebot: [1 1 2]

7:38 frodef: so what is gained, exactly?

7:38 wrt. (let (x 1) [1 x 2])

7:38 Chousuke: if you have a macro that takes a list instead of a vector: (let (x 1) x), there is no hint that the (x 1) isn't a function call.

7:38 eleftherios: rhickey can perhaps shed some light

7:39 rhickey: shed light on what?

7:39 Chousuke: it also gives a visual clue.

7:39 plutonas: (let ((x 1)) `(1 ,x 2)) ---> (1 1 2) :D

7:40 eleftherios: rhickey: frodef doesn't see the value in having square brackets, Chousuke points out that they have a real use

7:40 Chousuke: plutonas: see, that looks like a let that takes the result of some function call ((x 1)) as its first parameter.

7:40 frodef: Chousuke: so it's a rather vague hint that can't even be trusted.. i.e useless.

7:40 rhickey: frodef: do you use CL or Scheme?

7:41 Chousuke: frodef: the other difference is that the argument is an actual vector, too. not a list :)

7:41 frodef: rhickey: you have one leature for each? :) I use CL.

7:42 Chousuke: literal vectors also have the effect that explicit 'list calls are nearly nonexistent :P

7:42 except when you actually want a list. quite often you don't :)

7:43 plutonas: Chousuke: of course if one is not familiar with the syntax of let he might consider ((x 1)) as some sort of function call... i'm not familiar with clojure to see the difference with the brackets

7:43 Chousuke: plutonas: well, you'd only need to know the difference between a vector form and a list form.

7:43 rhickey: frodef: you must have experience then with newcomers complaining about e.g. parens, before they have use it enough to see their value

7:43 Chousuke: plutonas: in list forms, the operator position is special.

7:44 rhickey: some Schemes support using []'s in lieu of parens, and convention there is to use them instead of parens for structural grouping

7:45 frodef: rhickey: sure, I see your point. I was asked, and so far [] is nothing but a hassle to me. But please enlighten me.

7:45 rhickey: isn't it unfortunate to also use them for vectors then?

7:46 eleftherios: in aesthetic terms, I feel the presense of square brackets certainly helps people like me who come from a Python background

7:46 Chousuke: frodef: they're not "also" used for vectors in clojure. they are always vectors.

7:47 many macros just take a vector parameter instead of a list like CL usually does

7:47 frodef: Chousuke: sure, but the fact that they are valid forms is what is unfortunate.

7:47 rhickey: frodef: I don't get that point

7:48 Lisps use data structures for syntax

7:48 asbjxrn: It's not a "valid form", it's a reader macro for (vector 1 2 3)

7:48 Chousuke: that's not strictly true, is it?

7:49 rhickey: asbjxrn: no it's not, it's read as a vector literal

7:49 Chousuke: ,(let (vector x 1) x)

7:49 clojurebot: java.lang.IllegalArgumentException: let requires a vector for its binding

7:49 asbjxrn: oh, well..

7:49 frodef: rhickey: if "[1 2 3]" was not a valid form, the presence of square brackets would unabiguuously imply grouping?

7:49 Chousuke: frodef: grouping isn't all vectors can be used for.

7:50 frodef: I think there are some DSLs that use vectors for the actual "language" and just interpret list forms as user code

7:50 can't do that in CL without unquotes and stuff.

7:50 rhickey: frodef: no, but that doesn't negate its value in distinguishing grouping from calls

7:51 this simple fact is that Clojure code is more readable and smaller than CL code, and the use of brackets and lack of extra pairing in let and cond are part of that. You are used to something else - that's ok

7:52 frodef:  maybe I'm being slow.. but (foo [x 1] (+ x 1)), here foo can be a regular function, or it can be precisely like let.. there's no real information in the fact that there's squre brackets around x and 1.

7:52 asbjxrn: Actually, I find the CL cond a bit easier to read...

7:53 eleftherios: asbjxrn: opposite here, the clojure cond is slim and easier on the eye

7:53 rhickey: frodef: that's just the argument against macros

7:54 duncanm: rhickey: morning!

7:54 asbjxrn: The extra parenthesis makes a little indendation difference between test and form when you have multiple branches

7:54 rhickey: applies to all Lisps, if foo is a macro the evaluation of everything inside it is subject to foo's definition

7:54 Chousuke: frodef: at least you know [x 1] is not a function call :)

7:54 unless the macro is insane

7:54 frodef: rhickey: sort of, yes, but I thought some of the motivation of [] was to counter that anti-macro argument.

7:55 rhickey: frodef: no, it really is the simple argument given by Chousuke - you know [x 1] it not a call or macro, and that matters a lot in how much mental effort you need to spend parsing code

7:56 frodef: maybe to python programmers.. ;)

7:56 eleftherios: frodef: or more likely, to anyone who is _not_ used to CL

7:57 frodef: which is probably a majority compared to CL programmers :-)

7:57 duncanm: i haven't thought how destructuring plays into this, but I've wanted to improve some of the error messages in Clojure: as a Schemer, I'd nominate changing the error message when writing: ((fn (x) x) 1)

7:57 right now, it says "Don't know how to create ISeq from: Symbol"

7:57 frodef: anyways, I'd like to ask if there's any way to get an emacs-mode thingy that gives me a REPL with a break-loop?

7:57 ..or even just stack-traces?

7:58 plutonas: something like slime?

7:58 duncanm: frodef: SLIME does that

7:58 frodef: plutonas: except slime has no break-loop, which makes it terible.

7:58 err

7:58 duncanm: break-loop?

7:58 you want something like USE-VALUE?

7:59 Chousuke: frodef: I think the visual differentiation is important too, for something like destructuring: (let [[x y] [(foo 1) (bar 1)]) is much easier on the eye than (let ((x y) ((foo 1) (bar 1))))

7:59 frodef: duncanm: "nested" REPLS for each error context.

7:59 duncanm: Chousuke: haha, not if you show that to a Schemer ;-)

7:59 frodef: ahh, levels.... that'd be handy, yes

8:00 frodef: duncanm: in my mind it's more that handy, it's the essential development tool.

8:01 duncanm: Chousuke: yeah, in fact, LET-VALUES in Scheme has one more set of parens too

8:01 eleftherios: duncanm: but perhaps what is easier on the eye of schemers and CL-ers hasn't been easy on the eye of the majority of other programmers; and the balance that clojure strikes is that it makes LISPy syntax easy on the eye of everyone else and well, Schemers and CL-ers can also get used to it

8:01 duncanm: eleftherios: no, i'm not arguing that the Clojure way is bad in anyway

8:02 eleftherios: duncanm: sure, I was just adding to the conversation :-)

8:02 duncanm: eleftherios: all i said was that, for Schemers and CL-ers, i'd be nice if there's slightly better error messages

8:02 frodef: I'm using clojure-mode.el by Lennart Staflin, which was the first one listed on whatever page google took me to. Is there a (more) preferred emacs pacakge? I slime the default?

8:02 eleftherios: duncanm: oh I was referring to your reply to Chousuke about the visual differentation point he made

8:03 duncanm: eleftherios: nod

8:03 eleftherios: duncanm: better error messages are alwasy erm...better

8:03 frodef: asbjxrn earlier showed me this http://technomancy.us/126 perhaps it helps?

8:04 duncanm: eleftherios: yeah, like i said, right now, ((fn (x) x) 1) -> Don't know how to create ISeq from: Symbol

8:04 Chousuke: Clojure's syntax additions are controversial, but I don't think the CL guys will actually be able to show that it makes Clojure inferior, syntax-wise

8:04 Maybe they can argue the point that there is little improvement, but that's not very useful

8:05 frodef: Chousuke: that's twice true.. :)

8:05 eleftherios: I find clojure syntax a joy

8:05 Chousuke: me too :)

8:05 duncanm: and yeah, the error messages could use improvement.

8:06 eleftherios: I have limited exposure to it but so far I really like it

8:06 duncanm: Chousuke: for that particular case, i wonder what it should say

8:06 Chousuke: duncanm: I thikn it

8:06 it's complaining about the (x) instead of [x]

8:06 duncanm: what if there's a procedure named X, and it returns a vector?

8:07 Chousuke: fn is a special form. that's not valid 'fn syntax

8:07 the (x) won't get evaluated

8:07 frodef: eleftherios: at least there's a newer version of the clojure-mode.el there. thanks.

8:07 duncanm: oh

8:08 Chousuke: so then yeah, it's a straight-forward case of making the error message better-worded

8:08 Chousuke: duncanm: maybe post an issue on the tracker about this?

8:08 just improving error messages in general

8:09 duncanm: Chousuke: will do once I get to the office

8:09 oh, i once made a posting about importing classes that are not namespace-qualified

8:10 it was either you, Chousuke, or someone else who helped me out and wrote some snippet that did that

8:10 Chousuke: Might've been Chouser too

8:10 duncanm: ahh, yeah

8:10 but either way, i don't think that post ever showed up

8:11 that's right, the snippet is basically this:

8:11 (.importClass *ns* name (clojure.lang.RT/classForName (str name)))

8:12 and i wrote that it'd be handy if (import '(foo)) did that automatically

8:12 maybe i should have written up a patch ;-P

8:20 eleftherios: frodef: :-)

8:22 asbjxrn: frodef: the classpath setup example on that page is useful, too.

8:22 duncanm: frodef: actually, given how exceptions work in Java, how would you want command levels to work with the REPL?

8:23 asbjxrn: Unless you set up a lisp command that adds all libraries you've got to the classpath if you need it or not.

8:24 One thing I wish were in slime, was display of local variables for the different stack levels when you expand them. Don't know enough about jvm to know if that is possible?

8:27 frodef: duncanm: hmm.. guess you're right it won't work.

8:27 clojure succeeded in lulling me into a false sense of not being on a braindead platform :)

8:29 eleftherios: frodef: too complicated, consider revising to: "clojure succeeded in lulling me into a false sense of being on a sane platform" :-)

8:30 frodef: right :)

8:30 eleftherios: bad humour, sorry :-)

8:33 rhickey: for those really interested in what they are getting from just one small part of the platform: http://developers.sun.com/learning/javaoneonline/j1sessn.jsp?sessn=TS-5427&yr=2009&track=javase

8:35 duncanm: rhickey: do you know if videos of the sessions will be made available?

8:35 frodef: rhickey: lots of neat stuff, for sure. It's just such a pity that a number of (imho) crucial things are completely missing/not supported.

8:36 duncanm: bah - you need to login to the Sun Developers Network just to download the PDF ;-P

8:37 rhickey: tradeoffs are a fact of life - if you think CL is without them, then stick with it

8:37 duncanm: yeah, PITA, but free

8:37 rys: Ah, nice link

8:38 eleftherios: rhickey: so true :-)

8:38 in any case, clojure is really fresh and great and hopefully we'll start doing some stuff with it at work (currently a Python shop)

8:39 frodef: true, but it remains a pity.

8:40 rhickey: IBM's JVM presentation was also good, but pdf link is currently broken: http://developers.sun.com/learning/javaoneonline/j1sessn.jsp?sessn=TS-5253&yr=2009&track=javase

8:42 frodef: some things are just going to be different. For instance, you can work in a REPL started with a debug agent, but not in debug mode, and attach a Java debugger at any time, get breakpoints and stepping, locals etc. Not a CL debugger's frames, but not nothing by any stretch

8:44 asbjxrn: I always feel such slideshows are less filling. I'm not smart enough to understand what was said about the bulletpoints...

8:44 rhickey: you can detach the debugger and keep on working, so it doesn't devolve into compile/link/run/debug/repeat

8:44 asbjxrn: yeah, it was a great high-speed talk, slides don't do it justice as usual

8:46 asbjxrn: I usually have problems getting the exeptions caught by the debugger, it is just me or is that tricky when using slime?

8:47 Or is that not the java way of debugging? I like to have a look around at what the state was when the error occured.

8:49 rhickey: asbjxrn: I don't know about Slime w/Clojure, but in a Java debugger you can break on exception, walk back through the stack and see all args and local values etc

8:49 Drakeson: is there an easy way in slime to a) get the arguments of a java method, b) go to the java documentation of an object (in emacs or in a browser)

8:51 asbjxrn: I'm thinking slime catches the exception and shows it to me before the debugger gets hold of it. Is that crazy talk or could it make sense? And what do you use? still just clojure-mode.el?

8:53 duncanm: asbjxrn: that's what rhickey told me when i met him a few months ago, that he uses clojure-mode.el

8:54 i'd just use clojure-mode too, but I'm really glad i finally worked out how to start a swank-session from within the clojure session in the app that i'm scripting

8:55 for months i've been cut-n-pasting code from emacs buffers to a tiny REPL window from within the app, now I can short-circuit the loop and do it all within emacs ;-P

8:57 bstephenson: I thought rhickey was using enclojure at the Script Bowl at Java One

8:57 but that was second hand info

8:57 * duncanm wants to check out enclojure

8:58 duncanm: maybe instead of having a tiny REPL implementation, i could make the app re-use enclojure instead

8:59 Chouser: reflective calls can sometimes be inlined??

8:59 that must not mean what I think it means.

9:06 asbjxrn`: ?

9:06 duncanm: yes?

9:07 Could not find clojure.lang.Compile. Make sure you have it in your classpath

9:07 is it not enough that I have -Dclojure.jar=... in ant?

9:07 Chouser: duncanm: probably not. clojure.jar also needs to be in your classpath

9:08 oh

9:08 hm.

9:08 duncanm: building contrib?

9:08 duncanm: Chouser: no, enclojure

9:08 Chouser: i'm new to a lot of java tools

9:08 Chouser: but when i build contrib, that's all i needed to do

9:09 Chouser: I don't know about enclojure, sorry.

9:09 I'm no Java heavyweight either.

9:09 duncanm: i bet there's some build.xml magic

9:15 rhickey: bstephenson: yes, I ran only enclojure during the Script Bowl and it worked out well. It's not my only tool, but it made building a simple app with Ring+Enlive with all their dependencies quite easy

9:17 cemerick: I'm afraid I haven't build enclojure from source in quite a while. The latest drop has been working well enough for me. (though debugging is still borked)

9:18 duncanm: can't I just do CLASSPATH=~/.clojure ant to temporarily add clojure to my classpath?

9:18 "CLASSPATH=~/.clojure ant"

9:18 rhickey: Ilya showed some serious advancement in La Clojure for IntelliJ at the show as well. JetBrains had printed handouts for it at their booth!

9:18 esp. cool - rename refactoring

9:19 duncanm: rhickey: that's neat

9:19 rhickey: supporting that was a design objective of Clojure

9:19 cemerick: rhickey: do they have any REPL library in place, or in progress?

9:20 rhickey: cemerick: REPL is new, still needs some bug-shaking

9:20 asbjxrn`: I think they had some improvements to the repl not long ago. But then it was pretty useless before.

9:20 rhickey: but he was flying around with context-aware completion everywhere

9:20 cemerick: ah. I was actually referring to a library to be embedded in apps to provide remote repls, but I'll assume they haven't got that far.

9:21 rhickey: cemerick: I don't think they have thought that through as far as enclojure has

9:21 yet

9:22 cemerick: it seems like a standard repl protocol and mechanism should be established (in contrib, anyway). It'd be unfortunate if every IDE had their own.

9:23 Chouser: cemerick: any reason it shouldn't be slime?

9:23 * rhickey hopes not Slime

9:23 cemerick: I guess I'd ask: why *should* it be slime?

9:23 rhickey: too much

9:24 * Chouser doesn't know anything about slime

9:24 rhickey: but there is a fundamental question - should a remote repl be stream or conversation oriented?

9:24 cemerick: I've never used it, but I presume there's a *lot* of baggage there, and the core devs of slime likely have no interest in considering clojure when making breaking changes, etc.

9:25 Drakeson: feature request: ([f1 f2] x) -> [(f1 x) (f2 x)]

9:25 Chouser: Drakeson: breaking change

9:25 asbjxrn`: Drakeson: who are you requesting it from?

9:25 frodef: rhickey: what does "conversation oriented" mean?

9:25 Drakeson: Chouser: what is the current meaning of ([f1 f2] x)?

9:26 Chouser: Drakeson: ([f1 f2] x) already means get the x'th item from that vector.

9:26 ,([:a :b :c] 1)

9:26 clojurebot: :b

9:26 rhickey: frodef: rather than stream characters the client will package a complete form for evaluation

9:27 asbjxrn`: Ah, I thought it was request for IDE rewriting (a.la. paredit)

9:27 Chouser: ,(map #(% 5) [- +])

9:27 clojurebot: (-5 5)

9:27 Drakeson: is there a map to create such function? ((some-map f1 f2) x) -> [f1 x] [f2 x]

9:27 cemerick: ah, I was unaware of the term, as well. I'd say it'd have to be 'conversation' oriented. That matches the semantics of what one does at the REPL.

9:28 Chouser: cemerick: I agree. Is slime not like that?

9:28 cemerick: Drakeson: (map #(% x) [f1 f2])?

9:28 Chouser: no idea.

9:29 slime is certainly convenient for those using emacs, but I'm not sure it has any other advantages w.r.t. establishing it as a quasi-standard for clojure.

9:30 asbjxrn`: I thought slime was the frontend, swank is the "protocol"?

9:30 cemerick: right, sorry, we should be talking about swank

9:31 Chouser: my fault.

9:32 cemerick: well, the (functional) lack of distinction is indicative of swank's charter, I think. Are there any other editors besides emacs/slime that use swank successfully, and across swank revisions?

9:32 Drakeson: does this have a name already: (defn mapf [& fs] (fn [x] (map #(% x) fs)))

9:33 asbjxrn`: There is some vim clients, I belive?

9:33 * Drakeson wishes for a [non-ugly] way to search for the name of a function given its body, or some input-output samples.

9:34 Chouser: Drakeson: currently the best tool for that kind of search is #clojure

9:34 rhickey: huh, that worked... http://github.com/richhickey/clojure/tree/master (please don't rely on yet, but help me look it over for any problems)

9:34 Drakeson: (not trying _all_ functions from "clojure api" and testing the output)

9:35 sweet. Is that _the_ official git repos? are we finally relieved from "git svn"?

9:36 rhickey: Drakeson: nothing official yet, still working things out

9:37 it looks like assembla+github will work

9:37 cemerick: asbjxrn`: I honestly don't know, but the first page of results from googling 'vim swank' aren't promising. This probably sums it up: http://www.cliki.net/vim

9:39 * rhickey wishes he could see github's admin tab in Camino...

9:39 asbjxrn`: rhickey: well, clone and build works, at least.

9:39 Chouser: rhickey: it's not just the width of your window?

9:40 asbjxrn`: rhickey: Maybe I missed your answer/you missed my question yesterday: you wanted logged chat/messaging supprt from assembla, is that for replacement or in addition to freenode/google groups?

9:42 rhickey: Chouser: it can be made visible by making the window really wide, but works fine at same width in Safari

9:43 asbjxrn`: still looking at what parts of assembla to use, so far messages seem to not integrate as well with email as ggroups, and offer only priority as an enhancement

9:44 cemerick: rhickey: I just replaced the current master from your github repo with the 'trunk' from my mirror of the GC svn, and git diff is empty. I'd say +1.

9:44 uh, git status, I mean

9:46 Chouser: cemerick: wow I wouldn't expect that.

9:46 I bet it won't work for me.

9:46 cemerick: your mirror is more than plain git-svn? or you were mirroring only trunk?

9:47 cemerick: Chouser: that should absolutely be the case. Anything else would indicate a big problem, I think.

9:47 Chouser: I checked out the ref for svn/trunk, and copied those contents over (e.g. none of my patches moved over, etc)

9:47 I have my patches in a different branch.

9:47 Chouser: I use git-svn on the whole repo, so I have trunk and branch sub-dirs. The diffs aren't likely to match.

9:48 cemerick: If you 'git svn init -s URL', then it'll make git branches out of the branches, and root things at trunk.

9:49 having trunk and branch subdirectories is sorta broken, IMO

9:49 rhickey: I used github's own create from svn repo option, which has a step for setting up the authors, and seems to do the right thing with branches and tags

9:49 cemerick: huh, fancy :-)

9:49 too bad we can't use github

9:49 rhickey: ?

9:50 cemerick: rhickey: I mean Snowtide, not clojure.

9:50 rhickey: ah

9:51 Chouser: cemerick: you can pay for private hosting at github, can't you?

9:51 cemerick: Chouser: it's the @ github part that's the problem. I'd love to be able to deploy it in-house, but that's a no-go for them.

9:51 rhickey: you have to trust the people at github with your source

9:52 Chouser: cemerick: ah.

9:52 cemerick: hell, I don't trust myself with our source! :-P

9:52 tWip: how about http://fi.github.com/ ?

9:52 rhickey: I meant from a disclosure standpoint

9:53 cemerick: tWip: oh, that's new!

9:53 tWip: yes, it is... recently announced

9:53 cemerick: whew, $600/user/year.

9:54 gitosis will do for now :-) I'd be willing to pay $600 / user perpetual.

9:54 tWip: ouch

9:55 do they specify what "user" means? if it means one actual person, then that seems quite high

9:55 # of accounts it seems, then forget it :P

9:56 Chouser: I wonder if the price is high now to reduce the demand on their support staff.

10:01 frodef: When I start up my swing window (and in particular a file chooser) it seems sometimes the UI freezes, and I can get ig going again only by hitting enter a few times at the repl in *inferior-lisp* ..

10:01 .. does this ring a bell with anyone?

10:01 asbjxrn`: Yes.

10:02 frodef: asbjxrn: really? any tips?

10:02 asbjxrn`: But I don't remember what I did to resolve it, or if I just don't have the issue with my current project.

10:02 Sorry.

10:02 frodef: ah.. :)

10:02 Chouser: every time I start getting closer to really committing to emacs, something like this comes up.

10:03 frodef: I somehow doubt emacs is at fault.

10:03 Chouser: well, it is slime/swank which I wouldn't do early.

10:03 frodef: also this behavior seems to come and go, which is frustrating.

10:03 Chouser: frodef: I'm sure. :-/

10:04 asbjxrn`: Do you set up keyboard listeners in your app?

10:04 frodef: only have shortcuts for menus.

10:04 jdz: and might it be an issue with the swing's event handler running in the main thread or something like that?

10:05 frodef: jdz: who knows..

10:06 perhaps it would be a good idea to spawn the "application" in a new thread?

10:07 seemed to do the trick..

11:03 is there something similar to CL's (error "blah failed.") ? I.e. to throw a generic error (well, Exception) with a message?

11:04 kotarak: frodef: throwf in clojure.contrib.except

11:04 frodef: hanks

11:33 cemerick: is there a form floating around that allows one to build a map whose values refer to other values, similar to a let? e.g. (let-map [a 5 b (+ a 5)) -> {:a 5 :b 10} I just want to avoid doing stuff like (let [a 5 b (+ a 5)] {:a a :b b})

11:59 lisppaste8: cemerick pasted "let-map, as described above, FWIW" at http://paste.lisp.org/display/81703

12:02 drewr: Interesting.

12:02 cemerick: heh, is it?

12:03 I just got tired of building up these bunches of values, and then stuffing them into maps with the same names as I was using in the let forms.

12:03 drewr: ,(apply hash-map [:foo 1 :bar 2])

12:03 clojurebot: {:foo 1, :bar 2}

12:03 cemerick: uh-huh. Unfortunately, :bar's value can't refer to :foo's value.

12:04 drewr: Hm, yes.

12:08 stuartsierra: That's clever.

12:09 cemerick: heh, maybe my macro-fu is getting stronger :-)

12:10 stuartsierra: Now all you need is a straggly gray beard to be a REAL lisper.:)

12:10 drewr: The macro itself is unimpressive, but the abstraction is cool.

12:11 * cemerick leaves it up to drewr to bring him back to earth. ;-)

12:11 drewr: s/unimpressive/uncomplicated/

12:11 cemerick: drewr: sure, sure. Just having fun. :-)

12:12 unfortunately, the 3-4 times I tried to grow a beard, it got too scratchy after 4-5 days, so I'll be forever ineligible to be a great lisper, or a proper sensei.

12:13 drewr: You have to get past the initial scratchy phase.

12:13 cemerick: yeah, I couldn't take it

13:19 rhickey: ah, github - trying to view core.clj via their interface:

13:19 A script on this page may be busy, or it may have stopped responding. You can stop the script now, or you can continue to see if the script will complete.

13:19 technomancy: they have some JS that handles line number links etc.

13:20 it doesn't go over to well on 4000+-line files. =\

13:21 rhickey: fine in safari, again

13:21 * rhickey must use tested browser...

13:22 rhickey: actually, safari 4 is smokin'

13:23 technomancy: yeah, IIRC that browser JITs all its JS, so no surprises there

13:24 actually Firefox 3.5 (which does JIT on JS too) works fine

13:26 gnuvince: technomancy: doesn't webkit compile JS to native code now?

13:26 technomancy: gnuvince: squirrelfish does, yeah

14:38 zargon_: how do i parse a string into a (clojure) number

14:38 ?

14:38 stuartsierra: ,(read-string "3.14159")

14:38 clojurebot: 3.14159

14:39 zargon_: thx

14:39 gnuvince: ,(Double/parseDouble "3.1")

14:39 clojurebot: 3.1

14:39 zargon_: thats a java thingy

14:39 gnuvince: ,(type (Double/parseDouble "3.1"))

14:39 clojurebot: java.lang.Double

14:39 gnuvince: ,(type (read-string "3.1"))

14:39 clojurebot: java.lang.Double

14:40 zargon_: ,(type (read-string "1234"))

14:40 clojurebot: java.lang.Integer

14:40 zargon_: will this promote to BigInt automatically?

14:40 gnuvince: try it

14:40 zargon_: ,(type (read-string "1234123123123123123123123"))

14:40 clojurebot: java.math.BigInteger

14:40 stuartsierra: read-string will promote, Integer/parseInt will not

14:40 zargon_: ok, thats what i need

14:41 thx

14:41 Chouser: read-string probably has security implications that the java parse* static methods do not.

14:41 gnuvince: ,(read-string "(+ 2 3)")

14:41 clojurebot: (+ 2 3)

14:41 Chouser: the Clojure reader is not currently safe for untrusted input.

14:42 technomancy: Chouser: you mean something like ballooning memory usage by creating lots of keywords/symbols?

14:42 tgevaert: ,(defstruct foostruct :bar) (defmulti foop) (defmethod foop clojure.lang.PersistentStructMap [f] (println f)) (foop (struct foostruct "bar"))

14:42 clojurebot: DENIED

14:42 stuartsierra: There's a reader macro that evaluates (almost) any arbitrary form.

14:43 triddell: Chouser: like SQL injection type exploits?

14:43 Chouser: ,(read-string "#=(java.lang.System/exit 0)")

14:43 clojurebot: java.lang.RuntimeException: java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0)

14:43 gnuvince: Chouser: nice

14:43 Chouser: clojurebot evals things in a Java sandbox, otherwise that would have shut down the process.

14:43 tgevaert: ,(+ 1 2)

14:43 clojurebot: 3

14:44 tgevaert: I'm trying to dispatch on a struct type, but I'm getting a nullpointer exception

14:45 dnolen: tgevaert: paste some code.

14:45 tgevaert: I tried to evaluate it with the clojurebot, but he denied me

14:46 alright, when I add the type function as the dispatch function, it works

14:47 I was following the example from http://java.ociweb.com/mark/clojure/article.html#DefiningFunctions

14:48 Chouser: dispatch-fn is not optional, apparently

14:48 tgevaert: nvm. hehe

14:48 Chouser: but you don't get a compile-time error, you just get NPE anytime you try to call it.

14:48 seems like it could default to 'type'

14:49 or throw at compile-time.

14:50 tgevaert: when I read the example, I missed the class dispatch fn, and for some reason I just assumed that 'type' was an implicit one

14:50 so, entirely my fault

14:50 cemerick: that really should throw, I'd think

14:51 Chouser: yeah, throw at compile time or offer a sane default.

14:51 rhickey: want an issue/patch for that?

14:51 I'm surprised it hasn't come up more often.

14:52 tgevaert: I guess other people read the (defmethod) docs more carefully, heh

14:52 Chouser: :-)

14:52 dnolen: a lot of the editors display type signature now.

14:53 ,(:arglists ^#'defmulti)

14:53 clojurebot: ([name docstring? attr-map? dispatch-fn & options])

14:55 tgevaert: ,(deref nil)

14:55 clojurebot: java.lang.NullPointerException

14:55 cemerick: is there ever a sane default for something like that?

15:00 Chouser: cemerick: dispatch-fn could default to 'type'. Dunno if that would be too impure for rhickey's taste.

15:02 cemerick: type of what, though? a single value for a single argument, or a vector of types, one for each argument?

15:03 Also, dispatching on type acts as if it's dispatching on class, until someone unwittingly passes in some argument that does have :type metadata, and very odd stuff starts happening.

15:04 stuartsierra: Yeah, I've wondered about that, using 'type' in libs, but no one's objected yet.

15:06 cemerick: well, people who pick up clojure these days for more than 5 minutes are already self-selecting, so it's unlikely that a problem regarding dispatch would puzzle them for long enough to post about it, etc.

15:07 A day is coming, though, when people will need to make a decision about what to do "after java". At that point, things might get a little rougher in the support area.

15:09 Chouser: Well, I'm fine with throwing an exception when no dispatch-fn is given.

15:22 Drakeson: is (compile 'clojure.example.hello) supposed to work, as mentioned in http://clojure.org/compilation ?

15:23 technomancy: Drakeson: it should work as long as the classes/ directory is on your classpath

15:29 Drakeson: technomancy: oh, that was it. thanks.

15:57 stuartsierra: Anybody using OSGI?

16:01 hiredman: lisppaste8: url?

16:01 lisppaste8: To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.

16:03 hiredman pasted "hmmm" at http://paste.lisp.org/display/81714

16:04 stuartsierra: Interesting, but what's the goal there?

16:05 hiredman: no more NPE

16:05 it falls very short of that

16:06 stuartsierra: I see, you want to do static type checking like Haskell?

16:06 hiredman: isa? is pretty cool

16:07 stuartsierra: I'd like to be able to some kind of verifier tool or something

16:07 stuartsierra: sounds hard

16:08 hiredman: yes

16:10 sh10151: is there a clojure function that, given '(a b c d e), returns ([a 0] [b 1] [c 2] [d 3] [e 4]) ?

16:10 called enumerate or count in other languages I think

16:10 stuartsierra: clojure.contrib.seq-utils/indexed

16:10 sh10151: thanks

16:32 replaca: hs anyone here used clojure (presumably c.c.zip-filter.xml) to *modify* an xml object? I could use some pointers to get me started.

16:32 Chouser: replaca: it's not so hot at that.

16:33 zip-filter can be used to find an element, which you can then change. but if you want to make a series of changes it gets complicated very quickly.

16:33 I believe this was a main reason why cgrand ditched zip-filter for his enlive lib. You might look at that.

16:34 replaca: ahh, luckily a singe change would do it, I think (trying to create a bunch of similar nodes with editted attr values)

16:34 thanks Chouser, I'll take a look

16:35 sh10151: you can always use XSLT

16:35 it's what it was designed for ;)

16:36 Chouser: sh10151: xslt is why I wrote zip-filter.

16:36 technomancy: does anyone else get isa? and instance? confused?

16:36 sh10151: aside from the angle-brackets I like it

16:36 esp. xslt 2.0

16:37 technomancy: I feel like isa? should be named instances-of-this-class-are-a? or something

16:37 Chouser: sh10151: it is weak, hard to extend, wordy. I dislike it immensly.

16:37 dnolen: Enlive in my experience is much better than xslt, xslt can be lame for complex transformations.

16:37 I used XSLT for tarnsforming census data and it was a bear for anything non trivial.

16:39 technomancy: isa? works on tag hierarchies as well.

16:39 clojurebot: technomancy is to blame for all failures

16:39 lisppaste8: hiredman annotated #81714 "untitled" at http://paste.lisp.org/display/81714#1

16:40 technomancy: dnolen: yeah, I keep expecting (isa? String "hi") to work.

16:41 Chouser: sh10151: I really like xpath (except for how hard it is to extend), and xslt is one of the best ways to get to use xpath. But ultimately I think I want something more like enlive

16:41 ...which I will get around to looking at Real Soon Now.

16:41 sh10151: at least xalan is pretty trivial to extend with java and javascript

16:41 never needed to extend saxon

16:41 technomancy: enlive needs some nontrivial examples in its docs; I couldn't figure it out

16:42 zargon_: whats the idiom for creating a map from a list where key:x value:f(x)?

16:43 dnolen: technomancy: true, more documentation would be nice, but I have used it great success.

16:43 technomancy: dnolen: great; post some examples! =)

16:43 stuartsierra: zargon_: (zipmap your-list (map f your-list))

16:44 dnolen: my favorite was when I created a table structure with divs in the markup, and the designer changed it to tables and I just had to change one line in my template.

16:44 zargon_: stuartsierra: thx

16:53 replaca: Chouser: btw, I really love zip-filter. I can see that's going to get a prominent place in my toolbox

16:55 hiredman: if I have a macro that emits a defn form, how can I stick extra metadate in the defn from?

16:55 like if I used (defn #^{}

16:56 replaca: hiredman: the metadata there is actually on the var

16:56 hiredman: yeah

16:56 kotarak: `(defn ~(with-meta fn-name {:bla :blub}) ...) would be my guess

16:56 hiredman: so

16:56 replaca: so you can add it to the var after you've created it

16:56 kotarak: But there was some issue with that.

16:57 hiredman: kotarak: that will, I think. put metadata on the symbol

16:57 kotarak: And def will transfer it to the Var, no?

16:57 hiredman: oh

16:57 hmm

16:57 kotarak: Or was that defn.

16:57 replaca: kotarak: no, I don't hink so

16:57 *think

16:58 kotarak: But defn will transfer it.

16:58 Because (defn #^{} bla) also puts the metadata on the symbol...

17:00 replaca: looking at the def of defn, I think you're right

17:04 hiredman: hah

17:04 excellent

17:04 thanks

17:07 cemerick: this is a very unfortunate error message -- bit me in a macro:

17:07 ,(if-let [a 6] 5 6 7)

17:07 clojurebot: java.lang.IllegalArgumentException: if-let requires a vector for its binding

17:09 hiredman: cute

17:10 kotarak: The eternal struggle between error message writers and syntax error writers.... ;)

17:31 blbrown: another clojure question: http://groups.google.com/group/clojure/browse_thread/thread/5fef7a9fcc578650

17:52 hiredman: #$!@#$

17:52 This user does not exist

17:53 whee

17:53 that was scary, for a minute I thought github had forgotten about me

17:53 http://gist.github.com/128259

17:55 so deft will check that the arity of the signature and the arguments is the same, and that the return type of the function body matches the return type in the signature

17:55 otherwise it throws an exception instead of def'ing the function

17:56 cp2: heh

18:05 hiredman: the aspect ratio on stuart's talk is wonky

18:43 eleftherios: cgrand-r1c: are you doing any work on Ring?

18:47 quidnunc: eleftherios: I think that's his logging bot

18:48 hiredman: ~seen cgrand

18:48 clojurebot: cgrand was last seen quiting IRC, 108 minutes ago

18:50 quidnunc: I believe he lives in France so you might taking that into account if you wanwt to reach him.

18:50 eleftherios: quidnunc: oh I thought cgrand-eye was the logging bot

18:50 yes, he lives in france, it says so somewhere on his blog

18:51 quidnunc: thank you :-)

18:51 quidnunc: eleftherios: I'm not sure the difference between the two. I think he just uses cgrand when he is actually present.

18:51 eleftherios: I see

19:01 hiredman: anyone have a link to that essay/paper/whathaveyou on egal?

19:07 eleftherios: has anyone purhcased this screencast, http://peepcode.com/products/functional-programming-with-clojure Is it any good?

19:09 actually, here's a whole series of screencasts http://www.youtube.com/view_play_list?p=AC43CFB134E85266

19:09 this guy here posted 20 useful links

19:10 http://mattsears.com/2009/6/6/20-clojure-links-to-get-you-up-to-speed

19:10 hiredman: eleftherios: http://delicious.com/clojurebot

19:10 technomancy: the youtube screencasts seemed more like a lecture to me

19:11 eleftherios: technomancy: a good or a bad lecture? :-)

19:12 technomancy: I didn't watch that many of them, I just wondered why it was in video form when it seemed like it could have been conveyed more easily through text.

19:12 but I'm biased since I wrote the peepcode one. =)

19:15 eleftherios: oh!

19:15 haha

19:15 technomancy: will there be more clojure related screencasts on peepcode you think?

19:16 I am considering getting the yearly subscription perhaps

19:16 technomancy: eleftherios: it's possible, but there aren't any definite plans.

19:16 eleftherios: though they seem to have a Ruby bias and I am a python programmer so I have not that much interest on those

19:17 technomancy: my next one will be an advanced Emacs screencast

19:17 eleftherios: that's useful :-)

19:17 technomancy: but doing a second one is always risky since you generally will never sell more of the second than the first.

19:20 eleftherios: Is this some sort of a market rule? :-)

19:43 cadsu: clojurebot, do you log this channel?

19:43 technomancy: cadsu: chouser does

19:43 cadsu: good evening technomancy

19:43 technomancy: o hai

19:43 clojurebot: logs?

19:43 clojurebot: logs is http://clojure-log.n01se.net/

19:44 hiredman: clojurebot: log is <reply>see logs

19:44 clojurebot: You don't have to tell me twice.

19:46 cadsu: that's really nice!

19:47 we'd like to have something like that in our #atlclojure channel

19:48 that's just a little channel for our atlanta clojure group to have meetings in, but we'd like to log things and have a bot

19:49 one of our members should be able to host it, but I think its up to me to set up the bot

19:49 is it hard to set up the way it is here?

19:49 hiredman: hmmm

19:50 clojurebot: where are you?

19:50 clojurebot: http://github.com/hiredman/clojurebot/tree/master

19:50 hiredman: the bot does have some #clojure specific bits, and it is not in the most consumer friendly form

19:50 technomancy: hiredman: so n01se.net's logs come from clojurebot?

19:50 hiredman: I dunno how Chouser does the logging

19:50 technomancy: oh

19:51 drewr: He just uses his IRC client, IIRC.

19:51 hiredman: clojurebot certainly could do logging

19:51 cadsu: for basic logging I'm sure there are simpler solutions

19:51 hiredman: the most basic would just be to have someone's client log

19:52 cadsu: indeed, I have been

19:53 hmmmmm, there is the interesting problem of merging separate logs from trusted but non synchronized users!

19:53 hehe, but I ought to focus

19:53 hiredman: http://mg.pov.lt/irclog2html/

19:53 cadsu: I think I should put a basic irc client as a process running on a friend's server

19:54 mblinn: would anyone know if I need to do any classpath jiggery to use vimclojure on a file in which I declare a namespace at the top using ns?

19:54 hiredman: mblinn: everything needs to be in teh classpath of the nailgun server

19:54 mblinn: and . isn't automatically added or anything?

19:54 hmm

19:54 hiredman: mblinn: dunno

19:55 or "it depends"

19:55 mblinn: heh

19:55 well, so all I'm trying to do is write a little program that's in its own namespace

19:57 but when I try to open it up, it seems that the JRE is looking for my_ns__init.class or my_ns.clj on the classpath

19:58 hiredman: what is the namespace?

19:58 mblinn: hyde

19:58 hiredman: :(

19:58 ~namespaces

19:58 mblinn: hmm

19:58 clojurebot: namespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it

19:58 hiredman: ~compile

19:58 clojurebot: the unit of compilation in clojure is the namespace. namespaces are compiled (not files). to compile a namspace the namespace needs to be on the classpath and so does ./classes/ (and the directory needs to exist) because clojure writes the class files to that directory. http://clojure.org/compilation

19:58 mblinn: ah

19:59 hiredman: I guess the compile isn't relevent here

19:59 triggering those together is just sort of a reflex

19:59 mblinn: heh

19:59 hiredman: anyway, good luck, I'm gone

19:59 mblinn: thanks much

20:20 blbrown_win: I asked by lazy imports and a guy recommended new-by-name. Do you think his solution is the way to go: http://groups.google.com/group/clojure/browse_thread/thread/5fef7a9fcc578650

20:22 cemerick: heh, the one time I needed something like that, I did a (eval `(com.foo.Bar. ~arg1 ~arg2)) :-P

20:23 never though there was a prefab facility for it.

20:23 blbrown_win: was new-by-name just introduced

20:24 hmm, uses reflection

20:28 that is odd, apparently I can't play music from my remote machine.

20:35 cemerick: whoa, 10 minutes fixing something in java, and I just wrote (println "foo" + "bar") in a repl.

20:45 blbrown_win: I always forget the syntax for calling static methods. Is it (System/currentTimeMillis) ?

20:49 stuhood: blbrown_win yes

20:50 tgevaert: ,(System/currentTimeMillis)

20:50 clojurebot: 1244768140876

20:52 Chouser__: cemerick: heh.

21:23 hiredman: ,(+ 15 23)

21:23 clojurebot: 38

21:26 cp2: ,(+ 19 23)

21:26 clojurebot: 42

21:26 cp2: thats more like it

21:32 blbrown_win: ,smart bot

21:32 clojurebot: java.lang.Exception: Unable to resolve symbol: smart in this context

21:32 blbrown_win: clojurebot, smart bot

22:05 twopoint718: ,(macroexpand '(with-open [a FOO] (dostuff a)))

22:05 clojurebot: (let* [a FOO] (try (clojure.core/with-open [] (dostuff a)) (finally (. a clojure.core/close))))

23:34 polarbizzler: is this where you get help?

23:35 i can't get my xml to parse right

23:35 blbrown: Well, I like Firestone when I am having car trouble, is that what you mean?

23:36 polarbizzler: well i got this xml i'm trying to parse and the xml-> always returns nil

23:37 <?xml version="1.0" encoding="UTF-8"?>

23:37 <UserProfile>

23:37 <SiteUIDList>

23:37 <Uid value="run"/>

23:37 <Uid value="race"/>

23:37 <Uid value="route"/>

23:37 <Uid value="shoe"/>

23:37 <Uid value="vitals"/>

23:37 </SiteUIDList>

23:37 </UserProfile>

23:37 I don't know how this irc thing works never used it before i heard you can get help on here sometimes

23:39 (xml-> (zip/xml-zip (xml/parse xml)) :UserProfile )

23:39 should that return something?

23:42 its driving me nuts I'm a clojure noob

23:43 i guess i'll just let that one simmer for a while

23:54 hiredman: polarbizzler: is that xml in a file or what?

23:54 polarbizzler: yes

23:54 hiredman: and (xml/parse xml) returns ok?

23:55 polarbizzler: yup i see the tree coming back

23:55 hiredman: ,(doc xml->)

23:55 clojurebot: "clojure.contrib.zip-filter.xml/xml->;[[loc & preds]]; The loc is passed to the first predicate. If the predicate returns a collection, each value of the collection is passed to the next predicate. If it returns a location, the location is passed to the next predicate. If it returns true, the input location is passed to the next predicate. If it returns false or nil, the next predicate is not called. This process is repea

23:55 hiredman: ,(doc clojure.xml/parse)

23:55 clojurebot: "([s] [s startparse]); Parses and loads the source s, which can be a File, InputStream or String naming a URI. Returns a tree of the xml/element struct-map, which has the keys :tag, :attrs, and :content. and accessor fns tag, attrs, and content. Other parsers can be supplied by passing startparse, a fn taking a source and a ContentHandler and returning a parser"

23:56 durka42: so

23:56 hiredman: ~def xml->

23:56 durka42: UserProfile is the root element

23:57 using :SiteUIDList gets you something

23:57 polarbizzler: oh you can't use the root element?

23:57 oh cool that gets something how do you filter on attributes?

23:58 hiredman: I guess the idea is you already have the root element

23:58 http://code.google.com/p/clojure-contrib/source/browse/trunk/src/clojure/contrib/zip_filter/xml.clj#135 has some examples

23:59 durka42: Clojure=> (xml-> (zip/xml-zip (xml/parse "/Users/alex/Programming/test.xml")) :SiteUIDList :Uid (attr :value))

23:59 ("run" "race" "route" "shoe" "vitals")

Logging service provided by n01se.net