#clojure log - Feb 04 2009

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

0:06 cooldude127: knapr: well, you can't even even change a

0:07 hiredman: cooldude127: well, a could be a mutable java something or other

0:07 cooldude127: oh, true

0:07 hiredman: :P

0:07 cooldude127: that would change x tho, wouldn't it?

0:08 hiredman: no, x is a ref(erence)

0:08 x -> a

0:08 cooldude127: well, it would change the value of @x then

0:08 hiredman: @x is a

0:08 cooldude127: exactly

0:09 hiredman: but up is down

0:09 @x is not x it is a, so mutating a somehow would not change x

0:10 cooldude127: true

2:44 yangsx: sorry, but what's the name for progn in Clojure?

2:49 ok, it's do.

3:02 gordongecko: do you guys think hacking Lisp is more fun than programming other languages? I feel so now, Lisp has something hackish and something elegant over it at the same time. it feels very unbeauracratic, i can do what i want. i really like python but it doesnt feel as fun anymore. but maybe it is just me learning smething new when using Lisp.

3:04 jdz_: gordongecko: do you expect anything but a positive answer to the question?

3:04 (note the channel)

3:13 adakkak_: can someone tell me what defmulti is closest to in the imperative world and whether there is something similar in lisp?

3:14 jdz: adakkak_: it's kind of similar to defgeneric/defmethod of Common Lisp

3:14 adakkak_: with a bit of hand waving

3:15 adakkak_: is it similar to haskell or erlang style pattern recognition (I should not have asked how similar it is to lisp, since I do not know lisp :)

3:18 jdz: i think it is similar to pattern mathing in those languages, but not in the sense of destructuring, but fixed argument value checking

3:19 adakkak_: what do you mean by destructuring?

3:20 jdz: look for "destructuring" in http://clojure.org/special_forms

3:21 gordongecko: how do i flatten?

3:22 jdz: gordongecko: type "/leave", that should do it.

3:22 gordongecko: concat and reduce conj, neither works

3:24 felzix: I'm having classpath problems. I read that I shouldn't use add-classpath. What is the preferred method?

3:24 adakkak_: ,(apply concat '(1,2,3,4,'(1,2,3)))

3:24 clojurebot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: Integer

3:25 jdz: felzix: provide classpath when starting clojure?

3:25 felzix: I'm doing so through slime.

3:26 jdz: felzix: you're using swank-clojure-extra-classpaths, right?

3:26 adakkak_: ,(apply concat (list (list 1 2 3) (list 1 2 3) (list 1 2 3)))

3:26 clojurebot: (1 2 3 1 2 3 1 2 3)

3:26 felzix: yes

3:26 does that work for .clj's?

3:26 jdz: well yes

3:27 felzix: ok, thanks. something else is wrong, then, so I will investigate after sleep

3:27 jdz: felzix: you don't have to add the .clj's to classpath, only the directories they are in

3:27 felzix: oh

3:28 jdz: and the namespace resolution also works with hierarchical directory structure (same as Java)

3:28 felzix: so should I match namespace and file name?

3:29 jdz: http://clojure.org/libs

3:30 felzix: ah, thanks

3:30 I think that's the problem

3:40 gordongecko: why are hashmaps O(log32) and not O(1)?

3:49 jdz: gordongecko: you fail at trolling.

3:50 gordongecko: im not trolling im gordon gecko

3:50 im askign a question how is that trolling?

3:50 is it because hashmaps are functional inc lojrue and not mutable?

3:51 jdz: gordongecko: where have you seen O(1) hashmaps? O(1) inserts or lookups?

3:52 gordongecko: and the answer is simple anyway: it's that way (i don't really know if it is) because it is implemented that way.

3:52 gordongecko: yes insert and lookups, i thought that was standard fo rhashmaps?

3:53 jdz: gordongecko: was that an answer to a question?

3:53 gordongecko: yes but then why is it implemented that way would be the natural follow-up question?

3:54 what?

3:54 jdz: hashtables have never been constant time insert/lookup

3:56 gordongecko: no not amortized constand but most of the time constant

3:56 os log32 worst case scarnio then?

4:00 Lau_of_DK: Java gurus, why does this fail (.exec (Runtime/getRuntime) (into-array "ls") nil (java.io.File. "/home/lau/")) ?

4:01 gordongecko: whats wrong with this syntax: (throw (Exception. "Matrices not of the same size.")) ?

4:02 jdz: Lau_of_DK: do you really mean (into-array "ls")?

4:02 Lau_of_DK: nothing gordongecko

4:02 jdz: Yes

4:03 wait

4:03 jdz: No I dont

4:03 thanks

4:08 gordongecko: what is the right exception to throw when someone triees to multiply to matrices that are not valid to multiply with each other?

4:08 illegalargumentexception?

4:10 Lau_of_DK: I guess thats correct, though not very descriptive

4:10 Anyone here very comfortable with Javas Process class ?

4:13 jdz: the documentation looks sane

4:13 hiredman: Lau_of_DK: into-array takes some kind of seq

4:13 (into-array "ls")

4:13 ,(into-array "ls")

4:13 clojurebot: #<Character[] [Ljava.lang.Character;@1846aed>

4:14 hiredman: ,(into-array ["ls"])

4:14 clojurebot: #<String[] [Ljava.lang.String;@18b0b4a>

4:14 Lau_of_DK: It sure does, but when a process takes longer than 5 secs to complet, it seems that the process just hangs there, and I dont know how to debug it

4:14 hiredman: We've left the into-array discussion, it was just a mistake

4:14 hiredman: so you have

4:14 * hiredman needs a better irssi theme

4:14 jdz: Lau_of_DK: does the process produce output or wait for input?

4:15 Lau_of_DK: hiredman: try ERC

4:15 hiredman: or maybe just ignore joins/parts

4:15 Lau_of_DK: jdc it just fires "git log --numstat" in a very big repo

4:15 So its supposed to run for 10 - 15 secs, and then I can pull the Inputstream

4:16 jdz: Lau_of_DK: you should start reading the strem earlier because i think the process blocks on standard output (buffer being full)

4:16 Lau_of_DK: oh you may be right

4:18 (let [ pr (.exec (Runtime/getRuntime)

4:18 "git log --numstat"

4:18 nil

4:18 (java.io.File. "/home/lau/coding/bigrepo/")) ]

4:18 (apply str

4:18 (pmap char (stream-seq (.getInputStream pr)))))

4:18

4:18 Shouldnt this be as fast as I can go ?

4:19 jdz: don't you want lines from the output?

4:20 anyway reading character by character is usually not a very good idea

4:20 and then, why do you use pmap?

4:20 i'd expect the resulting string to be a permutation of what was output by the process actually

4:21 Lau_of_DK: Hmm :)

4:21 It worked, BUT it shouldnt have printed the output

4:21 :)

4:21 Thanks for the tip jdz

4:21 jdz: did it print the output, or just return it?

4:22 Lau_of_DK: It returned it, but its close to 65k lines, so I should just have (count x) it

4:37 dk.bestinclass.gitdoc> (count (get-log))

4:37 2698927

4:37

4:37 Thats quite a few lines

4:37 jdz: is it lines or characters?

4:42 Lau_of_DK: its chars :)

4:57 (doc apply)

4:57 clojurebot: Applies fn f to the argument list formed by prepending args to argseq.; arglists ([f args* argseq])

4:57 Lau_of_DK: Lazy?

5:01 liwp: are you asking if apply is lazy?

5:02 cgrand: if the seq passed to apply is lazy then it's the applied function that will drives evaluation of the seq

5:04 jdz: i don't agree

5:05 apply must fully realize the sequence before passing it to the function

5:05 hiredman: nope

5:05 jdz: i might be wrong, ofc

5:05 hiredman: apply is lazy

5:05 this comes up every other day

5:05 jdz: (off to reading documentation)

5:06 hiredman: ,(let [f (fn [& x] (first x))] (apply f (interate inc 0)))

5:06 clojurebot: java.lang.Exception: Unable to resolve symbol: interate in this context

5:06 hiredman: ,(let [f (fn [& x] (first x))] (apply f (iterate inc 0)))

5:06 clojurebot: 0

5:07 hiredman: ^- apply to an infinite seq

5:07 *tadda*

5:07 cgrand: it's a good candidate for FAS

5:07 FAQ

5:08 Lau_of_DK: Ok - So apply is lazy, disregarding the supplied function ?

5:08 jdz: hiredman: (apply #(+ %1 %2) (iterate inc 0))

5:08 hiredman: jdz: what about it?

5:09 jdz: hiredman: it's a counterexapmle to yours

5:09 hiredman: ,(apply #(+ %1 %2) (iterate inc 0)

5:09 clojurebot: Eval-in-box threw an exception:EOF while reading

5:09 hiredman: ,(apply #(+ %1 %2) (iterate inc 0))

5:09 jdz: gz, you blew up clojurebot

5:09 clojurebot: Execution Timed Out

5:09 hiredman: sure I did

5:10 anyway, if that wasn't an infinite seq, that would throw an exception

5:11 ,(apply #(+ %1 %2) [1 2 3])

5:11 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: sandbox$eval--1445$fn

5:11 jdz: hiredman: yes, but since it is infinite, apply tries to realize it

5:11 and blows up

5:11 hiredman: yeah, but that is the function's fault

5:12 jdz: how?

5:13 hiredman: if the function behaved like the one I used then apply would be lazy

5:13 cgrand: realizing the whole seq is the default behaviour for non var-arg functions only

5:14 jdz: well, only a small fraction of the functions behave like your function

5:14 cgrand: ,(apply (fn [x y & etc] (+ x y)) (iterate inc 0))

5:14 clojurebot: 1

5:14 hiredman: "the functions"

5:14 I submit that there are an infinite amount of functions

5:15 so a small fraction is, infact, a lot

5:15 jdz: you are not suggesting making all functions taking variable number of arguments, do you?

5:15 * hiredman goes to bed

5:16 jdz: and ignoring extra arguments

5:16 Lau_of_DK: hehe

5:16 jdz: not only ignoring, but dropping them into oblivion

5:16 Lau_of_DK: I really appreciate you guys duking it out - I'm really happy now, I did one better than contrib, again :)

5:17 jdz: we're just having a friendly discussion here

5:18 cgrand: it's a bug on the clojure part to not throw an exception when you pass an infinite seq of args to a bounded-arity function

5:18 jdz: cgrand: how can you tell if a sequence is infinite?

5:19 or finite, for that matter

5:19 cgrand: you can't but you can tell if a function is vararg or not

5:19 jdz: cgrand: apply already does that

5:19 as far as can be deduced from the effects

5:20 cgrand: jdz: not quite

5:20 when you call apply on a non-vargarg function

5:21 clojure tries to realize the twenty first items

5:23 liwp: so it seems that apply realizes all fun non-rest fun args and then passes the rest of the args list to the rest arg

5:23 cgrand: if it get less than twenty items then everything is fine and you get an error if you passed the wrong number of args

5:23 liwp: i.e. apply is not lazy

5:24 it just happens to not both to go through the remaining arg list after it has realized the non-rest args for the fun

5:24 s/both/bother/

5:24 cgrand: if it gets 20 items, it realizes the whole seq and pass it to the function (remember that we are in the non-vararg case, the programmer is not intended to pass an infinite seq)

5:24 liwp: that's right

5:24 which also implies that it's not lazy

5:25 Lau_of_DK: I can tell you have I've just made a parser, which uses apply #func 2 times during the parsing over 2.5 million characters, if both applys realized the whole stream, it would take forever, but it doesnt

5:26 liwp: surely you do not have a fn with 2.5M args?

5:26 Lau_of_DK: Its a stream

5:26 liwp: i.e. some of the fn args are either seqs or a rest arg

5:26 how do you call apply? can you show the code?

5:27 Lau_of_DK: (pmap #(apply concat %)

5:27 (partition 2

5:27 (partition-by #(re-seq #"^commit .*" %)

5:27 (line-seq (BufferedReader.

5:27 (StringReader.

5:27 (apply str

5:27 (pmap char (stream-seq

5:27 (.getInputStream pr))))))))))))

5:27

5:27 jdz: applying a function and calling it are different things

5:27 well, kinda

5:27 cgrand: liwp: yes it's lazyness for the rest arg (other args have to be computed, there's no thunks in Clojure)

5:27 Lau_of_DK: No comprende senior?

5:28 liwp: cgrand: AFAICT we're in agreement here...

5:28 Lau_of_DK: isnt that the definition of lazy? That the car is computed and the cdr (rest) is not ?

5:28 cgrand: liwp: I agree :-)

5:28 liwp: ;)

5:29 Lau_of_DK: dk.bestinclass.gitdoc> (time (def all-commits (pmap build-struct (get-log))))

5:29 "Elapsed time: 67989.686049 msecs"

5:29

5:29 This is a bit much though

5:29 For 2.6M chars, 1860 commits.

5:30 cgrand: Lau_of_DK: why are you doing (apply str (pmap char... ?

5:30 achim_p: Lau_of_DK: are you sure you need pmap?

5:30 :)

5:30 jdz: Lau_of_DK: how about (... (line-seq (new BufferedReader (.getInputStream pr)))?

5:30 Lau_of_DK: achim_p: It slows down alot without pmap

5:32 cgrand: Lau_of_DK: pmap does not guarantee the order of the result and your function (char) is inexpensive

5:32 Lau_of_DK: jdz, then it breaks

5:32 k

5:33 jdz: But at the time of breaking, I actually imagine apply str has realized the whole seq...

5:33 cgrand: pmap => map gets it to 37 secs, instead of 67..... suprising to me

5:34 Chousuke: I don't think str is lazy :/

5:34 Lau_of_DK: achim_p: I appologize :)

5:34 Chousuke: I think youre right

5:35 cgrand: pmap incurs a parallelization overhead which for such a simple function as 'char isn't worth it

5:36 Lau_of_DK: ok, I thought I had to consider both the function and the amount of data, and since the amount is unpredictable, so I opted for pmap

5:37 achim_p: Lau_of_DK: no need for that :)

5:39 cgrand: Lau_of_DK: can you paste the code somewhere?

5:39 jdz: (let [pr (.exec (Runtime/getRuntime) (into-array ["ls" "-l" "-h"]))]

5:39 (line-seq (new java.io.BufferedReader (new java.io.InputStreamReader (.getInputStream pr)))))

5:39 Lau_of_DK: 2 sec

5:41 cgrand: Its in engine.clj : http://github.com/Lau-of-DK/gitdoc/tree/master

5:41 jdz: there, no apply, no pmap, no waste

5:42 Lau_of_DK: cgrand: If you try to run it, to avoid the UI, just use ($set :path "/path/to/repo") and (get-log)

5:42 or (pmap build-struct (get-log))

5:44 jdz: look at the code on Github, yours is what I have, but it doesnt fit with my parser

5:45 Chousuke: Lau_of_DK: If you cut'n'paste functions from contrib I think you need to identify the copyrights separately

5:45 Lau_of_DK: the EPL states "Contributors may not remove or alter any copyright notices contained within the"

5:45 jdz: Lau_of_DK: where exactly is a code like mine?

5:46 Lau_of_DK: Chousuke: I think they're under the same license, both projects

5:46 Chousuke: Lau_of_DK: they are, but there are numerous copyrights

5:46 Lau_of_DK: jdz: Where I pull the stream, I use BufReader/StrReader

5:46 Chousuke: Lau_of_DK: and you can't remove those :/

5:46 Lau_of_DK: Chousuke: Ok, I'll rewrite it a little, so its no longer contribs :)

5:46 jdz: Lau_of_DK: what StrReader are you talking about?

5:46 Lau_of_DK: StringReader.

5:47 jdz: my code does not have any StringReader

5:47 Chousuke: Lau_of_DK: I don't think that works :P

5:47 Lau_of_DK: oh..

5:47 Chousuke: It'll work

5:47 jdz: I see now

5:47 lisppaste8: cgrand pasted "get-log without map nor apply str" at http://paste.lisp.org/display/74861

5:47 Chousuke: Lau_of_DK: see, it would be much easier just to use contrib as a dependency.

5:48 Lau_of_DK: jdz: 1 sec, youre a genious

5:49 Thanks cgrand, yours is similar to jdz's i see

5:49 jdz: (i fail to see similarity, though)

5:49 Lau_of_DK: You use InputStreamReader, he uses StreamReader

5:49 jdz: well, ok, i failed

5:50 yeah, i'm not used to all the Java stream*{reade/writer}*moreRandomStuff

5:50 cgrand: err StreamReader does not exist

5:51 InputStreamReader is what I meant

5:52 Lau_of_DK: k, then to me they look the same, running at 1 sec

5:52 thats an improvement of 66 secs... thats pretty wild

5:53 How do I reach that conclusion myself the next time?

5:53 jdz: Lau_of_DK: try not to overengineer

5:53 i'm still not sure that function does what it should

5:54 Lau_of_DK: jdz: I really dont - If picture the solution, and write it up, then I usually hit 45 type-casting errors, and I try to accomodate = just to get it running

5:54 jdz: but that maybe because i have not yet used partition

5:54 Lau_of_DK: jdz: It works perfectly

5:55 jdz: Lau_of_DK: that approach of yours is wrong. if something does not work you first explain to yourself why it does not, then you should be able to fix it. if after fixing it it still fails, return to step one.

5:55 Lau_of_DK: That fits pretty well with something cgrand told me a while ago... its back to the basics I believe :)

5:55 jdz: randomly poking code until it seems to do what you want is what Perl coders do\

5:56 Lau_of_DK: that was cruel jdz, just plain cruel

5:56 Chousuke: Lau_of_DK: you might also try breaking the function into smaller pieces

5:56 jdz: well, you don't want to associate yourself with Perl programmers, now do you? :)

5:56 Chousuke: for example, returning the line-seq should probably be separated from chopping it into commits.

5:57 Lau_of_DK: true, it needs refactoring

5:57 Chousuke: Though I take that to the extreme sometimes :P

5:58 I write 5 one-liner functions just so I can make the final function read easily and be small as well :P

5:59 I just find it easier to follow if each sub-operation has its own name that specifies what the sub-operation is, instead of just code that does it.

6:00 Lau_of_DK: Just remember, that when I read your code, I have to go look up all of your smaller function to understand to final cute function...

6:00 Doesnt always work well in teams

6:00 Chousuke: well, that depends on how well I've named them :)

6:01 in functional programs you don't need to look them up if they're named well enough *and* you can be reasonably convinced that they work correctly.

6:01 Lau_of_DK: Yes I do, otherwise I'll violate cgrands principle, that I should understand every I do

6:01 And I dare not do that

6:02 jdz: if you can't think of a name for a function you want to write then the function is wrong (and doomed to failure anyway)

6:02 (most of the time)

6:02 Chousuke: you wouldn't really understand anything useful by looking at how the functions are implemented.

6:03 if the naming is not a failure, your conclusion would be that it does what its name says :)

6:03 jdz: Lau_of_DK: also, the name of the function discussed here should be something like "get-commits"

6:04 because otherwise it contradicts with the function documentation

6:07 gordongecko: do you unittest or prove?

6:08 jdz: gordongecko: do you prove your unittests?

6:08 gordongecko: do you test your proofs?

6:09 i always found the idea of unittests a bit insane.

6:09 and stupid

6:09 jdz: why?

6:10 (i don't)

6:10 gordongecko: but i dont have the mathskills to prove all my code yet

6:10 knapr: and youd end up doing loads of work it turns out you dont have to

6:12 jdz: knapr: and then after 2 years of development you wish you had written those tests but can't afford to start doing it because all your code is a big pile of spaghetti

6:12 Lau_of_DK: jdz: Why bring Ruby into this?

6:13 jdz: huh, where?

6:13 Lau_of_DK: you said spagehetti code.. come on, keep up

6:13 jdz: i mean, it wasn't be :)

6:13 *me even

6:13 spaghetti code is language independent!

6:14 Lau_of_DK: ok, we'll cancel the jokes for today :)

6:14 p_l: jdz: And if written in certain way, can still be proven correct with little amount of testing :P

6:16 jdz: p_l: i thought that spaghetti code is a style of writing code in certain way. did not know there are still intricate ways in what the spaghetti code differs...

6:17 p_l: jdz: when most of it can be mathematically proven... why not? There's always "spaghetti on crack sprinkled with crackpot fiction in comments" style

6:17 jdz: oh, right. forgot about spaghetti code written in Haskell.

6:20 AWizzArd: Well, it is basically nonsense about this provability of code. Noone is sitting down, proving that his 20k LOC are correct.

6:20 For type safety - sure, a lot can be done there.

6:21 But if the program is actually *doing* what we want is very different.

6:21 jdz: any haskeller can tell you that if his program compiles it is correct

6:21 AWizzArd: ;-)

6:22 well, by that logic it is also true for any other program in any language.

6:22 When a Clojure program compiles, it is also correct.

6:22 jdz: hence all ruby programs are incorrect because they don't compile! yay, proven!

6:23 AWizzArd: What did Morpheus say to Neo? "Welcome in the real world."

6:23 p_l: lol

6:28 as for "program in <lang. with very strong typesystem> is proven correct when it compiles"... it reminds of a joke about ML, where it was "It's proven bugfree when it compiles, however you never get rid of type errors so your program never compiles"

6:34 metaperl: Could someone please help me get slime and clojure working ... here is my problem - http://groups.google.com/group/clojure/browse_thread/thread/39ff69778f8ac93a

6:39 Lau_of_DK: metaperl: How comfortable are you with emacs?

6:40 metaperl: Lau_of_DK: I have used it since 1992

6:41 Lau_of_DK: metaperl: Then you'll want this: http://github.com/technomancy/clojure-mode/tree/installer

6:41 That'll try to download the latest clojure/contrib/clojure-mode/slime and configure them/suggest how to configure them

6:47 metaperl: Lau_of_DK: are you being serious? That is just a single .el file

6:47 gordongecko: if doing (def a (ref m)), does changing one of a or m chnage the other?

6:48 Lau_of_DK: metaperl: Yes I am, put the file in your load-path, require it, and M-x clojure-install

6:48 metaperl: oh

6:48 Lau_of_DK: gordongecko: @a will change if you change m

6:48 metaperl: wow, the file itself says none of that

6:49 Lau_of_DK: metaperl: Its a work in progress, the author camps in here, look at the very bottom for the definitions

6:50 user> (def m 5)

6:50 user> (def a (ref m))

6:50 user> (def m 10)

6:50 user> @a

6:50 5

6:50

6:50 AWizzArd: @a is a reader macro for (deref a)

6:51 metaperl: Lau_of_DK: the clojure website points you to this - http://github.com/jochu/clojure-mode/tree/master

6:57 this is freakin weird. everytime I try to get technomancy's version, I pull down jochu's version instead

7:00 Lau_of_DK: Look at .git/config - It probably still point to Jochu

7:00 lisppaste8: gekko pasted "gauss jordan elimination" at http://paste.lisp.org/display/74864

7:00 gordongecko: why isnt the ref being changed?

7:00 why isnt the ref being changed? ^^

7:01 ayrnieu: the second (def m 10) does not change the m of the first (def m 5); m's value is already irrelevant by the second def of m. (def a (ref m)) is simply (def a (ref 5)).

7:01 Lau_of_DK: (doc ref-set)

7:01 clojurebot: Must be called in a transaction. Sets the value of ref. Returns val.; arglists ([ref val])

7:14 gordongecko: was that for me?

7:14 i saw i had some errors (and somehow they were never acknowledged, makes me msis haskella little)

7:14 but it still doesnt work

7:14 ayrnieu: ask a question, then.

7:16 gordongecko: well, it seems nothing happens to the refs, and why sint stuff printed out?

7:17 ayrnieu: OK, I'll get right on using my psychic powers to see the program you're having trouble with, what you want to do, the refs you mean, the stuff you want printed, etc.

7:18 cgrand: gordongecko: for is not a loop, use doseq instead. But really there is too many mutations, you need to understand how tio turn imperative for loops into reduces

7:19 gordongecko: it was psoted above...

7:20 http://paste.lisp.org/display/74864

7:21 lisppaste8: gekko annotated #74864 with "untitled" at http://paste.lisp.org/display/74864#1

7:21 ayrnieu: fine. Starting the top: (dosync alter maxrow (fn [] y)) should be (dosync (alter maxrow (fn [_] y))) . Or you can use set-ref instead of that fn

7:21 gordongecko: yeha i changed that, see annotation

7:22 ayrnieu: no, you changed one part of it.

7:22 gordongecko: what does _ mean?

7:23 ayrnieu: (fn [_] y) is equivalpent to (fn [a] y). It's just a throway binding.

7:23 ,((fn [_ x _ _] x) 1 2 3 4)

7:23 clojurebot: 2

7:24 rhickey: gordongecko: If you really want to learn Clojure and functional programming, I'd advise you stay away from refs/vars/atoms/agents/set! at first

7:24 ayrnieu: the function your passing should take the present value of the ref as an argument.

7:24 ugh. you're.

7:28 lisppaste8: metaperl pasted "How to get technomancy's clojure mode working under win32" at http://paste.lisp.org/display/74865

7:31 Lau_of_DK: metaperl: Im glad it works - that approach goes for Linux as well

7:31 lisppaste8: gekko annotated #74864 with "untitled" at http://paste.lisp.org/display/74864#2

7:32 metaperl: yes, I had to unzip the technomancy git directory...

7:32 git clone simply would keep getting jochu's stuff! it was crazy

7:32 Lau_of_DK: Weird

7:33 cgrand: rhickey: (if you had time to look at it) can I open an issue (and attach a patch) for the bug with zip/remove?

7:34 rhickey: cgrand: yes, thanks

7:49 knapr: ah of cim not usign dorun

7:50 is doseq = dorun for?

7:51 rhickey: knapr: logically, yes, but doseq will be faster as it doesn't produce a lazy sequence that you don't need.

7:51 knapr: (dorun (for [x vlah] (do ....))) is that (doseq ...) ?

7:52 ayrnieu: ,(doc doseq)

7:52 clojurebot: "([seq-exprs & body]); Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by \"for\". Does not retain the head of the sequence. Returns nil."

7:53 gordongecko: a common idiom is (dorun (for (do /// how do i replace that?

7:53 doseq?

7:55 ayrnieu: ,(doseq [x (range 10)] (print x))

7:55 clojurebot: 0123456789

7:59 gordongecko: how the hell can:

7:59 (def a (ref 10))

7:59 (doseq [x [1 2 3]] (dosync (alter a (fn [y] (+ y @a)))))

7:59 user=> @a

7:59 80

7:59 ?

7:59 lisppaste8: gekko annotated #74864 with "untitled" at http://paste.lisp.org/display/74864#3

8:00 ayrnieu: gordon, what is y bound to?

8:00 durka42: the fn you pass to alter gets @a as its parameter

8:00 so you double a three times

8:01 10 * 2^3 = 80

8:01 rhickey: gordongecko: stop using refs

8:01 jdz: and the looping variable x is not used

8:01 gordongecko: im using + not *...

8:02 i see now

8:03 rhickey: well it is pretty hard to redo some stuff into functional stuff

8:04 AWizzArd: just requires some training.. after a while it will feel natural

8:04 And it is difficult to *not* do it functional.

8:04 Refs are cool for keeping state in your app. It is much easier than keeping it around in every function as a parameter.

8:04 rhickey: gordongecko: (reduce + 10 [1 2 3])

8:04 jdz: gordongecko: you will never learn to do it in functional style if you keep doing it in imperative style

8:05 AWizzArd: A few days ago I translated a Lisp program with 53 SETFs in it into Clojure. I did not need one ref.

8:05 jdz: AWizzArd: i'm pretty sure they were not needed in the original program either?

8:05 AWizzArd: Not *needed*, right.

8:06 jdz: one can program fortran in any programming language.

8:06 AWizzArd: But it just makes sense to write idiomatic (vs idiotic) code in the host lang.

8:06 * durka42 translated a mess of java quicktime to clojure, and almost avoided refs but needed two of them to keep state in functions that were being used as callbacks by java libraries

8:07 Chousuke: gordongecko: you can't start looking for a functional approach by simply translating an imperative algorithm :/

8:09 I wrote a functional matrix multiplication thingy (it's probably too slow for real use because it uses vectors of vectors, but it seems to work)

8:13 http://gist.github.com/58093 like this

8:14 it might be faster to use a similar approach, but with java arrays and some copying.

8:14 rhickey: ILC registration open - no per diem rate, but conference early reg pretty cheap (IMO): http://www.regonline.com/builder/site/Default.aspx?eventid=688757

8:15 AWizzArd: Do you plan to talk about Clojure there?

8:17 rhickey: AWizzArd: I'm doing a full-day tutorial

8:17 AWizzArd: uh *thumbs up*

8:19 gordongecko: Chousuke: i did normal matrix mult, though using refs to, i giot it haskell usifn rlistcomprehensiosn though

8:21 Chousuke: try translating that haskell into clojure

8:21 AWizzArd: rhickey: is nil in the new lazy filter still false?

8:22 ayrnieu: (if nil 1 2) still evaluates to 2

8:22 rhickey: AWizzArd: you mean in the lazy branch? yes, nil is still false :)

8:22 AWizzArd: so would it support (filter #(re-find #"xyz") (duck-streams/read-line "myfile"))?

8:22 ah good

8:27 lisppaste8: gekko annotated #74864 with "fixed" at http://paste.lisp.org/display/74864#4

8:27 gordongecko: there it is

8:27 unfunctional but functioning

8:28 not sure if it gives the right results though :)

8:28 rhickey: seeing code like that in Clojure makes me sad :(

8:32 Chousuke: refactored the matrix multiplication a bit, should be even easier to understand it now

8:35 AWizzArd: rhickey: you will see it more and more often, but at the same time the quality of code will also go up.

8:35 The newcomers to functional programming or programming in general will have their problems.

8:36 Chousuke: though, hm... (count m1) is not probably correct for row-width for other than square matrices :P

8:36 AWizzArd: But luckily a person is a newbi only for the shortest amount of time of her programmer carreer.

8:39 if you want to transpose a matrix you can do it in an elegant way, as Peter Norvig suggests.

8:39 If you have (def some-matrix '[[1 0 0 0] [1 0 0 0] [1 0 0 0]])

8:39 and (defn matrix-transpose [matrix] (when matrix (apply map vector matrix)))

8:39 then you can simply (matrix-transpose some-matrix) ==> ([1 1 1] [0 0 0] [0 0 0] [0 0 0])

8:40 gordongecko: i use hashmaps

8:40 good later on for sparse ones

8:40 and seems to simplify some things too

8:41 inv(s.matrix([[2,3],[1,-1]])) -> array([[ 0.2, 0.6], [ 0.2, -0.4]]) in scipy, but i get: ((2 0) (0 -5/2))

8:42 hmm and the algorith i translated from gives: [[1, 0], [1, 1]]

8:42 bah!

8:42 AWizzArd: then the algorithm is not translated yet

9:11 cooldude127: gordongecko: what method are you using for inverses?

9:12 AWizzArd: When I have a list of vectors x and want to collect from each vector of x the 1st, 2nd and 5th element, is then (map #(vector (% 1) (% 2) (% 5)) x) the best approach?

9:13 cooldude127: AWizzArd: seems like the simplest

9:16 Chousuke: ,(let [vectors [[1 2 3] [4 5 6]]] (for [x vectors] (map #(get x %) [0 2])))

9:16 clojurebot: ((1 3) (4 6))

9:16 Chousuke: AWizzArd: ^

9:18 or #(x %) instead of #(get x %)

9:18 ayrnieu: ,(map (fn [[a b _ _ e & _]] (vector a b e)) [[1 2 3 4 5 6] [-1 -2 -3 -4 -5 -6]])

9:18 clojurebot: ([1 2 5] [-1 -2 -5])

9:22 AWizzArd: Chousuke: why you prefer it with get?

9:23 Chousuke: that was just the first thing that came to my mind :)

9:24 AWizzArd: rhickey: can we maybe also get ("012345" 2) ==> \2 ? :)

9:25 Chousuke: I think that's unlikely, as Strings don't implement IFn :)

9:27 Chouser: clojurebot should have a nice set of sample data pre-defined

9:27 gordongecko: user=> (map (partial apply +) [[1 2 3] [4 5 6]]) vs user=> (map #(reduce + %) [[1 2 3] [4 5 6]])

9:27 why partial apply?

9:28 Chousuke: I wonder. :p

9:28 gordongecko: cooldude127: gauss-jordan elim

9:28 rhickey: ,(map (fn [{a 0 b 1 c 4}] [a b c]) [[1 2 3 4 5 6] [-1 -2 -3 -4 -5 -6]])

9:28 clojurebot: ([1 2 5] [-1 -2 -5])

9:28 Chouser: ,(let [vectors [[1 2 3] [4 5 6]]] (for [x vectors] (map x [0 2])))

9:28 clojurebot: ((1 3) (4 6))

9:28 Chousuke: I edited the matrix thingy not to use (partial apply +)

9:28 I also fixed some bugs...

9:30 rhickey: ayrnieu: associative destructuring works on vectors too

9:30 ayrnieu: easier than _s when you want the 17th thing

9:31 ayrnieu: :-)

9:33 zakwilson: I remember seeing an addon or patch for Arc that allowed user-defined behavior for any type when it appears at the head of a list. I thought it was a cool idea, though I have no idea how practical it would be to implement something like that in Clojure.

9:34 rhickey: zakwilson: I'm not doing that in Clojure for perf reasons - if you want to make a callable thing you can derive from IFn, but yes, that rules out adding callability to String

9:35 AWizzArd: ah okay, because Strings are final?

9:36 rhickey: AWizzArd: even if they weren't, you get Strings from others who wouldn't know to create a ClojureString for you

9:36 AWizzArd: ic

9:37 rhickey: It's an inherent weakness to 'just derive from my interface' design - no one outside of a captive audience will

9:37 Chouser: wasn't making regex's callable on the todo at some point?

9:38 rhickey: Chouser: it has come up - what would they do?

9:38 ayrnieu: ,(proxy [java.util.regex.Pattern] [])

9:38 clojurebot: java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers)

9:39 ayrnieu: OK. Or: java.lang.VerifyError: Cannot inherit from final class

9:39 Chouser: I've not been sure, but I think re-seq would be pretty good.

9:39 rhickey: Chouser: those are the 2 issues, it won't be a Pattern anymore, and what to do when called

9:40 The process has stalled here every time :)

9:40 * Chouser nods

9:41 Chouser: re-seq would be a fine thing for it to do, but I'm not sure that's worth making it no longer a Pattern

9:43 gordongecko: why do you pople prefer clojure over haskell? for java interop?

9:44 AWizzArd: Because it is a Lisp, dynamic, is hosted on the more practical VM and because it is easier.

9:44 Chouser: I started learning Clojure before Haskell because I require macros.

9:44 zakwilson: For syntactic abstraction and dynamic typing.

9:44 Or, as AWizzArd said: because it's a Lisp.

9:44 ayrnieu: gordon - I despise Haskell.

9:45 zakwilson: I'd like to learn Haskell, actually. Still, I get the sense that its design isn't about me getting things done with as little fuss as possible.

9:46 knapr: then what is it?

9:46 it is about getting stuff done correctly and having your program perform well on several cores

9:46 zakwilson: Haskell, or Clojure?

9:48 AWizzArd: knapr: when we want stuff get done correctly, then we better come up with an AI system that is actually cappable of programming. Humans are so lousy at it, we will never get complex systems right without help.

9:49 Chouser: "correctly enough"

9:49 AWizzArd: right

10:32 gnuvince: zakwilson: I believe it's as little fuss as can be (currently) managed by a static typing system

10:37 AWizzArd: clojurebot: max people

10:37 clojurebot: max people is 137

10:44 AWizzArd: slightly offtopic: can one change event handler for swing objects during runtime? For example the action event for a button.

10:46 opqdonut: should be possible

10:46 achim_p: AWizzArd: you an dynamically add/remove listeners

10:46 opqdonut: there might of course be some concurrency issues

11:00 brianh: AWizzArd: if you haven't seen it, you need to check this out http://java.sun.com/products/jfc/tsc/articles/threads/threads1.html#event_dispatching

11:19 Chouser: doesn't "continue" seem like a more accurate name than "restart"?

11:19 though I suppose that's in danger of sounding like a continuation

11:20 brianh: Chouser: exactly what i was thinking

11:20 Chouser: which?

11:20 brianh: sounds like continuation

11:20 Chouser: "proceed"?

11:21 danlarkin: -1 for proceed

11:22 Chouser: "restart" is better? it sounds like something's going to be done over again, like a retry. But that's not accurate.

11:23 brianh: proceed sounds too much like a mutex/threading kind of thing

11:24 Chouser: uncatch

11:24 brianh: teleport

11:24 danlarkin: continue sounds fine to me imo

11:24 brianh: :)

11:24 Chouser: yeah, teleport gives about the right feeling.

11:24 danlarkin: why is continue better than proceed?

11:25 brianh: beam as in 'Beam me up Scotty"

11:25 k i'll stop now...

11:26 is 'transfer' already taken?

11:27 danlarkin: Chouser: I guess just the aesthetics of the word

11:27 Chouser: well, I'll proceed with continue for now. We can restart this conversation later.

11:28 * danlarkin sighs

11:30 cooldude127: are sets in clojure ordered?

11:30 gnuvince: sorted-sets are

11:30 ,(set [1 2 3])

11:30 clojurebot: #{1 2 3}

11:30 gnuvince: ,(sorted-set [1 2 3])

11:30 clojurebot: #{[1 2 3]}

11:30 gnuvince: ,(sorted-set 1 2 3)

11:30 clojurebot: #{1 2 3}

11:30 gnuvince: I guess my first example wasn't the best one

11:31 opqdonut: :D

11:31 cooldude127: eh, they probably aren't right for what i need

11:31 gnuvince: ,(set [:a :b :c])

11:31 clojurebot: #{:a :b :c}

11:31 cooldude127: i think vectors may make more sense

11:31 gnuvince: damnit

11:34 Chouser: ,#{-2 -1 0 1 2}

11:34 clojurebot: #{0 1 2 -2 -1}

11:35 cooldude127: ahhh something messed up clojure and slime?

11:35 it says evaluation aborted at every expression

11:36 java.lang.NoClassDefFoundError: clojure/lang/StringSeq

11:37 jbondeson: cooldude127: are you running off of one of the branches?

11:38 cooldude127: jbondeson: i don't think so

11:38 i'm using clojure-install

11:38 jbondeson: i just did a full rebuild of everything and it works for me.

11:38 boxbeat: are there arrays in clojure?

11:38 cooldude127: boxbeat: vectors

11:38 boxbeat: make-array creates a java array

11:38 cooldude127: or you can use java arrays

11:38 boxbeat: how do i index it?

11:39 jbondeson: nth

11:39 boxbeat: or it is not for use in pure clojure just for java interop?

11:39 cooldude127: boxbeat: ,([1 2 3] 0)

11:39 ,([1 2 3] 0)

11:39 clojurebot: 1

11:39 jbondeson: or that shortcut

11:39 cooldude127: ,([1 2 3] 2)

11:39 clojurebot: 3

11:39 boxbeat: yes but the array

11:39 cooldude127: boxbeat: don't use it for pure clojure

11:39 use vectors

11:40 boxbeat: i want to create a videoplayer

11:40 is that hard?

11:41 cooldude127: boxbeat: probably

11:41 jbondeson: depends how heavily you lean on existing java media libraries

11:41 cooldude127: jmf might be helpful

11:43 jbondeson: you'll probably spend most of your time just with java interop and ui stuff.

11:43 video players are exactly a very functional problem.

11:43 cooldude127: jbondeson: found my problem. i had bad form in my file i had compiled

11:44 jbondeson: are -> aren't

11:44 cooldude127: sweet.

11:53 boxbeat: jbondeson: how come?

11:53 if im just doing the interface (not the decoding) then it is just heavy java interop no?

11:53 is doing the coding in Clojure a good idea(if doing it form scratch)?

11:54 Chouser: boxbeat: you're going to implement a video codec?

11:55 jbondeson: if all you're doing is the interface, then clojure isn't really your best bet. if you were implementing a new codec, then that would be more suitable to clojure (depending on the codec)

11:56 Chouser: jbondeson: you don't like Clojure for UIs?

11:57 jbondeson: haven't done much of it, but from what i've seen you're not exactly doing much different from java

11:59 Chouser: but at least you have macros to reduce repitition, unlike in Java.

11:59 jbondeson: true.

12:01 some of the cell stuff can be nicely integrated into UI as well.

12:01 i'm actually just about to put together some visualizations for my swarm code, so i guess i'll know first hand all the difficulties.

12:03 was there ever a consensus on the form removal reader macro?

12:03 boxbeat: i did an mp3player in clojure using swing +contrib-miglayout. while the code is prob shorter than it is in Java it felt like i was mainly wrapping java code and some things was hard to do from Clojure + I actually was missing checked exceptions.

12:04 I can call clojure code form Java if i do gen-class, right?

12:04 so codec in clojure, UI in Java...

12:04 jbondeson: yes

12:04 you could

12:04 djpowell: or you can call clojure code from java dynamically, in a similar way to clojure.lang.Script does

12:08 AWizzArd: In Java it is: new javax.swing.filechooser.FileNameExtensionFilter("JPEG file", "jpg", "jpeg"); Now I try in Clojure: (javax.swing.filechooser.FileNameExtensionFilter. "JPEG file" "jpg" "jpeg") which does not work. How can I make it work?

12:09 djpowell: it should work - what is the error?

12:11 AWizzArd: One can paste it into the repl.. it says it doesn't find a right constructor.

12:11 djpowell: ah

12:11 AWizzArd: In the javadocs Sun lists the method header as FileNameExtensionFilter(String description, String... extensions)

12:11 djpowell: i see, that method has varargs

12:11 AWizzArd: the ... looks strange

12:11 yes

12:11 I guess :-)

12:11 djpowell: varargs in Java are syntactic sugar for String[] extensions

12:12 so you need to make an array for the last parameter

12:12 Chouser: (javax.swing.filechooser.FileNameExtensionFilter. "JPEG file" (into-array ["jpg" "jpeg"]))

12:15 jbondeson: that's a bit ugly

12:16 walters: seems like a clojure bug

12:16 AWizzArd: works though

12:16 thx

12:18 jbondeson: you gotta love the ability to get a 25% increase by adding a 'p' in one place...

12:18 cooldude127: jbondeson: what?

12:20 jbondeson: just changed a map to a pmap in one of my functions to parallelize it

12:21 cut the runtime by 25%

12:21 AWizzArd: nice

12:21 jbondeson: my swarms are swarmier than ever

12:21 AWizzArd: what are you doing?

12:21 simulation?

12:21 GA? GP?

12:22 jbondeson: particle swarms

12:22 opqdonut: swarm optimization?

12:22 djpowell: i was wondering if wrapping a seque around some resultset-seq derived sequence might smooth out the doing cpu vs waiting on blocking io from the database, but i guess jdbc drivers do a load of buffering anyway

12:22 jbondeson: opqdonut: yes, one of the varieties.

12:23 opqdonut: sweet, what's the problem?

12:23 jbondeson: right now i'm just running on some test problems to make sure my port works.

12:24 I've used it for neural network training before, much faster than many BP methods

12:24 opqdonut: interesting, I guess I should try that

12:25 jbondeson: i did the NN+Swarm in C a couple years ago, going to try to put together a functional NN library in clojure. That should be fun.

12:25 for fun i'm going to see how the PS works with the mona lisa problem that's all the rage

12:27 opqdonut: be sure to blog about it ;)

12:27 jbondeson: oh so no.

12:27 opqdonut: (j/k)

12:27 BigTom: jbondeson: hasn't someone done a clojure version? (he saysjoining halfway througha conversation)

12:28 jbondeson: yeah, but he used a GA-ish algorithm.

12:28 BigTom: ah

12:28 jbondeson: just want to see how the PS would perform. it's good at numerical optimization, so the fun part is reworking the problem to be easily optimized by a PS

12:29 BigTom: PS?

12:29 jbondeson: sorry, particle swarm

12:29 BigTom: Ah, interesting

12:34 Can everyone bear it if I ask another swank/slime question?

12:35 I can do the basics now but I am having a problem with dependencies (in clojurebox on windows)

12:37 I have put this in may .emacs (add-to-list 'swank-clojure-extra-classpaths "C:\dev\clojure\compojure\compojure\deps\fact.clj")

12:37 as suggested in th ereadme

12:37 and get - Symbol's value as variable is void: swank-clojure-extra-classpaths

12:37 AWizzArd: If you use Emacs+Slime+Clojure, can you please open a fresh repl and do: (javax.swing.JFileChooser.)

12:37 What happens for you?

12:38 Does it immediately return a JFileChooser object?

12:39 jbondeson: BigTom: I think you want the actual file name in the classpath like that, but I could be wrong...

12:39 AWizzArd: Or is it like on my system, that it crashes? Emacs won't respond to anything anymore?!

12:39 jbondeson: err don't think

12:39 sorry

12:40 AWizzArd: if i drop off irc, its because it hung my emacs

12:40 BigTom: AWizzard: it hangs

12:41 jbondeson: mine returns

12:41 Cark: awizard : you're on windows ?

12:41 AWizzArd: yes

12:41 Windows here

12:41 Cark: i have the same problem

12:41 jbondeson: clojurebox?

12:41 AWizzArd: jbondeson: what Clojure version do you use?

12:41 jbondeson: i just updated

12:41 BigTom: emacs is ok, but I have a dead REPL

12:41 AWizzArd: Nope, my own emacs+slime setup

12:41 Cark: switch to the inferior-lisp and press enter a couple times

12:41 jbondeson: and i also just yesterday went to the most recent build of EmacsW32

12:42 BigTom: Cark: What is the inferior-lisp?

12:43 Cark: a buffer in emacs

12:43 =P

12:43 because of this problem i actally decided to do without emacs

12:43 i mean without slime

12:43 BigTom: The editing buffer?

12:44 Cark: that's another repl, not the slime repl

12:44 BigTom: ah, how do I fire it up?

12:44 jbondeson: the buffer will be called "*inferior-lisp*" and should have a prompt like "user=>"

12:44 if you hold control and right click you should get a buffer menu

12:44 BigTom: I guess I use "start inferior lisp"

12:44 Cark: C-X C-B should give you a list of buffers

12:44 jbondeson: err left

12:44 AWizzArd: cfunny behaviour

12:45 jbondeson: do you also have newest versions of clojure-swank and clojure-mode?

12:45 jbondeson: AWizzArd: I do a full rebuild, so yes.

12:46 Cark: my understanding is that this is not a clojure problem, but rather a compatibility problem between emaxs and swing

12:46 you have the same without slime too

12:46 AWizzArd: jbondeson: what OS are you using? XP?

12:47 jbondeson: Vista

12:47 Cark: that's only under windows yes

12:48 BigTom: What is the difference between Slime and inferior-lisp?

12:48 Cark: the slime repl lives in a separate thread

12:49 inferior lisp is the direct pipe to the clojure process

12:49 at least that's how i understand it

12:51 AWizzArd: Cark: but jbondeson doesn't have our problem.

12:51 Cark: it works fine after it worked once

12:52 AWizzArd: yes :-)

12:52 Cark: still very annoying

12:52 AWizzArd: indeed

12:52 jbondeson: what jvm version are you targeting?

12:52 Cark: 1.6 latest

12:52 AWizzArd: java 6 update 11 (server, 32 bit)

12:53 jbondeson: same

12:53 AWizzArd: k

12:53 Cark: so maybe it doesn't break under vista ?

12:53 jbondeson: seems to be the only real difference

12:53 AWizzArd: then I will now update to the newest Clojure, to the newest swank and emacs mode and see if that helps.

12:53 I remember I did *not* have these problems one month ago.

12:54 Cark: i always had this problem

12:54 AWizzArd: or Cark, do you also have a fresh copy of all components for Clojure?

12:54 BigTom: I think it happened to me on the previous versions

12:54 Cark: awizzard : not right now

12:54 AWizzArd: jbondeson maybe has the more intense Windows. The fresher one. The one that simply feels better.

12:54 Cark: i learned to live with it

12:54 BigTom: I now have the latest clojurebox versions on XP and the SLIME REPL hung (emacs didn't)

12:55 AWizzArd: ah okay, so you have the clojurebox setup, while I am using my own install

13:01 BigTom: I'm going to have to go, reception is getting bad

13:10 jbondeson`: anyone know how to force a total reload of swank?

13:11 I updated the extra-classpaths and it doesn't seem to want to take it when i kill buffers and reload.

13:12 Chouser: is there a better way to check if a var has been dynamically bound, other than (= @thevar (.getRoot thevar))

13:23 Lau_of_DK: Good evening everyone

13:29 Design question. Imagine I have large quantities of data Im parsing by passing them through a map or something similar. How would I go about showing the progress to a UI?

13:29 jbondeson: most common way would be some form of callback at intervals in the processing

13:30 the other way would be some kind of mutable object that stores the current progress

13:31 Chousuke: I suppose you could wrap the function you're mapping in something that keeps a counter and notifies the UI

13:31 Chouser: or even more fun, create a generic seq filter that does it

13:32 Chousuke: not too difficult I suppose

13:32 Chouser: (map dowork (showprogress my-ui-obj (line-seq foo)))

13:33 Lau_of_DK: hmm, Chouser, thats blows the 'interval' idea doesnt it ?

13:33 Chouser: Hm, why aren't Vars Named? They clearly have names.

13:33 Lau_of_DK: I don't think so

13:34 Lau_of_DK: thought I suppose you'd have to tell it how much work to expect.

13:34 though

13:34 Lau_of_DK: jbondeson: If you take a look at this system, where would you implement callbacks ? http://paste.lisp.org/display/74861

13:34 Chouser: Thats a tough one

13:35 Chousuke: the imperative case is no different though. :)

13:35 Chouser: rhickey: may I add a Named implementation to Var? I want to use vars in a heirarchy.

13:38 Lau_of_D`: Sorry X froze on me, last thing I saw was my own question, any answers?

13:39 cooldude127: Lau_of_DK`: what'd ya ask?

13:39 jbondeson: Lau_of_DK: I'm trying to think how pmap is going to consume and process your file.

13:40 Lau_of_DK: Yes, I cant really visualize it

13:40 jbondeson: you may be able to add a call in the function pmap is using to map.

13:40 calculate, call, return calculation

13:40 Lau_of_DK: But you realize that pmap = map right?

13:41 jbondeson: yes.

13:41 Lau_of_DK: k

13:41 jbondeson: the biggest issue is adding in more side effects.

13:41 line-seq is lazy, right?

13:42 Lau_of_DK: Yea

13:42 jbondeson: well...

13:44 I think changing your work function in the map to signal "one more work item complete" would work.

13:45 you just have to deal with the concurrency problems with that

13:45 or if you don't mind have a mutable object you could just have an inc in that function.

13:45 not pretty, but it gives you what you need.

13:46 Lau_of_DK: I think actually, since the workload in size is practically unpredictable, the best think might be to increment a ref during mapping, and then doing the whole parse in a seperate thread, just keeping an eye on the ref

13:47 jbondeson: yeah.

13:48 Lau_of_DK: Alright, thanks for your input guys

13:49 Chousuke: Lau_of_DK: http://gist.github.com/58262

13:49 my take at the side-effector :P

13:50 closures <3

13:51 Lau_of_DK: (doc swap!)

13:51 clojurebot: Atomically swaps the value of atom to be: (apply f current-value-of-atom args). Note that f may be called multiple times, and thus should be free of side effects. Returns the value that was swapped in.; arglists ([atom f] [atom f x] [atom f x y] [atom f x y & args])

13:51 Lau_of_DK: Same speed as commute?

13:51 Chousuke: probably faster.

13:51 works only on atoms though.

13:51 and you don't need a transaction :)

13:51 Lau_of_DK: cool

13:51 Thanks man

13:53 jawolfe: Hi, anyone know if it's possible to efficiently get "the object that is held in the set which compares equal to x, if found" in a Java Set?

13:54 I can't find any corresponding method in the API

13:55 Chouser: jawolfe: wow. That seems like a bit of an oversight.

13:55 you can do .contains, but then you just know you found something. getting the actual identity of the object in the Set doesn't seem possible.

13:55 Chousuke: hm, but if you already have an equal object, do you need the *actual* object in the set?

13:56 jawolfe: Well, I'm trying to extend Clojure contains? and get to work on Sets

13:56 and I believe the contract of "get" is that it should get the identical? object from the set

13:56 not just an .equal one

13:56 Chouser: Yeah, I'm surprised, but that looks like how it is

13:57 So, maybe this was Rich's way of making me find the answer to my question of why contains? doesn't work on Sets

13:57 :)

13:58 Chouser: jawolfe: :-) wouldn't shock me.

13:58 jawolfe: Am I right on the contract of Clojure "get"?

13:59 All I can find is from the data_structures page, where it says returns "the object that is held in the set which compares equal to the key"

13:59 which I take to mean the identical? object

14:01 Chousuke: hmm

14:01 jawolfe: this is way it currently works for clojure sets

14:01 '(let [x [1] y #{x}] (identical? x (get y [1])))

14:02 ==> true

14:03 Chousuke: jawolfe: it uses .equals

14:04 jawolfe: I created a string that was not identical to a constant string, but still equal to it, and was able to retrieve it from a set containing a constant string

14:04 ayrnieu: ,(let [x [1] y [1] z #{x y}] (map #(identical? % (get z [1])) [x y]))

14:04 clojurebot: (false true)

14:06 jawolfe: Chousuke: You mean it returns the actual object from the set, not the .equal query, right?

14:06 ,(let [x [1] y [1] z #{x y}] z)

14:06 clojurebot: #{[1]}

14:07 Chousuke: jawolfe: yeah, it returns the thing in the set

14:07 jawolfe: So, right ... it does seem that "get" currently returns the actual (identical?) object from the set that's .equal to the query, not just an object .equal to the query

14:08 And it looks like there's no way to get this behavior in sublinear time from a java.util.Set

14:08 Chousuke: ,(let [a "foo" b (apply str (seq "foo"))] [(identical? a b) (identical? a (get #{a} b))]

14:08 clojurebot: Eval-in-box threw an exception:EOF while reading

14:08 Chousuke: oops

14:08 ,(let [a "foo" b (apply str (seq "foo"))] [(identical? a b) (identical? a (get #{a} b))])

14:08 clojurebot: [false true]

14:09 jawolfe: So, the only question is whether this is the contract of "get" on sets or just an implementation artifact; from the wording, I suspect the former

14:10 So, I give up on this :) ... thanks all!

14:23 Mije: god bless shawn hoover

14:24 clojure box is a relief for the newbie :)

14:24 kefka: I have a problem where I include a .jar file in my classpath but can't load the classes into Clojure. I get the following error:

14:24 "java.lang.NoClassDefFoundError: package/SQLCore (wrong name: SQLCore) (NO_SOURCE_FILE:0)"

14:25 This is different from the error I get when the *.class is not supplied at all in the .jar, which is:

14:25 user=> (import '(package Foo))

14:25 java.lang.ClassNotFoundException: package.Foo (NO_SOURCE_FILE:0)

14:26 What is happening here? What's behind the NoClassDefFoundError that fires when the *.class is, in fact, found?

14:26 hiredman: where is there a '/' in package/SQLCore?

14:26 why

14:26 kefka: I called (import '(package SQLCore))

14:28 I'm not sure why it adds the '

14:28 the '/'

14:28 hiredman: kefka: that class is in the wrong package, it looks like

14:28 http://mail-archives.apache.org/mod_mbox/tomcat-users/200411.mbox/%3Cs19b6e5c.076@gwmail.media.utah.edu%3E

14:29 kefka: Ok. So I need to put it in a package?

14:30 hiredman: uh

14:30 kefka: I was hoping to avoid that. I don't like how the directory structure has to match the package structure exactly.

14:30 Chousuke: kefka: you can't avoid that.

14:30 it'll just keep your code organised anyway

14:30 kefka: hiredman, Chousuke: Ok, thanks.

14:31 Chousuke: you can always have files that are just included by other files, of course; they have no structure rules.

14:32 but in general it's good to have a clear namespace structure, and the directory layout has to match that at least for the files that declare a namespace.

14:35 technomancy: contrib committers: there's still a CPL.txt file in the contrib repo; shouldn't that be removed?

14:35 also, it wouldn't hurt to maybe toss a README in there... =)

14:36 * Chouser adds a README: "Ignore the CPL.txt"

14:36 technomancy: heh

14:49 duck1123: clojurebot: CPL.txt is <reply>Pay no attention to the CPL.txt

14:49 clojurebot: 'Sea, mhuise.

15:16 jayfields: what do you use in Clojure similar to a ternary operator. (e.g. [ruby] foo = condition ? "1" : "0")

15:17 technomancy: jayfields: in Clojure if is pretty succinct

15:17 kotarak: (let [foo (if condition 1 0)] ...)

15:17 technomancy: jayfields: actually even more succinct than the ternary operator. =)

15:17 cooldude127: jayfields: if is the ternary operator :)

15:17 technomancy: The Original Ternary Operator.

15:18 jayfields: I was trying to do (.setSide (if (< quantity 0) "buy" "sell"))

15:18 technomancy: (literally; lisp was the first language to have an else clause with if)

15:18 jayfields: and getting a weird error

15:18 technomancy: jayfields: you're trying to call setSide on an object, but it looks like you're missing that object

15:18 setSide is a method, right?

15:19 jayfields: yeah, I'm in a (doto ...)

15:19 kotarak: What is the error?

15:19 Weird are many errors....

15:19 cooldude127: ^ was about to ask

15:19 technomancy: oh, ok that's different then. more of a problem with how you're using doto than if

15:19 kotarak: lisppaste8: url

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

15:19 jayfields: (doto msg (.setSide (if (< quantity 0) "buy" "sell")))

15:19 kotarak: You can paste the problematic code and the error there.

15:19 ozy`: jayfields: if/then/else/end is an expression in ruby, too, you know :p

15:19 ayrnieu: ,(doto "hi" (.contains (if (< 1 3) "h" "x")))

15:19 clojurebot: "hi"

15:20 ayrnieu: eheh.

15:20 kotarak: I'm still missing the error....

15:21 jayfields: one sec, I'll see if I can isolate and paste

15:21 technomancy: jayfields: doto is a macro, so your regular assumptions about evaluation order may not apply. (I haven't used it myself.)

15:22 jayfields: (doto msg (.setSide (if (< quantity 0) 1 0))) seems fine

15:22 but if I try to replace 1 & 0 with enum values I get failure.

15:22 *failures

15:22 technomancy: enum values?

15:22 you mean strings?

15:23 jayfields: public class BuySellEnum {

15:23 public BuySellEnum() {

15:23 }

15:23 public static final int BUY = 0;

15:23 public static final int SELL = 1;

15:23 }

15:23 kotarak: jayfields: please paste the code in question together with the exception you get. Like this is only guessing.

15:23 lisppaste8: url

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

15:23 kotarak: Please there. ^

15:24 (doto msg (.setSide (if (< quantity 0) BuySellEnum/BUY BySellEnum/SELL))

15:24 technomancy: jayfields: yeah, that sounds like your problem. strings are not the same as enums.

15:25 jayfields: I suck. I think it was a typo the whole time. sorry.

15:25 cooldude127: lol

15:26 jayfields: I had BuySellEnum/Sell instead of BuySellEnum/SELL

15:26 kotarak: jayfields: no problem. But be clear in how the code looks like. Otherwise others have a hard time to help. :)

15:26 jayfields: got it, next time I try the paste thing. Thanks.

15:26 *I'll

15:27 technomancy: it helps a lot to get paste integration with your editor.

15:27 jayfields: do you have a link for IntelliJ integration, or should I google?

15:28 technomancy: I don't know about that, no.

15:28 kotarak: try to google in the google group of clojure.

15:28 There you should find the announcement.

15:28 jayfields: cool. thanks. The clojure plugin for IntelliJ is pretty young unfortunately.

15:28 kotarak: http://code.google.com/p/clojure-intellij-plugin/

15:29 Hopefully correct. :]

15:38 jbondeson: sorry about all the bouncing in/out today.

15:38 cooldude127: NO APOLOGIES ACCEPTED

15:38 jbondeson: ;-;

15:39 cooldude127: lol

15:52 BigTom: technomancy?

15:53 technomancy: BigTom: ahoy

15:53 BigTom: technomancy: Hi, I saw your blog re Slime

15:54 If I wanted to give it a go should I clean out my clojure box and start from straight emacs?

15:54 gnuvince: Is there a command-line debugger that I can use with Clojure?

15:54 BigTom: I don't have a big enough investment for that to be a problem

15:55 technomancy: BigTom: you shouldn't need to do that, no.

15:55 but if you feel like starting from a clean slate, you could check out the Emacs Starter Kit.

15:55 kotarak: gnuvince: there is jdb...

15:56 hiredman: http://java.sun.com/j2se/1.3/docs/tooldocs/solaris/jdb.html

15:56 ^- manpage which for some reason I don't have, even though I have jdb

15:57 technomancy: BigTom: is this on Windows?

15:58 gnuvince: kotarak: great

15:58 thanks

15:58 hiredman: thanks to you too :)

15:58 BigTom: technomancy: I thought I would try it on Linux first

15:59 * gnuvince hates using a debugger: it usually means that there are side effects involved.

15:59 technomancy: BigTom: ok, that's the only thing *I've* tested on, though it sounds like it may only need small tweaks for win

15:59 gnuvince: that or it means your test suite isn't good enough

16:00 BigTom: do I just follow the instructions in the top of clojure-mode.el

16:00 technomancy: BigTom: that should do it; yeah

16:00 gnuvince: technomancy: hold on to your chair: no tests for this part :)

16:00 technomancy: gnuvince: =(

16:00 gnuvince: technomancy: I'm not sure how I'm gonna handle them.

16:04 technomancy: gnuvince: getting started on tests can be the trickiest part. the project I was just on took a whole day to get the test suite even running; once I had that in place the implementation took only half a day. =\

16:04 metaperl: hey, I heard you were using M-x clojure-install on Windows?

16:05 gnuvince: technomancy: I mean, it's all side effects stuff with packed binary data

16:05 metaperl: gnuvince: hi

16:05 gnuvince: yes, it works

16:05 technomancy: thank you for your work

16:05 gnuvince: metaperl: pardon?

16:05 cooldude127: wait, really? that works on windows?

16:05 metaperl: odd thing is, with windows git, I kept getting the old version of clojure-mode even though I was cloning from technomancy's archive

16:05 oh

16:05 technomancy: metaperl: no problem. it sounds like you had to mess around with the path a bit? I pushed out a new version which should make that unnecessary.

16:06 metaperl: gnuvince: sorry

16:06 technomancy: metaperl: were you using the installer branch?

16:06 I haven't merged to master yet.

16:07 lisppaste8: metaperl pasted "what worked for me" at http://paste.lisp.org/display/74882

16:08 metaperl: technomancy: what is the installer branch? I tried git clone git://github.com/technomancy/clojure-mode.git ... over and over and I kept ending up with the soure code in jochu's github instead... so I downloaded a zip of the git and unpacked it

16:08 oh maybe that is why I kept getting his source code?

16:08 it was frustrating :)

16:08 cooldude127: metaperl: there are two branches, master and installer

16:08 metaperl: i thought it was a bug with github or git win32

16:08 technomancy: metaperl: yeah, sorry... I want to communicate with jochu about the installer before I merge to master.

16:08 cooldude127: installer is the one with the cool stuff in it

16:09 metaperl: does the git hub page infer that somehow?

16:09 what clone command would I use for that?

16:09 Chousuke: you should get both branches

16:09 technomancy: metaperl: anyway, it sounds like on windows probably nobody is going to use the default value of clojure-src-root anyway...

16:09 metaperl: i dont know how to do that?

16:09 Chousuke: just git checkout installer afterwards

16:09 (by default master is checked out)

16:10 hiredman: I am not sure what is more annoying, so much emacs talk, or irssi coloring all the nicks the same

16:10 metaperl: again, how do I look at the github page and see the fact that there are two main branches?

16:10 cooldude127: Chousuke: nope

16:10 Chousuke: only master is cloned by default

16:10 technomancy: metaperl: oh! I didn't realize that the github checkout instructions wouldn't mention the fact that you were on another branch

16:10 Chousuke: oh.

16:10 technomancy: I can see how that would be very confusing.

16:10 metaperl: technomancy: I did git clone

16:10 git clone git://github.com/technomancy/clojure-mode.git

16:10 technomancy: Chousuke: actually git clone only pulls master across by default iirc

16:10 Chousuke: well, git checkout -b installer origin/installer I guess :/

16:10 technomancy: metaperl: yeah, that's my bad; should have explained that.

16:11 metaperl: so you are saying I should h ave done a git checkout installer in the clojure-mode directory afterwards?

16:11 technomancy: metaperl: what Chousuke said

16:11 but I will merge this into the master branch; this is too confusing

16:11 and I'm pretty sure we'll want to keep it since it's been working out so well.

16:11 metaperl: he didnt say where to do it, but I'm assuming the root directory of what was checked out

16:11 technomancy: sorry for the confusion.

16:11 metaperl: ok I will wait for the merge

16:12 Chousuke: technomancy: better yet: swap the two brances ;)

16:12 branches*

16:13 though I guess you could just make a tag for the old master too, instead of a branch

16:13 metaperl: the git grandmasters hash it over :)

16:13 i have perl professional work to do, so I will check in with you cats after 5pm

16:13 (1 hr from now)

16:14 Chousuke: git actually makes a lot of sense once you get the basics

16:14 technomancy: metaperl: thanks for getting this working; nice to know it's cross-platform.

16:15 metaperl: :)

16:15 cooldude127: technomancy: it was cross-platform before, just not windows :)

16:15 technomancy: heh

16:16 cooldude127: usually I have a "Windows support is entirely accidental" disclaimer on my codes.

16:16 cooldude127: i noticed

16:17 Chousuke: :)

16:17 cooldude127: technomancy: i saw it on mire too

16:18 Chousuke: I'd extend that to support of environments besides my own...

16:18 cooldude127: i make sure technomancy's code works on os x

16:19 technomancy: I delegate my OS X testing.

16:19 since it's "illegal" for me to run a VM with it.

16:19 hiredman: eh?

16:20 technomancy: hiredman: I can't test on OS X without either buying a Mac or violating the EULA.

16:20 which is pretty silly.

16:20 BigTom: technomancy: Its installing now

16:20 hiredman: ah

16:20 BigTom: I'll have a go with Windows tomorrow

16:20 technomancy: hiredman: even MS is not that restrictive. =\

16:21 Chousuke: MS mainly sells software though.

16:21 cooldude127: apple is a hardware company

16:21 technomancy: Chousuke: sure, they have their motivations. doesn't make it reasonable.

16:21 cooldude127: they'd be broke if you didn't have to buy a mac

16:21 technomancy: Chousuke: I'm trying to make things work better on OS X, and they are opposing me.

16:22 Chousuke: I can see your point.

16:22 technomancy: it's not as bad as the iPhone where you have to ask permission to enrich the developer and application ecosystem, but it still offendsn me.

16:22 Chousuke: maybe they should provide a "tester licence" for running in a VM for testing purposes.

16:22 technomancy: Chousuke: on the other hand, outsourcing cross-platform testing has been working out great for me so far. =)

16:23 Chousuke: :)

16:23 technomancy: so I can't complain *too* much

16:23 cooldude127: technomancy: i'm a good tester :)

16:23 Chousuke: At least OS X is pretty unixy

16:23 technomancy: cooldude127: you do indeed have a knack for finding my dumb mistakes. =)

16:23 Chousuke: so if you don't make any unreasonable assumptions it'll just work most of the time.

16:24 cooldude127: technomancy: i have a skill for spotting problems in other people's code

16:24 Chousuke: yeah that is true

16:24 technomancy: Chousuke: a lot of it is BSD-isms like the crazy behaviour of cp -r if you add a trailing slash to a directory entry

16:24 cooldude127: technomancy taught me to tell aquamacs to fuck off, albeit very indirectly and probably without his knowledge

16:25 hiredman: BSD is Unix, GNU is Not Unix

16:25 :P

16:25 cooldude127: lol

16:25 hiredman: I mean, it even says so, right in the name

17:06 cads: has clojure ever been anything other than a lisp?

17:06 ayrnieu: it hasn't.

17:06 cads: thanks ayrnieu

17:07 Chouser: I believe in it's oldest form it was a common lisp program that generated Java and C# source code.

17:07 its

17:08 ayrnieu: http://dotlisp.sourceforge.net/dotlisp.htm

17:09 kotarak: o.O

17:10 cads: wow :D

17:12 kotarak: So it was a Scheme. :)

17:14 technomancy`: nice; like half of lisp.reddit.com is clojure now.

17:15 Chouser: I really thought the compiler was originally in CL, but I'm not finding it now.

17:21 shoover: dotlisp was a different project. you can find clojure in CL in the svn history

17:26 Raynes: Clojure is gaining popularity fast. Looks like a JVM LISP is everyones dream.

17:26 technomancy`: Raynes: a *modern* lisp is the big draw for me.

17:27 just losing all the 80s-ish trappings (like the big hair and the synths)

17:27 turbo24prg: is there a "built-in" to find the entry for a value in a map?

17:27 ayrnieu: another JVM Lisp: http://common-lisp.net/project/armedbear/

17:27 hiredman: I was looking for a .Net lisp the first few times I stumbled across clojure

17:27 ayrnieu: ,({1 2, 3 4} 1)

17:27 clojurebot: 2

17:28 Raynes: technomancy`: The fact that the community is already huge, and that the language rocks, and that Rich actually hangs out in here, people are already working on IDE support for Clojure and a book is 2 months away from shipping did it for me.

17:28 hiredman: turbo24prg: java Map or clojure map?

17:28 Raynes: Did I mention the language rocks?

17:28 technomancy`: heh

17:28 hiredman: ,(:a {:a 1 :b 2})

17:28 clojurebot: 1

17:28 hiredman: ,(get {:a 1 :b 2} :a)

17:28 clojurebot: 1

17:28 turbo24prg: ayrnieu: with the value (like 2), not with the key

17:29 ayrnieu: the language is very cool, and the book (that you can already get on PDF, beta 6 now) does a very good job of showing this

17:29 Chouser: ,(find {:a 1, :b 2} :a)

17:29 clojurebot: [:a 1]

17:29 kotarak: turbo24prg: (filter #(= (second %) value-to-look-for) the-map) untested.

17:29 turbo24prg: in cl you can give find a :test method

17:29 hiredman: turbo24prg: you want a bimap?

17:30 look up keys with values, look up values with keys?

17:30 turbo24prg: right

17:30 hiredman: ick

17:31 durka42: you could use two maps...

17:31 hiredman: ,(reduce #(assoc %1 (second %2) (first %2)) {} {:a 1 :b 2})

17:31 clojurebot: {2 :b, 1 :a}

17:31 Chouser: ,((into {} (map (fn [[x y]] [y x]) {:a 1, :b 2})) 2)

17:31 clojurebot: :b

17:31 kotarak: turbo24prg: (merge (zipmap keys values) (zipmap values keys))

17:31 jbondeson`: kotarak has what you want.

17:32 kotarak: But with lots of assumptions.

17:32 unique keys, unique values, ...

17:32 hiredman: (doc zipmap)

17:32 clojurebot: Returns a map with the keys mapped to the corresponding vals.; arglists ([keys vals])

17:32 turbo24prg: are strings stored multiple times then (when using two maps)?

17:32 hiredman: huh

17:32 Chouser: no

17:32 not unless you try very hard

17:33 turbo24prg: Chouser: what does that mean? :)

17:33 jbondeson`: if you're not doing it a million times the previous filter statement works.

17:33 the real issue is non-unique values.

17:34 Chouser: turbo24prg: string literals in Clojure are interned and objects are hardly ever deep-copied.

17:34 ,(identical? "foo" "foo") ; interned

17:34 clojurebot: true

17:35 turbo24prg: well, thanks for your help!

17:35 ayrnieu: ,(let [d {1 2 2 3 3 2}] (map count [(set (keys d)) (set (vals d))]))

17:35 clojurebot: (3 2)

17:37 Chouser: ,(let [a [1 "foo"] b [(second a) 2]] (identical? (second a) (first b))) ; copy reference, not object

17:37 clojurebot: true

17:37 Chouser: ,(identical? "foo" (String. "foo")) ; explicit copy

17:37 clojurebot: false

17:37 gnuvince_: hiredman: trying to convert Haskellers to Clojure? :)

17:41 turbo24prg: so i don't have to role my own dictionary encoding when i use a string in several maps, because it actually stores references?

17:42 Chouser: turbo24prg: sounds right to me.

17:42 hiredman: gnuvince_: well, I would just sort of like all the haskell code out there to be translated to clojure so I can use it

17:42 technomancy`: hiredman: speaking of haskell... think you'll make it to seafunc or not?

17:43 ayrnieu: this is the only haskell code of note: http://www.willamette.edu/~fruehr/haskell/evolution.html

17:43 turbo24prg: awesome.

17:43 hiredman: technomancy`: nah, I have to go fix someones internet

17:43 technomancy`: hiredman: bummer

17:44 hiredman: I am really geting fed up with cheapo router/gateway/nat boxes

17:44 albino: time to by a soekris

17:44 s/by/buy

17:46 hiredman: albino: price*4

17:46 but yeah

17:46 that would be best

17:47 that would be awesome infact

17:47 technomancy`: I get out of a lot of that kind of stuff by saying that I haven't used Windows in over 5 years since that's usually where the problem lies.

17:47 * hiredman day-dreams about that

17:47 albino: isn't it like $300 or something like that?

17:47 hiredman: $278

17:48 technomancy`: nah

17:48 albino: hiredman: dude, you can make 80k+ a year hacking java, you should be able to afford it

17:48 technomancy`: albino: sounds like it's for someone else

17:48 albino: oh

17:48 I thought it was for his house

17:48 hiredman: kwatz. I do not hack java so I do not make that kind of money

17:49 anway, this is sort of off topic, I guess

17:49 albino: hiredman: stop painting start hacking :). 1) Obtain job hacking java 2) Sneak in clojure instead of java 3) profit

17:49 hiredman: although, I think sablevm is in the package repo for some of the opensource firmwares

17:50 dunno if clojure runs on sablevm though

17:50 technomancy`: sablevm?

17:51 * technomancy` imagines a pair of argent parentheses rampant or a field of sable.

17:51 technomancy`: would make a good logo

17:51 *on

17:51 (heraldry jokes are not very funny.)

17:51 hiredman: NOTE: THIS PROJECT HAS MET ITS RESEARCH GOALS AND IS NOT ACTIVELY MAINTAINED ANYMORE.

17:51 ^- sablevm homepage

17:52 albino: ahh, that's where the academic world fails the real world

17:52 where research goals are met

17:58 technomancy`: but it met its research goals! so it must be good.

18:26 BigTom: technomancy: Your install script works so far for me on Linux

18:26 gnuvince_: ,(+ (byte 254) 3)

18:26 clojurebot: 1

18:26 BigTom: I even ran one of those swing snake apps that were popular a few weeks back

18:26 gnuvince_: ,(+ (int (byte 254)) 3)

18:26 clojurebot: 1

18:27 technomancy: BigTom: great

18:27 BigTom: technomancy: I'll give it a go on Windows tomorrow, thanks

18:27 technomancy: cool

18:27 BigTom: g'night

18:28 cooldude127: technomancy: clojure-install is a hit!

18:28 technomancy: out of the park.

18:28 cooldude127: technomancy: is clojure-update in yet?

18:28 oh yeah it is

18:28 i'm forgetful

18:28 technomancy: cooldude127: it is, but the save-window-excursion I added wasn't working.

18:28 cooldude127: really?

18:29 technomancy: yeah, I may not have exactly what you wrote at first though.

18:29 cooldude127: technomancy: weird, cuz i think i'm using what you put in, and it works for me

18:30 gnuvince_: Is it possible to convert from byte to int?

18:30 technomancy: maybe I was using an older copy... sometimes I get confused since the my clojure-mode repo and starter kit aren't always in sync

18:30 cooldude127: technomancy: could be. i copied clojure-mode.el over from clojure-mode repo

18:33 technomancy: did you talk to jochu? your master has been merged

18:33 from installer

18:33 in your repo

18:33 technomancy: cooldude127: I've just sent a pull request; haven't heard back

18:34 cooldude127: oh ok cool

18:34 technomancy: I figured this stuff wasn't going away though.

18:34 cooldude127: yeah

18:34 everybody likes easy installers

18:34 Chousuke: hm

18:34 cooldude127: and this is definitely the kinda thing clojure can use

18:34 Chousuke: the new clojure-mode is not going to screw up my git-svn repos is it? :)

18:34 I see you have added automagixk

18:34 magicks*

18:35 cooldude127: Chousuke: if you don't use clojure-install or clojure-update

18:35 gnuvince_: ,(byte 255)

18:35 clojurebot: -1

18:35 gnuvince_: hmmm

18:35 cooldude127: it shouldn't mess up anything

18:35 gnuvince_: Does Clojure have unsigned versions of its numerical types?

18:35 cp2: so, whats the story with lazy-cons?

18:35 Chousuke: java doesn't, so no.

18:35 cp2: is cons now lazy?

18:35 ayrnieu: http://darksleep.com/player/JavaAndUnsignedTypes.html

18:36 gnuvince_: damn

18:36 ayrnieu: cp2 - in the lazy branch, (first (cons 1 (repeat 1))) => 1

18:36 gnuvince_: I have a program that *needs* to read unsigned bytes

18:36 cp2: i see

18:36 ayrnieu: oh well, that's 1 in trunk as well.

18:36 technomancy: Chousuke: you can use clojure-install or clojure-update with a different src-root and it won't conflict. but if you don't touch those commands, there's no way it would mess you up.

18:36 no side-effects. =)

18:37 cooldude127: Chousuke: and clojure-update assumes you are using git for all, as in it just does git pull in those directories

18:37 cp2: oh ayrnieu, i only brought that up because i thought it was removed

18:37 rhickey was here explaining a few days ago

18:37 it appears its still there

18:38 im using 1235 (from clojure box)

18:39 Chousuke: cooldude127: hm, maybe make that configurable?

18:39 I need git svn rebase :)

18:39 ... for clojure and clojure-contrib

18:39 technomancy: Chousuke: it's more targeted at people who are just getting started... but that might make sense

18:40 do you use git-svn because you need to be able to commit?

18:40 cooldude127: Chousuke: well, clojure-update is meant to be used after doing clojure-install

18:40 Chousuke: technomancy: nah. the git repo is just too lagged

18:40 cooldude127: gnuvince_: apparently you need to use a short

18:40 * Chousuke wishes there were an auto-updated git mirror

18:41 technomancy: Chousuke: the github one is updated manually?

18:41 Chousuke: maybe with a cron script or something; I don't know.

18:41 certainly not automatically when the SVN repo changes.

18:41 technomancy: Chousuke: hows about I replace "git pull" with "git pull || git svn pull"

18:42 err--rebase

18:42 so if it fails it will fall back to git-svn

18:42 ayrnieu: clojurebot notices svn updates. Have *it* update a git repo :-)

18:42 cooldude127: clojurebot: latest?

18:42 clojurebot: latest is 1250

18:42 cooldude127: yeah github is 9 revs behind

18:42 technomancy: huh; didn't realize it was that bad

18:43 Chousuke: Google should implement git support for google code.

18:43 cooldude127: Chousuke: hell yeah

18:43 Chousuke: would be easier to persuade rhickey too :P

18:43 gnuvince_: cooldude127: so I'll need to convert all my data types up one level?

18:43 cooldude127: gnuvince_: looks like it based on the link that was on here

18:43 ayrnieu: gnuvince, it depends on what you're doing.

18:44 gvunince - signed bytes and unsigned bytes are the same at the bit level, after all.

18:44 cp2: is the sf svn for clojure the "official" one

18:44 cooldude127: cp2: i think it's on google code now

18:45 Chousuke: it moved to google code a while ago.

18:45 cp2: i see

18:45 Chousuke: as did contrib

18:45 cp2: k, thank you

18:45 Chousuke: I see it as an improvement, but still wish it was git instead of SVN :)

18:45 cooldude127: should have gone to github :)

18:45 cp2: personally i like bazaar

18:45 Chousuke: or actually, any DVCS would do

18:45 hg, bzr, or even darcs I guess.

18:46 walters: Chousuke: i think it depends on Google internally giving up on improving SVN; last I heard they were still paying someone to do that

18:46 cooldude127: lol

18:46 ayrnieu: you can use svk with the existing svn repo.

18:46 cp2: Server Error

18:46 burn in hell google

18:46 cooldude127: ayrnieu: right now i think people are using git-svn

18:46 Chousuke: ayrnieu: I haven't heard good things about svk.

18:47 cooldude127: i don't like it

18:47 Chousuke: git-svn is great, though.

18:47 ayrnieu: svk was a little slow on my 412Mhz Zaurus.

18:47 technomancy: I heard the github guys gave a training talk at Google; don't know if that means they're using git-svn or considering going all-git on some teams

18:47 Chousuke: initial checkout is a pain, but after that it's like SVN was never there... at least for local stuff.

18:47 ayrnieu: Other people may dislike it for being written in Perl, or for not being something that they already prefer -- git, etc.

18:48 cooldude127: i have never used git-svn

18:48 gnuvince_: ayrnieu: I need to do an addition to specify a terminaision clause, and when it wraps to -100, it wreaks havoc

18:48 cooldude127: i think i'm just scared

18:48 Chousuke: cooldude127: do you use git though?

18:48 cooldude127: Chousuke: yes :)

18:48 all the damn time

18:48 Chousuke: then you should check out git-svn

18:49 technomancy: cooldude127: is that because you're a student and don't have to deal with Legacy Stuff? =)

18:49 cooldude127: technomancy: i think so

18:49 walters: ayrnieu: i think the argument against SVK is that it's sort of like trying to build a skyscraper on top of the foundations built for a house

18:49 cooldude127: technomancy: i can't think of anything i need to checkout from svn

18:49 jbondeson`: i still don't trust these new fangle-dangle dcvs things

18:49 * jbondeson` gets his cane

18:49 cooldude127: lol

18:50 ayrnieu: walters - uh, OK.

18:50 Chousuke: jbondeson: you can use them like traditional VCS systems too!

18:50 technomancy: jbondeson: back in *my* day, we had to keep each file in its own RCS repository... and it was uphill both ways!

18:51 Chousuke: though using git with a SVN-like workflow is really not effective.

18:51 ayrnieu: jbondeson, watch the git screencasts.

18:51 jbondeson: it doesn't help that git on windows sucks

18:51 Chousuke: git is best used by committing often and cleaning up the mess later.

18:51 gnuvince_: jbondeson: git isn't the only DVCS

18:51 cooldude127: Chousuke: git rebase -i ftw :)

18:51 Chousuke: you don't need to worry about committing broken stuff, as long as you don't push it, which is a huge win :)

18:52 could probably make emacs autocommit on every save :/

18:52 cooldude127: Chousuke: but then your git log would suck

18:53 Chousuke: cooldude127, well, that's easy to fix.

18:53 just squash together the commits

18:53 cooldude127: damn i love git sometimes

18:53 Chousuke: and throw away the ugly development branch

18:53 technomancy: the peepcode on git is really good

18:53 Chousuke: and master will look like you never make errors (not even spelling errors in log messages)

18:53 cooldude127: AS IS THE ONE ON EMACS

18:53 technomancy: heh

18:54 Chousuke: I wrote an Emacs mode that would autocommit to git on an idle-timer and then synchronize with other repos over zeroconf for near-realtime collaborative editing

18:54 it were a blast

18:54 Chousuke: heh

18:54 cooldude127: geoffrey grosenbach is a screencasting bad-ass

18:55 technomancy: Chousuke: http://github.com/technomancy/conspire/tree/master

18:55 Chousuke: another thing I love about git is that I can actually make the commits meaningful

18:55 cooldude127: technomancy: i was looking at that code

18:55 Chousuke: log messages, rather

18:55 jbondeson: technomancy: why does that sound like it would be fun to screw with your coworkers using that...

18:55 technomancy: jbondeson: heh

18:55 cooldude127: technomancy: how good is the conspire code?

18:55 Chousuke: often, you end up making unrelated edits in a single commit, or during a series of commits

18:55 technomancy: cooldude127: i never actually tested it with more than two conspirators

18:56 Chousuke: git makes separating that mess into clean, well-labeled commits *trivial*

18:56 technomancy: so probably not very good. I'm sure the timing code needs improvement.

18:56 cooldude127: technomancy: does it work when you're on different networks?

18:56 technomancy: cooldude127: not currently; it autodetects peers using zeroconf

18:56 aka bonjour

18:57 cooldude127: yeah

18:57 technomancy: wtf is roastbeef?

18:57 technomancy: cooldude127: it's just some lame checkout tool I wrote

18:58 for compiling the absolute latest version of a program

18:58 cooldude127: oh

18:58 technomancy: Roast Beef is also a character in the excellent web comic Achewood.

18:58 cooldude127: i'm more interested in the first answer :)

18:59 technomancy: the second answer is probably more entertaining

18:59 cooldude127: lol

19:00 technomancy: you've got to start at the beginning with reading Achewood though. it's high-context humor.

19:05 Chousuke: hmm, running git gc every once in a while is useful

19:05 cooldude127: lol

19:05 * jbondeson is going to strangle his cruise control server

19:06 Chousuke: my clojure repo went from 32MB to 11MB and contrib from 16MB to 4.7MB

19:06 technomancy: Chousuke: are you running clojure on your phone or something? =)

19:06 that's not a lot of mega bytes

19:07 Chousuke: nah, operations weren't really getting slow or anything

19:07 but if this were a bigger project...

19:07 cooldude127: like...linux!

19:07 * Chousuke looks at his emacs git repo...

19:07 Chousuke: using 262MB right now

19:08 though it hasn't changed that much since I last repacked it. :/

19:08 cooldude127: emacs is a fatty

19:08 technomancy: a long-lived one at that

19:08 Chousuke: emacs contains a lot of software :)

19:09 bitbckt: just needs a decent editor

19:09 * bitbckt ducks

19:09 cooldude127: like tetris

19:09 * cooldude127 throws something at bitbckt

19:09 Chousuke: bitbckt: M-x viper

19:09 bitbckt: I kid, I kid.

19:09 * Chousuke actually uses viper

19:10 * cooldude127 loves how this class goes over the shit we're quizzed on AFTER WE TAKE THE QUIZ

19:11 jbondeson: typing M-x viper is admitting defeat

19:11 Chousuke: defeat of what?

19:11 it

19:11 jbondeson: of mind, body, and soul!

19:11 Chousuke: it's just enabling a superior UI!

19:12 jbondeson: so sad...

19:12 Chousuke: the fact that it's possible to write vim in emacs proves that emacs is, as an editor, superior, but its UI is still crappy :/

19:12 cooldude127: lol

19:14 jbondeson: see the problem is you're thinking of it as a UI or editor, and not a full blown operating syste!

19:14 +m

19:14 Chousuke: or maybe I shouldn't call emacs an editor... it's more of a set of composable features

19:14 walters: emacs is a buffer-oriented toolkit

19:15 cooldude127: an awesome toolkit

19:15 made of composable awesome

19:15 Chousuke: emacs is kind of like maths; if you have 1 and 2, you can have 3, or 1/2, or -1

19:18 and then someone writes a bunch of elisp that does something no-one though of before and that is like a whole new branch of maths; and all the old stuff can be re-examined

19:18 thought*

19:19 cooldude127: lol

19:23 notyouravgjoel: how does one find the length of a list?

19:24 Chouser: (doc count)

19:24 clojurebot: Returns the number of items in the collection. (count nil) returns 0. Also works on strings, arrays, and Java Collections and Maps; arglists ([coll])

19:24 notyouravgjoel: thanks!

19:25 zakwilson: I read somewhere that emacs is a great operating system... it's just too bad about the text editor.

19:27 Chousuke: not everyone agrees that a *text* editor is best for code anyway :)

19:28 cooldude127: i happen to like the text editor, so...suck it

19:28 zakwilson: I saw some interesting new language that used some sort of flowchart-like interface constructed by drag-and-drop.

19:29 I can never remember what it's called.

19:29 Chousuke: I know what you're talking about

19:29 I forgot the name too

19:29 cooldude127: i wish i did

19:29 Chousuke: It seemed very cumbersome though

19:29 jbondeson: any interface that relies upon the mouse is inherently flawed =P

19:29 zakwilson: That was my first impression too.

19:30 danlei: there was something like that back when i had an amiga ...

19:30 i hated it :)

19:33 zakwilson: Maybe program code shouldn't always be text, but I have yet to see a compelling alternative.

19:33 Chousuke: well, lisp code is *not* text but I suppose you mean the visual representation :)

19:34 hmm

19:34 zakwilson: Lisp code is a bunch of object literals. Object literals are text.

19:34 Chousuke: no, the actual lisp code is a data structure

19:34 you never see it; you just see your textual representation of it.

19:35 peter_12: has anyone written a Clojure interpreter in JavaScript?

19:35 Chousuke: there's a translator.

19:35 ClojureScript, in clojure-contrib

19:35 danlei: i think the interlisp guys used structure editors, not textual representation of code

19:35 Chousuke: a work-in-progress though.

19:35 peter_12: I was specifically interested in an interpreter

19:36 Chousuke: write one in clojure! and then translate it with clojurescript.

19:37 peter_12: Chousuke: :-)

19:37 zakwilson: I suppose it depends on whether you're talking about in-memory code or source code.

19:37 Chousuke: zakwilson: well, I'm talking about what the compiler sees.

19:37 or the interpreter.

19:37 zakwilson: And I'm talking about what the reader sees.

19:38 Chousuke: well, that is text, yeah.

19:38 could be images as well I suppose.

19:38 zakwilson: Doesn't PLT have some support for images in source code?

19:38 Chousuke: cut and paste things together, scan it, use some kind of image recognition as the "reader"...

19:39 cut and paste in this case is to be taken literally.

19:40 zakwilson: http://docs.plt-scheme.org/drscheme/Graphical_Syntax.html

19:40 Chouser: what a pain

19:44 notyouravgjoel: is there any namespace stuff I have to do to use the set stuff?

19:44 cooldude127: i think sets are in core, so no

19:45 notyouravgjoel: the api says its in clojure.set

19:45 ayrnieu: ,index

19:45 clojurebot: java.lang.Exception: Unable to resolve symbol: index in this context

19:45 cooldude127: ,(doc union)

19:45 clojurebot: java.lang.Exception: Unable to resolve var: union in this context

19:45 ayrnieu: ,clojure.set/index

19:45 clojurebot: #<set$index__5686 clojure.set$index__5686@1adceb8>

19:45 cooldude127: ok i was wrong

19:46 basic set structure is in core, but the operations are not

19:52 danlei: oh, that's interesting. i googled a bit for interlisp + structure editor and there's even a thread about it in the clojure group, which also has a link to xerox. nice ...

19:56 durka42: ,(int (Byte/parseByte "3"))

19:56 clojurebot: 3

19:56 durka42: ,(.intValue (Byte/parseByte "3"))

19:56 clojurebot: 3

20:11 ozy`: ,(apply #'hack [the-internets])

20:11 clojurebot: java.lang.Exception: Unable to resolve var: hack in this context

20:13 ayrnieu: speaking of which, fun fact: no matter how well you obfuscate your JS, at some point the browser makes a tangible request.

20:27 jayfields: lisppaste8

20:27 lisppaste8: url

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

20:28 jayfields pasted "java - clojure running code" at http://paste.lisp.org/display/74893

20:29 jayfields pasted "should.clj" at http://paste.lisp.org/display/74894

20:30 jayfields pasted "example.clj" at http://paste.lisp.org/display/74895

20:30 ayrnieu: please use annotations instead of all these separate pastes.

20:30 jayfields: sorry, this is my first attempt at using pastie.

20:31 lisppaste8: jayfields annotated #74893 with "should.clj" at http://paste.lisp.org/display/74893#1

20:31 jayfields annotated #74893 with "untitled" at http://paste.lisp.org/display/74893#2

20:32 jayfields: okay, so I'm trying to run the last annotated snippet

20:32 which uses "should.clj"

20:32 and the whole thing is launched via the Java code

20:32 but I get java.lang.Exception: Can't refer to qualified var that doesn't exist (Example.clj:5)

20:33 I assume because main is being defined on helpers.Should

20:33 is there any way I can get around this?

20:33 ayrnieu: `(defn ~'main ...)

20:34 ,[`a `~'a]

20:34 clojurebot: [sandbox/a a]

20:34 jayfields: cool, thanks.

20:37 okay, I can't figure it out from the examples, do you guys have any links to docs I can read?

20:38 ayrnieu: can't figure what out?

20:38 jayfields: if I change should to

20:38 (defmacro should [form]

20:38 `(defn ~'main [] ~@form))

20:38 I get Can't take value of a macro: #'clojure.contrib.test-is/is (Example.clj:5)

20:41 ayrnieu: two options. One: `(defn ~'main [] ~form) Two: (defmacro should [& form] ...)

20:42 (macroexpand '(should (is (= 50 50)))) => (def main (clojure.core/fn is (= 50 50)))

20:42 timothypratley: silly question -> what's the equivalent of an enum in Clojure

20:42 ayrnieu: more idiomatic: [& exprs]

20:43 timothy - symbols.

20:44 jayfields, do you see the problem?

20:46 jayfields: it looks like 'is is expanding in a way that's causing me problems.

20:46 timothypratley: ayrnieu: I suppose I could create a macro that takes a sequence of symbols and defs them to a number:

20:46 jayfields: since I'm getting Can't take value of a macro: #'clojure.contrib.test-is/is (Example.clj:5)

20:46 timothypratley: (myenum [foo bar baz])

20:47 ayrnieu: presently your macro takes its one argument, '(is (= 50 50)), and is flattening it onto the end of `(defn ~'main [] ...)

20:47 timothy - or, you could think of symbols as already being named numbers.

20:48 jayfields: ah, right, thanks.

20:49 timothypratley: ayrnieu: they still need to be defed though right? So I figure if the enum is going to be put in a DB later for instance or sent over a wire... having a number would be handy...

20:49 durka42: you don't have to def keywords

20:49 timothypratley: I think I'm just dense

20:49 ayrnieu: timothy - for that, use a map.

20:49 timothypratley: ah keywords!

20:49 to the rescue

20:49 ayrnieu: ,(class :a)

20:49 clojurebot: clojure.lang.Keyword

20:50 timothypratley: yeah ok so I can just use keywords and create a map if I need to translate them to external

20:50 durka42: right

20:50 timothypratley: thanks!!!

20:50 ayrnieu: hmph.

20:51 ,(map #(-> class ancestors count) ['a :a])

20:51 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: sandbox$eval--1633$fn

20:51 ayrnieu: ,(map #(-> % class ancestors count) ['a :a])

20:51 clojurebot: (11 6)

20:51 ozy`: ,cycle

20:51 clojurebot: #<core$cycle__3720 clojure.core$cycle__3720@45064f>

20:51 ozy`: ,(cycle '(infinity))

20:51 clojurebot: Execution Timed Out

21:11 ozy`: ,(/ 0 0)

21:11 clojurebot: java.lang.ArithmeticException: Divide by zero

21:11 ozy`: ,(/ 0.0 0.0)

21:11 clojurebot: java.lang.ArithmeticException: Divide by zero

21:11 ozy`: FINE

21:11 be that way

21:13 Raynes: Why does Double/parseDouble throw a NumberFormatException? :(

21:14 Chouser: what arg did you give it?

21:14 ,(Double/parseDouble "x")

21:14 clojurebot: java.lang.NumberFormatException: For input string: "x"

21:14 cemerick: just out of curiosity, is r1155 when the (.staticFunction Classname args) form went away for invoking static functions?

21:14 Chouser: ,(Double. "x")

21:14 clojurebot: java.lang.NumberFormatException: For input string: "x"

21:15 Chouser: cemerick: with just a quick glance at the patch, my guess is "no".

21:16 Raynes: Chouser: Doesn't matter what I give it.

21:17 cemerick: Chouser: Thanks for looking. I'm "porting" various projects up to clojure head (from pre-AOT clojure), and that change surprised me, I hadn't caught wind of it before

21:17 Raynes: ,(Double/parseDouble "2.5")

21:17 clojurebot: 2.5

21:17 Raynes: . . .

21:17 Oh really?

21:17 Hmmm

21:18 I bet it's the version of Clojure I'm using. I'll have to check that.

21:18 Chouser: cemerick: git bisect is a decent way to pin down the exact commit that changed a behavior like that.

21:20 cemerick: Chouser: I'll check it out. I just did a quick commit-comment search using gitx, and 1155 is the only plausible one that mentions "static" in the last few months -- not that that means anything

21:20 it's *exceedingly* ironic that we're now using git, after all of my pooh-poohing it :-P

21:22 Chouser: you're coming off of svn? has the transition gone well?

21:22 ayrnieu: the internet's a fad.

21:22 cemerick: pretty decently. The trick was figuring out a good time to flip the switch.

21:23 We're actually in the middle of it now. This week is all about moving to git, "porting" to clojure head, and getting going with the new enclojure.

21:23 oh, and moving from using ivy to git submodules for dependency management. That's been the trickiest needle to thread.

21:24 Chouser: hm, I don't know anything about git submodules.

21:24 cemerick: quite handy -- svn:externals for the most part

21:25 they're sort of dumb for dependency management, but there's a good stopgap until we decide on what to use long-term among what's available: http://twitter.com/cemerick/status/1174146543

21:26 s/there's/they're

21:29 vjr: howdy all!

21:29 notyouravgjoel: is there an any function that doesnt need clojure.parallel?

21:29 Chouser: notyouravgjoel: I can't imagine what you mean.

21:30 vjr: hi

21:31 notyouravgjoel: sorry, the "pany" function in clojure.parallel

21:31 Chouser: gah, I'm getting dragged into writing some kind of object system. this is not what I meant to be doing.

21:31 notyouravgjoel: ah, no, I think the only parallel fn in core is pmap

21:32 vjr: hello I'm using the riddell.us doco to setup slime. Getting Exception in thread "main" java.lang.NoClassDefFoundError: jline/ConsoleRunner?

21:32 notyouravgjoel: erm no no, I just wanted a simple way to return a random item from a list. not hard to implement, I know

21:32 vjr: The jar is in .closure

21:32 danlarkin: Chouser: re: object system: for conditions/restarts?

21:33 Chouser: danlarkin: :-/ yeah

21:33 vjr: sorry .clojure

21:34 danlarkin: Chouser: perk up!

21:34 Chouser: ,(nth mylist (rand-int (count mylist)))

21:34 clojurebot: java.lang.Exception: Unable to resolve symbol: mylist in this context

21:34 notyouravgjoel: thanks though =)

21:34 Chouser: hah. yeah, anyway, like that. no builtin.

21:34 notyouravgjoel: haha, thats exacty what I did

21:35 random note to the community: clojure is pretty sweet, I'm really enjoying using it

21:40 danlarkin: woo hoo, I have hash-map lookups working in my django templating language!

21:41 ryszard_szopa: what is the correct way to define an Exception class?

21:41 gen-class?

21:41 Chouser: ryszard_szopa: I'm trying to make that unnecessary at this very moment.

21:42 danlarkin: ryszard_szopa: you've stumbled upon a mole-hill

21:42 Chouser: ryszard_szopa: but yes, gen-class or gen-interface

21:42 and then you have to AOT compile

21:43 ryszard_szopa: Chouser: could you please expand AOT?

21:43 Chouser: Ahead Of Time

21:43 http://clojure.org/compilation

21:44 you need it for bullet 3 on that page: generate named class

21:45 I'd recommend avoiding custom Exception classes if you can. There's a large number of builtin ones available.

21:45 ~exceptions

21:45 clojurebot: http://paste.lisp.org/display/74305

21:45 ryszard_szopa: hum, do I understand correctly that the present state of affairs regarding exceptions is not what most people would desire?

21:46 cemerick: IllegalArg, IllegalState, and IOException are generally sufficient for 90% of all error conditions

21:46 IMvHO, anyway

21:48 ryszard_szopa: I don't know a lot about Java, so I'm a little puzzled

21:48 in Python I am supposed to generate a new exception class every time I need it

21:48 ie. when there's no exception defined for that specific situation

21:48 is that not the case in Java?

21:49 walters: that is the case for Java (though reusing exceptions is also fine if there's one available)

21:50 Chouser: but generating a new named class in Clojure is often more trouble than its worth

21:50 cemerick: I think it depends on what circles you travel in. That approach can get pathological pretty fast, and has in various libraries. CannotConnectToCustomServerForThisReasonException, etc

21:50 Chouser: and there are better options, just not fully realized yet...

21:50 ryszard_szopa: Chouser: what did you mean when you said you were trying to make that unnecessary?

21:51 walters: cemerick: right, well i've seen people do exception + enum too

21:51 ryszard_szopa: Chouser: are you implementing a common lisp like condition/restart thing or something?

21:51 danlarkin: ryszard_szopa: I know what you mean about the difference coming from python

21:51 Chouser: Common Lisp has a condition/restart system that has a superset of the features of Java exception handling, and I'm working on a lib to provide many (most) of those features for Clojure.

21:52 including defining new error (condition) types without requiring AOT compilation.

21:52 walters: a key difference with python is that python is source-interpreted (though it does have bytecode as a semi-implementation detail)

21:52 ryszard_szopa: Chouser: and how is it going?

21:53 Chouser: well, I've got the core of it sketched out, but now i'm on an object-system tangent that I don't like

21:53 I've only been working on it for a couple evenings.

21:53 cemerick: walters: that's just as crazy to me. Who's writing recovery paths for all of these statically-defined error conditions?

21:54 ryszard_szopa: Chouser: doesn't the normal exception-handling mechanism interfere with what you are trying to do?

21:54 Chouser: possibly. :-)

21:55 walters: cemerick: there weren't a lot; i forget where i saw it though

21:56 cemerick: walters: I've seen some pretty pathological stuff. For that matter, http://paste.lisp.org/display/74305 is pretty bad as it is.

21:57 walters: cemerick: well, a large chunk of those are implementation bits

21:57 ryszard_szopa: Chouser: good luck then. I am counting on you ;-)

21:57 cemerick: walters: sure, but I won't let that blunt my rhetoric! ;-)

21:57 walters: cemerick: =)

21:58 cemerick: but yeah, it's a valid point

22:25 notyouravgjoel: is there an else for cond?

22:26 Chouser: any true value will do. :else is conventional

22:26 notyouravgjoel: thanks

22:34 cemerick: notyouravgjoel: use :else as the always-true last "predicate" for cond

22:39 notyouravgjoel: java.lang.ClassCastException: clojure.lang.PersistentList (hello-world.clj:0) any ideas?

22:40 cooldude127: paste it

22:42 lisppaste8: notyouravgjoel pasted "class exception problem" at http://paste.lisp.org/display/74902

22:42 notyouravgjoel: http://paste.lisp.org/display/74902

22:42 =)

22:43 vjr: Is jline worth it?

22:43 notyouravgjoel: the last line is the problem, I believe

22:43 or, that's what causes it to fail

22:44 danlarkin: vjr: I use rlwrap

22:44 vjr: danlarkin: thanks, i'll check it out

22:45 notyouravgjoel: ah

22:46 i think it is the cons

22:47 arbscht: notyouravgjoel: yes, you're calling (currently-on) as a function

22:47 notyouravgjoel: oh my nevermind. That was moronic

22:47 vjr: finally got jline to work. Not the worst hair puller by far but still annoying.

22:48 danlarkin: vjr: what platform are you on?

22:48 vjr: danlarkin: mac os x

22:49 danlarkin: vjr: mmhmm, I've heard of annoyances on osx, that's why I use rlwrap and avoid it all together

22:49 sorry, altogether

22:49 vjr: danlarkin: gotcha. so much to learn so little time.

22:49 arbscht: notyouravgjoel: incidentally, for fns that are not overloaded, you can omit the extra parens. i.e. (defn foo [x] ...) instead of (defn foo ([x] ...))

23:01 notyouravgjoel: ,-1/2

23:01 clojurebot: -1/2

23:09 vjr: danlarkin: rlwrap works very nicely. Thanks.

23:09 cemerick: anyone know why gen-and-load-class is commented out?

23:10 danlarkin: vjr: *cheer*

23:10 cemerick: replaced by :gen-class in the ns macro

23:11 cemerick: danlarkin: hrm, not entirely, especially if one is generating a lot of classes and impls progammatically....

23:15 Chouser: cemerick: generating classes is now only allowed when compiling.

23:15 named classes, that is.

23:17 cemerick: Chouser: That's OK I think. I just need to have some shell of the class being generated loaded as well so that I can have type-hints right afterwards in the implementation fns.

23:18 Chouser: well, you can call gen-class directly (you don't have to use :gen-class in the 'ns' macro)

23:18 cemerick: that's the plan -- but by my reading, gen-class doesn't load the generated bytecode in addition to saving it...

23:20 Chouser: I think you're right. I wonder if that's intentional. Everything else that happens during compile is available for use immediately.

23:21 wait, I've done this.

23:23 well, I can't find it now, but I think I was doing type hints in the same .clj file as I did the :gen-class

23:26 cemerick: yeah, we've been doing that, but it required using gen-and-load-class as well as gen-and-save-class at "compile" time in order for the subsequent import and type hinting to not fail

23:26 if gen-class does load the generated bytecode (perhaps while it's on its way through the compiler itself), then all will be well

23:27 Chouser: I'm having a hard time thinking of why it shouldn't, but I don't see in the code anywhere that it does.

23:31 cemerick: yeah, that's why I was asking :-)

23:31 I guess I'll just jump in and see how it goes

23:33 Or, maybe: has anything developed of late in terms of being able to have some designated map instances automagically implement javabean properties based on key/value pairs?

23:34 I wouldn't mind not bothering with my "genbean" gizmo if something better has come along in the interim.

23:34 danlarkin: heh, un-bean

23:35 Chouser: cemerick: I don't think so, but Rich won't take any patches to struct maps. I think he wants it to do all your fanciness for you.

23:36 cemerick: Chouser: I guess I got my patch into PersistentStructMap just in time, then :-)

23:38 Chouser: this one's just sittin' there: http://code.google.com/p/clojure/issues/detail?id=46

23:39 cemerick: Chouser: is there any particular reason why struct maps are a DMZ at the moment? Big plans?

23:40 I remember he mentioned generating slots in struct maps as java fields, which would be pretty slick.

23:41 ...though Object.clone isn't the fastest thing in the world (probably slower than consing an array and doing arraycopy, actually)

23:41 Chouser: yeah, I seem to recall it was something along those lines.

23:42 I don't know if he has solid plans or not, but I think he's pretty busy redoing seqs right now

23:43 cemerick: I'm much too far away from that to be happy or sad about it.

23:44 Chouser: I ought to try the lazy branch and see how much of my code breaks with nil punning gone, but I'm too ... lazy.

23:44 cemerick: we're producing a lot of code lately, so I'm just trying to keep from tripping over breakage everywhere

23:44 yeah, the loss of nil punning is going to be quite a shock, I think

23:45 I *almost* feel like problems are being solved that I simply don't have, but I'm going to end up having to work with the solutions anyway, etc.

23:46 'course, I barely figured out how to open the code editor after this last hiatus of mine :-)

23:47 Chouser: yeah, I understand that. I think it's telling though that both streams and lazier seqs require giving up nil punning.

23:47 but that's just about the only thing that either of them break

23:47 cemerick: see, I can't even conceptualize the difference between the two. My own little blub paradox.

23:48 Chouser: which makes nil punning itself seem like a bit of a fragile construct that we might be better off without anyway, to future proof our code.

23:48 oh, they're very different. I can understand if you don't want to put in the time to grok them at this point though.

23:48 did you see the comparison Rich posted?

23:49 http://paste.lisp.org/display/74721

23:49 cemerick: no. my unread clojure list folder has 1125 messages in it right now :-(

23:50 Chouser: streams are very stateful, like normal-language iterators with 'next!' functions and such

23:50 cemerick: *gack*

23:51 Chouser: yeah. he packaged them all up so they're pretty safe, and apparently they run 2x faster than seqs

23:51 cemerick: see, lazy-cons and lazy-cat serve me *very* well. Pythonesque generators don't interest me much at the moment.

23:52 Chouser: the lazy branch is a pretty minor tweak on what seqs already do. lazy-seq instead of lazy-cons, and you're not as likely to consume more than you need, even with deep pipelines.

23:52 cemerick: I guess I've got to be zen about it and all. Otherwise, I'm one of the arses that would go off and try to create "Common Clojure" or some nonsense. ;-)

23:52 bad analogy, but it's late

23:52 blbrown: what does 'code should equal data' really mean. For example, http://paste.lisp.org/display/74903 here this data structure looks like a CSV file. Looks good to me, but at the same time, I feel like it contains bad desgn, say if I have to refactor the code.

23:53 Chouser: I haven't tried the lazy branch yet, but I don't think lazy-cons is going away in either branch. these are just new alternatives the provide performance and/or more laziness.

23:53 nil punning is just about the only victim

23:54 cemerick: I'm guessing that, barring hitting a bug, we'll be sitting on the current head for a while. Lot of deep diving into domain-specific stuff over the next month or so.

23:54 I'm glad things are moving along so nicely though, community and organization-wise. I wish I could do more (or, anything), but things have been nuts for a while.

23:58 blbrown: cemerick, contribute by writing code and talking about it. That is what I am doing.

23:59 cemerick: blbrown: the code flows aplenty. We're still trying to be mostly stealthy about things until we figure out a variety of tech and business issues, though.

23:59 I talk up clojure pretty constantly locally, though, via http://wmassdevs.com and other forums

Logging service provided by n01se.net