#clojure log - Jan 29 2010

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

0:26 dakrone: having some classpath problems with clojure-couchdb, not sure the best way to get it loaded, into a REPL, trying to do this: http://pastie.org/799971

0:27 anyone know what I'm doing wrong?

5:19 Hali_303: when I do a for comprehension, the side effects of the body is not executed until the resulting list is used,right?

5:19 how to force execution of side effects?

5:20 esj: i think do-run

5:20 or do-walk

5:20 Hali_303: (I need to call a Java method for every element of a list)

5:20 esj: is what you're after - not ever used them

5:21 (doc dorun)

5:21 clojurebot: "([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. dorun can be used to force any effects. Walks through the successive nexts of the seq, does not retain the head and returns nil."

5:21 esj: dowalk holds onto the head

5:22 Chousuke: doall

5:22 not dowalk :)

5:22 Hali_303: if you're using for for side-effects, consider using doseq instead

5:23 Hali_303: thanks all, i'll try these

5:23 Chousuke: Hali_303: it supports for-like syntax but does not generate any lazy seqs

5:23 Hali_303: nice

5:23 Raynes: I hate when people ask questions in the form of a statement.

5:23 esj: do what Chousuke says, as I say, I've not actually used these

5:23 Raynes: "How to do this"

5:23 Hali_303: you mean you miss the question mark?

5:24 Chousuke: I sometimes simply forget the question mark :P

5:24 Raynes: No, it's the 'how to' part that's silly.

5:24 Like you're about to explain how to do what you mention. :p

5:24 When in reality you're asking how to do something.

5:25 And are you sure it isn't doseq he's looking for?

5:25 I'm not sure he needs to use for at all.

5:25 Chousuke: right. As I suggested :)

5:25 Raynes: Oh, I didn't see that.

5:25 :p

5:51 esj: the coffee on Friday is never strong enough

6:46 Raynes: LauJensen: I just read your Python vs Clojure comparison. Joyful read. I'm going to post it on dreamincode.net, so you might get a little attention in the comment section. ;)

6:46 At least, I'd like to post it there if it's alright with you.

6:46 (A link, not the text of course.)

6:49 LauJensen: Raynes: Rich Hickey prefers that we avoid direct comparisons, especially those with value judgements such as the ones I make in that post, so if you want to respect his oppinion its best to leave it alone - I'm personally a little torn on the issue, because 1) I dont want to step on anybody to promote Clojure, but 2) There are people who benefit from hearing others (in this case my) experience and the resulting conclusion

6:50 Raynes: Well, you see, there is a little problem here. I kind of accidentally hit the post button before you replied. :|

6:50 LauJensen: I'll add an explicit note about this situation.

6:51 LauJensen: Ok :)

6:55 I'm not sure how much it will hurt, but its important to distance Rich from those kinds of posts. What has happend with most of the comparisons is that a multitude of people write counter-blogposts showing of certain feats of their language which the feel weren't represented, and I encourage that

6:56 Raynes: LauJensen: That's exactly what I did. I posted what you said, minus the "respect his opinion" bit, because I don't want to look like an asshole.

6:56 LauJensen: hehe - got link ?

6:56 Raynes: http://www.dreamincode.net/forums/index.php?showtopic=152675

6:57 Of course, I added a bit myself, basically saying the same thing.

6:58 It's late, so nobody has read it yet. If you see anything in need of changing, I could do so.

6:58 LauJensen: Looks fine

6:59 My last post even got linked on climateaudit.org :)

6:59 Raynes: Hah. Nice.

6:59 spariev_: lol

6:59 LauJensen: yea :)

6:59 neotyk: LauJensen: nice way to promote :)

7:00 LauJensen: Yea - I got about 7300+ visits yesterday from people who were interesting in the weather report via Clojure :)

7:01 Raynes: Haha.

7:01 LauJensen: Its not _huge_ but I think its pretty good for a blog which targets such a narrow audience, lispniks on the jvm

7:01 Raynes: I don't believe my website has had that number of visits... Well, ever.

7:03 I has a 40% off code for Joy. :D

7:03 LauJensen: Wow you got a discount on a book that isn't written yet?! :)

7:03 esj: Raynes: good move. Tremendous book

7:03 rsynnott: "Whenever a human being exhales they emit CO2 so the Carbon Tax is in effect a tax on life." - no it isn't. *mutters*

7:03 LauJensen: I'm really looking forward to that book, but I wish they would pmap it and have it done by feburary

7:04 esj: (inc Lau)

7:04 Raynes: esj: I'll be purchasing the ebook version on the 1st.

7:04 LauJensen: rsynnott: Is there where I drop the ever powerful "yes it is" argument, or do you explain further?

7:04 rsynnott: heheh

7:04 Raynes: I never buy print non-fiction print books.

7:05 rsynnott: no-one is planning on taxing CO2 emissions from humans (as in, from human biological function). Anyway, not really on-topic

7:05 Interesting post, though

7:06 LauJensen: rsynnott: We hosted the Climate Conference here in Denmark recently, and I believe it was in that setting that the Chinese said that Climate changes could not be a separate issue from population control as every person emits CO2 - So the first talks about it have already begun

7:06 But I agree its OT - Thats why I don't jump into the political comments - I just wanted to roll a big data set

7:06 Raynes: #globalwarmingnonsensenobodyintheclojurechannelbutlaujensonandrsynnottreallycaresabout ;)

7:06 esj: Is it an anti-pattern to have a map containing functions that operate on other members of the map ? I have this feeling I have just created an object accidentally.

7:07 LauJensen: esj that sounds awful

7:07 esj: i agree

7:07 here's what I'm trying to do. I have a dataset, that lives in a sorted-set-by. I'd like to be able to specify verifier functions, so that when that sorted-set is conj'd to, it runs the verifiers for it

7:08 I feel maybe I should be passing them in to the conj'ing function, and closing over them

7:08 returning a conj-only-this-sort-of-data function

7:08 LauJensen: Are you conjing from multiple functions since you cant implement the validation alongside the conj?

7:09 esj: yeah

7:09 LauJensen: (->> input (filter conjoinable?) (map my-previously-nasty-fn)))

7:09 esj: this makes sense

7:10 so the idea is to keep the dataset a dataset, and wrap functions

7:10 i was horrified when I saw what I'd done.

7:11 thanks Lau

7:11 * Raynes tries to remember how to use his macro.

7:21 CalJunior: '(map [1 2 3] '(1))

7:21 ,(map [1 2 3] '(1))

7:21 clojurebot: (2)

7:21 CalJunior: how do I do this in reverse?

7:22 call the value and get the index(/indices)

7:26 mtd: if I (add-classpath ...) a java source directory will clojure be able to give me line numbers for java exceptions (thrown by said java classes, of course)?

7:48 djpowell: hmm i have some code that does stuff with a big hashmap with loads of litle struct like maps inside. it seems to use quite a bit less memory in clojure 1.1 than 1.0 - is that expected?

8:41 chouser: rhickey: I keep having to moderate your messages to the group.

8:41 seems so silly

8:42 rhickey: chouser: don't worry about mine - I'll flush them through after I've posted.

8:42 chouser: oh, ok.

8:43 rhickey: It looks like Google has fixed the impersonation problem, and I've unmoderated MB's account since I haven't seen any spam via his name in a while

8:43 chouser: ah, great.

8:43 rhickey: Nor mine, but I remain cautious

8:45 AWizzArd: When I want to dynamically create functions for which I want to type hint their parameters its done best with a macro and with-meta, yes?

8:46 or: i basically want to do: (defn foo [(with-meta 'x {:tag String})] x)

8:46 chouser: The way macros are usually used is not what I would call dynamic. Usually they're expanded at compile time.

8:47 AWizzArd: I just wrote a working macro for that, but it is using gensym and tags those.

8:47 ampleyfly: so, I'm trying to build clojure-contrib from source. all the pages I find talk about clojure-contrib.jar, but I get no such resulting file, are the pages outdated or is something wrong?

8:47 AWizzArd: chouser: well yes.. though as soon a jvm with clojure is running then compile time always happens during runtime.

8:47 jcromartie: AWizzArd: unless you AOT

8:48 AWizzArd: i thought aot also starts first Clojure

8:48 jcromartie: when you set out to do it, yes

8:48 chouser: yes, you can compile things at runtime and of course evaluate things at compile time, but that does not mean they are the same thing. The distinction is useful and practical.

8:49 hm.. though intertwined. perhaps I'm being pedantic.

8:49 AWizzArd: yes, I agree and don't want to suggest anything in this regard. I just wonder if (defn foo [#^String x] x) can be expressed by using with-meta

8:50 I agree to what you said before, and not that you are pedantic.

8:50 :)

8:51 I want to generate lists and (eval them) to produce functions that are used as comparators for sorted maps/sets and are type hinted.

8:51 chouser: That test, when read, produces roughly the same form as when evaluating `(defn foo [~(with-meta 'x {:tag 'String})] x)

8:51 AWizzArd: (compare) is nice too, but I suppose that compare needs to rely on reflection.

8:53 As I see it the reader is doing the necessary magic to tag x in (defn foo [#^String x] x)

8:53 chouser: yes

8:53 AWizzArd: And this can't be done by using with-meta without another eval

8:56 ok, then my macro is fine I think

8:56 it works, and I only wanted to make sure that I didn't miss a more elegant solution.

8:56 chouser: no

8:56 well, I'm not sure.

8:56 can you paste your code somewhere?

8:57 AWizzArd: Unfortunately not right now.

8:57 chouser: if you're building that form to pass to eval, you shouldn't need *another* eval

8:57 if you're building that form in a macro, you shouldn't need eval at all.

8:57 AWizzArd: I am not using eval. My strategy is different:

8:59 I gensym a symbol. I tag it to be a String (for example). This symbol I insert into (fn [here] ..)

9:00 And indeed, if I pass Object into my macro i get a reflection warning. If I pass in a String Clojure is silent, and my function parameters indeed have the type tags.

9:00 cemerick: cgrand: looks like I need to do (eval (compile-selector some-selector-binding)) in order to get the FSM for a bound selector value?

9:01 mikem: Does anyone know whether Rich Hickey's presentations (clojureforjava.pdf, clojureforlispers.pdf, etc) in the Google group files section (http://groups.google.com/group/clojure/files) are liberally licensed? ie: can I re-use the material for my presentation?

9:05 rhickey: so, I'm dreading pulling contrib (the version I have builds with ant just fine). What is going to happen to me?

9:05 chouser: rhickey: just make sure you have maven installed and a good fast internet connection

9:05 jcromartie: rhickey: Maven is going to pull down the entire internet as a dependency at every phase.

9:06 i.e. things like *clean* is a dependency that it has to download

9:06 but it works :)

9:06 chouser: rhickey: but Stuart S. fixed up the pom and the README so building it against your own clojure.jar should be no problem.

9:06 (once you have maven and it has fetched its copy of the internet)

9:07 AWizzArd: funny :)

9:07 rhickey: what's current maven?

9:07 cemerick: stick with 2.2.x

9:07 * rhickey has 2.2.0

9:07 chouser: I think readme just says you need 2-something

9:07 cemerick: 3.x is not fully baked yet

9:10 mikem: rhickey: your slides at http://groups.google.com/group/clojure/files don't say how they're licensed... would I be able to use some of the contents for my presentation to a local functional programming group?

9:11 rhickey: mikem: with acknowledgement, sure

9:11 mikem: rhickey: yep, of course with acknowledgment :) thank you

9:11 ampleyfly: do you get the clojure-contrib.jar-file when building with maven?

9:11 AWizzArd: When I have a sorted-set/map, is there then a way to access its comparator fn?

9:12 ,(meta (sorted-map-by compare))

9:12 clojurebot: nil

9:13 chouser: AWizzArd: (.comp the-map)

9:14 AWizzArd: is it correct that functions don't have metadata?

9:14 chouser: not anymore!

9:15 AWizzArd: So, I can add type hints to already existing functions?

9:17 oh, you mean metadata for functions was removed?

9:18 ,(meta (fn [a] a))

9:18 clojurebot: nil

9:18 chouser: no, you were right that previously you could not add metadata to an existing function

9:18 in the master branch, you now can.

9:19 AWizzArd: Yesterday I downloaded Clojure from http://build.clojure.org/ and that version does not give me metadata on fns yet.

9:19 chouser: however, the compiler does not appear to check the :tag of anonymous functions

9:19 AWizzArd: ,(meta (fn xyz [a] a))

9:19 clojurebot: nil

9:19 chouser: for me, (meta (fn [a] a)) returns e.g. {:line 36}

9:20 AWizzArd: yes, in my Clojure too

9:20 chouser: well, that's metadata on a function.

9:20 AWizzArd: yes

9:21 so, functions that were defn'ed will give me access to the arglists metadata

9:21 rhickey: is it better to not make metadata of anonymous functions available?

9:21 as in :arglists

9:22 mikem: I'm getting a "failed to validate POM for project" when trying to build clojure-contrib (latest git)

9:22 rhickey: AWizzArd: what is the question?

9:22 mikem: I'm building against a local clojure.jar as specified in README.txt

9:22 any ideas?

9:23 Ah, here's a more descriptive error: "For dependency Dependency {groupId=org.clojure, artifactId=clojure, version=1.2.0-master-SNAPSHOT, type=jar}: system-scoped dependency must specify an absolute path systemPath."

9:23 AWizzArd: rhickey: is there a way to do add type hints to the args of an anonymous function?

9:24 mikem: ok, passing the absolute path to clojure.jar (not one starting with ~) works

9:24 chouser: AWizzArd: such a thing would do you no good without recompiling the function anyway.

9:25 AWizzArd: ok

9:25 and is there a way to get the arglists of an anon fn?

9:26 rhickey: AWizzArd: you can add metadata to an anonymous fn like this:

9:26 user=> (meta #^{:my :meta} (fn [x] x))

9:26 {:line 2, :my :meta}

9:26 chouser: mikem: thanks! I needed to do that too.

9:26 AWizzArd: this works for me

9:26 ampleyfly: mikem: do you also get a lot of errors after "Testing clojure.contrib.test-contrib.test-jmx"?

9:27 rhickey: but using fn metadata as a reflection thing is a bad path. If we really want fn reflection then fns should directly support it. :arglists meta is for humans

9:28 AWizzArd: Yes, that makes sense. And it would indeed be a good idea to have reflection for fns.

9:28 mikem: ampleyfly: actually, I'm getting a ClassNotFoundException for clojure.contrib.pprint.ColumnWriter during the build

9:30 chouser: contrib is building and testing fine for me now

9:31 AWizzArd: chouser: is (= ::User (type user)) the most efficient way to check if user in a (deftype User)?

9:31 cemerick: mikem, chouser: a relative path will work fine, ~ is a shell expansion that java won't process

9:32 chouser: cemerick: a relative path did not work for me

9:32 cemerick: hrm....or, I think it will

9:32 nevermind then :-)

9:33 ampleyfly: I think the readme says relative paths don't work

9:34 mikem: cemerick: yep, didn't work for me either.

9:35 cemerick: I think I'm remembering maven 1 and the jar override options...

9:36 abrenk: ampleyfly: I just pulled and -contrib builds fine. What version of Java are you using?

9:38 ohpauleez: rhickey: I just found out you're coming to my city in April

9:38 if you need anything before or while you're here, totally let me know

9:38 rhickey: ok, thanks

9:39 ohpauleez: also, for all, the clojure talk I gave at Drexel yesterday went very well, they asked me to go over the scheduled time by an hour

9:40 rhickey: ohpauleez: cool

9:40 * rhickey trembles in fear of: http://groups.google.com/group/clojure/browse_frm/thread/182f171afc49473b#

9:41 chouser: ohpauleez: excellent

9:41 ampleyfly: abrenk: hrm, it seems I'm running java version "1.6.0_0"

9:41 OpenJDK Runtime Environment (IcedTea6 1.6.1) (6b16-1.6.1-3ubuntu1)

9:41 OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)

9:41 mikem: my clojure-contrib build is currently suffering from this error: http://paste.lisp.org/display/94078 -- seems it was reported earlier, but I can't find an answer in my logs

9:42 rhickey: first Clojure NYC meetup also a big success - 60+ people

9:42 chouser: wow

9:43 abrenk: ampleyfly: I was using "Java HotSpot(TM) Server VM (build 14.3-b01, mixed mode)" from Sun.

9:45 ampleyfly: I thought I was runnig suns vm too

9:46 well, changed it with update-alternatives --config java, no errors this time around, I still don't get a clojure-contrib.jar, but a clojure-contrib-1.2.0-SNAPSHOT.jar, is that fine?

9:53 rhickey: did the contrib tests get folded together? - there used to be 2 phases of contrib tests

9:54 chouser: I didn't know there were 2 phases

9:56 rhickey: chouser: just by running ant test you got two sets of tests and results

9:56 now, since mvn package runs tests and mvn test builds, what's the difference?

9:58 chouser: log says "Remove test-contrib, "mvn clojure:test" is equivalent"

9:59 rhickey: what does this mean? [WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!

9:59 does mvn have a command line switch to show me the available targets?

10:00 AWizzArd: rhickey: what in the thread to which you linked scares you?

10:01 rhickey: just about all of it

10:01 clojurebot: slime-install is an automated elisp install script at http://github.com/technomancy/emacs-starter-kit/blob/2b7678e9a331d243bf32cd8b591f826739dad2d9/starter-kit-lisp.el#-72

10:01 chouser: rhickey: looking at the old build.xml file, "test" appears to do test_contrib and test_datalog. "mvn ... package" reports testing datalog as well as the other namespaces, so I would assume that's sufficient.

10:09 esj: is it intended that (empty coll) where coll is a sorted-set-by destroys the comparator ?

10:10 '(conj (sorted-set-by #(> %1 %2)) 1 4 2)

10:10 ,(conj (sorted-set-by #(> %1 %2)) 1 4 2)

10:10 clojurebot: #{4 2 1}

10:10 esj: but

10:10 ,(conj (empty (conj (sorted-set-by #(> %1 %2)) 1 4 2)) 1 4 2)

10:10 clojurebot: #{1 2 4}

10:11 chouser: Did we regress? http://www.assembla.com/spaces/clojure/tickets/128

10:13 esj: seems to work here. what version of clojure are you using?

10:13 esj: {:interim true, :major 1, :minor 1, :incremental 0, :qualifier "master"}

10:13 and clojurebot agrees with me.

10:13 _fogus_: ,(for [x (range 1 11)] (/ 2520 x))

10:13 clojurebot: (2520 1260 840 630 504 420 360 315 280 252)

10:14 _fogus_: When did freenode start requiring nick registration?

10:15 chouser: _fogus_: a week or so ago I think. spam issue apparently.

10:15 _fogus_: I must have missed that memo

10:16 Today was the first day that it blocked me... I was chatting away at people here and no one would respond to me. :-(

10:16 Chousuke: I think it's a channel mode?

10:16 chouser: _fogus_: your request for memos had the old cover sheet

10:18 _fogus_: chouser: I guess I'll have attend the corresponding training

10:20 chouser: _fogus_: I signed you up for that. You're welcome. Be sure to come in by 8am on Sunday.

10:21 * rhickey can't see the connection between contents of contrib's pom file and the mvn targets

10:21 chouser: I can't remember how to figure out if a particular commit is in the history of a particular tag

10:26 * _fogus_ hates the term "Blub"

10:33 jcromartie: _fogus_: where did blub come up?

10:33 fmu: i think Blub is due to pg

10:34 jcromartie: yes it is

10:34 _fogus_: Apparently Clojure is Blub now. http://lambdassociates.org/blog/klambda.htm sigh

10:34 somnium: Blub is underrated -- it can get the job done and its not weird.

10:34 Raynes: I really need some food.

10:35 Oops, this isn't Twitter!

10:35 ;)

10:35 _fogus_: Blub has become "whatever *I* don't like"

10:35 * _fogus_ thinks it might have always been that

10:36 jcromartie: _fogus_: When Clojure, Python and CL are Blub, you know the author is totally out of touch.

10:36 chouser: esj: well, I'm stumped. I can't reproduce your error with master or 1.1.0. git claims the fix is in 1.1.0.

10:37 esj: bizarre ! But I'm hallucinating right, because CB gave me the same answer ?

10:38 chouser: esj: yes, and though clojurebot claims to be running 1.1.0 snapshot, I'm never to confident.

10:38 esj: did you build your own clojure.jar?

10:38 esj: yeah

10:38 i'll repull and see what comes out

10:38 thanks for looking at this for me chouser

10:40 Raynes: Anybody interested in a Wave invite?

10:41 the-kenny: Raynes: I can offer some of these too

10:41 Raynes: I have plenty go around.

10:42 Like, 23.

10:43 the-kenny: I have 19 here

10:45 Raynes: the-kenny: Heh. A couple of months ago, everybody in the channel would have been screaming "ME!!!!"

10:46 the-kenny: Raynes: Just write it on Twitter :p There are plenty people

10:46 Raynes: Yeah. I don't like the people on twitter though. :|

10:51 esj: who stole clojars.org ?

10:51 jcromartie: so I am building this web app in Clojure, using Compojure to serve up JSON

10:51 and I have got my data all relational-like

10:52 I am using sets to store records, and each record is a map

10:52 I can index the sets using watches

10:52 it seems pretty good

10:52 much faster than a database

10:53 esj: well, until you have I/O....

10:53 jcromartie: I'm wondering what other people do to model their data when building an application

10:53 esj: what do you mean?

10:53 esj: well, its the syncing stuff to disk that's soaks up performance

10:54 jcromartie: I got a pretty good solution going yesterday

10:54 not sure how it's going to scale

10:54 but it's pretty agnostic at this point... I should be able to move it to a DB if necessary

10:54 or whatever solution

10:54 but it's fun to build it in the first place :P

10:55 esj: cool

10:55 Raynes: Heh.

10:56 the-kenny: Tweeted it, explicitly stating that the invitations were only for my followers, and exactly 3 minutes later some random guy replies: "@IORayne yes,I need it,thank u.(jinrilidong@gmail.com)"

10:56 * Raynes chucles.

10:56 Raynes: chuckles*

10:56 the-kenny: Raynes: That's exactly what I experiences

10:56 experienced

10:58 alexyk: chouser: will Ctrl-C with break-thread and no ongoing computation kill repl itself?

10:59 ah, it just says SIGINT

10:59 i.e. "not so fast"

10:59 esj: chouser: OK. Turns out I was lying to you, sorry. In my git pulled clojure it seems to work. In that which I pulled from clojars using leiningen it does not. I'm using the clojure jar documented on the leiningen webpage, [org.clojure/clojure "1.1.0-alpha-SNAPSHOT"] . I'll see if there are alternatives, but clojars is being a little slow right now. Thanks for the pointers.

11:00 chouser: alexyk: yeah, it gets a little wonkey

11:00 esj: both report identical *clojure-version* however

11:01 chouser: alexyk: if you hit Ctrl-C while sitting at the prompt, sometimes your next operation will fail. though not always. :-/

11:01 oh, wait.

11:02 1.1.0-alpha-SNAPSHOT means *before* 1.1.0, so all bets are off

11:02 esj: aha !

11:03 chouser: as does 1.1.0-master -- alpha's actually probably older

11:03 esj: is there anywhere that I read this naming convention to get clued up ?

11:04 chouser: you need "1.1.0" or "1.2.0-master..." to be sure of having that fix

11:05 esj: yeah, I've just changed to 1.1.0 and its 100%

11:05 chouser: maybe we should change the convention. use "1.1.0" and then "1.1.0-postrelease-SNAPSHOT" or something.

11:05 eh. maybe not.

11:05 esj: great!

11:05 esj: another myster solved.

11:06 serves me right for copy-pasting the project.clj on the webpage :)

11:08 * chouser wonders if PG is now envious of the attention Clojure gets. http://tinyurl.com/yaxswhp

11:09 cemerick: rhickey: not sure if someone else addressed it, but the "Using platform encoding" means that a resource and source file encoding isn't set in the pom.

11:09 stuartsierra: should add <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> to <properties>

11:11 rhickey: also, maven doesn't have targets, hit has phases that build plugins can attach themselves to: http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html

11:12 chouser: do you have greatest hits in the logs bookmarked?

11:12 chouser: I do not

11:12 cemerick: that'd be an interesting wiki project

11:12 chouser: hm, it would.

11:12 cemerick: "The Clojure Archeology Project"

11:18 stuartsierra: cemerick: ok, pushed

11:20 arohner: is github's code output broken for anyone else? I get a big string of A's where code should be

11:20 zakwilson: I'm a bit confused about why I'd use atoms. It appears that everything I'd want to do with an atom could also be done with an agent without any changes in semantics. Are they smaller/faster?

11:21 arohner: ah, it's just chrome. FF is fine

11:22 cemerick: _fogus_: Being labelled as blub by Qi folk is not a horrible thing :-)

11:23 arohner: zakwilson: the semantics are different. agents are async; stuff happens in another thread "later". atoms are synchronous

11:23 chouser: zakwilson: 'swap!' on an atom doesn't return until it's successful. 'send' and 'send-off' to an agent queue the work and return immediately, likely before that work has been done

11:23 zakwilson: chouser: that's what I wanted to know.

11:24 I somehow missed that swap! blocks.

11:40 arohner: one weird thing about defprotocol maps: it's easy to do things that require your protocol, and it's easy to accidentally turn your deftype into a regular map

11:41 as in (my-protocol-fn obj)

11:41 and then (merge {:a 1} (obj))

11:41 the return value of merge is a normal map, and now you can't call protocol functions on it

11:45 esj: chouser: here it is. After I figured it out from the repl.sh I saw it in the docs. lein repl uses the version of clojure in the leiningen.jar, not that spec'd in your project.clj.

11:46 Raynes: esj: Yeah, that bit me in the ass a few days ago.

11:46 * esj must learn to rtfm

11:48 alexyk: is there a way to tell the repl to do some massive GC action?

11:49 chouser: (System/gc)

11:49 dunno if it's massive, and that's the extent of my knowledge. :-)

11:49 arohner: that isn't guaranteed, I believe

11:49 it's a "hint"

11:49 alexyk: ok

11:49 chouser: I don't think the gc guarantees much of anything.

11:50 alexyk: IDEA has this little trash bicket and when you click it, it does work every time

11:50 bucket

11:50 rsynnott: alexyk: in all JVMs? :)

11:50 Raynes: alexyk: You've invented a new word!

11:50 I has a trash bicket!

11:50 * rsynnott doesn't think a JVM has to take notice of commands to do GC _at all_, if it doesn't want to

11:54 chouser: rhickey's java indentation style is infecting my C++ code

11:54 * chouser disinfects

11:56 arohner: is there a reason why (empty) can't work on deftype maps?

11:57 I see its source currently throws UnsupportedOperationException. Is that because it's the smart thing to do, or just hasn't been done yet?

11:58 hiredman: arohner: deftypes aren't maps

11:59 arohner: hiredman: thank you for correcting that. From now on I'll refer to "deftypes that implement IPersistentMap"

11:59 hiredman: arohner: :P

12:00 Raynes: My deftype implements IPersistentMap because dissoc is cool. :D

12:02 chouser: trying to implement only 'empty' of IPersistentMap makes it mad

12:05 rhickey: arohner: does your cool deftype have fields?

12:05 arohner: rhickey: yes

12:05 rhickey: then how could it be empty?

12:05 hiredman: ,(empty (struct (create-struct :foo :bar) 1 2))

12:05 arohner: rhickey: fair enough

12:05 clojurebot: {:foo nil, :bar nil}

12:06 arohner: what I really want is for:

12:06 (my-protocol-fn (merge {:foo true} my-deftype))

12:06 but merge returns a normal map, rather than my deftype

12:07 so I was thinking (merge (empty my-deftype) {:foo true} my-deftype))

12:07 hiredman: why not switch the order?

12:07 rhickey: why not just (merge my-deftype {:foo true})?

12:08 chouser: presumably he wants nil for non-:foo fields

12:08 arohner: oh right, merge doesn't do what I want here

12:08 chouser: yes, that's the standard idiom I use. I forgot my deftype has {:foo nil}

12:09 I want to set :foo to true if it is nil

12:12 tmountain: would it be possible to rewrite this function to use recur? http://gist.github.com/289897

12:15 mabes: From what I can tell from the source of clojure.contrib.duck-streams/read-lines if an exception is thrown while reading a line the file reader is never closed.. Is that correct? http://github.com/richhickey/clojure-contrib/blob/2ae8ff46d348522efe9f96cfd31f6e9b6018cfdc/src/clojure/contrib/duck_streams.clj#L234

12:16 i.e. there is no try/finally form wrapping it

12:17 chouser: mabes: I think you're right, though you could still close the reader you passed in yourself.

12:18 mabes: chouser: I suppose that is why the doc string is very explicit about the reader only being closed when the wntire seq is consumed. I was just wondering if with-open could be used in this context or not..

12:20 chouser: with-open should be used instead of ever relying on read-lines to close the stream, IMO.

12:20 closing an already-closed thing generally does no harm

12:22 mabes: but read-lines only takes a filename, not a reader.. so I don't see how you could use them in conjunction

12:22 chouser: oh!

12:22 you're right. don't use read-lines.

12:23 mabes: heh, ok

12:23 chouser: you can use duck-streams/reader and with-open, and then line-seq

12:23 mabes: well, I'm writing my own csv-lines that wraps SuperCSV so I was modeling it after read-lines when I ran into the question of exceptions. I'll probably have my csv-lines take a reader to avoid a similar problem

12:24 chouser: (with-open [rdr (ds/reader "foo.txt")] (vec (map ... (line-seq rdr))))

12:25 mabes: ahh, I didn't know about line-seq.. I was only looking in duck-streams. Thanks for the tip

12:35 _schulte_: any recommendations for how to add a :timeout option to the shell-out sh method?

12:35 I've been playing around with the java example from http://stackoverflow.com/questions/808276/how-to-add-a-timeout-value-when-using-javas-runtime-exec but without much success

12:38 hiredman: ~def shell-out

12:38 clojurebot: Excuse me?

12:38 hiredman: clojurebot: do it!

12:38 clojurebot: defmulti doc is ugly

12:39 _schulte_: def clojure.contrib.shell-out

12:40 nvrmind, just found a nice solution here http://stackoverflow.com/questions/1683680/clojure-with-timeout-macro

12:42 cgrand: cemerick: ping

12:52 mtd: can clojure tell me from which location a java class has been loaded?

12:54 the-kenny: mtd: Can java tell you that?

12:54 If so, clojure can that too :)

12:56 cemerick: cgrand: hola :-)

12:57 mtd: you can use .getResource using the classfile location (e.g. "com/foo/bar/ClassName.class") to get a URL

12:57 on your classloader or a Class instance, that is

13:00 the-kenny: Is it possible to use the same code to access things in resources/ while I'm at a repl? (Interactive, without creating a .jar first)

13:00 mtd: cemerick: thanks - what am I doing wrong with (. (java.lang.ClassLoader/getSystemClassLoader) getResource "/java/lang/ClassLoader.class")

13:00 the-kenny: Oh and.. can someone give me some code snippets? :)

13:00 mtd: (it evaluates to nil)

13:00 cemerick: the-kenny: if resources/ is a classpath root, sure

13:00 mtd: drop the leading /

13:01 the-kenny: cemerick: I think lein adds it to the classpath

13:01 cemerick: I know nothing about lein, sorry.

13:01 mtd: cemerick: thanks (doh)

13:01 arohner: hrm, merge-with doesn't work with deftype maps

13:04 cgrand: cemerick: so what are you trying to do with those dynamic selectors?

13:04 the-kenny: Uhm.. I can't find resources/ in the classpath or any other property.. what does leiningen do with it?

13:07 cemerick: cgrand: I've been slowly glomming up a "merge-page" transformer that does the right things when composing two separate full-document snippets (e.g. rooted at <html>), and want to be able to specify where body content should be pulled from. It looks like I need to (eval (compile-selector ...)) in order to take selector values as args.

13:07 arohner: replacing (m k) with (get m k) in merge-with fixes it. should I open a bug?

13:07 cemerick: Eh, that doesn't make a lot of sense. Pasting shortly...

13:07 somnium: the-kenny: do you have a ./resources dir in project root?

13:07 the-kenny: somnium: Of course

13:07 somnium: But wait.. it doesn't has to do with leiningen.

13:07 somnium: the-kenny: hmm, using lein-swank?

13:07 the-kenny: I forgot that I use swank-clojure-project, not leiningen

13:07 somnium: I added a line to swank-clojure-project to add it

13:07 ah ok

13:08 the-kenny: somnium: Can you gist it for me?

13:08 somnium: sure

13:08 cemerick: lisppaste8: url?

13:08 that bot's been dead for days

13:08 cgrand: http://paste.lisp.org/display/94101

13:09 cgrand: I msg'd you just to see if there was a better route I was missing.

13:10 mtd: Is there a recommended log4j version to use with clojure.contrib.logging? It doesn't work with 1.2.8 (old, probably): http://gist.github.com/289942

13:10 cemerick: mtd: 1.2.14 worked for me, last time I bothered with log4j

13:10 mtd: cemerick: thanks. Yeah, not my choice to use it unfort :(.

13:11 somnium: the-kenny: http://gist.github.com/289943

13:11 the-kenny: somnium: Awesome, thanks

13:14 ahhh my snippet works now.. never thought about issues with swank-clojure-project

13:15 cgrand: cemerick: the question is how did you fill body-selector?

13:16 cemerick: cgrand: fill?

13:16 cgrand: how do you set the value for the :body-selector key?

13:17 why, at runtime, have you a literal selector?

13:17 cemerick: (merge-html other-snippet {:body-selector [:#someid]})

13:17 hrm

13:18 cgrand: (merge-html other-snippet (selector {:body-selector [:#someid]})) and remove the compile-selector+eval

13:19 or make merge-html a macro that expands to `(merge-html* ... (selector ~selector-spec))

13:20 somnium: the-kenny: do you have SBCL working with slime and clojure?

13:20 the-kenny: somnium: I had it working once.. But I never used it since I started with clojure

13:21 cgrand: cemerick: sorry pasted too fast: (merge-html other-snippet {:body-selector (selector [:#someid])})

13:21 the-kenny: You have to install the swank-backend by hand if you use slime from elpa

13:21 cemerick: cgrand: oh, sure, I saw that -- didn't think it was too friendly to have to have selector calls everywhere

13:21 that's when I landed on the eval

13:22 Making merge-html (or any transformer, really?) a macro seems like overkill.

13:23 cgrand: but is you selector written by the user or emitted by another function?

13:24 somnium: the-kenny: ah, ok. Im hesitant to screw with .emacs for something Ill rarely use. Hoping for a Clojure/CL/Slime success story

13:24 the-kenny: somnium: Shouldn't be very hard. I can gist two utility-functions to start sbcl and clojure without a prefix argument to M-x slime

13:24 cemerick: cgrand: could be either. I can easily imagine one wanting to have it as an attribute in the source html snippet.

13:25 the-kenny: Normally you would have to do C-u <something> M-x slime RET to get a list of possible backends for slime to start

13:25 somnium: the-kenny: great. Scheme (about 3 versions now) work with quack -- the more lips the merrier

13:25 s/lips/lisps

13:25 cgrand: the whole selector or a part of it? a selector can have dynamic parts?

13:26 the-kenny: somnium: Pushed your fix to my fork of swank-clojure :)

13:27 AWizzArd: Is there an ETA when build.clojure.org will be fixed again?

13:27 somnium: the-kenny: technomancy has really done wonders on the readability of swank-clojure.el

13:28 cemerick: cgrand: probably the whole thing. e.g. {:body-selector (-> other-snippet get-body :attrs :selector read-string)}

13:30 the-kenny: somnium: Yeah :)

13:31 cgrand: cemerick: so you are putting code back in the template, no?

13:32 cemerick: cgrand: I'm going to say that a vector isn't code. :-)

13:32 I'm not doing that right this moment, but I can imagine that being a reasonable thing to do.

13:38 cgrand: cemerick: I try to understand the whole picture from your paste. So, what you are trying is to have a kind of pipeline, generating an html page and then transforming it. That's right?

13:40 cemerick: cgrand: The fundamental objective is to have a way to compose a variety of pages together. In my case, right now, it's enough to have the pages merged in a reasonable way -- generally appending body content, appending or prepending head content. It's working pretty well so far, I just wanted to make sure I wasn't running afoul with the eval.

13:42 cgrand: cemerick: given your requirements you can't skip the eval.

13:43 cemerick: cgrand: OK. Should I take that to mean you think my requirements/approach are misguided? ;-)

13:49 cgrand: cemerick: No I wouldn't dare to say that but it doesn't fit with the Enlive Way™ :-)

13:51 cemerick: cgrand: huh -- I figured I was on the One True Path this whole time :-/

13:51 cgrand: as you decompose a problem in smaller functions, a page should be decomposed in smaller snippets (which themselves can be decomposed etc.)

13:52 cemerick: That's what I've done, but I guess I'm still groping around for an elegant way to reassemble the whole.

13:52 cgrand: I understand

13:53 I'm actually exploring two non-exclusive ways to ease this pain

13:54 cemerick: FWIW, I'm plenty giddy with how I've got things laid out now, so the heights of glee that I'll hit when you put out those blessed options are hard to imagine. :-)

13:54 cgrand: the first one is smart/auto/magic templates which don't require selectors

13:56 AWizzArd: I don't understand why you need to generate html at all cemerick :)

13:57 cemerick: AWizzArd: ?

13:57 AWizzArd: I mean, why not generate the html/gui on the client, all via Javascript?

13:57 Then your Clojure code will be html free.

13:57 cemerick: well, my clojure code *is* html-free

13:57 AWizzArd: Instead you offer a rest interface

13:58 cemerick: well, I do that too

13:58 AWizzArd: good

13:58 cemerick: but a js-generated interface doesn't let me work with a designer (as easily), and I particularly dislike javascript itself

13:58 AWizzArd: and GWT and/or Dojo don't help here?

13:59 Aah, you are not only the server side programmer but also responsible for the client side?

13:59 cemerick: GWT requires coding in Java, which I like only somewhat more than js

14:00 and yup, I've got my hands in all the cookie jars

14:00 chouser: js is much less painful than java, imo

14:00 which is why gwt has confused me from the beginning

14:00 cemerick: I know Java too well for that to be the case for me.

14:01 AWizzArd: chouser: then Dojo or some other framework could be more interesting

14:01 cgrand: I too prefer js to java

14:01 cemerick: chouser: and don't get me started. ;-) I blew an hour yesterday figuring out how 'this' works in js, which it turns out I've not understood for years.

14:01 AWizzArd: but GWT offers you to step with a mature debugger through your JS program

14:02 chouser: cemerick: have you read or seen anything by Douglas Crockford?

14:02 AWizzArd: So, why do webbrowsers ship JS at all? They should natively run Clojure and our problems would be gone.

14:02 chouser: cemerick: http://www.youtube.com/watch?v=hQVTIJBZook

14:02 cemerick: chouser: the's the "good parts" guy, right?

14:03 chouser: but it's all moot. We'll compile clojure to js and all be happy.

14:03 AWizzArd: chouser: funny, recently i mailed with him

14:03 chouser: cemerick: yes

14:03 cgrand: cemerick: and the second way I'm exploring is to glue html fragments together with ring/compojure middlewares

14:03 * cgrand off to dinner

14:04 cemerick: cgrand: both sound intriguing

14:05 chouser: a clojure GWT is a likely maxima -- actually running clojure in the browser will be nifty, but the size of the resulting lib will be quite massive.

14:06 chouser: nope

14:06 < 5KB

14:06 (gzipped)

14:07 cemerick: heh

14:07 AWizzArd: hmm?

14:07 What do you mean?

14:07 cemerick: chouser: lobby mozilla and apple *now*, and go all the way to 0

14:07 chouser: still too much for "mostly static" pages, but not at all bad for an "app"

14:07 cemerick: heh.

14:08 AWizzArd: I mean full clojure runtime support for javascript should be able to fit into a clojure.js.gz file of less than 5 kilobytes

14:08 AWizzArd: Do you talk about a Firefox plugin, or a clojure interpreter written in JS or just using an applet?

14:08 chouser: that may not include contrib or a compiler

14:09 cemerick: chouser: are you serious?

14:09 chouser: yes

14:09 cemerick: ballsy

14:09 call, that is

14:09 chouser: heh. not really -- I already did it once.

14:09 AWizzArd: I am still a bit sceptical. Do you want to use an underlying infrastructure?

14:09 cemerick: chouser: I seem to remember clojurescript's repl being in the 300K area

14:09 chouser: oh

14:09 really?

14:09 stuartsierra: So the multiple profiles in the contrib POM breaks the Hudson build.

14:10 chouser: maybe I should check my numbers. :-)

14:10 uh

14:10 AWizzArd: stuartsierra: oh good, you found the place of the problem

14:10 cemerick: stuartsierra: how?

14:11 stuartsierra: Breaks dependencies somehow.

14:11 technomancy: are we going to get to the point where we only AOT the stuff that actually needs it in contrib?

14:11 cemerick: stuartsierra: can you paste a stack?

14:12 technomancy: I guess I should wait on that question until it's stable. =)

14:12 chouser: yep, sorry, mis-remembering. I should be careful about that. 25KB gzipped

14:12 cemerick: huh, I thought it was decidedly > 100

14:12 somnium: chouser: is that with a compressor?

14:13 chouser: 130KB ungzipped

14:13 cemerick: ah, that was probably it

14:13 chouser: somnium: yes. YUI compressor, gzipped, without sorted collections or a compiler, 22KB

14:13 stuartsierra: technomancy: The maven plugin makes that pretty easy.

14:14 maybe we should do that

14:15 technomancy: stuartsierra: it's certainly caused a lot of confusion in the past

14:15 cemerick: stuartsierra: FWIW, changing the activation of the local profile to <activation><property><name>clojure.jar</name></property></activation> is probably worthwhile

14:15 technomancy: stuartsierra: talking with replaca_ it sounds like at least the pprint stuff could be moved over to reify w/o AOT

14:16 I think that would leave us with only a single gen-class requiring AOT, and that one might be able to be ported as well

14:16 chouser: I would *love* to see pprint without AOT. It was the only reason I started building contrib in the first place.

14:21 hiredman: :pre and :post are part of metadata?

14:22 chouser: metadata is how they're communicated to the compiler

14:22 hiredman: ok

14:23 I see examples of :pre and :post like (defn f [x] {:pre [(> x 1)]} ...)

14:23 somnium: ,(macroexpand-1 '(fn [x] {:pre [ (= x 42)]} 42 ))

14:23 clojurebot: (fn* ([x] (clojure.core/assert (= x 42)) 42))

14:24 hiredman: I thought metadata went before the arg list

14:24 is it a fn metadata vs var metadata thing?

14:26 Hali_303: how can I debug clojure code?

14:26 (I mean step by step, not evaluating something in the REPL)

14:26 ohpauleez: hiredman: maybe, but the order I use is doc string, args, pre/post

14:26 somnium: in the source for fn it appears they expand straight to assert clauses

14:26 chouser: hm, I take that back. metadata is one of the ways to communicate :pre and :post -- metadata on the arglist vector

14:27 hiredman: hmmm

14:27 I would rather just have one metadata map

14:27 chouser: and it's only communicating to the fn macro, which emits the assert code itself. compiler uninvolved

14:27 hiredman: anyway

14:34 pre and post are in master right now, yes?

14:34 chouser: yes. 1.1

14:35 you can have a separate :pre/:post pair for each fn body

14:35 hiredman: hmmm

14:35 AWizzArd: what is pre/post?

14:35 chouser: so one for in the metadata of the whole fn or var wouldn't really work

14:36 AWizzArd: http://blog.fogus.me/2009/12/21/clojures-pre-and-post/

14:36 AWizzArd: seems it has become a fulltime job to follow all changes in Clojure :)

14:37 cemerick: I'm hoping the 1.2 release will be something we can sit on for a while. It's a helluva treadmill. ;-)

14:38 chouser: you can just pretend the new features don't exists. *evil chuckle*

14:39 cemerick: I actually can't think of anything pressing for us that isn't on HEAD now.

14:39 oh, actually, serialization is broken for vectors (again), which I should submit a patch for

14:39 but that's nothing compared to reify, deftype, etc., which is huge for us

14:40 hiredman: http://gist.github.com/290030 the (numerator 1) throws java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.Ratio instead of the expected assert exception

14:43 chouser: I get AssertionError here

14:43 hiredman: grrr

14:43 hmmm

14:44 if I load the functions into a repl I get the assertion failed, but if I put them in core.clj and build a jar I get the class cast exception

14:45 chouser: perhaps it's getting built with *assert* false

14:45 hiredman: Oh

14:45 right

14:46 AWizzArd: with a :pre [(do (log-to disk) true)] it looks a bit like Common Lisps :before modifier

14:46 hiredman: :(

14:46 AWizzArd: please no

14:46 AWizzArd: what?

14:46 clojurebot: What is meta

14:47 AWizzArd: I mena, "no" to what?

14:47 chouser: AWizzArd: until you compile with *assert* off

14:48 AWizzArd: Well, I would not want to misuse the :pre/:post thing for such cases, as it would be trivial to write a function or macro to add "before and after effects" to functions

15:00 duncanm: is there a version of cond in clojure that supports =>, like Scheme's cond?

15:00 chouser: duncanm: did you look at condp ?

15:01 duncanm: i did, i'll look closer

15:01 chouser: I'm not sure what scheme's => does, so condp may not help.

15:01 duncanm: oh

15:02 chouser: in Scheme, you can write (cond (has-x?) => (lambda (x) ....))

15:02 if HAS-X? doesn't return #f, the 'x' in the lambda gets bound to the return value of HAS-X?

15:02 chouser: where does that lambda's argument value come from?

15:02 ah

15:02 duncanm: from the return value of the test

15:02 it's handy

15:03 AWizzArd: duncanm: the => is ignored and only for the readability?

15:03 chouser: (if-let [x (has-x?)] (dosomethingwith x) :fail)

15:03 duncanm: AWizzArd: well, the => is a hint to the COND macro to set up the binding in the lambda, right?

15:04 otherwise, it'll just return a lambda without evaluating it

15:04 Chousuke: doesn't condp have just that?

15:04 :>> or something

15:04 duncanm: ahhh

15:04 right

15:04 test-expr :>> result-fn

15:05 chouser: duncanm: but if you have just one test case, look at if-let or when-let

15:06 _schulte_: chouser: speaking of, why is there no while-let?

15:07 Chousuke: probably because while is not that often needed :/

15:08 _schulte_: fair enough, it was easy enough to implement anyways

15:12 chouser: I've not yet found a use for 'while'

15:13 _schulte_: I used to for reading from a pipe in a shell script, not sure if there's a more idiomatic approach to that

15:13 hiredman: damn

15:13 chouser: I've generally used 'repeatedly' in such places

15:13 hiredman: pardon me

15:14 * _schulte_ looks up repeatedly

15:14 hiredman: gah

15:14 I was just going to post the issue I created and gmail says the conversation is updated, and it's someone else with an issue and a patch

15:15 chouser: patch fight! may the best patch win!

15:15 LauJensen: Is the a variable I can use to (str "This file is called " special-var) ?

15:15 hiredman: clojurebot: ticket #255

15:15 clojurebot: {:url http://tinyurl.com/ydbmus8, :summary "add denominator and numerator fns for Ratio", :status :test, :priority :normal, :created-on "2010-01-29T20:08:36+00:00"}

15:15 chouser: *file*

15:15 hiredman: clojurebot: ticket #254

15:15 clojurebot: {:url http://tinyurl.com/ybk7bm9, :summary "Expose c.l.Ratio's accessors", :status :test, :priority :normal, :created-on "2010-01-29T20:05:24+00:00"}

15:16 kotarak: hiredman: I'm sorry...

15:16 hiredman: :(

15:16 kotarak: How can I mark my ticket as duplicate?

15:16 hiredman: I'll live, I guess

15:16 kotarak: I marked mine as

15:17 kotarak: ok. But how? I didn't see (an obvious) checkbox. (But I haven't looked very hard..)

15:17 hiredman: kotarak: the associate button

15:17 chouser: ooh, hiredman's has hinted return value

15:17 LauJensen: chouser: Any others?

15:17 hiredman: you can then pick which kind of association

15:17 chouser: LauJensen: how many do you need?

15:18 LauJensen: 1 that works

15:18 kotarak: Assemble is not intuitive. :(

15:18 LauJensen: chouser: Its probably a slime thing, I'll complain if it doesn't work when I deploy

15:19 chouser: hiredman's also has a test and correct docstring capitalization.

15:19 kotarak: hiredman: seems I should mark mine as duplicate: chouser

15:19 :

15:19 ooh, hiredman's has hinted return value

15:19 chouser: but kotarak's has a more meaning parameter name

15:19 meaningful

15:19 kotarak: 2:1 for hiredman

15:20 chouser: It's close, but I'm going to have to vote for hiredman's. :-)

15:20 kotarak: chouser: may I add, that I chose consist docstring caps according to surrounding functions? Or this just a cheap argument?

15:20 chouser: heh, no, perfectly valid!

15:21 stuartsierra: Ok, pushed some changes to contrib's POM, should work in Hudson and also support builds with a local clojure.jar

15:21 * hiredman doesn't have a decent editor to open kotarak's patch in :(

15:21 kotarak: ?

15:21 chouser: gvimdiff

15:22 kotarak: vim doesn't do it?

15:22 hiredman: browser is on the windows machine

15:22 I would have to download the patch, and find an scp client, and copy it somewhere

15:22 * chouser installs gvim on every windows machine that comes within reach

15:22 stuartsierra: Also only AOT-compiles the namespaces that need it for gen-class.

15:22 * kotarak too

15:22 * tmountain as well

15:22 LauJensen: chouser: *file* gives NO_SOURCE_PATH both in and out of SLIME

15:22 chouser: also cygwin.

15:23 kotarak: stuartsierra: +1

15:23 chouser: LauJensen: are you sure you have a source file?

15:23 hiredman: ,*file*

15:23 clojurebot: "NO_SOURCE_PATH"

15:23 hiredman: ,(doc *file*)

15:23 clojurebot: "; The path of the file being evaluated, as a String. Evaluates to nil when there is no file, eg. in the REPL."

15:24 hiredman: :(

15:24 duncanm: is there a way to find out if all my agents are done working?

15:25 chouser: LauJensen: try defining a macro like this: (defmacro this-file [] *file*)

15:25 LauJensen: k

15:25 chouser: LauJensen: then use (this-file) instead of *file*

15:25 duncanm: i have agents running a function that tail-calls itself when it's not finished, i wanna know if all the agents are done

15:25 chouser: duncanm: nothing automatic. promise/deliver might help

15:26 patrkris: question regarding vimclojure: how is it possible to kill a REPL instance? The documentation says to use the ",close" shortcut, but it doesn't work (it seems not even to be mapped).

15:26 chouser: oh, tail-calls as in (send *agent* ...) or as in (recur ...)?

15:26 kotarak: patrkris: type ,close in the repl as a command

15:26 LauJensen: chouser: using that macro and then using (this-file) returns 415 when I call (count (slurp (this-file))) - the file is 19 lines long

15:26 patrkris: kotarak: aaaah, thanks

15:26 duncanm: chouser: (send *agent* (fn [] .... (recur)))

15:26 LauJensen: so its good now

15:26 What made the difference?

15:27 kotarak: patrkris: , is not the leader. Then it would read <LocalLeader>close.

15:27 duncanm: chouser: i wanna know if they've all stopped polling

15:27 patrkris: kotarak: yeah, my mistake :)

15:27 kotarak: how's the rewriting of clojureql coming along?

15:28 kotarak: the frontend that is

15:28 kotarak: patrkris: hopefully well. Slowly working through the system. It starts taking shape.

15:28 chouser: LauJensen: *file* is the file currently being evaluated. if you're at a repl and call a function that uses *file*, that file is no longer being evaluated, something at the repl is. thus NO_SOURCE

15:28 patrkris: kotarak: will it be ready for 1.0 or will it come in a later release?

15:28 LauJensen: chouser: But I wasnt calling from the REPL though

15:28 kotarak: patrkris: It is planned for 1.0.

15:29 patrkris: kotarak: cool - looking forward

15:29 LauJensen: Just had a file which had (println *file*) in the middle of it, called that from a terminal

15:29 hiredman: LauJensen: that works for me

15:29 kotarak: patrkris: such a change must be done with a 0.x number. Later I would think twice about breaking code. But with a leading zero, we are still free to change everything.

15:29 hiredman: echo "(prn *file*)" > a.clj ; java clojure.main a.clj

15:29 chouser: however, when (this-file) is expanded, the macro's body is evaluated while the file that's using (this-file) is being evaluated, thus at the moment *file* is what you're expecting. this-file expands to the current value, a string, which then sits there in the compiled function until you need it.

15:30 patrkris: kotarak: yeah... i thought that was what you were going to do - or wait for a 2.x release.

15:30 chouser: duncanm: await

15:30 kotarak: or that. But I don't like libraries change completely with a new major release.

15:31 hiredman: kotarak: have you looked at arel?

15:31 kotarak: arel?

15:31 (^^^ obviously not)

15:31 hiredman: new activerecord relational algebra thinger

15:32 http://github.com/rails/arel

15:34 LauJensen: Is there something in contrib which handles timespan durations, or are people still hanging on to Yoda time ?

15:35 chouser: Joda is the future of time.

15:35 hiredman: jedis measure durations in yoda time

15:36 LauJensen: As I thought exactly

15:36 chouser: Yoda sets his watch to Jedi time

15:38 kotarak: hiredman: interesting. Similar to what we want to do. Though, I'd like to get away a little from SQL. Eg. I have a working prototype for a fleetdb backend.

15:38 How do I delete a file attachment from a ticket?

15:40 hiredman: yeah, delay the move from some kind of abstract representation of a query on a dataset to a concrete query (as a string, or what have you) as long as possible

15:41 kotarak: We delay until we know the connection type. Allows all sorts of emulations. Eg. FULL JOIN. etc. For SQL it will then go into a string first and then a PreparedStatement. For FleetDB it is "compiled" directly into a query: {:select :coll {:where ..}}.

15:42 hiredman: have you looked at google's datastore at all?

15:46 kotarak: no

15:47 But it looks ugly with the query strings. :|

15:48 hiredman: eh? I've never used a query string

15:48 kotarak: Just reading about GqlQuery. But maybe that's very low-level.

15:49 hiredman: http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/package-summary.html <-- bottom stuff is generally more how I've used (but from clojure)

15:51 anyway, it's another schemaless store

15:56 jasapp: ~seen somnium

15:56 clojurebot: somnium was last seen in #clojure, 90 minutes ago saying: in the source for fn it appears they expand straight to assert clauses

15:57 jasapp: somnium: you around?

16:06 kotarak: (doc into-array)

16:06 clojurebot: "([aseq] [type aseq]); Returns an array with components set to the values in aseq. The array's component type is type if provided, or the type of the first value in aseq if present, or Object. All values in aseq must be compatible with the component type. Class objects for the primitive types can be obtained using, e.g., Integer/TYPE."

16:59 LauJensen: Do we have something in contrib which mimics cl-format, like (p 55) "55 secs", (p 120) "2 minutes", ?

16:59 kotarak: pprint?

17:01 LauJensen: ~source pprint

17:01 kotarak: (doc pprint)

17:01 clojurebot: "clojure.contrib.pprint/pprint;[[object] [object writer]]; Pretty print object to the optional output writer. If the writer is not provided, print the object to the currently bound value of *out*."

17:02 kotarak: (doc clojure.contrib.pprint)

17:02 clojurebot: java.lang.ClassNotFoundException: clojure.contrib.pprint

17:03 LauJensen: Does look like it can handle time

17:04 kotarak: LauJensen: I think it's pretty complete.

17:04 format on steroids.

17:04 LauJensen: hehe

17:04 I think Rich once noted that format and loop together were more complex than all of Clojure

17:05 * technomancy would believe it

17:05 * kotarak too

17:05 kotarak: maybe adding for

17:07 LauJensen: In addition to pprint, Tom has this on Github http://github.com/tomfaulhaber/cl-format/tree/master/com/infolace/

17:09 Amazing to see a subset of format implemented in 1700+ lines of Clojure

17:12 raek: how does (alias) affect identity of qualified keywords?

17:13 (alias 'pl 'se.raek.pyttelisp)

17:13 (identical? :pl/foo :se.raek.pyttelisp/foo)

17:13 => false

17:13 hiredman: raek: use ::pl/foo

17:14 raek: hmmm, ok

17:14 hiredman: the double colon on a namespace qualified keyword will resolve through an alias

17:15 on a non-qualified keyword it will qualify the keyword to the current namespace

17:15 (at read time)

17:15 kotarak: LauJensen: I think the cl-format repo is from before contrib times.

17:16 raek: is namespace aliases only relevant at read time?

17:18 hiredman: raek: no

17:18 well

17:18 hmmm

17:19 kotarak: raek: you also can access things via introspection at runtime. Useful eg. for extracting completion information for an editor.

17:19 hiredman: raek: what are you trying to do?

17:19 raek: i'm making a lisp toy language

17:20 and I wanted to use multimethods

17:20 hiredman: use the ::pl/foo thing

17:20 ,(require '[clojure.zip :as z])

17:20 clojurebot: nil

17:20 hiredman: ,::z/foo

17:20 clojurebot: :clojure.zip/foo

17:21 raek: yes, that was what I were looking for

17:21 "Child and parent can be either symbols or keywords, and must be namespace-qualified:"

17:21 i din't want to write the namespace all the time in the repl

17:21 so I made an alias

17:22 that's when I found out that :pl/foo didn't mean what I thought

17:22 anyway, thanks!

17:23 xp_prg: hi all, I am a mere mortal and don't understand how lisp writes other languages

17:23 can someone hold my hand and tell me?

17:23 I understand lamdba functions, functions writing other function via metaprogramming, functional languages in general

17:27 hiredman: xp_prg: what does "how lisp writes other languages" mean?

17:33 Hali_303: if I have a function that can take two kinds of arities [a b] and [a b & c], how to transfer control from the first to the second?

17:33 drewr: call that function with more than two args

17:33 hiredman: how do you normally transfer control between functions?

17:33 Hali_303: I've tried (functionname a b []), but that puts an empty vector into the list

17:34 hiredman: why are you trying to call the three argument body with two arguments?

17:34 kotarak: Hali_303: sounds you expected (apply fn-name a b []) ?

17:34 hiredman: well, 2+ argument body

17:36 Hali_303: my problem is that if c is not given (called only with two parameters), the three parameter function does not get selected (which is the default implementation)

17:37 hiredman: Hali_303: I don't think you understand how dispatching on arity works

17:39 Hali_303: see this http://pastebin.com/d5abec2c

17:40 the problem is, that in this case :children will be ([]) instead of []

17:40 when I use the two parameter version

17:40 hiredman: why do you have & c?

17:40 or & children

17:41 Hali_303: so that the user can give children as parameters

17:41 but if he does not want, he can add later to the empty list

17:41 kotarak: Hali_303 You don't need the 2-param case.

17:42 hiredman: ok, so the excpected behaviour is (Form foo bar baz bleep bloop) and inside Form, children will be bound to (baz bleep bloop)

17:42 why would you expect it to be any different if you replace baz with an empty vector?

17:43 Hali_303: kotarak: ahh indeed :)

17:44 hiredman: ok, now it sounds very logical :)

17:44 thanks!

18:06 is there a shorthand for (reduce str ?

18:06 Chousuke: no, but don't use reduce with str

18:06 use apply instead

18:07 Hali_303: oh, thanks

18:07 Chousuke: it's faster because str uses a stringbuilder internally

18:07 Hali_303: I see

18:08 DeusExPikachu: is there a good pathname handling lib?

18:13 technoma`: DeusExPikachu: I use contrib's java-utils/file

18:17 DeusExPikachu: technoma`, k

19:21 devlinsf: Hey everybody.

19:21 I'm getting a weird bug w/ 1.2

19:21 java.lang.NoSuchMethodError: clojure.lang.RestFn.<init>(I)V

19:21 Has anyone seen this before?

19:22 the-kenny: clojurebot: clojure.lang.RestFn

19:22 clojurebot: ant clean and rebuild contrib

19:23 devlinsf: Clojurebot knows common errors?

19:23 the-kenny: devlinsf: If we tell him the solutions, yes ;)

19:24 devlinsf: Wow

19:24 the-kenny: clojurebot: the answer is 42

19:24 clojurebot: Roger.

19:24 technoma`: devlinsf: that means you're using .class files compiled with an older version of clojure

19:24 the-kenny: clojurebot: the answer?

19:24 clojurebot: the answer is 42

19:24 technoma`: 99% of the time it's contrib's fault

19:24 devlinsf: technoma`: Ah, great. Since you're here...

19:24 technoma`: though now that contrib uses actual version numbers it should become less of an issue

19:24 devlinsf: How do I solve w/ Lein?

19:24 Is there an "Edge Contrib"?

19:25 technoma`: devlinsf: if the version numbers for clojure and contrib match it shouldn't be an issue

19:25 devlinsf: So there's a 1.2 contrib?

19:25 technoma`: if it is, that would point to a bug in either contrib's pom or the config in build.clojure.org

19:25 yep

19:26 the-kenny: devlinsf: Oh, and try lein clean && lein deps

19:26 so you have a "clean" checkout

19:26 devlinsf: Yeah, I've been cleaning

19:26 I do have a version mismatch

19:29 Okay, changed versions. Got a working jar

19:29 Back to hacking

19:30 Thanks all

19:43 _fogus_: .((juxt + *))

19:43 ,((juxt + *))

19:43 clojurebot: [0 1]

20:07 AWizzArd: uh, the Oracle favicon.ico is now used in Suns Java documentation

20:10 qed: ,(juxt + +)

20:10 clojurebot: #<core$juxt__4985$fn__4995 clojure.core$juxt__4985$fn__4995@c41d96>

20:10 qed: ((juxt + +))

20:10 ,((juxt + +))

20:10 clojurebot: [0 0]

22:04 chouser: ,((sorted-map (int 1) 2) (long 1))

22:04 clojurebot: 2

22:04 chouser: rhickey: does this violate the java.util.Map contract?

22:05 ,(instance? java.util.Map (sorted-map (int 1) 2))

22:05 clojurebot: true

22:21 ts00000: ,(def foo {:a 1, :b 1, :c 1})

22:21 clojurebot: DENIED

22:21 ts00000: how do I come up with a foo that has :c filtered?

22:22 I tried remove and filter but I think my syntax is wrong

22:22 if I have a :c, I want it not there

22:22 rhickey: ,(instance? java.util.SortedMap (sorted-map (int 1) 2))

22:22 clojurebot: false

22:35 chouser: rhickey: is that my answer?

22:35 ts00000: (dissoc {:a 1 :b 1 :c 1} :c)

22:43 ts00000: if I have keys in a map, and I want to look up the "prices" for those keys in a separate map named prices, should I do it with something like (for [x (keys map)] [prices x])? and if so, why does this return two results rather than one?

22:44 like if the map is (def x {:a 1, :b 2, :c 3}) and prices is (def prices {:a 500.01, :b 500.02}) it returns two separate vectors

22:45 but with the same values essentially

22:45 it returns a vector per key?

22:47 chouser: are you trying to look up eack key in prices?

22:47 ts00000: yeah, pretty much

22:47 chouser: then you want (prices x) not [prices x]

22:48 ts00000: hmm

22:48 ok, that works, but I was actually hoping for some kind of map as a result, but I think I can work with that

22:49 chouser: you want {1 500.01, 2 500.02} or something?

22:49 ts00000: well, i've got a great number of maps, and a single price table

22:50 so I want to go through the maps, and come up with the prices, but I also need the quantities that are in the original map

22:50 so the map has like :item qty

22:50 :foo 300

22:50 and I have a price for foo in the prices table

22:51 but i'm looking for a clojurish way of basically doing some qty*price work and coming out with a number

23:14 rhickey: chouser: notreally

Logging service provided by n01se.net