#clojure logs

2009-02-14

00:02durka42,(* 9.35 7)
00:02clojurebot65.45
00:04durka42,(/ 9.35 15)
00:04clojurebot0.6233333333333333
00:05durka42,(/ 9.35 0.5)
00:05clojurebot18.7
00:06Chouser?
00:06durka42so i used a lazy language instead
00:30blbrownjust an observation, if you have a proxy function... (proxy [Proxy] [] (func []) ...if
00:30blbrownif Proxy is not defined, you get a nullpointerexception, is that normal
00:33Chouserwhat would you prefer it do?
00:36ayrnieu"Dear blbrown, your attempt to proxy an undefined Proxy on line 33 of yourprogram.clj has failed for this reason: Proxy does not exist. Maybe you meant Proxine? Would you like me to edit this change into yourprogram.clj and try what you were doing again?"
00:36Chouserhm, not bad.
00:37blbrownhehe
00:38blbrownIm just saying
00:38hiredman,(a 'b)
00:38clojurebotjava.lang.Exception: Unable to resolve symbol: a in this context
00:38hiredmanhmmm
00:38Chousereven better "...Maybe you meant foo.bar.Proxy? I tried that instead and although it compiled, the formal names of some of the methods do not seem to fit well with superclass argument names, so you may wish to review this code."
00:38ayrnieu(declaim (speed 0) (safety 3) (clear-error-messages (fact 400)))
00:39blbrown,(proxy [RunnableX][] (run [] (println foo))
00:39clojurebotEval-in-box threw an exception:EOF while reading
00:39blbrown,(proxy [RunnableX][] (run [] (println foo)))
00:39clojurebotjava.lang.NullPointerException
00:39blbrownyea
00:39blbrown,(proxy [Runnable][] (run [] (println foo)))
00:39clojurebotjava.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers)
00:59blbrownModius, you from Austin?
02:42danlarkinhappy valentine's day, clojurecrats!
02:43RaynesHappy valentines day danlarkin.
02:44blbrownyea...random thought. I wonder why Yahoo didn't buy twitter, hmm
02:47danlarkinbecause they need cash flow, not another non-revenue producing acquisition :)
02:49albinocashflow for the twitter people though
03:01blbrowndanlarkin, twitter will make cash, maybe not now, but guaranteed they will.
03:01danlarkinblbrown: easier forecast than done
03:59zargon_(map #([%]) [1 2 3])
03:59zargon_java.lang.IllegalArgumentException: Wrong number of args passed to: LazilyPersistentVector
03:59zargon_Why is that?
04:00zargon_if I use a defn makevec instead of the anonymous function it works ...
04:03zargon_(map (fn [x] [x]) [1 2 3]) works too
04:53cgrandzargon_: #([%]) expands to (fn [x] ([x])) not to (fn [x] [x])
04:53cgrand,(map vector [1 2 3])
04:53clojurebot([1] [2] [3])
05:03zargon_cgrand: thx
06:20turbo24prgmorning
06:20turbo24prgis it possible to change pr's behaviour to print objects?
06:21turbo24prgor is it necessary to create a new multimethod that dispatches on the type?
06:28turbo24prgi'd like to hook up common lisp to a clojure script with a repl-server (on the clojure side)
06:29turbo24prgbut CL's reader won't understand brackets or braces
06:46zakwilsonA couple of reader macros could make CL understand the brackets and braces.
06:49turbo24prgyeah, that's another way
06:50turbo24prgi'd love to see some decent clojure/CL interaction possibility, but currently a repl-sockets seems the only possibility
09:23kilp, (+ 4 5 6)
09:23clojurebot15
09:23kilp, (/ (+ 4 5 6) 2)
09:23clojurebot15/2
09:24kilp, (/ (+ 4 5 6) (float 2))
09:24clojurebot7.5
09:24kilp(import '(javax.swing JPane))
09:24kilp, (import '(javax.swing JPane))
09:24clojurebotjava.lang.ClassNotFoundException: javax.swing.JPane
09:24kilp, (import '(javax.swing JFrane))
09:24clojurebotjava.lang.ClassNotFoundException: javax.swing.JFrane
09:24kilp, (str "clojurebot" " sucks" " at" " importing")
09:24clojurebot"clojurebot sucks at importing"
09:25kilp(+ " hello" "there")
09:25kilp, (+ " hello" "there")
09:25clojurebotjava.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
09:25kilp, (mod 5 2)
09:25clojurebot1
09:25kilp, (rem 5 2)
09:25clojurebot1
09:25kilp, (div 5 2)
09:25clojurebotjava.lang.Exception: Unable to resolve symbol: div in this context
09:25kilp(/ 5 .0)
09:26kilp(/ 5 0)
09:26kilp(/ 5 1)
09:26clojurebot*suffusion of yellow*
09:26kilp, (/ 5 1)
09:26clojurebot5
09:26kilp, (/ 5 1.0)
09:26clojurebot5.0
09:26kilpwhy did he say that all the sudden?
09:40lisppaste8Chouser pasted "my first stream-creator" at http://paste.lisp.org/display/75472
09:40Chouseris an atom the best way to do that?
09:41rhickeyChouser: it's the best Clojure offers, but those cases could be more lightweight
09:42rhickeyI've thought about simpler reference type - 'box', but am holding off so far
09:43Chouserok, but the explicit state is at least necessary.
09:43rhickeyChouser: I was wondering why for the if thing you didn;t just write a macro that defines if itself, removing any conditionality from if itself (other than the LazySeq test)
09:43rhickeyChouser: yes, state needed - are you switching to streams now?
09:44Chousernot really, but dipping my toe in I guess.
09:49Chouseras for the 'if' thing, I can take another run at it if you want. I didn't think the extra test at compile time was worth trying to avoid.
09:50rhickeyChouser: trying your patch now
09:50ChouserI want to make sure the value of the property at compile time is used also at runtime. my first patch didn't have that, and it makes it pretty easy to think you've got the assert on when in fact only some cases are being checked.
09:57rhickeyChouser: No matching field found: isEmpty for class java.lang.String
09:58Chouser1.5?
09:59Chouserthere's a whole lot of clojure missing at that spot in core
09:59rhickeyChouser: yeah, it's hard working up there isn't it? :)
10:00Chouserit really is
10:00rhickeyUtil and RT have a lot though
10:00Chouserbut it's feels weird to have, right, all of the methods of all of the classes.
10:00rhickeyUtil/equals
10:01rhickeyChouser: gotta start somewhere
10:01Chouser.isEmpty was my 3rd or 4th attempt. :-)
10:01rhickeyuntil we rewrite Clojure in Clojure
10:03Chouseryou should be careful with such statements -- people will hold you to it.
10:05rhickeyChouser: at some point I'm likely to increase the generality of the underpinnings of fn to be a full class generator...
10:05rhickeyIt's actually kind of arbitrary that it only generates IFn derivees
10:05Chouserlazy-seq was giving me a bit of that impression
10:05rhickeyexactly
10:06kilpAndroid acepts paid applications now! wooooot! did anyoen got something significant running on android wrritten in clojure going?
10:07rhickeyA few tweaks and it could gen almost anything, and with no indirection (and thus no dynamism) could compete for speed with the parts of Clojure now written in Java
10:10rhickeyChouser: so what's your impression of lazy branch? hard port? more elegant lazy fns of your own?
10:15Chouserlazy branch is good.
10:16ChouserI don't think I'll miss nil puns much for new code
10:17Chousereven with the assert property, fixing existing puns is a bit of a pain
10:18rhickeyChouser: did you have a lot of them? was it more than just adding a seq call?
10:18ChouserI had one that I spotted visually, pondered for a while, decided it was ok, but was then caught by the assert.
10:18Chouserno, not many
10:18Chouserjust a 'seq' call every time
10:18clojurebotsvn rev 1281; [lazy] added (optional) detection of conditional test of LazySeq, build with: ant -Dclojure.assert-if-lazy-seq=true patch from Chouser
10:19Chouserin this one case, the assert stack trace confused me, and I spent a while hunting it down
10:19Chouserthe seq was created in one place, stored in a map elsewhere, and punned in a third spot. The assert of course didn't point out where the seq was created.
10:21rhickeyChouser: I think the assert will be a big help in the porting phase - thanks!
10:21kilpcan anyone show an example of drawing some lines or shapes on a JFrame usign java graohics2D?
10:22rhickeyChouser: how about 'more'? I think keeping the semantics of rest was critical to making this idea work, but left with new more function
10:25Chouserrhickey: you're welcome. I enjoy participating in the language creation process without having to make any of the hard decisions. :-)
10:25Chousukeheh
10:26pjb3I'm trying to figure out how to use require from the REPL
10:26pjb3I'd like to do the equivalent of
10:26pjb3(ns foo (:require [clojure.xml :as xml]))
10:26Chouserrhickey: you're asking if I think (rest x) == (seq (more x)) is necessary?
10:27pjb3without the ns
10:27pjb3(require [clojure.xml :as xml]) doesn't do it
10:28pjb3(require '[clojure.xml :as xml])
10:28pjb3that works
10:28Chouserkilp: It's a Frame instead of a JFrame, and there some other complexity in there, but... http://gist.github.com/40012
10:29Chouserrhickey: uses of lazy-cons to lazy-seq were easy find and easy to fix (though i've not tested the actual laziness of any of them yet).
10:29rhickeyChouser: no, I'm wondering if you've thought of a brilliant name for 'more'
10:30rhickeyI'm pretty sure changing the semantics of rest (to mean what more does) would have been a disaster
10:32Chouserin lazy we have seq, sequence, and sequential to mean slightly different things, right?
10:32Chouser'more' might accurately be called 'sequential-rest'?
10:32lisppaste8kilp pasted "listener" at http://paste.lisp.org/display/75474
10:33kilp^^ how do I generate that in clojure?
10:33leafwkilp: with a proxy.
10:34rhickeyChouser: more currently guarantees Sequence, not Sequential
10:35leafwkilp: see example of proxy usage for an interface here: http://pacific.mpi-cbg.de/cgi-bin/gitweb.cgi?p=fiji.git;a=blob;f=plugins/Examples/Command_Launchers/Command_Launcher_Clojure.clj;hb=HEAD
10:36rhickeyChouser: best names would probably be: rest (now more), rest-seq (now rest)
10:37Chouserbut of course 'rest-sequence' is too long and 'rest-seq' isn't right.
10:38Chouserrhickey: are you considering those, or would that be too much of a breaking change for 'rest'?
10:40rhickeyWhat I found was that there were plenty of acceptably eager uses of rest in terminal/consuming code, and far fewer calls to rest that needed to become more in lazy-sequence fns
10:40Chouserok, that doesn't surprise me.
10:40rhickeyso changing rest would be much needless grief
10:40Chousersure
10:40Chouseron the other hand while 'more' is not inaccurate, it's not a terribly helpful name.
10:40rhickeyplus an incompatibility with other Lisps where rest/cdr is eager
10:40blbrownhow would I send a class to a java method (E.g. String.class)
10:41rhickeyso new functionality gets new name
10:41kilpare processor registers stacks?
10:41kilpwhat doe smore do?
10:41rhickeyChouser: agreed, more is not a great name
10:41ChouserI already have trouble remembering which is more and which is rest.
10:41leafwblbrown: just use String, without the .class
10:41Chouserbut as you said, 'rest' isn't *terribly* common, so it could afford to be a bit long I'd think.
10:42rhickeyChouser: which 'rest'?
10:42blbrownleafw, that is what I thought, hmm
10:42Chouserbut maybe not 'rest-sequence' longer
10:42Chousersorry!
10:42ChouserI meant 'more' :-P
10:42ChouserI meant 'more' isn't terribly common.
10:43rhickeyrest-coll?
10:43Chouserlet's call it that for the rest of this discussion, shall we?
10:44rhickeycall it what?
10:44rhickeywhose on first? :)
10:44rhickeywho's
10:44Chouser(rest-coll myvec) seems to be the same as (rest myvec)?
10:45rhickeytoo similar?
10:45Chouserno, I was reaching the opposite conclusion.
10:46Chouserthis is a hard conversation.
10:46rhickey:)
10:46rhickeywhat dod you mean by "rest-coll myvec) seems to be the same as (rest myvec)" ?
10:46ChouserI was thinking that if rest-coll does anything sensible on other kinds of collections (besides LazySeqs) that 'rest-coll' might indeed by a fine name.
10:47rhickeyuser=> (rest-coll [1 2 3])
10:47rhickey(2 3
10:47rhickey)
10:47Chouserright
10:47rhickeysame as more
10:48Chouseroh
10:48kilppublic class ExitListener extends WindowAdapter {
10:48rhickeyuser=> (more [1 2 3])
10:48rhickey(2 3)
10:48kilp(proxy ExitListener (WindowAdapter
10:48Chouserwait... rest-coll *is* more, istn' it?
10:48kilp?
10:48rhickeyuser=> (more [1])
10:48rhickey()
10:48Chouseroh, man.
10:48rhickeyChouser: yes, rest-coll as a new name for more
10:49Chouserok, good. for a moment there I was very worried.
10:49kilppublic class ExitListener extends WindowAdapter {
10:49kilp public void windowClosing(WindowEvent event) {
10:49kilp System.exit(0);
10:49leafwkilp: use http://paste.lisp.org/new/clojure
10:50Chouserright, so if some misguided soul calls 'rest-coll' on their vector because they know that vector is a coll and don't realize they can just use 'rest', no harm is done.
10:50Chouserthe '-coll' in the name isn't lying or misleading.
10:51lisppaste8kilp pasted "how to use proxy?" at http://paste.lisp.org/display/75475
10:51Chouserit's longer than 'rest' which helps suggest it's less commonly used, which I think is accurate.
10:52leafwkilp: did you see the TextListener example above?
10:52rhickeyChouser: well, if they wanted the nilling effects of rest, rest-coll wouldn't be the same
10:53rhickeyThere's also lazy-rest, which implies a delay to me, but would match lazy-seq
10:53Chouserah, I see you already demonstrated that to me. :-)
10:53rhickeyuser=> (rest [1])
10:53rhickeynil
10:53rhickeyuser=> (lazy-rest [1])
10:54rhickey()
10:54rhickeydoes that seem weird?
10:54Chouseryes, I don't think lazy-rest is too good. lazy-seq-rest would be more accurate.
10:54rhickeyetc?
10:55ChouserI think rest-coll is my favorite so far. It works on colls, returns a coll (not a ISeq/nil).
10:55Chouseretc's not better than more
10:59kilpleafw: yes i look at it but dont quite get it
11:00rhickeymore->rest, rest->next might be best possible names, compatibility aside
11:05kilphow do I write System.exit(0); from Clojure?
11:06kilp(.exit System 0) ?
11:06Chousuke(System/exit 0)
11:06Chousuke/ for static fields
11:06Chouserkilp: good guess though, I think that used to work. :-)
11:06Chousukeyeah, but not any more :)
11:06Chousukeunless Class has a .exit field :/
11:07Chouserrhickey: sure, 'more->rest' is a fine name. :-) I gotta go, have fun making the hard decisions.
11:07rhickeynice
11:10leafwby the way: on the web page, the search field does not accept function names like "->"
11:10kilpvery schemey with using ->
11:10lisppaste8kilp annotated #75475 with "untitled" at http://paste.lisp.org/display/75475#1
11:11kilpis that somehow correct?
11:14leafwkilp: that defn returns nil. IS that what you want?
11:22pilkleafw
11:22pilkno
11:22pilkiw ant to add an exitaction to the frame
11:25pilkwhen the user presses X I want to do some stuff
11:25pilkhow?
11:26lisppaste8leafw annotated #75475 with "untitled" at http://paste.lisp.org/display/75475#2
11:28pilkthanks
11:28pilkpublic void windowClosing(WindowEvent event
11:28pilkand i never have to mention WindowEvent?
11:28Chousukeleafw: you don't need to call create-exit there? /:
11:29leafwyeah
11:29leafwtoo tired
11:29leafwthe frame is not shown either.
11:30lisppaste8leafw annotated #75475 with "untitled" at http://paste.lisp.org/display/75475#3
12:33shooverrhickey: is the .net contrib you mentioned a few weeks ago public or private?
12:34gnuvince_Hey
12:34gnuvince_Can anyone tell me how to "use" the hasclojure property in clojure-contrib's build.xml?
12:34gnuvince_(so that the .clj are compiled to .class files)
12:35rhickeyshoover: should be in contrib soon - watch the group for an announcement by the author
12:35rhickeypossibly this weekend
12:35shooverrhickey: thanks. my talk is Thursday, and I've love to have something to tell
12:38danlarkingnuvince: -Dclojure.jar=/path/to/clojure.jar
12:39gnuvince_ah!
12:39gnuvince_I was doing -Dhasclojure=/path/to/clojure.jar
12:56gnuvince_Is it possible to have more than one Available task in an if with Ant?
12:56gnuvince_Like, <target name="foo" if="predicate1,predicate2">...</target>
12:59zargon_how do I "map" a list to a map with key=list[i] and value=f(list[i]) ?
12:59zargon_my solution would involve a loop ... but there must be a better more "idiomatic" way?
13:02ayrnieu,(let [lst (range 10) f #(* % -1)] (apply hash-map (interleave lst (map f lst))))
13:02clojurebot{0 0, 1 -1, 2 -2, 3 -3, 4 -4, 5 -5, 6 -6, 7 -7, 8 -8, 9 -9}
13:03kotarak,(let [lst (range 10)] (zipmap lst (map #(* % -1) lst)))
13:03clojurebot{0 0, 1 -1, 2 -2, 3 -3, 4 -4, 5 -5, 6 -6, 7 -7, 8 -8, 9 -9}
13:03kotarakMany ways to Rome... (and back again)
13:03zargon_zipmap!
13:03zargon_thx guys
13:37Lau_of_DKGood evening everyone
13:41danlarkinoh hi lau :)
13:42Lau_of_DKHi Dan, what did you decide?
13:43danlarkinhaha
13:43danlarkinneither!
13:43Lau_of_DKCruel - Then what?
13:44danlarkinwell, sorry to disappoint but I am still nameless. I really tried though, I swear! I talked it over with friends last night for as long as they could stand and the best we came up with was "copter"
13:45Lau_of_DKhaha, man... you need more friends like me
13:45Lau_of_DKHow about "Mohito" ?
13:45Lau_of_DKOr its prolly spelled 'Mojito'
13:46danlarkinI wish hansard were a better name
13:46Lau_of_DKSo pick Hansard,
13:47Lau_of_DKI mean, if thats the best you can come up with, then thats that :) We will suffer it
13:51danlarkinwell you've got some time... right now it won't build, I'm in the middle of a circular dependency issue, so I won't be uploading until I work this out
13:52Lau_of_DKok
14:08clojurebotsvn rev 1282; [lazy] renamed rest to next, renamed more to rest
14:12Lau_of_DKrhickey_: Thats a little odd, why name rest => next?
14:13cgrandI tend to think of next as frest
14:13Lau_of_DKAre you thinking lazily ? :)
14:17rhickeycgrand: it's the next seq object, if any
14:18rhickeyI've updated this: http://clojure.org/lazier
14:18cp2hello ragnard
14:18cp2er, rhickey
14:20rhickeyI'm not sure I'm going to do this, but I had to try it to see what it looks like and get feedback. It took me about 45 minutes to convert Clojure itself, so I think it is a manageable change (basically rename all rest calls to next, except those in lazy fns)
14:20rhickeyI like the resulting code - next means next seq/cursor, rest means rest of the collection
14:21rhickeycp2: hi
14:25rhickeycgrand: what I found in porting core was that most recur calls use next, and most lazy-seq conses use rest, which match the imperative/lazy semantics well
14:26rhickeyopen to feedback, including OMG please don't!!
14:26rhickey:)
14:27Lau_of_DKrhickey: Cant you just put some sample code in the pastebin ? :)
14:29rhickeyhttp://code.google.com/p/clojure/source/diff?spec=svn1282&amp;r=1282&amp;format=side&amp;path=/branches/lazy/src/clj/clojure/core.clj
14:29Lau_of_DKClever :)
14:32danlarkinmy only problem with next is it kinda sounds like it'd be frest
14:32danlarkinbut I can get over that
14:32rhickeydanlarkin: you mean second :)
14:33rhickeydanlarkin: but yes, I understand, cgrand thought so too
14:33rhickeyit could be next-seq or something else more explicit
14:34danlarkinmmhmm
14:35ChouserI don't know if I would have thought that, but I don't see how 'rest' doesn't mean the next lazy-seq obj.
14:35rhickeyChouser: note the next in your sentence
14:36Chouseryes, hense the confusiong over why 'next' means something else.
14:36rhickeyit doesn't
14:36Lau_of_DK(def a [1 2 3]) (def b (next a)), is b then [2 3] ?
14:37rhickey(next aseq) == next seq object or nil there isn't one
14:37rhickey(rest x) a collection of items other than the first
14:37Chouser'next' now means "the next ISeq, or nil", and 'rest' now means "the next LazySeq", right?
14:38Lau_of_DKBut you said that you just renamed rest? Which was why I thought it was weird
14:38rhickeyChouser: sorry, didn't catch the lazy- in your sentence
14:38Chouserah
14:38Chouserhard hard hard conversation. I'm sure it'd be bad in person in front of a white board, but not this bad.
14:38ayrnieuis clojurebot on lazy?
14:39rhickeyrest doesn't promise lazy-seq, or have anything to do with lazy necessarily, better to think of as a collection of the rest of the items other than the first
14:39ayrnieu,(more [1 2 3])
14:39clojurebotjava.lang.Exception: Unable to resolve symbol: more in this context
14:40rhickeynext -> next seq/cursor or nil , rest -> collection of rest of items, may be empty
14:40Chouseris it ever going to start returning sub-vectors or (disj (first mymap))?
14:40Lau_of_DKGot it
14:41rhickeyChouser: nope, because it promises that collection will be a Sequence
14:41rhickeyimportant because macros need to use sequence fns to create logical lists distinguishable from vectors/maps
14:42rhickeyand form-consuming code often needs to partition by list/not
14:42jwinterI also thought next would mean second, it feels a little strange that it returns a sequence and not an element. Naming things is hard.
14:42rhickeysuch code (e.g. the compiler) will use Sequence
14:44rhickeyjwinter: it's tru some iteration protocols use next to return the next item, but also have the side effect of moving cursor. In a functional iteration protocol (which is what seqs are), it can only do one or the other
14:44hiredmanit might be easier for people to decide which one to use if they were called rest and lazy-rest
14:44rhickeyhiredman: I think we put that to rest earlier
14:45hiredmanoh
14:47jwinterWhat are the names for lazy-cdr in other languages?
14:47ChouserI think I still prefer rest+rest-coll over anything as ambiguous as 'more' or 'next'
14:48rhickeyChouser: what about rest and next-seq ?
14:49Chouserit'd be worried about the -seq being misleading, as it doesn't mean the same kind of thing as the 'seq' function returns.
14:49Chousernext-coll would be great.
14:49rhickeydurka42: more would be gone, and rest/next are not synonyms in my book, a benefit
14:49rhickeyChouser: it means exactly the same thing
14:50rhickeyreturns seq or nil
14:50durka42true, those aren't really synonyms
14:50rhickeyChouser: ah, rest being current (more) and rest-seq being current (rest)
14:52rhickeysorry, next-seq being current rest
14:52Chouserah. oh. um...
14:52rhickey(rest x) -> a collection, (next-seq x) -> a seq or nil
14:52Chousersheesh. yeah, I guess that'd be ok.
14:53Chouserexcept that's the longer name for the more common case.
14:53rhickeyright, thus next
14:53Chouserand 'rest' would still exist but mean something different.
14:53Chousereh.
14:53gnuvince_with ant, how can you view the available tasks?
14:54rhickeythe core code looks good once you detach yourself from a preconception of next == second
14:54gnuvince_It doesn't appear to be documented in ant -h
14:55rhickeynext is imperative, rest is lazy
14:55ChouserI think I still prefer rest == (seq (rest-coll x)) and rest-coll
14:55Lau_of_DKrhickey: when you say that next != second, is that because next is more like frest?
14:55Chouseror maybe next == (seq (rest-coll x)) and rest-coll. That'd be ok.
14:56rhickeyChouser: hmmm, I don't like rest-coll, begs what does -coll mean?
14:57Chouserit takes a coll and returns a coll
14:57rhickeyChouser: so do lots of things
14:58rhickeyseqs are colls too
14:58Chouserbut nil is not
14:59rhickeyI like rest and next because those are the words I'd use in sentences describing the behavior, independent of the implementation
15:00rhickeyLau_of_DK: frest == second
15:01Lau_of_DKk
15:01rhickeymany many people complain that the return value of rest can't be 'empty', but it's pretty easy to understand there might be no next thing
15:01rhickeythus nil
15:02Lau_of_DKThats true
15:02Lau_of_DKI really liked the whole read-once concept, thats an intuitive way to consume a seq in my oppinion
15:04jwintergnuvince: does ant -projecthelp do what you want?
15:04ChouserExperimental branches of Clojure -- http://blog.n01se.net/?p=39
15:07Lau_of_DKChouser: Great blog you got
15:08rhickeyChouser: nice! and with an example that conveniently doesn't use more/rest-coll/next/whatever :)
15:09Lau_of_DKrhickey: You've got a definate meanstreak
15:09gnuvince_jwinter: yes, thanks!
15:09rhickeyLau_of_DK: no, I meant that as a compliment strictly
15:09Chouserrhickey: heh, yeah, I've been marvelling to myself that the discussion here wasn't invalidating my post.
15:09Lau_of_DKoh :)
15:10rhickeyChouser: exactly!
15:10gnuvince_I wrote a build.xml file for my project, but I've never used ant before
15:13rhickeyI guess an alternative is to have only (rest x) -> collection, since (next x) is just (seq (rest x)), but that will just beg for next to be written (and named)
15:13rhickeyseq-rest?
15:14Lau_of_DKI dont really see the problem in just sticking with 'rest'
15:14rhickeyLau_of_DK: rest meaning what?
15:14Lau_of_DKDont consider the names, but (seq (rest-coll x))
15:14Lau_of_DKSo just get a seq or nil, from whatever is left
15:15rhickeyLau_of_DK: that still leaves naming 'rest-coll'
15:15rhickeywhich must be added for lazier, not derived behavior
15:16Lau_of_DKtrue
15:16hiredmanrest-
15:16rhickeyLau_of_DK: that was my first take (a revert away from this point), leave rest alone and add 'more'
15:16rhickeybut the names are bad
15:17Lau_of_DKI never disliked 'more' actually, what dont you like about it?
15:17Lau_of_DKIts as intuitive as next
15:18rhickeyLau_of_DK: it's more of a synonym for rest, and implies almost nothing about the difference
15:19Lau_of_DKSo how about adopting your syntax-tweak for streams, having rest and rest*, making that a convention for clojure?
15:26rhickeyLau_of_DK: I'm not sure * conveys anything
15:27Lau_of_DKrhickey: It conveys nothing, thats why it should be a convention - but perhaps it was a dumb idea :)
15:27rhickeyLau_of_DK: which one is rest* ?
15:28Lau_of_DKYou get to decide, you can make the convention, but I'd think rest == (seq (rest* x)) would make the most sense
15:29Chouserrhickey: without the assert patch, would you still be considering changing the meaning of 'rest'?
15:31rhickeyChouser: I'm just going through core now, looking at what are now 'nexts', virtually all are nil puns, mostly like (if items ... (recur ... (next items))
15:32rhickeyThe change of rest->next is easiest - search/replace, then it's the same job as more was, not using next in lazy fns
15:32Chouserah, good point.
15:32rhickeyChouser: but like I said before, leaving rest alone is the easiest thing, but is it the best thing?
15:33rhickeythe vast majority of uses of next could be written (if (seq items) ... (recur ... (rest items)), and would thus match lazy code
15:34rhickeythe problem is they wouldn't be as fast as before, need the if/when-let for that
15:34ChouserI'm not so much in favor of leaving 'rest' alone as I am in not introducing a new subtly different meaning for it.
15:34rhickeyagreed
15:34rhickeyand yet it is the presumed meaning of many
15:35Chouserevery question posted here and on the group, every answer, every example is going to require a note clarifying which 'rest' this code is using.
15:36rhickeytrue, and not a small problem
15:37rhickeyso will the need to advise, moving forward, not to use rest
15:37Chouserless critical now, as most people who are using the lazy branch know they need to be careful, but after merge there will be old and new versions of clojure and new users may not be even aware which version they've got.
15:37rhickeyOTOH, the only real difference is whether the pun works
15:38rhickey(if items ... (recur ... (rest items)) changes in lazier to (if (seq items) ... (recur ... (rest items))
15:38rhickeyrest isn't broken, pun is
15:39rhickeybut yes, a breaking change to interface
15:40Lau_of_DKIt'll get annoying real quick to prefix everything with (seq) though
15:40rhickeyChouser: so I take it you're in the "please don't!!" category?
15:40ChouserI still don't think nil punning will be much missed after some changeover pain.
15:41Chousermy one converted file, 170 lines, 2 places needed seq calls added.
15:42rhickeyChouser: but rest still nil puns, and there were lots more of those in core, so it seems that one's harder to give up
15:43Chouserrhickey: yeah, I guess I'd slightly prefer rest/more over next/rest.
15:43Chouserbut I'd be fine with next/rest-coll or next/lazy-seq-rest
15:44rhickeynext/rest* ?
15:44Chouserbecause then we'd get questions like "where did rest go" rather than "why is my program in an infinite loop"?
15:44rhickeyright
15:45Chousersure, next/rest* would be ok
15:45rhickeysolves the 'which rest?' problem
15:45Chouserright
15:46rhickeynext/more ?
15:46rhickeyif we're retiring rest
15:47rhickeyany of the synonyms become fair game
15:47Chouserand you like next for (seq (whatever x))
15:49rhickeyChouser: yes, wishes now I had chosen it in first place - I see in my note I thought the issue would be Java people presuming it returned the second item and had side effects of moving cursor, which they will :(
15:49rhickeynotes
15:50Chouserthey'll get over it
15:51rhickeyI agree, I'm most concerned with being internally consistent, and now, with legacy
15:51rhickeynext/dregs
15:51Chouserha!
15:51Lau_of_DKwith legacy ?
15:52ChouserI've been surprised at how easily confused I've been between rest and more, so I'm trying to guess how hard next/more or next/rest* would be.
15:52Chouseror dregs, I suppose.
15:53fandaconsistency is the most important
15:53fandathink about 2 years later... if something is broken, it will be even harder to fix
15:53rhickeyBefore I mapped to cons' first/rest, I had move/step etc as candidates for 'rest'
15:54rhickeyjust working on persistent iterator, not the lazy issue then
15:54Lau_of_DKrhickey: I doesnt matter if 1.0 is completely backwards incompatible, as long as its optimal right?
15:55rhickeyLau_of_DK: I'm not sure, still smarting from the bashing that happened around AOT changeover...
15:55rhickeythus hiding in branches
15:56Lau_of_DKBackwards compatability can/will get in the way of innovation, which is perfectly fine and understandable, but my feeling is that going into ver. 1.0 all bets are off, 1.1, 2.0 and so on should probably be launched with BC... But thats just my oppinion
15:56Chouserdoes such bashing come mostly from the CL folks who haven't seen their language change in a decade? Us scripty ruby/python kids don't mind so much, I'd guess.
15:57rhickeyChouser: there was a lot of influx to Clojure at the same time, people trying examples that didn't work, pulling a release that preceded the change, and getting the impression things were less stable than I think they have been generally
15:58Chouserhm, ok.
15:58fandarhickey: just make as many people aware of the issue by posting on the mailing list or even on the website clojure.org
15:58fanda(when that happens)
15:59fandai think it's understandable
16:11rhickeyHere's another way to think about it - if (rest x) means a collection of the items other than the first (and this is the primary abstraction in fully lazy), what's a good nickname for the seq of that collection?
16:12Lau_of_DKrest? :)
16:13rhickeyLau_of_DK: did you miss the presumption? "if (rest x) means a collection of the items other than the first "
16:14Lau_of_DKNo I didnt, and Im really not trying to be difficult, but it just seems like the right word for it, you have the first item, and then you have the rest - And I think that the rest call should default to a seq no matter what
16:14rhickeyI'm thinking some seq variant, seq-> or something
16:15Lau_of_DKhmm.. seq-> is actually quite cool
16:15rhickeyLau_of_DK: then you can't have fully lazy
16:15Chousukewhat's the -> supposed to signify? :/
16:15Lau_of_DKI have a fully lazy if the rest of my seq is always wrapped in a seq?
16:16Lau_of_DKChousuke: Advancing through the seq
16:16Lau_of_DK(I assumed)
16:16Chousukerhickey: so in this fully lazy world, would (rest [1 2 3]) return a vector?
16:17rhickeyChousuke: no, always a sequence
16:17ChousukeI see. so no way to have it keep the vector guarantees. :/
16:18rhickeysequence encompassing seqs and lazy sequential collections
16:19rhickeyChousuke: use subvec
16:22Chouseror persistent queue, depending on what you're doing
16:25cp2is there a sort of "contains" function for sequences? (or something like member in common lisp)
16:26Chousercp2: are you aware of sets? they usually work better than seqs when you're going to be testing for the existance of a particular value.
16:26cp2ah, i didnt think of that
16:26cp2yes, that would work better in this case
16:27Chouserexcellent. and of course then you can just use the set itself as a function. so pretty. :-)
16:27cp2yeah, i do llike that :(
16:27cp2:) **
16:33Lau_of_DKIsnt there some serious documentation available on Compojure?
16:33ChouserLau_of_DK: just what you're about to write.
16:34Lau_of_DKThats not a whole lot
16:44Lau_of_DKCompojure doesnt escape html by default I suppose? :)
16:50Lau_of_DKjava.lang.NoSuchMethodError: clojure.lang.Util.equal(Ljava/lang/Object;Ljava/lang/Object;)Z (iwish.clj:15)
16:50Lau_of_DK [Thrown class clojure.lang.Compiler$CompilerException]
16:50Lau_of_DK
16:50Lau_of_DKCan somebody enlighten me on what this means ?
16:55Chouserthat doesn't look healthy.
16:56Chouserbut it's hard to guess without more stack or the code, or both.
17:01gnuvince_What's the general preference for GUIs, Swing or SWT?
17:01Lau_of_DKgnuvince_: Qt
17:01gnuvince_bleh
17:01Lau_of_DKbleh?
17:02gnuvince_I dislike Qt
17:02Lau_of_DKargh, I sense religious issues... nevermind, chooser whatever inferior standard your idol commands you to
17:05gnuvince_I'd rather use something that's actually used in the Java world
17:07Lau_of_DKYou mean like QtJambi ?
17:08gnuvince_No, like the 120,000 tools you can download from Sourceforge
17:09Lau_of_DKHave fun with those :)
17:10gnuvince_It's not just a question of fun, it's a question of learning something that the majority of Java people actually use.
17:10Lau_of_DKSure, youre free to do as you want
17:18lisppaste8shoover pasted "with-properties macro" at http://paste.lisp.org/display/75482
17:18shooveris there a better way to create the current# map in that paste?
17:19shooverwell, I made a sequence of vector tuples there, but it's logically a map
17:19shooverI want a new map that has the same keys as the original but the values are the result of a function on the keys
17:20durka42zipmap might help
17:23durka42,(let [orig {1 "one" 2 "two" 3 "three"}] [orig (zipmap (keys orig) (map #(* -1 %) (vals orig)))])
17:23clojurebotjava.lang.RuntimeException: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
17:23durka42,(let [orig {1 "one" 2 "two" 3 "three"}] [orig (zipmap (keys orig) (map #(* -1 %) (keys orig)))])
17:23clojurebot[{1 "one", 2 "two", 3 "three"} {3 -3, 2 -2, 1 -1}]
17:26hiredman,(apply hash-map (mapcat (fn [[a b]] [a (+ b 1)]) {:a 1 :b 2 :c 3}))
17:26clojurebot{:b 3, :c 4, :a 2}
17:26hiredman,(doc updatein)
17:26clojurebotjava.lang.Exception: Unable to resolve var: updatein in this context
17:26hiredman,(doc update-in)
17:26clojurebot"([m [k & ks] f & args]); 'Updates' a value in a nested associative structure, where ks is a sequence of keys and f is a function that will take the old value and any supplied args and return the new value, and returns a new nested structure. If any levels do not exist, hash-maps will be created."
17:27hiredman,(doc update)
17:27clojurebotjava.lang.Exception: Unable to resolve var: update in this context
17:27hiredmanhmmm
17:29shooverhiredman: warmer
17:29hiredman,(loop [h {:a 1 :b 2} k (keys h)] (if h (recur (update-in h [(first k)] inc) (rest k)) h))
17:29clojurebotjava.lang.NullPointerException
17:29hiredmanbah
17:30hiredman,(loop [h {:a 1 :b 2} k (keys h)] (if k (recur (update-in h [(first k)] inc) (rest k)) h))
17:30clojurebot{:a 2, :b 3}
17:32hiredmanugh
17:32hiredmanof course
17:32hiredmanyou could just use recude
17:32hiredmanreduce
17:33xooxHow do I use xml-zip to find a node "foo" that satisfies some properties and is also a child of "bar" that satisfies some other properties? I keep running out of heap when doing (xml-> (xml1->
17:33hiredman,(reduce #(assoc % (first %2) (inc (second %2))) {} {:a 1 :b 2})
17:33clojurebot{:b 3, :a 2}
17:33gnuvince_I have a license question: if I modified and distribute a GPL3 library with my program, that means I need to be GPL3 too, right?
17:35shooverhiredman: durka42: thanks for the help. update-in was close, but I think the simple map will suffice
17:35leafwgnuvince_: yes
17:36gnuvince_leafw: thanks
17:37gnuvince_Man, that license is practically a novel
17:38leafwit tries to patch all potential loopholes.
17:44gnuvince_This is sort of annoying...
17:45gnuvince_Anyway
17:48kilpwhere is condp
17:50hiredman~def condp
17:51hiredmanhuh
17:51hiredmanweird
17:51hiredmanoff by a few lines
17:52hiredman,(:line (meta #'condp))
17:52clojurebot3793
17:53hiredman~def update-in
17:54kilpcondp is in a newer release?
17:54kilp, (doc condp)
17:54clojurebot"([pred expr & clauses]); Takes a binary predicate, an expression, and a set of clauses. Each clause can take the form of either: test-expr result-expr test-expr :>> result-fn Note :>> is an ordinary keyword. For each clause, (pred test-expr expr) is evaluated. If it returns logical true, the clause is a match. If a binary clause matches, the result-expr is returned, if a ternary clause matches, its result-fn, which must
17:54kilpi have december release
17:55hiredmansvn rev 1180
17:55hiredmanclojurebot: well?
17:55clojurebotTitim gan �ir� ort.
17:55hiredmangah
17:57hiredmancondp was added to core 2008-12-21 1
17:58hiredmanhiredman.clojurebot.svn=> @svn-rev-cache
17:58hiredmanjava.lang.StackOverflowError
17:58hiredman:(
17:59hiredmansvn rev 1180
17:59clojurebotsvn rev 1180; added condp, with input from Stuart Sierra and Meikel Brandmeyer
18:03gnuvince_Nice; my old Python library takes 9:40 minutes to analyze 1000 Starcraft replay files. The Clojure implementation takes 3:50 minutes
18:06ayrnieuwhat other contrasts do you draw?
18:14gnuvince_ayrnieu: between Python and Clojure?
18:15ayrnieubetween your Python and Clojure programs.
18:15gnuvince_I intend to blog about, but here are a few:
18:16gnuvince_1. It was easier in Clojure to define the different actions of Starcraft in a declarative style. Python required meta classes and some thread unsafe things
18:17gnuvince_2. The tools that Clojure has access to because of Java are nice. The profilers -Xprof and -Xrunhprof were particularily useful in tracking down performance issues
18:17gnuvince_3. The community was extremely helpful whenever I had a problem.
18:18ayrnieuThanks; I'll look for the blog-post.
18:34lisppaste8kilp pasted "windowlistener not working" at http://paste.lisp.org/display/75485
18:34pilkthe first example works but in my bigger program(mp3 player it doesnt)
18:34pilkuser=> java.lang.IllegalArgumentException: No matching method found: addWindowListener for class javax.swing.JFrame (mp3player.clj:0)
18:35lisppaste8kilp annotated #75485 with "untitled" at http://paste.lisp.org/display/75485#1
18:36hiredmanpilk: no matching method found means you type signature does not match
18:36hiredmanyour
18:37pilkwait doto
18:38kilphmm system exit kills what, the whole jvm?
18:39hiredmanyes
18:39kilpbecuse i called system exit and then i didnt have to kill the player-thread
18:40kilpdoes System.exit(0); kill the whole JVM? all threads etc? do I ever need to expliicitly stop/close/kill a thread if calling System.exit? or shoulnt i call System.exit always?
18:40hiredmanthe jvm runs as a single process
20:53blbrownfunny that I want to merge scala and clojure somehow. Scala library called from clojure
21:04blbrownanyone working with javafx, wonder if it is possible to integrate with clojure
21:11kilphttp://podularraludop.appspot.com/ <- what do you guys think of the idea? add some up/down-voting and then signup so personal taste can be tracked.
21:12kilpi will redesign it once i figured out the exact functionality and get a .com address. (it is a podcast aggregator/recommender site)
21:13durka42hmm, you could call it "poddit"
21:13kilpwhy?
21:15durka42because it seems loosely like a reddit for podcasts
21:15kilpthinking which is bette,r updown or 1-5 voting
21:18tereddit sucks
21:20durka42does it now
21:20tejust being a jerk
21:20kilpdigg was before reddit right?
21:20kilpand the idea is hardly original anyway
21:20kilpbut all podcastsaggregators suck
21:20tenod
21:21teaggregation is equal to degradation
21:21teor something like that
21:21kilpi have to spend so much time funding the good oens it isnt worth it
21:21kilpmaybe ill use yahoos searchapi and find podcasts and post them automatically to the site
21:21kilpsomething liek that
21:21kilpthen have reviews
21:22kilpand have an app on android that you can buy
21:22kilpyou think it could work?
21:25teare there apps for android?
21:25telike on iphone?
21:25durka42yes
21:25tei had no idea
21:26durka42"android market"
21:26kilpyes and now us and uk developers csn charge for them
21:26kilpand it will open for rest of the world too
21:39gnuvince_How accurate are the results of java -Xprof? It tells me that nearly 25% of my program is spent in calls to rest
21:57eyerisCould someone type out how they read this in english? "(defmacro cond-let [bindings & clauses] ..."
21:57eyerisI am specifically confused by the & symbol
21:58eyerisAs far as I can tell it means "and bind the rest of the arguments to the clauses symbol"
21:58eyerisHowever I don't know how I am supposed to use them
21:58gnuvince_,(let [[x & xs] [1,2,3,4,5]] xs)
21:58clojurebot(2 3 4 5)
21:59eyerisSo it is like deconstruting binding for lists?
21:59gnuvince_The rest of the arguments are put into a seq and bound to the clauses parameter
21:59gnuvince_You can do whatever you want with them
21:59eyerisOkay, so what if I just want *all* of my paramters in a seq?
21:59gnuvince_[& xs]
22:00eyerisOh wow, duh
22:00gnuvince_,(let [[& xs] [1 2 3]] xs)
22:00clojurebot(1 2 3)
22:00eyerisI really should have tried that
22:00eyeris:)
22:00eyerisThank you
22:02gnuvince_np
22:49gnuvince_quiet tonight
22:49gnuvince_Lots of guys on a tight leash I guess
22:51blbrownhmm, does xml/parse support parsing just a string, not a file
22:59blbrownOK, inputstream
23:00gnuvince_~seen technomancy
23:00clojurebottechnomancy was last seen quiting IRC, 1596 minutes ago
23:01ayrnieu,(/ 1596 60.0)
23:01clojurebot26.6
23:01gnuvince_Kind of wanted his help with clojure-mode.
23:15blbrown~seen blbrown
23:15clojurebotblbrown was last seen in #clojure, 0 minutes ago saying: ~seen blbrown
23:15Chousernice
23:15blbrown~seen ,blbrown
23:15clojurebotno, I have not seen ,blbrown
23:15blbrown~seen ~seen blbrown
23:15clojurebotno, I have not seen ~seen blbrown
23:16blbrownChouser, I have yet to trick this bot. then again, I haven't tricked any IRC bots. They are just that smart
23:20gnuvince_~seen ""
23:20clojurebotno, I have not seen ""
23:21Chouser~clojurebot
23:21clojurebotclojurebot is like life: you make trade-offs
23:21Chouser~seen clojurebot
23:21clojurebotOf course I have seen myself.
23:24gnuvince_Does C-c C-c work for anyone else with Slime?
23:25WizardofWestmarcI just made sure, mine works fine. But I think my swank-clojure is a week or so old
23:26gnuvince_WizardofWestmarc: would you mind showing me your config?
23:26gnuvince_Maybe you have something I don't
23:27blbrownI wonder if it is better to use slime/clojure over jline at the console
23:28gnuvince_blbrown: depends on what you prefer
23:28gnuvince_If you're not into Emacs, jline, ledit, rlwrap are most likely better choices
23:28blbrownno, I am very into emacs
23:29gnuvince_I don't have jline
23:29gnuvince_I don't see the point, all the command line editing functions are already there.
23:29blbrownI normally merge jline with the clojure repl. It is basically just rlwrap for java
23:29blbrownreally
23:30blbrowninteresting, hmm, I could have sworn this didn't work with cygwin
23:32WizardofWestmarclemme dig it up, note mine's mostly clojurebox
23:33gnuvince_thanks
23:33gnuvince_It's a .exe, so I can't download it myself.
23:33WizardofWestmarcnod
23:35hiredmanjline has issues with unicode
23:35WizardofWestmarchm, the one in my home dir is my old clisp one, odd
23:36blbrownhiredman, I could have sworn there was a reason I used jline, hmm
23:37ayrnieublbrown - the wiki talks about jline before it talks about rlwrap :-) But use rlwrap. It's much nicer, and I had problems with wrapping with jline.
23:37hiredmanI switched to rlwrap cuase I like my unicode, and I kept forgeting about jline messing up unicode and going "OH MY GOSH, CLOJURE BUG!!!"
23:37blbrownis rlwrap a java application. I would need something cross platform
23:38gnuvince_blbrown: it's C
23:38gnuvince_But again, why do you need that if you got Emacs?
23:38hiredmancmd.exe seems to just give you some of the line editing stuff for free without jline or rlwrap
23:39blbrownhiredman, on XP?
23:39hiredmanyeah
23:39blbrownis there a function to detect an objects type, I guess a better 'instanceof'
23:39hiredman,(class '())
23:39clojurebotclojure.lang.PersistentList$EmptyList
23:40blbrownshould I know the api by heart before asking these questions, thanks that you guys are nice
23:40gnuvince_According to many messages I've found, slime-interrupt doesn't work with Clojure apparently
23:40lisppaste8WizardofWestmarch pasted "from clojurebox .emacs file" at http://paste.lisp.org/display/75502
23:45gnuvince_Nope, doesn't work :-/
23:45gnuvince_Thanks anyway
23:46WizardofWestmarcweird
23:46WizardofWestmarcdo you get an error or the like?
23:48WizardofWestmarcand does C-c C-k work?
23:48gnuvince_No errors
23:48gnuvince_It just doesn't do anything
23:48WizardofWestmarcwait
23:48WizardofWestmarcis the buffer named blah.clj?
23:48WizardofWestmarcit only works if it's a file with a clojure extension
23:48gnuvince_Usually, I try to stop something I've ran directly in the slime repl
23:49WizardofWestmarchm
23:49WizardofWestmarcyeah if the file you are editing and attempting to partial compile has the right extension, I'm at a los
23:49WizardofWestmarc*loss
23:50gnuvince_Yeah, nothing there.
23:50gnuvince_And I don't have C-c C-k bound.
23:50WizardofWestmarcnod
23:50WizardofWestmarcI really like that one for when I'm doing continual work that I'm not full compiling into .class files
23:55gnuvince_What is it bound to?
23:56WizardofWestmarcC-c C-k? I'd need to look up the command, but it's compile-file
23:56gnuvince_ah
23:56gnuvince_I usually just C-c C-c every defn I want
23:57WizardofWestmarcnod
23:57gnuvince_Hmmm
23:57WizardofWestmarcthe second is just when I know I want eeeeverything and it's a lot of forms
23:57gnuvince_C-c C-k would be much faster ;)
23:57gnuvince_thanks for the tip ;)
23:59gnuvince_Next step: finding how to get my app to be faster