#clojure logs

2009-06-11

00:17DTrejohiredman: I guess the people who wrote it need more engenuity at turning things into .clj
00:48cp2hiredman: it uses pircbot too... :x
01:00hiredmanpircbot is pretty easy
01:31replacatoo lazy to explore right now. Can someone online point me to a quick solution for escaping <> etc. in xml strings?
01:33durka42knowing xml, it's probably more complicated than &lt;
01:34replacanot too much, for this case, but there's a chunk of it
01:34replacalooks like c.c.lazy-xml has something
02:16replacasteven is on a roll!
02:21Carkwho's steven ?
02:24replacasteven gilardi
02:24replacawho's been checking in a ton of stuff the last few days
02:25Carkohhh ok =)
02:25Carkthanks !
02:27replacalooks like good stuff, too
02:28Carki was wondering how this new condition stuff interacts with java
02:28Carkguess i'll have to test it some day
02:30replacayeah, I haven't dug into it yet
02:31replacalike *so* many other things
02:31replacafinally played with xml & zippers tonight. pretty cool, once you've got it going on
06:26eleftheriosis there a ubuntu package for clojure?
06:30asbjxrnyes
06:31asbjxrnI don't use Ubuntu myself, so I know nothing about it, but: http://packages.ubuntu.com/karmic/clojure
06:34asbjxrnLooks pretty basic, the clojure jar and some scripts to launch it.
06:34asbjxrnYou may be better off following some guides to get a complete environment set up.
06:35eleftheriosyes, probably. I need to setup emacs etc. too
06:36eleftheriosI thought that the package would set up everything
06:36eleftheriosasbjxrn: yes, looking at it is very basic
06:37eleftheriosbut it is a start, I guess they will improve it over time :-)
06:37eleftheriosthough they have been very slow in picking up Clojure, other apps get packaged in very early versions
06:39asbjxrnIf you want to use emacs, I think this link is ok: http://technomancy.us/126
06:42eleftheriosasbjxrn: yes, I use emacs
06:42eleftheriosthank you
06:44eleftheriosasbjxrn: what I like in that page is that it has even attracted people like Bertrand Russell
06:44eleftherioswho says in a comment: "I've been using emacs for 15 years and just discovered ESK a few nights ago..."
06:44eleftheriosBertrand Russell uses emacs, cool
06:44eleftherios:-)
06:45plutonaswhat is ESK?
06:46asbjxrnEmacs starter kit
06:52eleftheriosI had never heard of it
06:53asbjxrnNeither had I. :) I didn't add it, but thinking maybe I should.
06:54asbjxrnSince it came so highly recommended.
07:09frodefany pointers on how to use contrib/swing-utils and swing in general?
07:09eevar2frodef: you could start by reading sun's swing tutorial
07:10asbjxrnNot really, but thanks for telling me about swing-utils. Just setting up some dialog boxes at the moment :)
07:11eevar2frodef: assuming you're new to swing, not just new to swing from clojure
07:11frodefeevar2: that's right. I'll have a look. thanks.
07:21frodef..but it'd still be nice to see an example of a swing-utils application :)
07:26eleftheriosfrodef: how long have you been using clojure? What's your opinion so far if you don't mind me asking
07:27frodefeleftherios: that the documentation is somewhat terse (at least for someone not so familiar with java).. :)
07:27frodef..that the square brackets are useless.
07:28frodef..that it's much better than using ordinary java.
07:31eleftheriosfrodef: why do you consider the square brackets useless?
07:32frodefI don't know that they give me anything, except occationally the hassle of "oh, these parens needs to be squared".
07:32Chousukefrodef: I think you're wrong.
07:32Chousukefrodef: with square brackets, you know it's not a operator form
07:33frodefhow so? [1 2 3] is a valid form too?
07:33Chousukeyeah, but not confusable with a function or a macro call
07:33Chousukethere are only two situation where (foo bar) is not a function/macro call in clojure :/
07:34Chousuke+s
07:34frodefIt's of no value to me, anyways.
07:35ChousukeSee, that's where I disagree with you :)
07:35frodefso you often look at random snippets of code outside their lexical context, then? :)
07:36Chousukeyou don't need to remember the macros where lists aren't evaluated as function calls because it's more clojurey to just use vectors.
07:36frodefso it's a hint that "this form probably isn't evaluated"?
07:37Chousukevectors are evaluated, but not as function calls
07:37Chousuke,(let [x 1] [1 x 2]); can't have a list there
07:37clojurebot[1 1 2]
07:38frodefso what is gained, exactly?
07:38frodefwrt. (let (x 1) [1 x 2])
07:38Chousukeif 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.
07:38eleftheriosrhickey can perhaps shed some light
07:39rhickeyshed light on what?
07:39Chousukeit also gives a visual clue.
07:39plutonas(let ((x 1)) `(1 ,x 2)) ---> (1 1 2) :D
07:40eleftheriosrhickey: frodef doesn't see the value in having square brackets, Chousuke points out that they have a real use
07:40Chousukeplutonas: see, that looks like a let that takes the result of some function call ((x 1)) as its first parameter.
07:40frodefChousuke: so it's a rather vague hint that can't even be trusted.. i.e useless.
07:40rhickeyfrodef: do you use CL or Scheme?
07:41Chousukefrodef: the other difference is that the argument is an actual vector, too. not a list :)
07:41frodefrhickey: you have one leature for each? :) I use CL.
07:42Chousukeliteral vectors also have the effect that explicit 'list calls are nearly nonexistent :P
07:42Chousukeexcept when you actually want a list. quite often you don't :)
07:43plutonasChousuke: 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
07:43Chousukeplutonas: well, you'd only need to know the difference between a vector form and a list form.
07:43rhickeyfrodef: you must have experience then with newcomers complaining about e.g. parens, before they have use it enough to see their value
07:43Chousukeplutonas: in list forms, the operator position is special.
07:44rhickeysome Schemes support using []'s in lieu of parens, and convention there is to use them instead of parens for structural grouping
07:45frodefrhickey: sure, I see your point. I was asked, and so far [] is nothing but a hassle to me. But please enlighten me.
07:45frodefrhickey: isn't it unfortunate to also use them for vectors then?
07:46eleftheriosin aesthetic terms, I feel the presense of square brackets certainly helps people like me who come from a Python background
07:46Chousukefrodef: they're not "also" used for vectors in clojure. they are always vectors.
07:47Chousukemany macros just take a vector parameter instead of a list like CL usually does
07:47frodefChousuke: sure, but the fact that they are valid forms is what is unfortunate.
07:47rhickeyfrodef: I don't get that point
07:48rhickeyLisps use data structures for syntax
07:48asbjxrnIt's not a "valid form", it's a reader macro for (vector 1 2 3)
07:48Chousukethat's not strictly true, is it?
07:49rhickeyasbjxrn: no it's not, it's read as a vector literal
07:49Chousuke,(let (vector x 1) x)
07:49clojurebotjava.lang.IllegalArgumentException: let requires a vector for its binding
07:49asbjxrnoh, well..
07:49frodefrhickey: if "[1 2 3]" was not a valid form, the presence of square brackets would unabiguuously imply grouping?
07:49Chousukefrodef: grouping isn't all vectors can be used for.
07:50Chousukefrodef: I think there are some DSLs that use vectors for the actual "language" and just interpret list forms as user code
07:50Chousukecan't do that in CL without unquotes and stuff.
07:50rhickeyfrodef: no, but that doesn't negate its value in distinguishing grouping from calls
07:51rhickeythis 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
07:52frodef 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.
07:52asbjxrnActually, I find the CL cond a bit easier to read...
07:53eleftheriosasbjxrn: opposite here, the clojure cond is slim and easier on the eye
07:53rhickeyfrodef: that's just the argument against macros
07:54duncanmrhickey: morning!
07:54asbjxrnThe extra parenthesis makes a little indendation difference between test and form when you have multiple branches
07:54rhickeyapplies to all Lisps, if foo is a macro the evaluation of everything inside it is subject to foo's definition
07:54Chousukefrodef: at least you know [x 1] is not a function call :)
07:54Chousukeunless the macro is insane
07:54frodefrhickey: sort of, yes, but I thought some of the motivation of [] was to counter that anti-macro argument.
07:55rhickeyfrodef: 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
07:56frodefmaybe to python programmers.. ;)
07:56eleftheriosfrodef: or more likely, to anyone who is _not_ used to CL
07:57eleftheriosfrodef: which is probably a majority compared to CL programmers :-)
07:57duncanmi 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)
07:57duncanmright now, it says "Don't know how to create ISeq from: Symbol"
07:57frodefanyways, 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?
07:57frodef..or even just stack-traces?
07:58plutonassomething like slime?
07:58duncanmfrodef: SLIME does that
07:58frodefplutonas: except slime has no break-loop, which makes it terible.
07:58frodeferr
07:58duncanmbreak-loop?
07:58duncanmyou want something like USE-VALUE?
07:59Chousukefrodef: 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))))
07:59frodefduncanm: "nested" REPLS for each error context.
07:59duncanmChousuke: haha, not if you show that to a Schemer ;-)
07:59duncanmfrodef: ahh, levels.... that'd be handy, yes
08:00frodefduncanm: in my mind it's more that handy, it's the essential development tool.
08:01duncanmChousuke: yeah, in fact, LET-VALUES in Scheme has one more set of parens too
08:01eleftheriosduncanm: 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
08:01duncanmeleftherios: no, i'm not arguing that the Clojure way is bad in anyway
08:02eleftheriosduncanm: sure, I was just adding to the conversation :-)
08:02duncanmeleftherios: all i said was that, for Schemers and CL-ers, i'd be nice if there's slightly better error messages
08:02frodefI'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?
08:02eleftheriosduncanm: oh I was referring to your reply to Chousuke about the visual differentation point he made
08:03duncanmeleftherios: nod
08:03eleftheriosduncanm: better error messages are alwasy erm...better
08:03eleftheriosfrodef: asbjxrn earlier showed me this http://technomancy.us/126 perhaps it helps?
08:04duncanmeleftherios: yeah, like i said, right now, ((fn (x) x) 1) -> Don't know how to create ISeq from: Symbol
08:04ChousukeClojure'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
08:04ChousukeMaybe they can argue the point that there is little improvement, but that's not very useful
08:05frodefChousuke: that's twice true.. :)
08:05eleftheriosI find clojure syntax a joy
08:05Chousukeme too :)
08:05Chousukeduncanm: and yeah, the error messages could use improvement.
08:06eleftheriosI have limited exposure to it but so far I really like it
08:06duncanmChousuke: for that particular case, i wonder what it should say
08:06Chousukeduncanm: I thikn it
08:06Chousukeit's complaining about the (x) instead of [x]
08:06duncanmwhat if there's a procedure named X, and it returns a vector?
08:07Chousukefn is a special form. that's not valid 'fn syntax
08:07Chousukethe (x) won't get evaluated
08:07frodefeleftherios: at least there's a newer version of the clojure-mode.el there. thanks.
08:07duncanmoh
08:08duncanmChousuke: so then yeah, it's a straight-forward case of making the error message better-worded
08:08Chousukeduncanm: maybe post an issue on the tracker about this?
08:08Chousukejust improving error messages in general
08:09duncanmChousuke: will do once I get to the office
08:09duncanmoh, i once made a posting about importing classes that are not namespace-qualified
08:10duncanmit was either you, Chousuke, or someone else who helped me out and wrote some snippet that did that
08:10ChousukeMight've been Chouser too
08:10duncanmahh, yeah
08:10duncanmbut either way, i don't think that post ever showed up
08:11duncanmthat's right, the snippet is basically this:
08:11duncanm(.importClass *ns* name (clojure.lang.RT/classForName (str name)))
08:12duncanmand i wrote that it'd be handy if (import '(foo)) did that automatically
08:12duncanmmaybe i should have written up a patch ;-P
08:20eleftheriosfrodef: :-)
08:22asbjxrnfrodef: the classpath setup example on that page is useful, too.
08:22duncanmfrodef: actually, given how exceptions work in Java, how would you want command levels to work with the REPL?
08:23asbjxrnUnless you set up a lisp command that adds all libraries you've got to the classpath if you need it or not.
08:24asbjxrnOne 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?
08:27frodefduncanm: hmm.. guess you're right it won't work.
08:27frodefclojure succeeded in lulling me into a false sense of not being on a braindead platform :)
08:29eleftheriosfrodef: too complicated, consider revising to: "clojure succeeded in lulling me into a false sense of being on a sane platform" :-)
08:30frodefright :)
08:30eleftheriosbad humour, sorry :-)
08:33rhickeyfor 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&amp;yr=2009&amp;track=javase
08:35duncanmrhickey: do you know if videos of the sessions will be made available?
08:35frodefrhickey: lots of neat stuff, for sure. It's just such a pity that a number of (imho) crucial things are completely missing/not supported.
08:36duncanmbah - you need to login to the Sun Developers Network just to download the PDF ;-P
08:37rhickeytradeoffs are a fact of life - if you think CL is without them, then stick with it
08:37rhickeyduncanm: yeah, PITA, but free
08:37rysAh, nice link
08:38eleftheriosrhickey: so true :-)
08:38eleftheriosin any case, clojure is really fresh and great and hopefully we'll start doing some stuff with it at work (currently a Python shop)
08:39frodeftrue, but it remains a pity.
08:40rhickeyIBM's JVM presentation was also good, but pdf link is currently broken: http://developers.sun.com/learning/javaoneonline/j1sessn.jsp?sessn=TS-5253&amp;yr=2009&amp;track=javase
08:42rhickeyfrodef: 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
08:44asbjxrnI always feel such slideshows are less filling. I'm not smart enough to understand what was said about the bulletpoints...
08:44rhickeyyou can detach the debugger and keep on working, so it doesn't devolve into compile/link/run/debug/repeat
08:44rhickeyasbjxrn: yeah, it was a great high-speed talk, slides don't do it justice as usual
08:46asbjxrnI usually have problems getting the exeptions caught by the debugger, it is just me or is that tricky when using slime?
08:47asbjxrnOr is that not the java way of debugging? I like to have a look around at what the state was when the error occured.
08:49rhickeyasbjxrn: 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
08:49Drakesonis 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)
08:51asbjxrnI'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?
08:53duncanmasbjxrn: that's what rhickey told me when i met him a few months ago, that he uses clojure-mode.el
08:54duncanmi'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
08:55duncanmfor 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
08:57bstephensonI thought rhickey was using enclojure at the Script Bowl at Java One
08:57bstephensonbut that was second hand info
08:58duncanmmaybe instead of having a tiny REPL implementation, i could make the app re-use enclojure instead
08:59Chouserreflective calls can sometimes be inlined??
08:59Chouserthat must not mean what I think it means.
09:06asbjxrn`?
09:06duncanmyes?
09:07duncanmCould not find clojure.lang.Compile. Make sure you have it in your classpath
09:07duncanmis it not enough that I have -Dclojure.jar=... in ant?
09:07Chouserduncanm: probably not. clojure.jar also needs to be in your classpath
09:08Chouseroh
09:08Chouserhm.
09:08Chouserduncanm: building contrib?
09:08duncanmChouser: no, enclojure
09:08duncanmChouser: i'm new to a lot of java tools
09:08duncanmChouser: but when i build contrib, that's all i needed to do
09:09ChouserI don't know about enclojure, sorry.
09:09ChouserI'm no Java heavyweight either.
09:09duncanmi bet there's some build.xml magic
09:15rhickeybstephenson: 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
09:17cemerickI'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)
09:18duncanmcan't I just do CLASSPATH=~/.clojure ant to temporarily add clojure to my classpath?
09:18duncanm"CLASSPATH=~/.clojure ant"
09:18rhickeyIlya showed some serious advancement in La Clojure for IntelliJ at the show as well. JetBrains had printed handouts for it at their booth!
09:18rhickeyesp. cool - rename refactoring
09:19duncanmrhickey: that's neat
09:19rhickeysupporting that was a design objective of Clojure
09:19cemerickrhickey: do they have any REPL library in place, or in progress?
09:20rhickeycemerick: REPL is new, still needs some bug-shaking
09:20asbjxrn`I think they had some improvements to the repl not long ago. But then it was pretty useless before.
09:20rhickeybut he was flying around with context-aware completion everywhere
09:20cemerickah. 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.
09:21rhickeycemerick: I don't think they have thought that through as far as enclojure has
09:21rhickeyyet
09:22cemerickit seems like a standard repl protocol and mechanism should be established (in contrib, anyway). It'd be unfortunate if every IDE had their own.
09:23Chousercemerick: any reason it shouldn't be slime?
09:23cemerickI guess I'd ask: why *should* it be slime?
09:23rhickeytoo much
09:24rhickeybut there is a fundamental question - should a remote repl be stream or conversation oriented?
09:24cemerickI'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.
09:25Drakesonfeature request: ([f1 f2] x) -> [(f1 x) (f2 x)]
09:25ChouserDrakeson: breaking change
09:25asbjxrn`Drakeson: who are you requesting it from?
09:25frodefrhickey: what does "conversation oriented" mean?
09:25DrakesonChouser: what is the current meaning of ([f1 f2] x)?
09:26ChouserDrakeson: ([f1 f2] x) already means get the x'th item from that vector.
09:26Chouser,([:a :b :c] 1)
09:26clojurebot:b
09:26rhickeyfrodef: rather than stream characters the client will package a complete form for evaluation
09:27asbjxrn`Ah, I thought it was request for IDE rewriting (a.la. paredit)
09:27Chouser,(map #(% 5) [- +])
09:27clojurebot(-5 5)
09:27Drakesonis there a map to create such function? ((some-map f1 f2) x) -> [f1 x] [f2 x]
09:27cemerickah, 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.
09:28Chousercemerick: I agree. Is slime not like that?
09:28cemerickDrakeson: (map #(% x) [f1 f2])?
09:28cemerickChouser: no idea.
09:29cemerickslime 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.
09:30asbjxrn`I thought slime was the frontend, swank is the "protocol"?
09:30cemerickright, sorry, we should be talking about swank
09:31Chousermy fault.
09:32cemerickwell, 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?
09:32Drakesondoes this have a name already: (defn mapf [& fs] (fn [x] (map #(% x) fs)))
09:33asbjxrn`There is some vim clients, I belive?
09:34ChouserDrakeson: currently the best tool for that kind of search is #clojure
09:34rhickeyhuh, that worked... http://github.com/richhickey/clojure/tree/master (please don't rely on yet, but help me look it over for any problems)
09:34Drakeson(not trying _all_ functions from "clojure api" and testing the output)
09:35Drakesonsweet. Is that _the_ official git repos? are we finally relieved from "git svn"?
09:36rhickeyDrakeson: nothing official yet, still working things out
09:37rhickeyit looks like assembla+github will work
09:37cemerickasbjxrn`: 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
09:39asbjxrn`rhickey: well, clone and build works, at least.
09:39Chouserrhickey: it's not just the width of your window?
09:40asbjxrn`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?
09:42rhickeyChouser: it can be made visible by making the window really wide, but works fine at same width in Safari
09:43rhickeyasbjxrn`: 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
09:44cemerickrhickey: 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.
09:44cemerickuh, git status, I mean
09:46Chousercemerick: wow I wouldn't expect that.
09:46ChouserI bet it won't work for me.
09:46Chousercemerick: your mirror is more than plain git-svn? or you were mirroring only trunk?
09:47cemerickChouser: that should absolutely be the case. Anything else would indicate a big problem, I think.
09:47cemerickChouser: I checked out the ref for svn/trunk, and copied those contents over (e.g. none of my patches moved over, etc)
09:47cemerickI have my patches in a different branch.
09:47ChouserI use git-svn on the whole repo, so I have trunk and branch sub-dirs. The diffs aren't likely to match.
09:48cemerickIf you 'git svn init -s URL', then it'll make git branches out of the branches, and root things at trunk.
09:49cemerickhaving trunk and branch subdirectories is sorta broken, IMO
09:49rhickeyI 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
09:49cemerickhuh, fancy :-)
09:49cemericktoo bad we can't use github
09:49rhickey?
09:50cemerickrhickey: I mean Snowtide, not clojure.
09:50rhickeyah
09:51Chousercemerick: you can pay for private hosting at github, can't you?
09:51cemerickChouser: 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.
09:51rhickeyyou have to trust the people at github with your source
09:52Chousercemerick: ah.
09:52cemerickhell, I don't trust myself with our source! :-P
09:52tWiphow about http://fi.github.com/ ?
09:52rhickeyI meant from a disclosure standpoint
09:53cemericktWip: oh, that's new!
09:53tWipyes, it is... recently announced
09:53cemerickwhew, $600/user/year.
09:54cemerickgitosis will do for now :-) I'd be willing to pay $600 / user perpetual.
09:54tWipouch
09:55tWipdo they specify what "user" means? if it means one actual person, then that seems quite high
09:55tWip# of accounts it seems, then forget it :P
09:56ChouserI wonder if the price is high now to reduce the demand on their support staff.
10:01frodefWhen 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:01frodef.. does this ring a bell with anyone?
10:01asbjxrn`Yes.
10:02frodefasbjxrn: really? any tips?
10:02asbjxrn`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:02asbjxrn`Sorry.
10:02frodefah.. :)
10:02Chouserevery time I start getting closer to really committing to emacs, something like this comes up.
10:03frodefI somehow doubt emacs is at fault.
10:03Chouserwell, it is slime/swank which I wouldn't do early.
10:03frodefalso this behavior seems to come and go, which is frustrating.
10:03Chouserfrodef: I'm sure. :-/
10:04asbjxrn`Do you set up keyboard listeners in your app?
10:04frodefonly have shortcuts for menus.
10:04jdzand might it be an issue with the swing's event handler running in the main thread or something like that?
10:05frodefjdz: who knows..
10:06frodefperhaps it would be a good idea to spawn the "application" in a new thread?
10:07frodefseemed to do the trick..
11:03frodefis there something similar to CL's (error "blah failed.") ? I.e. to throw a generic error (well, Exception) with a message?
11:04kotarakfrodef: throwf in clojure.contrib.except
11:04frodefhanks
11:33cemerickis 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:59lisppaste8cemerick pasted "let-map, as described above, FWIW" at http://paste.lisp.org/display/81703
12:02drewrInteresting.
12:02cemerickheh, is it?
12:03cemerickI 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:03drewr,(apply hash-map [:foo 1 :bar 2])
12:03clojurebot{:foo 1, :bar 2}
12:03cemerickuh-huh. Unfortunately, :bar's value can't refer to :foo's value.
12:04drewrHm, yes.
12:08stuartsierraThat's clever.
12:09cemerickheh, maybe my macro-fu is getting stronger :-)
12:10stuartsierraNow all you need is a straggly gray beard to be a REAL lisper.:)
12:10drewrThe macro itself is unimpressive, but the abstraction is cool.
12:11drewrs/unimpressive/uncomplicated/
12:11cemerickdrewr: sure, sure. Just having fun. :-)
12:12cemerickunfortunately, 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:13drewrYou have to get past the initial scratchy phase.
12:13cemerickyeah, I couldn't take it
13:19rhickeyah, github - trying to view core.clj via their interface:
13:19rhickeyA 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:19technomancythey have some JS that handles line number links etc.
13:20technomancyit doesn't go over to well on 4000+-line files. =\
13:21rhickeyfine in safari, again
13:22rhickeyactually, safari 4 is smokin'
13:23technomancyyeah, IIRC that browser JITs all its JS, so no surprises there
13:24technomancyactually Firefox 3.5 (which does JIT on JS too) works fine
13:26gnuvincetechnomancy: doesn't webkit compile JS to native code now?
13:26technomancygnuvince: squirrelfish does, yeah
14:38zargon_how do i parse a string into a (clojure) number
14:38zargon_?
14:38stuartsierra,(read-string "3.14159")
14:38clojurebot3.14159
14:39zargon_thx
14:39gnuvince,(Double/parseDouble "3.1")
14:39clojurebot3.1
14:39zargon_thats a java thingy
14:39gnuvince,(type (Double/parseDouble "3.1"))
14:39clojurebotjava.lang.Double
14:39gnuvince,(type (read-string "3.1"))
14:39clojurebotjava.lang.Double
14:40zargon_,(type (read-string "1234"))
14:40clojurebotjava.lang.Integer
14:40zargon_will this promote to BigInt automatically?
14:40gnuvincetry it
14:40zargon_,(type (read-string "1234123123123123123123123"))
14:40clojurebotjava.math.BigInteger
14:40stuartsierraread-string will promote, Integer/parseInt will not
14:40zargon_ok, thats what i need
14:41zargon_thx
14:41Chouserread-string probably has security implications that the java parse* static methods do not.
14:41gnuvince,(read-string "(+ 2 3)")
14:41clojurebot(+ 2 3)
14:41Chouserthe Clojure reader is not currently safe for untrusted input.
14:42technomancyChouser: you mean something like ballooning memory usage by creating lots of keywords/symbols?
14:42tgevaert,(defstruct foostruct :bar) (defmulti foop) (defmethod foop clojure.lang.PersistentStructMap [f] (println f)) (foop (struct foostruct "bar"))
14:42clojurebotDENIED
14:42stuartsierraThere's a reader macro that evaluates (almost) any arbitrary form.
14:43triddellChouser: like SQL injection type exploits?
14:43Chouser,(read-string "#=(java.lang.System/exit 0)")
14:43clojurebotjava.lang.RuntimeException: java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0)
14:43gnuvinceChouser: nice
14:43Chouserclojurebot evals things in a Java sandbox, otherwise that would have shut down the process.
14:43tgevaert,(+ 1 2)
14:43clojurebot3
14:44tgevaertI'm trying to dispatch on a struct type, but I'm getting a nullpointer exception
14:45dnolentgevaert: paste some code.
14:45tgevaertI tried to evaluate it with the clojurebot, but he denied me
14:46tgevaertalright, when I add the type function as the dispatch function, it works
14:47tgevaertI was following the example from http://java.ociweb.com/mark/clojure/article.html#DefiningFunctions
14:48Chouserdispatch-fn is not optional, apparently
14:48tgevaertnvm. hehe
14:48Chouserbut you don't get a compile-time error, you just get NPE anytime you try to call it.
14:48Chouserseems like it could default to 'type'
14:49Chouseror throw at compile-time.
14:50tgevaertwhen I read the example, I missed the class dispatch fn, and for some reason I just assumed that 'type' was an implicit one
14:50tgevaertso, entirely my fault
14:50cemerickthat really should throw, I'd think
14:51Chouseryeah, throw at compile time or offer a sane default.
14:51Chouserrhickey: want an issue/patch for that?
14:51ChouserI'm surprised it hasn't come up more often.
14:52tgevaertI guess other people read the (defmethod) docs more carefully, heh
14:52Chouser:-)
14:52dnolena lot of the editors display type signature now.
14:53dnolen,(:arglists ^#'defmulti)
14:53clojurebot([name docstring? attr-map? dispatch-fn & options])
14:55tgevaert,(deref nil)
14:55clojurebotjava.lang.NullPointerException
14:55cemerickis there ever a sane default for something like that?
15:00Chousercemerick: dispatch-fn could default to 'type'. Dunno if that would be too impure for rhickey's taste.
15:02cemericktype of what, though? a single value for a single argument, or a vector of types, one for each argument?
15:03cemerickAlso, 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:04stuartsierraYeah, I've wondered about that, using 'type' in libs, but no one's objected yet.
15:06cemerickwell, 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:07cemerickA 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:09ChouserWell, I'm fine with throwing an exception when no dispatch-fn is given.
15:22Drakesonis (compile 'clojure.example.hello) supposed to work, as mentioned in http://clojure.org/compilation ?
15:23technomancyDrakeson: it should work as long as the classes/ directory is on your classpath
15:29Drakesontechnomancy: oh, that was it. thanks.
15:57stuartsierraAnybody using OSGI?
16:01hiredmanlisppaste8: url?
16:01lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
16:03lisppaste8hiredman pasted "hmmm" at http://paste.lisp.org/display/81714
16:04stuartsierraInteresting, but what's the goal there?
16:05hiredmanno more NPE
16:05hiredmanit falls very short of that
16:06stuartsierraI see, you want to do static type checking like Haskell?
16:06hiredmanisa? is pretty cool
16:07hiredmanstuartsierra: I'd like to be able to some kind of verifier tool or something
16:07stuartsierrasounds hard
16:08hiredmanyes
16:10sh10151is there a clojure function that, given '(a b c d e), returns ([a 0] [b 1] [c 2] [d 3] [e 4]) ?
16:10sh10151called enumerate or count in other languages I think
16:10stuartsierraclojure.contrib.seq-utils/indexed
16:10sh10151thanks
16:32replacahs 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:32Chouserreplaca: it's not so hot at that.
16:33Chouserzip-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:33ChouserI believe this was a main reason why cgrand ditched zip-filter for his enlive lib. You might look at that.
16:34replacaahh, luckily a singe change would do it, I think (trying to create a bunch of similar nodes with editted attr values)
16:34replacathanks Chouser, I'll take a look
16:35sh10151you can always use XSLT
16:35sh10151it's what it was designed for ;)
16:36Chousersh10151: xslt is why I wrote zip-filter.
16:36technomancydoes anyone else get isa? and instance? confused?
16:36sh10151aside from the angle-brackets I like it
16:36sh10151esp. xslt 2.0
16:37technomancyI feel like isa? should be named instances-of-this-class-are-a? or something
16:37Chousersh10151: it is weak, hard to extend, wordy. I dislike it immensly.
16:37dnolenEnlive in my experience is much better than xslt, xslt can be lame for complex transformations.
16:37dnolenI used XSLT for tarnsforming census data and it was a bear for anything non trivial.
16:39dnolentechnomancy: isa? works on tag hierarchies as well.
16:39clojurebottechnomancy is to blame for all failures
16:39lisppaste8hiredman annotated #81714 "untitled" at http://paste.lisp.org/display/81714#1
16:40technomancydnolen: yeah, I keep expecting (isa? String "hi") to work.
16:41Chousersh10151: 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:41Chouser...which I will get around to looking at Real Soon Now.
16:41sh10151at least xalan is pretty trivial to extend with java and javascript
16:41sh10151never needed to extend saxon
16:41technomancyenlive needs some nontrivial examples in its docs; I couldn't figure it out
16:42zargon_whats the idiom for creating a map from a list where key:x value:f(x)?
16:43dnolentechnomancy: true, more documentation would be nice, but I have used it great success.
16:43technomancydnolen: great; post some examples! =)
16:43stuartsierrazargon_: (zipmap your-list (map f your-list))
16:44dnolenmy 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:44zargon_stuartsierra: thx
16:53replacaChouser: btw, I really love zip-filter. I can see that's going to get a prominent place in my toolbox
16:55hiredmanif I have a macro that emits a defn form, how can I stick extra metadate in the defn from?
16:55hiredmanlike if I used (defn #^{}
16:56replacahiredman: the metadata there is actually on the var
16:56hiredmanyeah
16:56kotarak`(defn ~(with-meta fn-name {:bla :blub}) ...) would be my guess
16:56hiredmanso
16:56replacaso you can add it to the var after you've created it
16:56kotarakBut there was some issue with that.
16:57hiredmankotarak: that will, I think. put metadata on the symbol
16:57kotarakAnd def will transfer it to the Var, no?
16:57hiredmanoh
16:57hiredmanhmm
16:57kotarakOr was that defn.
16:57replacakotarak: no, I don't hink so
16:57replaca*think
16:58kotarakBut defn will transfer it.
16:58kotarakBecause (defn #^{} bla) also puts the metadata on the symbol...
17:00replacalooking at the def of defn, I think you're right
17:04hiredmanhah
17:04hiredmanexcellent
17:04hiredmanthanks
17:07cemerickthis is a very unfortunate error message -- bit me in a macro:
17:07cemerick,(if-let [a 6] 5 6 7)
17:07clojurebotjava.lang.IllegalArgumentException: if-let requires a vector for its binding
17:09hiredmancute
17:10kotarakThe eternal struggle between error message writers and syntax error writers.... ;)
17:31blbrownanother clojure question: http://groups.google.com/group/clojure/browse_thread/thread/5fef7a9fcc578650
17:52hiredman#$!@#$
17:52hiredmanThis user does not exist
17:53hiredmanwhee
17:53hiredmanthat was scary, for a minute I thought github had forgotten about me
17:53hiredmanhttp://gist.github.com/128259
17:55hiredmanso 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:55hiredmanotherwise it throws an exception instead of def'ing the function
17:56cp2heh
18:05hiredmanthe aspect ratio on stuart's talk is wonky
18:43eleftherioscgrand-r1c: are you doing any work on Ring?
18:47quidnunceleftherios: I think that's his logging bot
18:48hiredman~seen cgrand
18:48clojurebotcgrand was last seen quiting IRC, 108 minutes ago
18:50quidnuncI believe he lives in France so you might taking that into account if you wanwt to reach him.
18:50eleftheriosquidnunc: oh I thought cgrand-eye was the logging bot
18:50eleftheriosyes, he lives in france, it says so somewhere on his blog
18:51eleftheriosquidnunc: thank you :-)
18:51quidnunceleftherios: I'm not sure the difference between the two. I think he just uses cgrand when he is actually present.
18:51eleftheriosI see
19:01hiredmananyone have a link to that essay/paper/whathaveyou on egal?
19:07eleftherioshas anyone purhcased this screencast, http://peepcode.com/products/functional-programming-with-clojure Is it any good?
19:09eleftheriosactually, here's a whole series of screencasts http://www.youtube.com/view_play_list?p=AC43CFB134E85266
19:09eleftheriosthis guy here posted 20 useful links
19:10eleftherioshttp://mattsears.com/2009/6/6/20-clojure-links-to-get-you-up-to-speed
19:10hiredmaneleftherios: http://delicious.com/clojurebot
19:10technomancythe youtube screencasts seemed more like a lecture to me
19:11eleftheriostechnomancy: a good or a bad lecture? :-)
19:12technomancyI 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:12technomancybut I'm biased since I wrote the peepcode one. =)
19:15eleftheriosoh!
19:15eleftherioshaha
19:15eleftheriostechnomancy: will there be more clojure related screencasts on peepcode you think?
19:16eleftheriosI am considering getting the yearly subscription perhaps
19:16technomancyeleftherios: it's possible, but there aren't any definite plans.
19:16eleftheriosthough they seem to have a Ruby bias and I am a python programmer so I have not that much interest on those
19:17technomancymy next one will be an advanced Emacs screencast
19:17eleftheriosthat's useful :-)
19:17technomancybut doing a second one is always risky since you generally will never sell more of the second than the first.
19:20eleftheriosIs this some sort of a market rule? :-)
19:43cadsuclojurebot, do you log this channel?
19:43technomancycadsu: chouser does
19:43cadsugood evening technomancy
19:43technomancyo hai
19:43technomancyclojurebot: logs?
19:43clojurebotlogs is http://clojure-log.n01se.net/
19:44hiredmanclojurebot: log is <reply>see logs
19:44clojurebotYou don't have to tell me twice.
19:46cadsuthat's really nice!
19:47cadsuwe'd like to have something like that in our #atlclojure channel
19:48cadsuthat'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:49cadsuone of our members should be able to host it, but I think its up to me to set up the bot
19:49cadsuis it hard to set up the way it is here?
19:49hiredmanhmmm
19:50hiredmanclojurebot: where are you?
19:50clojurebothttp://github.com/hiredman/clojurebot/tree/master
19:50hiredmanthe bot does have some #clojure specific bits, and it is not in the most consumer friendly form
19:50technomancyhiredman: so n01se.net's logs come from clojurebot?
19:50hiredmanI dunno how Chouser does the logging
19:50technomancyoh
19:51drewrHe just uses his IRC client, IIRC.
19:51hiredmanclojurebot certainly could do logging
19:51cadsufor basic logging I'm sure there are simpler solutions
19:51hiredmanthe most basic would just be to have someone's client log
19:52cadsuindeed, I have been
19:53cadsuhmmmmm, there is the interesting problem of merging separate logs from trusted but non synchronized users!
19:53cadsuhehe, but I ought to focus
19:53hiredmanhttp://mg.pov.lt/irclog2html/
19:53cadsuI think I should put a basic irc client as a process running on a friend's server
19:54mblinnwould 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:54hiredmanmblinn: everything needs to be in teh classpath of the nailgun server
19:54mblinnand . isn't automatically added or anything?
19:54mblinnhmm
19:54hiredmanmblinn: dunno
19:55hiredmanor "it depends"
19:55mblinnheh
19:55mblinnwell, so all I'm trying to do is write a little program that's in its own namespace
19:57mblinnbut 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:58hiredmanwhat is the namespace?
19:58mblinnhyde
19:58hiredman:(
19:58hiredman~namespaces
19:58mblinnhmm
19:58clojurebotnamespaces 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:58hiredman~compile
19:58clojurebotthe 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:58mblinnah
19:59hiredmanI guess the compile isn't relevent here
19:59hiredmantriggering those together is just sort of a reflex
19:59mblinnheh
19:59hiredmananyway, good luck, I'm gone
19:59mblinnthanks much
20:20blbrown_winI 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:22cemerickheh, the one time I needed something like that, I did a (eval `(com.foo.Bar. ~arg1 ~arg2)) :-P
20:23cemericknever though there was a prefab facility for it.
20:23blbrown_winwas new-by-name just introduced
20:24blbrown_winhmm, uses reflection
20:28blbrown_winthat is odd, apparently I can't play music from my remote machine.
20:35cemerickwhoa, 10 minutes fixing something in java, and I just wrote (println "foo" + "bar") in a repl.
20:45blbrown_winI always forget the syntax for calling static methods. Is it (System/currentTimeMillis) ?
20:49stuhoodblbrown_win yes
20:50tgevaert,(System/currentTimeMillis)
20:50clojurebot1244768140876
20:52Chouser__cemerick: heh.
21:23hiredman,(+ 15 23)
21:23clojurebot38
21:26cp2,(+ 19 23)
21:26clojurebot42
21:26cp2thats more like it
21:32blbrown_win,smart bot
21:32clojurebotjava.lang.Exception: Unable to resolve symbol: smart in this context
21:32blbrown_winclojurebot, smart bot
22:05twopoint718,(macroexpand '(with-open [a FOO] (dostuff a)))
22:05clojurebot(let* [a FOO] (try (clojure.core/with-open [] (dostuff a)) (finally (. a clojure.core/close))))
23:34polarbizzleris this where you get help?
23:35polarbizzleri can't get my xml to parse right
23:35blbrownWell, I like Firestone when I am having car trouble, is that what you mean?
23:36polarbizzlerwell i got this xml i'm trying to parse and the xml-> always returns nil
23:37polarbizzler<?xml version="1.0" encoding="UTF-8"?>
23:37polarbizzler<UserProfile>
23:37polarbizzler <SiteUIDList>
23:37polarbizzler <Uid value="run"/>
23:37polarbizzler <Uid value="race"/>
23:37polarbizzler <Uid value="route"/>
23:37polarbizzler <Uid value="shoe"/>
23:37polarbizzler <Uid value="vitals"/>
23:37polarbizzler </SiteUIDList>
23:37polarbizzler</UserProfile>
23:37polarbizzlerI don't know how this irc thing works never used it before i heard you can get help on here sometimes
23:39polarbizzler(xml-> (zip/xml-zip (xml/parse xml)) :UserProfile )
23:39polarbizzlershould that return something?
23:42polarbizzlerits driving me nuts I'm a clojure noob
23:43polarbizzleri guess i'll just let that one simmer for a while
23:54hiredmanpolarbizzler: is that xml in a file or what?
23:54polarbizzleryes
23:54hiredmanand (xml/parse xml) returns ok?
23:55polarbizzleryup i see the tree coming back
23:55hiredman,(doc xml->)
23:55clojurebot"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:55hiredman,(doc clojure.xml/parse)
23:55clojurebot"([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:56durka42so
23:56hiredman~def xml->
23:56durka42UserProfile is the root element
23:57durka42using :SiteUIDList gets you something
23:57polarbizzleroh you can't use the root element?
23:57polarbizzleroh cool that gets something how do you filter on attributes?
23:58hiredmanI guess the idea is you already have the root element
23:58hiredmanhttp://code.google.com/p/clojure-contrib/source/browse/trunk/src/clojure/contrib/zip_filter/xml.clj#135 has some examples
23:59durka42Clojure=> (xml-> (zip/xml-zip (xml/parse "/Users/alex/Programming/test.xml")) :SiteUIDList :Uid (attr :value))
23:59durka42("run" "race" "route" "shoe" "vitals")