#clojure log - Jun 23 2010

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

0:00 dnolen_: so yay, nay? no one using clj-apache-http ?

0:12 gstamp_: is the macroexpand feature in swank-clojure not working for anyone else? When I try and expand a macro I just get the name of the macro back rather than the expansion

0:17 tomoj: gstamp_: where's point when you do it

0:18 gstamp_: on the macro name itself

0:19 tomoj: put it on the opening paren

0:20 gstamp_: great. thank you, that works

0:20 tomoj: I thought it used to clean it up a bit, but mine doesn't anymore

0:32 dnolen_: tomoj: I patched it, you need to use swank-clojure from HeAD

0:33 tomoj: cool

0:33 was that a regression or was it my imagination?

0:33 dnolen_: tomoj: things broke because of clojure 1.2.0 work

0:34 tomoj: ah

0:43 dnolen_: very nice, thanks :)

0:43 dnolen_: tomoj: np

0:43 tomoj: for is such a monster

0:43 47 lines for (for [x (range 10)] x)...

0:45 dnolen_: Clojure is like the most awesome Object Oriented language evar

1:21 defn: tomoj: did you look at the challenge problem

1:24 tomoj: yep

1:24 haven't thought much about it, though

1:30 defn: help me solve it :)

1:39 tomoj: depth-first search can't be right, I guess

1:46 defn: actually i think that will work

1:48 tomoj: but it will be too slow, won't it? :(

1:52 defn: yeah :(

1:52 I think using symmetry can help

1:53 you could do depth first but discard bad paths early in the search

1:54 detecting when a path splits the grid into two unconnected pieces could be helpful maybe???

3:02 Licenser: hmm the agent pool thingy is really hurting clojures performance :(

3:36 Bahman: Hi all!

3:37 I am new to Clojure and just learning it.

3:38 I am Bahman from Iran.

3:39 BTW, what's the difference between "remove" and "drop-while"? I can't find out how they differ.

3:39 Licenser: Greetings Bahman :) it is a good decision to learn Clojure, it's a wonderful language!

3:40 tomoj: ,(drop-while even? [2 4 6 1 3 7 8 10])

3:40 $(drop-while even? [2 4 6 1 3 7 8 10])

3:40 sexpbot: => (1 3 7 8 10)

3:40 tomoj: $(remove even? [2 4 6 1 3 7 8 10])

3:40 sexpbot: => (1 3 7)

3:40 Licenser: $(drop-while odd? [1 3 2 1 4])

3:40 sexpbot: => (2 1 4)

3:40 Licenser: oh darn you tomoj ;P I was about to give the exact same esaple just with odd

3:40 tomoj: sorry :(

3:41 Bahman: Yes Licenser...I've always liked to learn Lisp but the problem was that as I'm a Java developer I'm used to read-to-use high-level components like Workflow engines which Lisp lacked.

3:41 Fortunately Clojure doesn't have this problem.

3:41 Licenser: *nods* You'll also find the comunity qite friendly :)

3:42 Bahman: Licenser: Yes..it seems so :-)

3:43 tomoj: 8 is even...why it's not dropped?

3:43 Licenser: Bahman: drop while drops the first elements as long as the condition is true

3:43 remove removes all elements for that the condition is true

3:44 so drop-while stops as soon as it finds a element that does not match the condition

3:44 Bahman: Licenser: I see the point. Thanks.

3:44 Licenser: :)

3:44 welcome

3:45 Bahman: So, is it alright to ask here such silly questions if I'm stuck? :-D

3:46 Or should I use the forums (if any)?

3:46 Licenser: Of cause it is, most of us started like that :P

3:47 Bahman: Good for me :-D

4:13 Kjellski: How would you do this idiomatically? I want to parse a file with "newline" separated textblocks. I want to group these blocks, which are themselves csv. I´ve already slurped the data in and parsed it with

4:14 clojure-csv. Now I´ve got the vector over vectors, wich I want to separate with the elements [""] in there..

4:14 Any ideas?

4:14 Licenser: I'd make do (re-seq #"[^\n]" data)

4:14 Kjellski: On the file?

4:14 Licenser: ah okay you areldy have something

4:15 Kjellski: Okay, and after that use parse-csv?

4:15 Licenser: well won't clojure-csv not already do that for you?

4:15 never used the cloure-csv lib

4:15 Kjellski: Yes, but it´s a vector over vectors, which I want to group elements from...

4:16 AWizzArd: ,(doc group-by)

4:16 Licenser: a vector of vectors, I guess it are vectors of fields in vectors of lines right?

4:17 AWizzArd: Okay, clojurebot is offline. But maybe clojure.contrib.seq/group-by

4:17 Kjellski: AWizzArd: Thanks, I´ll have a look at that... ;)

4:17 Licenser: $(doc group-by)

4:17 sexpbot: => ------------------------- clojure.core/group-by ([f coll]) Returns a map of the elements of coll keyed by the result of f on each element. The value at each key will be a vector of the correspon... http://gist.github.com/449631

4:17 Kjellski: Licenser: thanks, I´ll have a try....

4:18 Licenser: hmm I apearently suck at making clojure code fast .P

4:19 spariev: Licenser: you should write some ruby - it'll help you to stop worrying about clojure speed :)

4:19 Licenser: spariev: :P

4:25 actually it's not slow it's an infinit loop

4:34 hmm what was the function to divide two integers?

4:34 rem was the reminder but I never can remember the name of the other one :(

4:35 spariev: $(doc quot)

4:35 sexpbot: => ------------------------- clojure.core/quot ([num div]) quot[ient] of dividing numerator by denominator. nil

4:36 Licenser: Thank you!

5:06 Hmm I just tried to implement a few benchmarks in clojure and I noticed that it's beauty quicky gets burried under a heap of performance measures :(

5:11 eevar2: Licenser: profiling overhead?

5:11 Licenser: eevar2: no what I mean is when you want to get close to java'ish speed you've to do tons of ugly things

5:11 and it still isn't exactly fast :P

5:12 eevar2: ah. missed "beauty" in that sentence

5:12 Licenser: clojure is great because solutions look clean and nice in it, are easy to read and understand

5:12 if you want to get it fast this gets lost and you write java with parens in different places (at least that is what it feels like to me right now)

5:13 Fossi: well, most "benchmarks" are actually pretty screwed anyway

5:13 eevar2: if you stick to the same algorithms, i.e. using loops instead of creating lists and so on, performance isn't all that different?

5:13 Fossi: well i guess that counts as "ugly things"

5:13 eevar2: might not be quite as idiomatic, but

5:14 Licenser: eevar2: yes it does kind of

5:14 because you can't really use any of the build in functions since they are slow

5:14 well not slow slow but compared to pure javaish code they are slow

5:15 * Licenser is trying to do this: http://www.apl.jhu.edu/~hall/text/Papers/Lisp-Benchmarking-and-Fannkuch.ps in a nice way

5:15 Licenser: my first atempt was quite nice looking short and well slow

5:16 now it gets slowly more and more ugly as it gets faster and faster

5:18 tomoj: Licenser: you have a java version written?

5:18 Licenser: I know where one is but I haven't written it myself

5:21 tomoj: are you planning to blog this attempt?

5:21 Licenser: tomoj: yes as sonn as I'm happy with it but I'm not :P

5:21 tomoj: using prim?

5:21 dunno how much that would help

5:21 Licenser: http://gist.github.com/449687 if you want to look

5:21 tomoj: yes using prim

5:22 I want to see how much worth the changes are

5:22 tomoj: the lisp code in that paper is horrifyingly ugly

5:23 AWizzArd: In what way?

5:23 Licenser: as in if you really benefit from it when writing fast code

5:23 and while being nearly convinced that the tradeoff is worth it, I slwoy think again it isn't since you anway have to make it ugly if you want it fast

5:24 bobo_: why is ugly code always faster then pretty code? in all languages, feels so wrong

5:24 Licenser: bobo_: I agree :I(

5:24 but I think it isn't in assembly

5:24 Bahman: Licenser: Look at the C code: SMALL k2=(k+1)>>1 ...it's somewhat a cheating :-) You can only do such things in C or Assembly.

5:25 bobo_: assambly is always ugly

5:25 eevar2: Licenser: _are_ you profiling btw, or just fumbling around blind? ;)

5:25 Licenser: eevar2: I know what is slow, I managed to reduce the overhead to nearly 0 in my algorithm

5:25 now the only thing that is slow is the permutations

5:26 at least that is what I think

5:26 but I'm not using a profiler as they always make me itchy

5:26 I do profile by hand so (as in removing bits of code to see the impact)

5:27 to make this fast I need to implement the permutations myself on a static mutating *cry* array

5:27 as I did with the reversing part

5:27 hoeck: Licenser: and did you measure the differences of a relatively beautiful fannkuch benchmark in prim and normal clojure?

5:27 Licenser: hoeck: I admit no

5:27 but I should do that

5:28 hoeck: because that would be really interesting to see

5:29 Licenser: true

5:32 hoeck: Licenser: do you have a nice looking but easily understandable and probably slow version of the fannkuch benchmark?

5:32 * hoeck likes to try it out

5:32 Licenser: hoeck: yes give me one second to make sure it is correct :P

5:33 hoeck: great :)

5:35 Licenser: it is still testing :P

5:36 I got the source for scala from http://shootout.alioth.debian.org/u32/program.php?test=fannkuchredux&lang=scala&id=1 too

5:36 for this clojure sadly is 10 times slower :(

5:36 in the optimized version that is

5:36 and 60 times lower in the nice one

5:37 http://gist.github.com/449701 the nice code

5:37 I find this pretty ideomatic at least

5:37 bartj: hi all

5:38 hoeck: Licenser: thanks

5:38 Licenser: welcome hoeck I might push the entire thing to github too

5:38 perhaps others are better then me at making things fast <tm>

6:08 hoeck: http://gist.github.com/449731

6:08 test results

6:08 bartj: I am not able to appreciate the value of partial

6:08 Licenser: it is only partially useful bartj

6:15 hoeck: Licenser: are you measuring the whole jvm execution time?

6:15 Licenser: hoeck: yes

6:16 hoeck: why?

6:16 Licenser: I know it is not exact

6:16 hoeck: no warmup etc etc?

6:16 Licenser: becase it should be the same for every compliation

6:16 the multiplyer should not change

6:16 just an index

6:16 or rather a static value

6:17 I will push my setup shortly

6:18 hoeck: but you are currently measuring jvm and clojure startup performance, not really the pfannkuchen

6:21 Licenser: hoeck: well for the small numbers yes, but usually I take bigger ones

6:21 where you see something like a few secs difference

6:21 or a magnitude of difference

6:22 spariev: Licenser: have you considered using Criterium http://hugoduncan.org/post/2010/benchmarking_clojure_code_with_criterium.xhtml for benchmarking ?

6:22 Licenser: *looks at that*

6:22 spariev: also, LauJensen has nice post on proper benchmarking AFAIK

6:22 Chousuke: including the jvm startup time and not doing any warmup will not make clojure look good at all :P

6:23 Licenser: spariev: since I want to not only benchmark clojure that isn't too helpful

6:23 Chousuke: it also won't be realistic

6:23 Licenser: actually if 1.1 takes twice as long as 1.2 (for example) that is a quite useful information unels 1.1 starts twice as slow as 1.2

6:24 * Licenser will post something in a few minutes (after the benchmark is through)

6:26 Chousuke: in those results you posted the actual execution time seems to be obscured by the startup.

6:26 It's difficult to tell how well it's actually performing

6:26 Licenser: Chousuke: yes I know that was just to show how it looks I'll post new ones that might be more interesting

6:26 since they are longer runing

6:26 but yes I know the benchmarks are falwed, as all benchmarks are, I know in what direction they are flawed so I hopefully won't go to draw bad conclusions from it

6:27 hoeck: Licenser: I'm using criterium too to do the fannkuch

6:27 Licenser: which branch is the one you use

6:27 Licenser: I use 1.2 master and 1.2 equal

6:28 I will github push the whoel setup in about 2 minutes (then this run should be through)

6:28 hoeck: Licenser: I mean, I'm looking for the one with magical loops and primitive ops as the default

6:28 Licenser: yes I push the exact .jars I use

6:28 unless that is prohibited and rhicky will sue me for it :(

6:28 Chousuke: of course it's not prohibited :P

6:28 Licenser: :P

6:29 Chousuke: unless you've done modifications, of course

6:29 Licenser: http://gist.github.com/449748

6:29 here results now I push

6:29 I compiled them

6:32 Chousuke: the difference with scala shouldn't be that big, considering you should be able to get jvm-native speeds from numerical calculations now.

6:33 Licenser: Chousuke: I agree but from the code I have it sadly is

6:33 pushing right now but with all the jars in there it take a moment

6:34 but the difference beteen master and equal is scarry for idomatic clojure code

6:34 it seems the equal branch is slower right now

6:34 at least for this kind of code

6:35 20s difference isn't startup time either

6:35 I wonder what causes this

6:41 Chousuke: did you remember to use ^:static and type hint as necessary?

6:41 eevar2: never ever profile your benchmarks

6:42 i hear you can go blind

6:42 defn: lol

6:44 bartj: is there a better way to remove empty strings in a sequence than:

6:45 , (remove #(= "" (.trim %)) [" " "abc" "" "x"])

6:45 ,(remove #(= "" (.trim %)) [" " "abc" "" "x"])

6:48 spariev: bartj: there is also blank? function in c.c.str-utils2/string , which you can use - (remove blank? [" " "abc" "" "x"])

6:49 Licenser: eevar2: you know even I, and I know that might seem as a shock, can only do one thing at a time :P

6:49 http://github.com/Licenser/clj-shootout have fun

6:50 but Chousuke the point was to see how basic code works compared in main and equal

6:50 hoeck: Licenser: got a clojure build from may competing against equals, old code does (fannkuch 7) in 190ms, equals in 240

6:51 bartj: spariev: cool, thanks

6:51 spariev: np

6:51 Licenser: hoeck: what? o.O

6:51 hoeck: Licenser: so we basically made the same observation, that equals is a bit slower on the idiomatic code

6:52 Licenser: wall 190 vs 240 isn't a bit sadly :( that is about 20%

6:52 hoeck: right :/

6:53 Licenser: now the task is to find WHAT makes it slower eevar2 and now I'm going to profile

6:53 Chousuke: Licenser: that doesn't look like very fast code at all.

6:54 Licenser: Chousuke: I know it is ideomatic code, the nicest way I could come up to write this algorithm

6:54 Chousuke: and there's next to nothing that would get a benefit from the equals branch

6:56 Licenser: Chousuke: I know but oddly enough it is not too far away from what much clojure code deos: reorganizing lists and gathering data above them

6:56 Chousuke: Licenser: I think the main problem in the function version is that you're using concat a lot

6:56 that'll create one *really* lazy seq

6:57 * eevar2 cheers at Licenser

6:57 Chousuke: My first guess would be that the overhead of laziness is killing performance :/

6:58 Licenser: Chousuke: but it never gets realized fully

6:58 Chousuke: Licenser: that's the problem

6:58 Licenser: it creates a whole bunch of thunks :P

6:58 Licenser: only the first argument but I'll see once I toss on the horror profiler

7:00 Chousuke: you'll have one lazy seq, take one item from it, then make a lazy seq over the rest of it, repeating, until you have a lazy seq times a dozen :P

7:01 Licenser: actually 38 lazy seqs deep

7:03 now I've to remember how I get this silly profiler to actually profile stuff :P

7:04 there was some trick to put the the starting class but I don't remember o.O

7:07 ah I fear I know what it was :( it was meh

7:10 Bootvis: what is the recommended way to store 2-dimensional data persistently?

7:11 Licenser: it seems reverse costs the most

7:14 depends on your access method

7:14 if it is 2 dimensional in sense of k/v then a hashmal if it is 2 dimensional in the sense of a matrix then a vector of vectors

7:15 Bootvis: thanks

7:16 Licenser: oddly enough both reverse and nthnext (both core functions) have gotten slower o.O

7:32 this is very odd

7:42 Bahman: A question: I'm reading "Practical Closure" and I came across this sentence: "When writing idiomatic Clojure, one cannot use sequences too much."

7:43 Is it correct? I think it should be "...once cannot avoid...".

7:46 Just to clear things: I thought Clojure is about sequences but this sentence seems the have the opposite meaning.

7:47 cemerick: Bahman: It's an odd sentence in any case.

7:47 * Licenser agrees with cemerick

7:47 cemerick: Sequences are core to idiomatic clojure.

7:47 Licenser: seqs are usually your friends

7:49 spariev: bahman: maybe you should submit this error at the apress site - http://apress.com/book/errata/1312 , oddly (as compared to manning) there is no forum for this kind of stuff

7:49 Bahman: Good to know that...So it's just a typo.

7:49 Thanks everyone.

7:50 Will do spariev.

7:53 Licenser: it seels Chousuke is right lazy seq, for some reason is slower

7:55 Chousuke: I think the sentence makes perfect sense.

7:55 Saying you can't use sequences too much means no matter how much you use them, it's not excessive

7:55 ttmrichter: Wait a second: there's a SECOND book on Clojure out? Cool!

7:56 Chousuke: Bahman: ^^

7:56 rfg: Bahman: I don't think it's a typo, just one of these sentences that doesn't sound right unless you are a native speaker.

7:56 cemerick: Chousuke: of course, you *can* use sequences too much, if they're not appropriate for a given problem. :-)

7:56 Licenser: actually it seems you can use them too much :P

7:56 Chousuke: cemerick: well, yeah. :P

7:57 Bahman: Oh!

7:57 cemerick: It's definitely an odd thing to say.

7:57 Chousuke: cemerick: but a little hyperbole never hurt anyone. much.

7:57 Bahman: You're just 30 seconds late rfg :-)

7:58 cemerick: Chousuke: and here I was going to reimpl stuff to use alist seqs instead of maps! :-P

7:58 rfg: That's because I'm typing on my phone :)

7:58 Licenser: so here is the odd thing: running the fannkuchen2 code with doall around the concat makes equal faster, doing it without the concat makes master faster

7:58 Chousuke: cemerick: but maps become alists when you call seq on them!

7:58 Bahman: So the sentence is analogous to "priceless"...whatever the "price" it is not enough...no matter how much seqs are used, it's not enough. Right?

7:59 Chousuke: Bahman: it's not *excessive*

7:59 Bahman: Chousuke: Got your point.

8:00 cemerick: Chousuke: right! Clearly, alists (and therefore seqs) are superior to maps! ;-)

8:02 AWizzArd: cemerick: alists as in CLs alists?

8:03 Licenser: aaaaaaaaaaaaaahhh lists?

8:03 cemerick: AWizzArd: yeah, don't worry about it, I'm being sarcastic/snarky.

8:07 mmm, juicy NoSuchFieldError when AOT-compiling

8:09 * cemerick should give rhickey time to enjoy his tea first :-)

8:09 rhickey: cemerick: I've got half a cup down, shoot

8:09 cemerick: rhickey: NoSuchFieldError during AOT: https://gist.github.com/d8ba04dd0613cb7e11ba

8:11 Bahman: Well, clojure.org seems to be banning access from Inside Iran :-(

8:12 rhickey: cemerick: have you got top-level calls?

8:12 Chousuke: Bahman: wouldn't it be the other way around :/

8:13 cemerick: rhickey: No....but, in which direction are you after?

8:13 Bahman: I don't know...I doubt even those censor-men know about Clojure :-S

8:13 Chousuke: Bahman: ie. Iran would ban clojure.org (Though I have no idea why), not vice versa :P

8:13 cemerick: rhickey: The reference to the java class is in a fn; the static init in the class is there to support later RT.var lookups (both static and in method bodies).

8:14 rhickey: cemerick: which version of Clojure?

8:15 Bahman: Chousuke: Maybe...thinking how to find out...

8:15 ttmrichter: Bahman, I'll show you how to work around your censors if you want to talk in private.

8:15 Bahman: ttmrichter: Will appre

8:15 I appreciate that :-)

8:15 ttmrichter: (For reference I'm in China and have censorship problems too. ;)

8:16 Chousuke: why would clojure.org get blocked? :P

8:16 cemerick: rhickey: latest snapshot AFAIK: 1.2.0-master-20100607.150309-85

8:16 Chousuke: maybe because it's hosted on wikispaces?

8:16 ttmrichter: Chousuke: They may share an IP block with something the Iranian government doesn' tlike.

8:18 rhickey: great, going to ggroup starts infinite loop - google fail

8:20 cemerick: I heard that yesterday too -- which browsers are afflicted? FF does just fine. *shrug*

8:20 hoeck: strange, had the same problem a week ago, couldn't even login to gmail, deleting all my google related cookies helped though

8:21 rhickey: nuked cookies, works

8:22 cemerick: target/classes is clear when you start this AOT?

8:23 cemerick: rhickey: yeah -- I've triple-checked that at this point

8:23 I can bounce back and forth between success and failure reliably by commenting out the RT.load

8:24 rhickey: cemerick: have you got a circularity in your static inits?

8:25 cemerick: rhickey: not that I'm aware of, though wouldn't that cause an error of some kind?

8:26 FWIW, this code is unchanged since the last time it was built ~Feb

8:27 Chousuke: git bisect? :)

8:27 rhickey: the error is really bogus, as every reference to a var callsite is made from within the same class

8:27 cemerick: Chousuke: If I must. I'm not thrilled about the prospect of bisecting ~5 months of clojure commits.

8:28 Associat0r: does Clojure allow unboxed user-defined value tyes (structs) on the CLR?

8:29 Chousuke: cemerick: well, it's a binary search so it won't take *that* long :)

8:29 cemerick: rhickey: My random initial thought was that the RT.load call isn't setting things up properly for the compiler -- so docviewer__init gets generated, but without certain vars that are only conditionally emitted?

8:30 my understanding of the compiler is quite out of date, pre-reify

8:32 rhickey: cemerick: yes, you could not have the callsites flag set, but that would disable both the callsite field generation and the references to it, i.e. as if you didn't have callsites

8:32 cemerick: right

8:33 Associat0r: rhickey: does Clojure allow unboxed user-defined value tyes (structs) on the CLR?

8:33 cemerick: rhickey: so, binding *compile-path* = null before the RT.load in the java class (with a pop after) leads to a successful compile.

8:34 rhickey: The RT.load generates classes missing the callsites, and then the "normal" load sees classfiles already, and just invokes the __init.load(), assuming callsites are already there?

8:35 rhickey: cemerick: you are getting two different versions of the classes

8:44 cemerick: it used to be that during AOT the compiler loaded the classes from disk, now doesn't to support dynamic classes and interfaces

8:44 AWizzArd: When I AOTed a defrecord, will then (.getClassLoader MyRec) ==> #<AppClassLoader sun.misc.Launcher$AppClassLoader@1ba34f2> while a non-AOTed record will yield something such as #<DynamicClassLoader clojure.lang.DynamicClassLoader@13c7b52>?

8:45 cemerick: rhickey: then perhaps RT.load should suppress AOT using the same binding I just used?

8:45 AWizzArd: Could that be a way to build a reliable record? fn?

8:46 rhickey: cemerick: that's how explicitly loaded files get compiled

8:47 cemerick: so it is

8:51 rhickey: RT.load has always been a bit hacky; perhaps a method specifically suited for runtime loading of namespaces from Java is warranted, which would then set things up so as to not trip up AOT.

8:51 probably just an invocation of require, actually

8:52 rhickey: cemerick: who said you could call RT.load?

8:52 you can invoke require

8:52 cemerick: rhickey: heh, no one! :-P

8:53 But, tons of people do, because one often needs to load code from Java. A proper support route for that seems reasonable.

8:53 rhickey: cemerick: require

8:53 cemerick: supported*

8:53 rhickey: RT.var("clojure.core/require").invoke(...)

8:54 cemerick: rhickey: right as I said before -- but help out the poor java folk, and give them something with a signature like RT.require(String).

8:54 rhickey: cemerick: the general recipe is - get the var you would use to do the same job from Clojure and invoke it

8:54 AWizzArd: We need a better Java API (:

8:54 * cemerick plays the smallest violin in the world

8:55 rhickey: cemerick: when does that stop?

8:55 cemerick: rhickey: at some point, but after zero. :-)

8:55 rhickey: cemerick: try the latest (disables direct binding, as it is doomed)

8:56 cemerick: rhickey: will do

8:57 rhickey: Some supported host API is still needed though. At least enough to load namespaces and call fns in a java-idiomatic way.

8:57 AWizzArd: rhickey: Do you have plans to to provide a record? and/or deftype? function?

8:58 * cemerick scribbles in his 1.3 notepad

8:58 rhickey: AWizzArd: maybe

8:58 AWizzArd: Would be very helpful for my Serialization lib.

8:59 Currently I check (parents MyRec) to estimate if something has good chances to be a record

9:02 chouser: if it's just a matter of a tool to view, create, and delete rules for you, perhaps it could be done outside gmail and then use http calls to make it happen inside

9:04 cemerick: contrib failures @ http://build.clojure.org/ just now

9:05 not sure who turn the batlight on for these day

9:05 days

9:05 whoa, wonky hudson error

9:09 rhickey: cemerick: stuart halloway is on that

9:20 AWizzArd: Maybe if Clojure managed internally a Set of all defrecords/deftypes, then such a lookup could be done easily, without adding empty interfaces and such.

9:22 mattrepl: can anyone think of a reason why I'd be getting a Var unbound exception from within a deftest? The Var is defined in a "project.core" namespace and the test is defined in a "project.core-test" namespace which references "project.core" via a use expression in it's own namespace def "(ns project.core-test (:use [project.core] :reload-all).....)"

9:23 I'm using master branch, did the most recent pull yesterday.

9:24 rhickey: AWizzArd: a marker interface is far superior to a registry

9:24 AWizzArd: mattrepl: did you just do (def xyz) and then try to access it, without intializing it with a value?

9:24 rhickey: ah okay, didn't know that

9:24 mattrepl: AWizzArd: in this case the Var is a function that was defined with defn

9:25 AWizzArd: Just thought that such a marker interface could be used by any class, even if those are not Records.

9:26 mattrepl: I get similar behavior from the "user" ns in SLIME, strangely it works only if I run slime-compile-defun before attempting to dereference the Var

9:27 I say "strangely" because I didn't have this problem before using a similar project setup

9:29 or rather, "the Var is bounded to a function that was defined with defn"

9:30 I have an idea of what would be broken, but I'm not sure why others wouldn't have already reported it... diving in...

9:30 mmarczyk: rhickey: about the ggroup infinite loop, deleting all googlegroups.com cookies fixed it for me

9:31 rhickey: mmarczyk: yes, me too

9:31 mmarczyk: rhickey: perhaps there were some groups.google.com cookies too... not sure

9:31 ah, ok then :-)

9:31 rhickey: cemerick: any word on latest and your problem?

9:32 cemerick: rhickey: sorry, got caught by a call; another 15m anyway

9:43 mmarczyk: hm, I've got a (defprotocol ToSQL (to-sql [self])) in one namespace, then a (defrecord InfixOperator [op-name] ToSQL (to-sql [self] op-name)) in another; the latter generates a reflection warning -- "call to contains can't be resolved"; any idea why?

9:43 rsh: how do you remove a macro defined in a ns?

9:44 Chousuke: rsh: ns-unmap

9:45 rsh: thanks

9:45 mmarczyk: rsh: as you would with a function; nb. this won't have any effect on code using this macro and compiled when it was in place

9:49 rhickey: in core_deftype.clj, line 215, shouldn't there be a type hint on v#?

10:03 alexyk: how do I make a stand-alone executable? uber-jar?

10:03 spariev: yes, lein uberjar will do

10:22 mattrepl: *sigh* misplaced parens around a series of defns. no compile error, but resulted in Var being interned but no function bounded

10:24 chouser: mattrepl: just yesterday systray had that very same error message with the very same cause

10:26 mattrepl: chouser: sounds like something worth fixing, maybe a compiler warning for nested defs?

10:27 chouser: just added it to my lint tool todo list

10:32 mattrepl: is it a conscious decision to put items like that in a lint tool instead of in the compiler? is there a plan to integrate a lint tool with the compiler?

10:33 chouser: I don't know.

10:33 Compiler errors are great, but warnings are a pain. We use a warning because we're not *sure* it's an error...

10:34 if we're not sure it's an error, that means someone might want to keep the warned code, which means they rightfully would want a way to turn it off

10:35 but you don't want a lib that turns it off to also turn it off in the lib-user's code, so how do you control the warning? at what granularity?

10:36 mattrepl: namespace?

10:36 chouser: if a flexible system is provided to let you turn on/off warnings per ns, file, function, etc. do we really want all that complexity bundled into the compiler?

10:37 perhaps if a lint tool can demonstrate sufficient value, simplicity, and flexibility, parts of it could be included in the compiler. or perhaps that would simply demonstrate it works fine standalone.

10:37 mattrepl: could be namespace metadata, the lint tool looks for it, and the compiler could optionally call lint

10:37 chouser: hm, that's an interesting idea

10:39 cemerick: rhickey: clean builds now, thank you :-)

10:39 I suppose I'll go eliminate the RT.load usages in any case.

10:41 I reserve the balance of my Java API griping time though. ;-)

10:41 chouser: heh, I like it. Senate rules.

10:48 AWizzArd: Is there a better way to produce all non-nil elements of a seq other than (take-while identity (iterate f coll)) or (take-while identity (repeatedly f))?

10:48 cemerick: chouser: same in the House. I'm cameralism-agnostic.

10:48 arohner: AWizzArd: (remove nil? seq)

10:48 * cemerick buckles down to test his patch for #322

10:49 AWizzArd: ,(last (take-while identity (iterate #(.getComponentType %) (class (make-array String 2 2 2 2)))))

10:49 $(last (take-while identity (iterate #(.getComponentType %) (class (make-array String 2 2 2 2)))))

10:49 sexpbot: java.lang.NoClassDefFoundError: clojure/core$iterate$fn__3752

10:50 AWizzArd: anyway, remove nil? is not the way, as this wouldn't produce the seq itself

10:50 chouser: I yield the remainder of my cameralism time to the gentleman from Massachusetts

10:50 cemerick: Man, one step towards a legislative process, and we're already getting less done!

10:50 AWizzArd: A version of iterate and/or repeatedly that stops when a specific result was found.

10:51 (repeat-until nil? f) and (iterate-until nil? f coll) so to say

10:52 chouser: $(take-while identity (iterate #(and % (.getComponentType %)) (class (make-array String 2 2 2 2))))

10:52 sexpbot: java.lang.NoClassDefFoundError: clojure/core$iterate$fn__3752

10:52 chouser: the bots are all broken?

10:52 AWizzArd: seems so

10:53 Not online or broken :p

10:53 The above code I pasted works in my Clojure.

10:55 Is there a Superclass for all Arrays?

10:55 chouser: Object

10:55 :-)

10:55 AWizzArd: Other than Obj...

10:57 How can one detect if a given Object is an Array?

10:58 (.isArray (make-array String 5))

10:58 k

10:58 chouser: really?

10:59 AWizzArd: yes

10:59 http://java.sun.com/javase/6/docs/api/java/lang/Class.html#isArray()

10:59 chouser: I get java.lang.IllegalArgumentException: No matching field found: isArray for class [B

10:59 AWizzArd: yes, I forgot to wrap it into (class ..)

10:59 chouser: ah

10:59 AWizzArd: retyped it here

11:00 * AWizzArd should make a note to himself: copy&paste is a good thing.

11:01 AWizzArd: (defn get-array-dims [a] (map count (take-while identity (iterate first (make-array Object 1 2 3 4 5)))))

11:01 array? and get-array-dimensions could be helpful in Core.

11:04 rhickey: wtf? google group redirect infinite loop came right back

11:39 Kjellski: What would you do if you want to iterate through a vector and at some particular element you want to start collecting until some other particular element?

11:40 mattrepl: drop-while then take-while?

11:42 Kjellski: mattrepl: hmm, how would that look like?

11:42 ,(doc take-while)

11:43 mattrepl: (take-while #("not the end element") (drop-while #("not the start element")))

11:44 Kjellski: mattrepl: thanks, I´ll try that...

11:44 mattrepl: tweak as necessary for inclusivity

11:45 hiredman: ping?

11:46 ping?

11:46 clojurebot: PONG!

11:47 rmarianski: Kjellski: split-with might do what you want also

11:48 Kjellski: rmarianski: thanks, I´ll try that too...

12:03 rmarianski: Following problem, that gives me only the first occurence and rest. But I need it like this: blocks from 1 to 1 [1 2 2 1 3 3 1 4 4] -> ([1 2 2] [1 3 3] [1 4 4])

12:06 rmarianski: Kjellski: afaik, you'll have to write something custom

12:07 dnolen: erg how can I produce a string that has double quotes without backquoting the double quote?

12:07 Chousuke: can you?

12:07 chouser: ,(char 34)

12:07 clojurebot: \"

12:08 Chousuke: that's probably not very convenient :P

12:08 chouser: no backquoting in the input! :-)

12:09 dnolen: there's no way to put double-quotes in a string literal without backquoting it.

12:09 dnolen: chouser: is there a simple way to replace them?

12:10 chouser: ,(.replace "I said 'Hello World!'" \' \")

12:10 clojurebot: "I said \"Hello World!\""

12:10 chouser: you mean like that?

12:14 dnolen: chouser: thx, I thought the presence of \" in the string was an issue, but now I see that it's probably something else.

12:17 Kjellski: How can I "unuse" a namespace?

12:20 Fossi: Kjellski: afaik you can't

12:21 chouser: remove-ns

12:21 Raynes: There is remove-ns.

12:21 o/

12:21 Kjellski: ty

12:21 * chouser spins his six-shooter and drops it back in the holster

12:21 Raynes: ;)

12:23 Joreji: Anyone can tell me why (. (identity String) newInstance "fred") is no longer working?

12:24 Kjellski: Hmmm... removed like this: (remove-ns 'clojure.contrib.str-utils) but this won´t work because when I try (use 'clojure.contrib.str-utils2) e.g. chomp is already bound... =(

12:27 chouser: Joreji: the newInstance method of Class doesn't take any args. Doubt it ever has.

12:28 Joreji: if you want to use reflection to call a constructor with arguments, try clojure.lang.Reflector/invokeConstructor

12:29 Joreji: chouser: I got that from: http://en.wikibooks.org/wiki/Learning_Clojure

12:29 All I want is to create an instance of a class which I store inside a symbol

12:30 chouser: ,(clojure.lang.Reflector/invokeConstructor String (to-array ["fred"]))

12:30 clojurebot: "fred"

12:30 Joreji: Ah, thanks!

12:30 chouser: it would be better to store a clojure function that does what you want, than just storing the symbol

12:31 ,(let [ctor #(String. %)] (ctor "fred"))

12:31 clojurebot: "fred"

12:31 chouser: simpler, more flexible, and much much faster

12:33 Joreji: chouser: Yeah, but I'd need to use a macro in order to get the #(String. %) fun work for other cases. This I'm trying to avoid. Fortunately I only use it sparsely, so it shouldn't be a problem.

12:38 chouser: ,((fn [p s] (->> [nil s] (iterate (fn [[_ [_ & xs]]] (split-with (complement p) xs))) (partition 2 1) (map (fn [[[_ [i]] [r]]] (cons i r))) (take-while first))) #{1} [1 2 2 1 3 3 1 4 4])

12:38 clojurebot: ((1 2 2) (1 3 3) (1 4 4))

12:38 chouser: Kjellski: that's for you

12:38 but I suppose there's a better way

12:39 oh. duh.

12:40 ,(map #(apply concat %) (partition 2 (partition-by #{1} [1 2 2 1 3 3 1 4 4])))

12:40 clojurebot: ((1 2 2) (1 3 3) (1 4 4))

12:40 chouser: sheesh

12:42 lpetit: Hello all, I've not been there for the past 24 hours. Are we close to the end of the prim et al. branch story ?

12:43 rhickey: lpetit: no

12:44 lpetit: ok !

12:45 rhickey: lpetit: people have given up on bigint contagion too easily, I haven't, and am working on it

12:46 * dnolen liked BigInt contagion

12:47 lpetit: rhickey: it's very exciting to assists / be part of the construction of such a great language !

12:48 rhickey: lpetit: not very glamorous from here :)

12:51 hoeck: rhickey: so you are working on a compromise?

12:53 rhickey: hoeck: more like what I first proposed, i.e. bigint contagion, while addressing some issues of that, but keeping the best of the other work (loop/recur, literals as primitives, etc)

12:53 bigint contagion would allow for polymorphic use of +, -, *, less need for auto-promoting prime versions

12:55 chouser: yay

12:55 hoeck: great

12:55 chouser: less need for prime versions seems like a huge win to me

12:56 Raynes: lpetit: Does counterclockwise work with Eclipse 3.5? I heard a guy saying it wasn't working earlier, so I'm curious.

12:56 rhickey: but a lot of work - a return to some sort of equiv based =, a new BigInt type, changes to key lookup in maps/sets

12:57 chouser: Are you punting on the new BigInt for now? Surely someone else could do that for you.

12:57 dnolen: wow, a better BigInt. no compromise.

12:58 rhickey: chouser: I'd love help on that, I could spec it easily. We need it because BigInteger and Long hashCodes differ for the same values, secondarily, for performance

12:59 chouser: I shouldn't volunteer for that, but I might anyway.

12:59 don't tell fogus I'm not working on the book.

13:00 fogus: don't tell chouser I'm not working on the book.

13:00 chouser: don't tell Manning we're not working on the book. :-/

13:01 rhickey: the interface would look a lot like BigInteger?

13:01 rhickey: the net result would be that heterogeneous keys would be supported for maps and sets, when used with the Clojure API would use equiv, from Java, adds an .equals test

13:02 cemerick: rhickey: doesn't kawa have a good set of bigs? At least a good start, perhaps...

13:02 rhickey: chouser: not at all, quite minimal BigInt/fromBiginteger /fromLong .toBigInteger, j.u.Number API, accessors for long and BigInt parts, then just implement the needed support for clojure.lang.Numbers

13:02 cemerick: eh, it's probably not license-compatible

13:03 rhickey: cemerick: no need for that whole impl, just punt to BigInteger, all this is is a shell wrapping long-or-BigInteger, enforcing the semantic that BigInteger is null if fits in long

13:03 It's quite a small thing

13:04 remember, Long et al don't provide arithmetics, just holders, this is like that

13:20 chouser: rhickey: you'd want BigInt on the prim branch?

13:25 rhickey: chouser: on new branch, equiv, not there yet...

13:26 chouser: ok

13:29 rhickey: chouser: there now

13:29 http://github.com/richhickey/clojure/tree/equiv

13:30 * chouser pulls

13:33 cemerick: Basically-working patch for #322 (making transitivity of AOT-compilation optional): http://github.com/cemerick/clojure/commit/6f14e0790c0d283a7e44056adf1bb3f36bb16e0e

13:34 rhickey, chouser: thoughts welcome

13:35 The only issue remaining is that the guard @ http://github.com/cemerick/clojure/commit/6f14e0790c0d283a7e44056adf1bb3f36bb16e0e#L1R5876 is necessary to avoid class gen by genclass and proxy, but putting it there makes protocol interface lookup fail at the moment.

13:39 hiredman: ,(docs resolve)

13:39 clojurebot: java.lang.Exception: Unable to resolve symbol: docs in this context

13:39 hiredman: ,(doc resolve)

13:39 clojurebot: "([sym]); same as (ns-resolve *ns* symbol)"

13:46 rhickey: chouser: you doing BigInt.java first? I need to twiddle with Numbers

13:49 bhenry: is there a built in exponents function? (something x y) -> x^y

13:49 chouser: rhickey: I was going to jump right into a .clj

13:49 deftype

13:50 rhickey: chouser: we'll have issue with that being available early enough

13:50 bootstrap

13:50 chouser: :-( boo. yeah.

13:50 rhickey: chouser: if that sours it for you, let me know, the map part is easier than I thought

13:51 chouser: poor timing to work on a multistage clojure self-compiler I suppose

13:51 rhickey: yeah

13:51 chouser: I can still take a swing at it.

13:53 mattrepl: bhenry: (Math/pow x y)

13:54 bhenry: mattrepl: thanks. i was just using (defn ** [x y] (apply * (repeat y x)))

13:55 ,(let [** #(apply * (repeat %2 %1))] (** 2 3))

13:55 clojurebot: 8

13:57 bhenry: ,(Math/pow 2 3)

13:57 clojurebot: 8.0

14:02 chouser: rhickey: .toLong throws on overflow? returns primitive?

14:06 rhickey: chouser: follow http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Number.html

14:08 chouser: so longValue instead of toLong

14:08 rhickey: chouser: right

14:15 chouser: hm, could probably use two classes and one interface to leverage method dispatch instead of having if(bigint == null) everywhere

14:22 iwillig: hi, i am trying to build a standalone jar with lein and i keep on getting the perplexing error

14:22 http://paste.pocoo.org/show/229013/

14:23 this is my main class

14:23 http://paste.pocoo.org/show/229025/

14:23 anyone have a few tips for a nb

14:24 cemerick: iwillig: the error is actually in geo.io

14:24 qbg: Don't do def outside of the toplevel

14:24 cemerick: iwillig: and, what qbg said :-)

14:24 KirinDave: cemerick: Yo dude. I am back.

14:25 iwillig: cemerick: how where you able to tell the error was in io ?

14:25 qbg: Probably from "at geo.io$read_features__101.doInvoke(io.clj:49)"

14:25 being the most recent call in your code

14:26 iwillig: thanks gusy

14:26 *guys

14:28 lpetit: Raynes: if you still here, then the answer is yes, 3.5 is its current primary target

14:31 cemerick: lpetit: it seemed to work with a 3.6 RC I tried last week *shrug*

14:42 lpetit: cemerick: thx for the info. I hoped it was.

14:42 must quit, cu

14:43 cemerick: lpetit: np -- I only used it for an afternoon, though, so don't take that as gospel :-)

15:04 fliebel: Is there anything in Clojure or Java to make servers other than HTTP? especially SMTP and POP3.

15:08 bartj: , (/ 22 7)

15:08 clojurebot: 22/7

15:08 bartj: , (/ 10 10)

15:08 clojurebot: 1

15:09 bartj: er, why is (/ 10 10) not a Ratio type?

15:10 chouser: reduces

15:10 ,(/ 4 2)

15:10 clojurebot: 2

15:10 chouser: ,(/ 2 4)

15:10 clojurebot: 1/2

15:11 bartj: it seems, like division with remainders are retained as Ratio type, right?

15:13 chouser: division with integers that does not result in a whole number results in a Ratio, yes.

15:16 bartj: chouser: thanks

15:29 lpetit: tcrayford created a project on github about clojure refactorings. I expect to add this kind of feature sooner or later (rather sooner than later !) to counterclockwise, but I'm not sure about the current impl. He apparently choosed to use the reader. So he's loosing information : how the metadata was entered (was it ^:key1 ^:key2 or {:key1 true :key2 true} ?), the comments, etc. . When the...

15:29 ...time permits to work on it for ccw, I guess I would first try to do as much as possible via static analysis with external source code parser, and maybe, in a second pass, try to 'plug' some info from a dynamic environment, if useful at all. Thoughts ?

15:39 bartj: , (contains? '("9" "8") "9") ; I was expecting a "true"

15:39 clojurebot: false

15:40 chouser: ,(contains? #{"9" "8"} "9")

15:40 clojurebot: true

15:40 fyuryu: bartj: contains? checks if a map contains a *key*

15:41 bartj: , (doc contains?)

15:41 clojurebot: "([coll key]); Returns true if key is present in the given collection, otherwise returns false. Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constant or logarithmic time; it will not perform a linear search for a value. See also 'some'."

15:41 cemerick: lpetit: entirely as an observer, I've seen a lot of editor plugins have a lot of trouble when they did anything other than use the language's real parser/reader/compiler/etc

15:41 bartj: fyuryu: the doc says it is a collection?

15:41 somnium: is it possible to generate and populate namespaces programmatically?

15:41 bartj: I assumed any seq would do...

15:42 fyuryu: bartj: well, I should be more precise, but still, it looks for a key

15:42 cemerick: lpetit: the ^:key1 vs {:key1 true} thing is really more of a formatting preference than anything, and you can default that to use the former if the metadata map is all keyword keys and boolean true values. There's probably more complicated scenarios.

15:43 fyuryu: bartj: since vectors are also maps (of their keys)

15:44 lpetit: cemerick: ccw uses its own hand-made parsetree with great success AFAIK :-p

15:44 fyuryu: ,(contains? [0 1] 1)

15:44 clojurebot: true

15:45 cemerick: lpetit: well, hopefully it pans out well :-)

15:46 bhenry: fyuryu be cautious that the 1 it's finding is the key of that vector and not the value 1

15:46 ,(contains? [0 2] 1)

15:46 clojurebot: true

15:46 lpetit: cemerick: maybe, but what about the comments. And what about spaces / current indentation of the source code ? Why should a refactoring command ruin someone's carefully hand-made formatting ? I think those are pretty strong arguments against using the current parser as is. But still, I'm unsure about the "mix" story, as in mixing dynamic and static information to try go deeper in the...

15:46 ...understanding of the semantics of the source code (e.g. where macros are used, that is almost ... everywhere !) ?

15:47 fyuryu: bhenry: yes, my example could be better.

15:47 bhenry: fyuryu my bad. i thought it was you having trouble, not answering the question.

15:48 fyuryu: ,(contains? [:a :b] 1)

15:48 clojurebot: true

15:48 lpetit: cemerick: but of course, if the current reader could be enhanced/instrumented to e.g. have a version which preserves everything in the source code

15:48 cemerick: lpetit: That's a fair point -- perhaps the next-gen reader should provide a more verbose output that includes everything tooling might need

15:48 heh

15:48 lpetit: cemerick: but wait, no, there may still be the problem of the reader macros, no ?

15:48 eh

15:49 ,(read-string "hello")

15:49 clojurebot: hello

15:49 lpetit: ,(read-string "hello there")

15:49 clojurebot: hello

15:49 lpetit: ,(read-string "(hello there)")

15:49 clojurebot: (hello there)

15:49 lpetit: ,(read-string "(hello #_there)")

15:49 clojurebot: (hello)

15:49 lpetit: cemerick: see, #_there was swallowed too :-(

15:50 * riddochc suffers through catching up on the last week of email on the clojure ml. Oy, the numbers.

15:50 lpetit: (quite normal)

15:50 cemerick: lpetit: Sure -- the current impl isn't suitable then. IIUC, the reader's due for a pure-clojure replacement -- at that point, I'm sure the powers that be will be receptive to changes to help out on the tooling front. *shrug*

15:50 lpetit: cemerick: oh, and last but not least: the reader will only help with strict-strict correct syntax. I'm pretty sure the need may occur to be able to work on "sufficiently correct syntax" where possible

15:51 bartj: fyuryu: there is no "1" in [:a :b], yet returns true?

15:51 lpetit: cemerick: yeah. Though maybe our timeframes may not overlap :-(

15:51 cemerick: lpetit: any ideas how the scala plugins do it (which do use scalac et al)?

15:51 lpetit: cemerick: to be continued. thx for sharing thoughts

15:51 cemerick: no idea

15:52 cemerick: heh, FWIW of course ;-)

15:52 raek: bartj: [:a :b] has the keys (in this case indices) 0 and 1

15:52 bhenry: bartj it's finding the key 1

15:52 ,(let [v [:a :b]] (v 1))

15:52 clojurebot: :b

15:52 lpetit: cemerick: of course :-p

15:52 (just kidding)

15:54 bartj: , (contains? [:a :b] :c)

15:54 clojurebot: false

15:55 Licenser: greetings my lispy friends

15:55 bartj: ok, first time seeing vectors being used as maps!

15:57 chouser: ,(map (vec "acgt") [2 1 3 1 2 1])

15:57 clojurebot: (\g \c \t \c \g \c)

15:57 chouser: ,(map (vec "acgt") [2 0 3 0 1 0])

15:57 clojurebot: (\g \a \t \a \c \a)

15:58 bartj: bhenry: in your example, (contains? [:a :b] 1) -- we first get the key b and then check for the existence of b in [:a :b] - right?

15:58 fliebel: chouser: Huh, what are you doing?

15:58 chouser: fliebel: I'm using a vector as a fn

15:58 rhickey: chouser: got anything?

15:58 chouser: rhickey: yeah, but I don't know java very well

15:59 it's hurting me

15:59 fliebel: chouser: So you create a vector of char symbols which get retrieved with map?

15:59 chouser: rhickey: give me another 5 minutes and I might have a useful starting place for you.

15:59 rhickey: ouch

15:59 chouser: ok, thanks

15:59 bhenry: bartj: you're confusing keywords with keys. and i should have said index instead of key. the 1 is an index in [:a :b]

16:00 so contains? is looking for a key. in a vector, its keys are its indices. [:a :b :c] will return true in contains? for 0 1 2

16:01 bartj: bhenry: thanks!

16:01 fliebel: Do Clojure or Java have a network library like Twisted?

16:02 dnolen: fliebel: Netty

16:02 there's the beginning of wrapper for it called saturnine on github

16:02 fliebel: dnolen: thanks, I'll look it up. I need to do some SMTP adn POP3 server stuff.

16:03 bartj: bhenry: what about a list?

16:03 chouser: rhickey: I haven't touched Numbers.java, but I have a BigInt.java. You want it in email?

16:03 bartj: , (contains? '(9 8) 1)

16:04 clojurebot: false

16:04 bhenry: bartj a list will always return false in contains?

16:04 rhickey: chouser: could you please email to dev list? Thanks!

16:06 bartj: bhenry: it seems to be that lists also have indices because things like this:

16:06 (first '(1 2))

16:06 , (first '( 1 2))

16:06 clojurebot: 1

16:06 bartj: *because of

16:07 bhenry: bartj, first doesn't find it by an index

16:07 neither do things like get.

16:07 you can

16:07 't do this

16:08 ,(let [my-list '(1 2 3)] (my-list 1))

16:08 clojurebot: java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn

16:08 bhenry: but you can do

16:08 ,(let [my-vec [1 2 3]] (my-vec 1))

16:08 clojurebot: 2

16:09 bartj: and this is because vectors are allocated in contiguous memory locations and lists are not - right?

16:10 bhenry: that's over my head, but i just read the joy of clojure and they specifically cover contains? on lists and vectors and other things like sets.

16:11 bartj: er, anyone here can confirm the above, plz?

16:11 hiredman: bartj: that is not true

16:11 vectors are not arrays

16:11 somnium: bartj its unrelated

16:12 rhickey: chouser: or just put in Files section of clojure-dev

16:12 bartj: hmm, then why does contains? work on vectors and not on lists?

16:12 hiredman: a list like '(1 2) is logically a head and a tail, there is no numbering

16:13 ,(doc contains?)

16:13 clojurebot: "([coll key]); Returns true if key is present in the given collection, otherwise returns false. Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constant or logarithmic time; it will not perform a linear search for a value. See also 'some'."

16:14 bartj: hiredman / bhenry: thank you for your patience, I get it...

16:15 chouser: rhickey: just sent.

16:15 rhickey: chouser: thanks!

16:15 chouser: I screwed up the overflow cases -- happy to fix it if you're rather not.

16:16 of course I likely screwed up other things too. Hope it saves you some time anyway.

16:17 rhickey: chouser: it will, thanks again

16:24 nathanmarz: does "reduce" use the stack as it goes through the seq? i'm getting a StackOverflowError while doing a reduce on a really long seq

16:28 bhenry: nathanmarz, is the code gistable (aka not proprietary)

16:31 nathanmarz: bhenry: http://gist.github.com/450501

16:31 it happens rarely

16:31 it might be happening in that map actually

16:36 qbg: nathanmarz: The code might be making lazy thunks too deep with map

16:37 Chousuke: that's most likely what's happening.

16:37 qbg: Try using doall around the map

16:38 Chousuke: I'm not quite sure what you're trying to do there

16:38 what kind of input do you have and what kind of output do you need?

16:38 lpetit: chouser: no reimplementation of equals/hashcode in BigInt ?

16:38 chouser: oh

16:38 I didn't get that far, did I. :-P

16:38 I'm just so slow at Java

16:38 lpetit: wasn't it the whole point of doing the exercise ? :-p

16:40 rhickey: lpetit: done already

16:40 lpetit: rhickey: ok then, so no need to give more feedback on the email ?

16:41 rhickey: lpetit: nope, that was just a starting point

16:41 lpetit: rhickey: ok, so just using clojure-dev as your private chouser/rhickey sandbox :-p

16:41 rhickey: lpetit: public, that's the point

16:42 lpetit: rhickey: ok, copyright et al.

16:48 Nanakhiel: mmarczyk, are you there?

16:48 mmarczyk: Nanakhiel: ?

16:48 Nanakhiel: http://codepad.org/Ej8SrXi1 do you agree with the design goals?

16:48 As you can hopefully infer, it is designed towards easy and efficient compilation

16:49 mmarczyk: um, why'd you ask me?

16:50 Nanakhiel: mmarczyk, because you are the fifth greatest programmer.

16:50 mmarczyk: changed your nick, I see?

16:50 Nanakhiel: Also, you solved my issue with tail calls, and I have your leg in my stomach.

16:50 mmarczyk: anything to do with a recent screenshot?

16:50 Nanakhiel: Ahh

16:50 Nahh

16:50 I have multiple

16:50 Islaam: Including this treasure I got before all others

16:50 Lajla: I have about 30 registered I think

16:51 mmarczyk: well, sorry, no time now

16:51 Lajla: mmarczyk, you can't go anywhere, you have but one leg.

16:52 Muahahahha

18:18 Licenser: optimizing clojure isn't actally funnny :(

18:35 dsop: is there a way at to start a compojure app using leinigen without building a jar?

18:37 lancepantz: dsop: you can do so from a repl, if that's what you're interested in

18:37 dsop: lancepantz: hm I was thinking more of a lein run target

18:38 lancepantz: yeah, just reopen you're namespace and call run-jetty in it

18:38 i guess you don't need to reopen it actually

18:39 *your :)

18:43 mmarczyk: dsop: there are at least two "lein run" plugins, one's available on Clojars -- leiningen-run "0.2" worked for me in a toy project -- and I remember reading about another one some time ago...

18:44 dsop: here's another one: http://github.com/sids/lein-run/

18:48 dsop: mmarczyk: thank you!

19:00 mmarczyk: np

19:05 kensanata: Yum, Practical Clojure arrived...

19:11 Licenser: benchmarks make me cry

19:12 http://gist.github.com/450704 is ugly code!

19:14 I give up for today good night people

19:31 alexyk: clj-json spends a long time rebuilding a map upon read. Is there a simple way to use jackson in stream mode, token by token, to rebuild a map very fast?

19:31 I guess avoiding reflection, in case I know what my map looks like.

19:34 arete: alexyk: you can use ObjectMapper and pass a Map type to readValue(Type)

19:34 but I don't know if it can handle clojure's Map types

19:34 alexyk: arete: what if I have nested maps? my idea is to read token by token

19:35 and construct my nested type as I go

19:35 arete: alexyk: it'll make a map of maps

19:35 jackson is fab =)

19:35 alexyk: arete: well I have 3 levels :)

19:36 arete: it has no depth limit

19:37 kiras: there doesn't seem to be a lot of information about using clojure for android programming yet. i found some links explaining how it can be done and this link http://groups.google.com/group/clojure/browse_thread/thread/213b7675a78755de/8195672b167d0ffd but is there a general consensus on whether it's a good idea at this point compared to just using java?

19:41 dsop: is there a good documentation of compojure 0.4, i searched but i didn't found any

19:43 nathanmarz: Chousuke qbg: you guys were right about that function, doall did the trick. thanks for the help

19:43 qbg: No problem

19:43 alexyk: how do you specify a main for leiningen's uberjar?

19:43 qbg: The :main option in project.clj

19:44 alexyk: meaning which clojure source to write?

19:44 mmarczyk: dsop: http://formpluslogic.blogspot.com/2010/04/migrating-from-compojure-032-to-040-and_01.html http://carpathia.blogspot.com/2010/05/yet-another-clojure-compojure-google.html http://compojureongae.posterous.com/ -- all "focused" articles, but you'll probably be able to gather some useful info from there

19:44 qbg: :main specifies the class to be used

19:44 I usually use a :gen-class'ed namespace

19:45 For a REPL, you would use :main clojure.main

19:45 alexyk: qbg: I have pure clojure, no gen-class...

19:45 I just want one defn to be main

19:46 mmarczyk: alexyk: use :main with a namespace name

19:46 alexyk: it'll call the function -main from there

19:46 alexyk: ok

19:47 qbg: I believe you still need to :gen-class that namespace

19:49 alexyk: lancepantz: is jiraph-0.1.3 on clojars fresh?

19:52 ninjudd: alexyk: it is, but i have some changes in my local repo that i'm planning to commit later this week

19:52 switching to protocols

19:53 and switching off ant

19:53 alexyk: ninjudd: coolio! finally a reason to learn them. Back to Clojure as OCaml now works and beats it 3x.

19:53 speedwise

19:53 but there's way

19:53 to catch up since

19:53 the current clojure is simple

19:54 (sorry return is in the way :)

19:55 ninjudd: hmm, are you using the jiraph walk code?

19:55 alexyk: ninjudd: I only use the .tc

19:56 ninjudd: ah

19:56 are you doing graph traversals? or just bulk read and write benchmarks

19:57 mmarczyk: qbg: alexyk: apparently no :gen-class is needed for :main

19:57 alexyk: mmarczyk: cool, thx

19:58 qbg: Interesting...

19:58 mmarczyk: qbg: I tried (ns foo.core) (defn -main [& args] (println "Foo!")) plus a project.clj with just :main foo.core in defproject, ran lein uberjar (with clojure and contrib jars in lib/) and java -jar foo-0.0.1-standalone.jar prints Foo!

19:59 qbg: Perhaps leiningen does some magic

19:59 alexyk: ninjudd: did you guys figure out how to use clojure-protobuf with lein?

19:59 mmarczyk: I do note that leiningen.core is :gen-classed

19:59 I wonder why

19:59 ninjudd: had some trouble getting it to work

20:00 alexyk: ninjudd: so do I have to manually do that beforehand?

20:03 technomancy: mmarczyk: the gen-class is to make the uberjar work

20:03 since http://www.assembla.com/spaces/clojure/tickets/315-add-support-for-running--main-namespace-from-clojure-main-without-aot still hasn't been applied =\

20:05 wait... you got java -jar to work without gen-class? iiiiinteresting.

20:05 mmarczyk: technomancy: right

20:06 technomancy: which is why I'm wondering if this issue might have been solved somehow without #315 noticing

20:07 technomancy: btw, would you like a patch for this? http://github.com/technomancy/leiningen/issues/#issue/55

20:07 technomancy: mmarczyk: yes! that'd be grande.

20:07 and also grand.

20:07 mmarczyk: :-)

20:08 :jar-name in defproject then?

20:08 technomancy: sure

20:08 mmarczyk: will be ready in a minute

20:09 lancepantz: mmarczyk: what about war and ubers?

20:09 mmarczyk: lancepantz: ah, good point about uber

20:09 lancepantz: i guess war would be in the plugin's logic

20:09 technomancy: mmarczyk: can't repro -main working without :gen-class here. perhaps you tried it with gen-class, removed the gen-class and tried again without cleaning?

20:09 mmarczyk: right

20:09 clojurebot: No, technomancy, you want gen-interface + proxy

20:09 mmarczyk: technomancy: hm... I thought I cleaned

20:09 let me check again

20:10 ah. well, apparently I hadn't -- sorry for the confusion

20:11 technomancy: got my hopes up. =)

20:11 well, #315 solves it pretty nicely... just no idea how long it'll take to get applied.

20:11 mmarczyk: only for them to be shattered again immediately... sorry ;-)

20:11 alexyk: :gen-class after all then...

20:12 yeah, your comment on HN is relevant here...

20:12 alexyk: clojurebot talks back. I must have been drinking

20:12 technomancy: clojurebot has an attitude.

20:13 alexyk: it'll get Obama summon it to White House and fire it if it keeps at it

20:15 "I have a deep respect and admiration for the clojurebot. It solved inane examples thrown at it by newbies for 2 years. It suffered hiredman's domestic abuse without crying. But Clojure is bigger than any bot."

20:24 mmarczyk: ah, turns out lein has the standard (uber)jar naming scheme hardcoded in a number of places... refactoring that now

20:40 technomancy|away: would you mind having "lein jar foo" create "foo.jar" (rather than the current "lein jar foo.jar")?

20:43 bhenry: mmarczyk: why not both instead of "rather than"

20:44 mmarczyk: bhenry: how do you mean? take notice of a trailing ".jar" in the name and throw it away?

20:44 bhenry: I mean, *not* throw it away, just not add another one

20:46 bhenry: something to catch it. i don't personally, but someone might have something made already to do this that they shouldn't have to change. it's not a big deal in this example, but i hate when things get broken from code changes.

20:46 mmarczyk: me too, so I suppose I won't break it after all :-)

20:49 although actually in this case

20:50 ...ah, never mind, I realised what I was going to say might be false actually :-P

20:51 bhenry: yeah. i wondered if people will read this later and be like "damn that bhenry, mmarczyk was going to make a change i've been hoping for since day one and he blew it."

20:51 mmarczyk: :-D

20:52 it'll be an scratch-a-word-from-two-lines-then-add-to-one change, not to worry ;-)

23:48 slyrus: anyone (here) working on computational biology projects in clojure?

23:51 Bahman: Hi all!

Logging service provided by n01se.net