#clojure log - Aug 19 2010

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

0:35 itistoday: is RC3 available from the github master branch?

0:36 i'm pretty sure i'm on it, but i'm not sure whether what i have is rc3 or an older version

0:37 err... is the master branch >= RC3?

2:00 Raynes: "Clojure goes in the right direction, but unfortunately, the trend and research is in advanced type systems and some syntax. An intermediate solution is for someone to fork Clojure and give it some nice Python-like syntax"

2:03 Scriptor: where would the "advanced type system" come from then?

2:06 Raynes: That was from a comment on this post: http://thecleancoder.blogspot.com/2010/08/why-clojure.html

2:10 tomoj: Raynes: think it's sincere?

2:11 Raynes: tomoj: Think what is sincere?

2:12 The comment? No, it sounds like trolling to me.

2:13 tomoj: I hope so

2:16 Scriptor: someone apparently agrees with him, though

2:18 Raynes: I'm sure a lot of people who miss the cosmic point will agree with him.

2:47 LauJensen: Good morning all

2:53 Bjering: morning.

2:53 Today I'll revisit my chat replacing alot of refs with agents.

2:56 I did the mistake of thinking I could port my C++ solution, just replacing blocks that used to be under locks to be blocks inside dosyncs. That is obviosly an oversimplification. What you said yesterday re refs and mutable objects makes alot of sense. Seems using agent as monitors around mutable java-objects atleast will make it read cleanly. Unsure if it is a perfomance issue, but thats why I am doing a benchmark after all...

3:02 LauJensen: It will likely perform better than refs, and agents seem a good fit for a chat server

3:03 And a big win, is that agents dont respin

5:39 pdelgallego: hi what are good project, problems and "katas" to learn clojure?

5:41 bobo_: pdelgallego: i did project euler

5:42 pdelgallego: bobo_, I have done of them, but they are too math-centric.

5:42 I did till number 12 I think

5:43 bobo_, Is there something like ruby quiz or "perl challenge of the week" in clojure?

5:46 spariev: pdelgallego: have you looked into this - http://codingkata.org/katas/ ?

5:46 pdelgallego: spariev, I didnt know that one. looks good.

6:03 LauJensen: Guys - I have a little OT topic but Im hoping there's some brains in here that can tackle this: I have a login screen which posts the input fields to a backend using $.ajax(). This works in all browsers except of course IE. If you open the page in IE and submit your details, you get an error on return new A.XMLHttpRequest, saying that it doesn't implement some function. Then refresh the page, try again and it works. Anybody heard of

6:03 that before?

6:07 old_sound: hi

6:11 LauJensen: Oh wow, I found it. Man its subtle. If you import scripts before <meta http-equiv="Conten...> IE8 will bork on it.

6:15 bobo_: ie always wants to be special

6:18 LauJensen: I should really get to work on a script which can take over IE and force the user to use Chrome instead

6:18 bobo_: there is a jquery plugin thats only function is to crash ie

6:18 :-)

6:19 maybe it was just ie6, but still

6:21 LauJensen: yea its only ie6 Im afraid

6:21 Bahman: Hi all!

6:22 LauJensen: Hi Bahman, old_sound! :)

6:22 old_sound: hi there, I was wondering if there's a way of generating a class name with clojure, from a string

6:22 Bahman: Hey LauJensen! What's the old_sound BTW?

6:23 LauJensen: Bahman: Its the guy who wants to make classes out of strings

6:23 old_sound: basically I want to generate records, so If I have the string "MyClass", I would like to be able to call (defrecord MyClass [a b c])

6:23 do you get the idea?

6:24 Bahman: LauJensen: Doh! I didn't see him. Hello old_sound :-)

6:24 old_sound: Hi there Bahman !

6:24 LauJensen: old_sound: Since defrecord is a macro I think you have to loot its source and modify it

6:25 ~source defrecord

6:25 old_sound: but how the get the contents of the string to be used like that?

6:25 LauJensen: there, go loot

6:25 old_sound: I think you just need a symbol

6:25 ,(symbol "MyClass")

6:25 clojurebot: MyClass

6:27 old_sound: I'm trying with that

6:27 like this (defrecord (symbol "ar") [a b])

6:29 LauJensen: old_sound: You have to make your own defrecord macro, to do the name filtering

6:30 old_sound: ok, I will try to understand what that means :) I'm new to clojure

6:30 LauJensen: old_sound: the thing is, macros expand to code that is then compiled. Passing in args like you want to do isnt possible with a macro

6:31 tomoj: old_sound: this a toy?

6:31 old_sound: tomoj: a toy?

6:31 tomoj: I mean, you're just screwing around?

6:31 old_sound: no

6:31 tomoj: LauJensen: sure it is? maybe I'm confused

6:31 LauJensen: tomoj: How?

6:31 old_sound: I'm trying to convert erlang records into clojure records

6:32 tomoj: (defmacro defmyrecord [str fields] `(defrecord ~(symbol str) ~fields)) or something?

6:32 old_sound: so in erlang a record is just a tuple of this form {record_name, {{key1, val1}, {key2, val2}}}

6:32 something like that

6:32 I want to convert that into a clojure record

6:33 tomoj: defrecording on the fly like that seems.. odd. I don't know why, but if I felt like I wanted to do that, I'd think really hard about it

6:34 old_sound: What I do right now is to just create a map

6:34 tomoj: just looking for speed?

6:35 I wouldn't think you'd get any speedup

6:35 old_sound: actually to have the kind of accessors functions, an perhaps add some methods later with protocols

6:35 LauJensen: tomoj: oh yea wrapping in another macro, why didnt I think of that ? :)

6:35 old_sound: I'm not looking for speed

6:35 tomoj: accessors..

6:36 old_sound: maybe that word is invented :P

6:36 clojurebot: keyword arguments is http://groups.google.com/group/clojure/msg/51bb53ca077154f8

6:36 tomoj: clojurebot: botsmack

6:36 clojurebot: clojurebot evades successfully!

6:36 LauJensen: haha

6:36 tomoj: shucks

6:37 LauJensen: tomoj: Where are you at in the world?

6:37 tomoj: austin, texas, usa

6:37 old_sound: you LauJensen ?

6:37 LauJensen: Home of Dell :)

6:37 old_sound: Im from Denmark (http://conj-labs.eu/instructors.html)

6:37 tomoj: I think my coworkers and I are going to start a clojure meetup here :)

6:38 LauJensen: Cool - You work with Clojure ?

6:38 tomoj: not as much as I'd like, but yeah

6:38 LauJensen: Which company ?

6:40 tomoj: borrowedsugar

6:40 old_sound: which kind of system do you work with?

6:40 LauJensen: Interesting!

6:41 tomoj: I wonder if any other austinites ever come here

6:41 zmila: new micro-interview :)

6:41 LauJensen: zmila: where?

6:41 zmila: right here right now :)

6:42 old_sound: well thanks for the help guys, I have to head home now

6:42 LauJensen: tomoj: What does 'tomoj' mean ?

6:44 tomoj: 'tomo' was my nickname (originally from esperanto-izing my given name), 'j' my last initial

6:45 LauJensen: oh okay

6:45 tomoj: coincidentally zo .tomoj. cu drani cmevla .ui

6:45 LauJensen: sure

6:46 zmila: tomoj estas multaj tomo-j :)

6:46 tomoj is a lot of tomo-s

6:49 tomoj: huh, coincidentally plural as well..

6:49 LauJensen: btw, here's a nice stunt. I have a preinstalled Windows 7 on my laptop just sitting in /dev/sda2, I never use it, but today I found out how to directly link that using Vbox and boot Windows 7 inside Arch from /dev/sda2 :)

6:50 ordnungswidrig: LauJensen: makes it a difference performance wise? partition vs. container file?

6:51 LauJensen: ordnungswidrig: Dont know

6:51 tomoj: that's interesting

6:51 LauJensen: The big difference is I dont need an imagine, and if I reboot into it from grub, I get all the changes Ive made while having the vbox running

6:51 s/imagine/image/

6:51 sexpbot: The big difference is I dont need an image, and if I reboot into it from grub, I get all the changes Ive made while having the vbox running

6:51 ordnungswidrig: LauJensen: thats a good point

6:52 LauJensen: does it manage the differnet devices well? virtualized network adapter vs. the real one?

6:52 LauJensen: Network and USB works fine. I havent made any special configs for anything else. I doubt I could get bluetooth to work easily

6:53 But it would make some network testing easier, as you can assign a number of network cards, with handpicked mac-adrs and vendor stringds

6:53 soyrochus: Hi there, I'm currently using Scriptjure to incorportate Javascript in a compojure/Ring project. Works well. But would be nice if ClojureScript would be maintained. Is there any news on that front?

6:54 LauJensen: soyrochus: Yea, the news is that most of CS becomes redundant once Clojure-in-Clojure is done. So the project is on hold I believe

6:54 soyrochus: the guy behind it, chouser_, practically lives in here, so you can check with him in a few hours

6:57 soyrochus: ok, thanks. I'm currently using the CLR version as well and it's more fragile nature can sometimes be maddening. Would be nice if CiC would help alleviate that

6:58 yonatan_: LauJensen: is there en ETA for clojure-in-clojure?

6:58 s/en/an

6:58 bsteuber: are there standard library functions for converting clojure-symbols to camelCase?

6:58 LauJensen: yonatan_: Not officially, but I recommend that you dont hold your breath

6:59 bsteuber: yes - I forgot where

7:00 bsteuber: hm, too bad :)

7:00 ordnungswidrig: bsteuber: a simple regex should do, shoudn't it?

7:00 tomoj: regex?

7:00 clojurebot: Sometimes people have a problem, and decide to solve it with regular expressions. Now they have two problems.

7:01 bsteuber: well, I guess I just use split and (map capitalize-first) or so

7:01 tomoj: hmm, munge goes to under_score

7:01 ordnungswidrig: hmm, java regex cannot do uppercase, I fear.

7:02 soyrochus: LauJensen: pity, I'm working in a multi-platform shop and Clojure has the potential to really make inroads here, it would be HUGE if there would be JVM / CLR /Javascript versions

7:03 More or less equivalent, I mean

7:03 LauJensen: soyrochus: You could contribute it if you like. There's already gone a lot of work into CS. Secondarily, javascript/jquery can actually hold its own.

7:07 ,(->> (re-find #"([a-z]+)([A-Z]+.*)" "camelCase") rest (map #(.toLowerCase %)) (interpose \-) (apply str))

7:07 clojurebot: "camel-case"

7:07 LauJensen: ordnungswidrig: you can simplify that a bit if you like :)

7:07 Will only do one dash though

7:08 Here's a better version

7:08 http://gist.github.com/raw/462593/9a8e3ce957ce5282672a145d0ec20a9393fa009f/enhanced-record.clj

7:09 @ bsteuber

7:10 bsteuber: ah, thx

8:13 LauJensen: Does anybody here know how the authors of Ring make access to servlet-params available?

8:16 alienscience: A ring request should have a :servlet-request key (I've not used it though)

8:17 Oh and a :servlet-context

8:17 http://github.com/mmcgrana/ring/blob/master/ring-servlet/src/ring/util/servlet.clj#L51

8:19 LauJensen: It used to, before the 0.3+ split up

8:19 So I have some legacy ajax-upload-backend code which doesnt work anymore

8:36 pdk: ,(/ 3840 2)

8:36 clojurebot: 1920

8:38 cemerick: LauJensen: there's a compojure mailing list/gg I think

9:35 mefesto: is the convention of an asterik after a function name to signal that it's use is mainly to support a macro?

9:36 chouser: I think it's less specific. more just a vague alternate to the non-splat thing.

9:36 cemerick: That, or that it's a support fn, not intended to be called directly.

9:36 chouser: like a "prime" tick in math

9:37 mefesto: chouser: sorry, 'non-splat' thing?

9:37 chouser: the un-asterikated thing

9:39 pdk: i like that name though

9:39 this function ain't got no splat

9:40 Raynes: chouser: Mind if I PM you?

9:41 chouser: Raynes: go ahead

10:02 LauJensen: mefesto: yes

10:14 * fogus_ Just when I thought my blog had a lot of followers and strong influence on the view of Clojure, Uncle Bob comes along and sets me straight.

10:21 LauJensen: fogus_: how so ?

10:22 fogus_: Just that my following is a fraction of his. Not that I'm complaining, he's great for exposure.

10:22 kaiwren: fogus_: Uncle Bob's definitely got the Clojure bee in his bonnet.

10:22 fogus_: kaiwren: Indeed

10:22 LauJensen: fogus_: I think its because you never got that shell working on your site :(

10:23 fogus_: well, it works, but it's flakey. I've neglected it too long

10:24 I'll redo it once CinC is targetting js

10:24 LauJensen: Yea - Would make for a fantastic interactive Clojure tutorial

10:24 fogus_: I was hoping a flood of contributions would come in when Gruber used it on his site (well, as a basis anyway), but nada

10:24 oh well

10:24 LauJensen: Dont even know who Gruber is...

10:25 fogus_: The daring fireball guy

10:25 Plouj: in Listing 6 on http://www.ibm.com/developerworks/java/library/j-jtp05236.html#2.0 what would be different if I threw a new InterruptedException instead of calling Thread.currentThread().interrupt();

10:26 kaiwren: I'm planning to build my personal site on compojure. That however helps nobody when it comes to exposure. :)

10:26 LauJensen: fogus_: Oh, Ive read some of his posts, but I think he's one of those internet phenoms I just dont get

10:27 kaiwren: Did I scare you away with my baking classes ?

10:27 technomancy: LauJensen: it's because you don't have a psychological need to justify spending large sums of money on fruit products.

10:27 I think that's his target audience

10:28 LauJensen: technomancy: ?!

10:28 fogus_: technomancy: +1

10:34 LauJensen: fogus_: Also someone like Bob, how do you rate his following and where does he get his crowds from?

10:34 (to me he was unknown until he spoke up about Clojure)

10:35 tomoj: he's a ruby god

10:35 and more I guess, from before I heard of him

10:36 fogus_: LauJensen: I think he's a big Agile/TDD guy. I don't know him from that however -- I think he did some pretty nice OOP essays a while back (I hope I'm not confusing him)

10:36 * technomancy is rather amused that he removed the "Object Mentor" title from his site

10:36 LauJensen: Ok. Its fun with some of these hackers who get such huge followings. I think Paulgraham.org takes 10 million hits per month

10:36 kaiwren: LauJensen: UncleBob is an XP guy, going back to the Agile Manifesto days

10:36 LauJensen: Ok

10:36 technomancy: but yeah, I did ruby/TDD for years and never heard of him either

10:37 kaiwren: He's big in the same circles as, say Martin Fowler

10:37 fogus_: Is he a ruby guy? I always thought he was Java/C++

10:37 LauJensen: I've heard he likes Ruby as well

10:38 kaiwren: fogus_: That lot were pretty much language agnostic. A lot of them have a SmallTalk background.

10:38 tomoj: he was at railsconf making everybody feel guilty about testing

10:38 LauJensen: technomancy: btw Phil, did you hear that I was able to boot a physical windows partition from inside Arch earlier today? :)

10:39 technomancy: LauJensen: I'm sorry to hear that.

10:40 bobo_: LauJensen: realy? how much work did it take? :-)

10:40 fogus_: I guess I've read/watched numerous things from him and am still not sure what he stands for. (shrugs)

10:40 LauJensen: bobo_: About 15 minutes

10:40 bobo_: i find it realy annoying to have 2 windows installs

10:40 LauJensen: technomancy: alright, I'll let you get back to MetaCity :)

10:40 bobo_: i would prefer 0

10:40 LauJensen: fogus_: Bob or Paul ? :)

10:40 fogus_: Bob

10:40 LauJensen: (take 8 (bob)) ? :)

10:41 @ fogus_

10:41 fogus_: LauJensen: I think his official role is gadfly :p

10:41 bobo_: imho, unclebob has written and done some of the best presentations about clean code ever

10:46 LauJensen: bobo_: I should check that out. I think my "Beautiful Code - The Manifesto" post was about the 3.rd or 4.th most flamed post I ever did - And thats saying something :)

10:46 bobo_: :-)

10:47 dont think ive read your post

10:48 LauJensen: http://bestinclass.dk/index.clj/2009/11/beautiful-code-manifesto.html

10:51 bobo_: have to go to the train, il read it later!

10:51 LauJensen: alright

10:56 cemerick: man, how can HN scoop conference organizers on their own conference? ;-)

10:59 chouser: that's the week right after I will have been gone for half a week to Strange Loop

10:59 my family's not going to like it, but how can I not go? argh!

10:59 fogus_: chouser: If you're going, I'm going

11:00 cemerick: I have family down there, so it's an incredibly easy sell for me :-)

11:00 arohner: tomoj: I'm in austin

11:00 chouser: fogus_: can't fool me -- I know you're already going. :-)

11:00 fogus_: chouser: :-o

11:00 cemerick: Might actually be in NC / DC area sometime soon full time anyway

11:00 fogus_: cemerick: Let me know when you are. I'm in the DC area

11:01 cemerick: fogus_: Just a vague possibility at the moment. You'll be the first to know if it comes off though. :-)

11:02 * fogus_ crosses fingers

11:02 Raynes: Aw. I wish I could afford to go. :(

11:03 I'm in Alabama, so it isn't *that* far, but even not *that* far is too far to afford gas and lodgings.

11:04 pdk: ALABAMA MAN

11:04 Raynes: Poor Alabama man.

11:08 cemerick: is there a general term for "equal except for case" re: strings? That's a mouthful.

11:08 s/general/better

11:08 pdk: case-insensitive

11:08 or case sensitive rather

11:09 Raynes: Well, shoot. Maybe I can work up enough for gas money. I can sleep in the car.

11:09 cemerick: "case-insensitively equal" isn't any better :-)

11:09 oh well

11:09 chouser: Raynes: I bet if you ask around you could find someone else who'd want to split a hotel room or something.

11:10 Raynes: chouser: It'll be October, so the car wouldn't be that bad anyway. I'm young. I can handle it. ;)

11:10 chouser: :-)

11:11 hm. I've done that, come to think of it. I was young and it was still pretty miserable.

11:11 Raynes: That's assuming I can get enough gas money in two months to get there. I don't have a job. I'll go ahead and sign up, since I am reasonable serious about it.

11:13 tomoj: arohner: cool! think we have enough others here for a meetup?

11:13 arohner: tomoj: the last time I saw it, the google map had ~3-4 in austin. That was probably close to a year ago

11:14 there's also an FP group trying to get off the ground

11:14 tomoj: this one? http://groups.google.com/group/austin-fp

11:14 arohner: tomoj: yeah

11:19 Raynes: If I went, I'd be the youngest person there.

11:19 tomoj: cool, thanks

11:19 Raynes: To my amusement.

11:21 Will registration cost anything?

11:29 chouser: I suppose next year will be (second clojure-conj). But what after that? (nth clojure-conj 2)?

11:29 liebke: exactly :)

11:29 Raynes: chouser: We'll have to add functions.

11:29 chouser: maybe it's a vector

11:29 (clojure-conj 2)

11:29 liebke: Raynes: we are trying to keep the registration fee low, but there will be one

11:29 Raynes: (twenty-first clojure-conj)

11:30 chouser: but still doesn't help the problem of second/2 being different

11:30 Raynes: liebke: I don't know what "low" is in context of registration fees for this sort of thing, so I guess we'll have to wait and see. Between gas money, food, and now this, it'll definitely be a close call.

11:36 http://groups.google.com/group/clojure/browse_thread/thread/b57965fafc722697

11:38 It kills me inside that this didn't make it in: http://www.assembla.com/spaces/clojure/tickets/315-add-support-for-running--main-namespace-from-clojure-main-without-aot

11:39 djpowell: gratz everyone on clojure 1.2!

11:39 Raynes: Ditto.

11:55 jcromartie: The link to "Clojure Contrib 1.2" on http://clojure.org/download is broken. It should point to http://github.com/downloads/clojure/clojure-contrib/clojure-contrib-1.2.0.zip

11:55 oops

11:55 http://clojure.org/downloads

11:55 speaking of broken links

12:05 Joreji: Hey guys, a Camera and a Ray both have a direction. With protocols, would you guys create two protocols ACamera and ARay which both have a dir method, or would you abstract the "having a direction" into yet another protocol? (e.g. ASomethingWithDirection)

12:05 arohner: Joreji: protocols (and their methods) are namespaced

12:06 I would create two different protocols

12:06 Joreji: Ah, right. Explains why I'm getting errors when trying to :use protocols from different namespaces, with same method names.

12:09 So I'm better off writing a multimethod for dir instead of specifying it inside the protocol? If I use a protocol, then I get method-name clashes when trying to use two protocols in one namespace which share names for their methods.

12:19 arohner: Joreji: just use require rather than use

12:19 (camera/dir) (ray/dir)

12:22 Joreji: arohner: Well, I'd like to use "dir" in any case - no matter whether it is a camera or a ray.

12:22 arohner: ok, in that case you will need a multimethod

12:24 Joreji: Too bad. But thanks for clarifying that up!

12:27 cemerick: Wow, big day. :-)

12:30 danlarkin: cemerick: yarly

12:30 hiredman: ping?

12:30 clojurebot: PONG!

12:31 cemerick: danlarkin: Man, I'm so lame. Had to google that.

12:31 I figured it was close to "yea, verily".

12:32 danlarkin: I love urban dictionary

12:41 hugod: clojars is feeling the strain

12:46 fogus_: http://fogus.me/static/preso/clj1.2+/

12:47 psykotic: chouser: hey. rayne asked me to email jcowan and ask him for ownership transfer for #clojure. could you privmsg me an email of yours i could cc?

12:47 chouser: psykotic: thanks. I wrote him earlier today.

12:47 dunno if the email address I have for him is good or not

12:49 Raynes: It's a small world.

12:49 psykotic: chouser: i have one i've used before, so i'll try that one.

12:50 chouser: psykotic: thanks!

12:51 Raynes: chouser: Isn't word of mouth awesome?

12:51 Or word of keyboard.

12:52 chouser: could be -- we'll see how this turns out. :-)

12:53 Raynes: chouser: I have ownership of #clojure-casual now, so if you get ownership and do the whole group registration thing, let me know. I'm not sure what the significance of all that is.

12:54 chouser: I mostly just want someone somewhere to be able to update the /topic as needed.

12:54 Raynes: Yeah, I was thinking about that earlier.

12:54 psykotic: yeah, the whole situation is kind of ridiculous :)

12:55 the whole 'race to see who registers the channel for project x' smells a bit like the domain name race

12:55 Raynes: I always wondered why it wasn't updated to point out that Clojure moved to github.com/clojure/clojure and stuff.

13:00 chouser: An interesting side-effect of being a group is that you can apparently give people group hostmasks. Picture ~raynes@clojure/user/raynes

13:00 ;)

13:01 chouser: regarding "What is the reason Lisp code is not written with closing parenthesis on new lines?" gmail says "conversation could not be loaded"

13:01 probably just as well.

13:02 psykotic: haha

13:02 cemerick: The more we can bury those old battles, the better.

13:02 Raynes: chouser: Indeed. It's the entire Clojure community giving reasons and Greg Slepac or whatever his name is telling everyone they're wrong.

13:03 It's like he believes that he has found some secret to Lisp readability that nobody over the past 50 years has noticed.

13:03 cemerick: Turn on paredit (or similar) in every editor mode and IDE plugin by default, problem solved. :-)

13:04 Raynes: cemerick: M-x show-paren-mode :D!

13:06 cemerick: Raynes: remember, I don't speak emacs ;-)

13:06 but, sure

13:07 Raynes: cemerick: It's the mode (I think) that makes an opening paren highlight when your whatchamacallit is on a matching closing paren.

13:07 cemerick: ah

13:07 I was meaning more the behaviour where closing parens are managed -- you simply can't put them on their own lines

13:07 or, not without undue effort

13:08 That's exactly how VS preserves newline-braces as the standard over there. *shrug*

13:10 fogus_: The whole problem with the paren-placement discussion is that people keep forgetting to type "for me" and "in my opinion"

13:12 Raynes: fogus_: But my opinion is the right one. :(

13:12 fogus_: as is mine

13:12 Raynes: fogus_: rhickey's, actually. :p

13:13 chouser: except where they diverge from mine.

13:13 Raynes: He speaks the truth.

13:15 jcromartie: mad props to everybody who got 1.2 out... I really wish I could have contributed but ASP.NET took over my life

13:16 Raynes: jcromartie: Is he watching you now? Does he know you're IRCing? s_s

13:16 itistoday: Raynes: you're a dick. :-)

13:16 Raynes: itistoday: You know I love you though. <3

13:18 itistoday: Raynes: sometimes... i have my doubts. ;-)

13:18 pdk: what's the meat of slepac's argument there

13:18 Raynes: pdk: He's right there, ask him. :p

13:18 pdk: heh

13:19 itistoday: pdk: http://gregslepak.posterous.com/on-lisps-readability

13:19 Raynes: ^ Is the famous mister Slepak.

13:19 psykotic: famously wrong

13:21 itistoday: I think Raynes makes a superbly rational argument agains this Slepak character: "My eyes bleed when I see code written like that."

13:22 Raynes: I think I heard somebody mention that you probably expected Guy Steele to appear in front of you, shake your hand, and say "Congratulations son, you've done it."

13:23 slyrus: where does the "WARNING: spit already refers to: #'clojure.core/spit in namespace: clojure.contrib.io, being replaced by: #'clojure.contrib.io/spit" message I see every time I start lein come from?

13:23 Raynes: It was funny at the time.

13:25 chouser: It doesn't seem like a topic nearly worthy of the time.

13:26 my position is simple: write what you want. If you want any help from me, write in a way that's at least reasonably close to how I like it to look.

13:26 fortunately if you write it that way, there are lots of people who will be more willing to help.

13:26 the end.

13:26 Raynes: chouser: That's because it isn't. But people (like me) can't resist the urge to reply to long blog posts.

13:27 That's my position. Get out of my position.

13:27 chouser: :-)

13:27 BrianForester: slyrus: I was just about to look up :use versus :require since I'm seeing similar warnings with: WARNING: repeat already refers to: #'clojure.core/repeat in namespace: proquest.pubConvert, being replaced by: #'clojure.contrib.string/repeat ...granted that is my code and not lein...

13:28 dnolen: clojurebot: use

13:28 clojurebot: use vs require is (:use [lib :only [a b c]) or (:require [lib :as alias]) -- (:use lib) is only for playing around

13:28 chouser: nice summary!

13:31 itistoday: chouser: there are good reasons for each style. i'm happy to help anyone out regardless of how they format their code.

13:31 chouser: itistoday: that's generous of you, thanks!

13:31 itistoday: seems silly to say to someone, "no, i won't help you because your code doesn't look like mine"

13:32 hiredman: I won't help you because you code looks like something a smurf barfed up

13:32 Raynes: I think the real issue, and the reason that you get lots of crap, is that most of us don't actually see the good reasons for the newline'd-paren style.

13:32 chouser: it's just a matter of how I choose to spend my time. If I'm already donating my time to help, I'd simply rather not spend it trying to see through some unusual formatting choices.

13:33 BrianForester: so :use brings functions into the current namespace? which explains the collisions I am (was) seeing.

13:33 chouser: Raynes: I don't think I'd put up much fuss if the "normal" way to format clojure was different. I like to integrate with the culture of the language I'm using.

13:33 itistoday: Raynes: i listed them in the post. and in principle giving someone crap for having a certain code style is a dick thing to do.

13:34 Raynes: especially when they explain their rational for it. :-p

13:34 hiredman: BrianForester: it doesn't bring them in they still are in the namespace they were def'd in

13:34 it just lets you refer to them without namespace qualifying

13:34 itistoday: Raynes: the other thing is that i've actually tried both styles. have you?

13:34 BrianForester: hiredman: K, thanks.

13:35 Raynes: Why would I? :\

13:35 itistoday: Raynes: exactly, you haven't.

13:35 Raynes: I've seen code written in both styles.

13:35 dnolen: *sigh* is this zombie paren discussion really going to be revived on IRC ?

13:35 cemerick: itistoday: don't mind hiredman, he's usually grumpy ;-)

13:35 itistoday: Raynes: Your *entire* argument is, "i don't like your style because it's different from mine"

13:35 Raynes: But seriously, why would I? ._.

13:35 hiredman: cemerick: how dare you!

13:35 itistoday: Raynes: and you then *jump* on people for even considering using a different style

13:36 cemerick: hiredman: pistols at dawn?

13:36 or is it usually at noon?

13:36 itistoday: Raynes: your so wrapped up in your own world-view, and closed to others, that you continue to ask, "why would I?" as well

13:36 Raynes: itistoday: No, my entire argument is that "I don't like your style because it's inconsistent with what *everyone else* does and has done for many years, and your arguments don't make sense to me."

13:36 It's really simple.

13:36 hiredman: I have a day job so it will have to be at dusk

13:36 cemerick: I agree with dnolen, it'd be nice if all parties involved in any kind of code style issue would walk away and agree to disagree. :-|

13:36 hiredman: maybe noon will work if I can squeeze it into my lunch break

13:37 cemerick: hiredman: screw it, let's just get a beer then. :-P

13:37 itistoday: cemerick: i would, but Raynes jumps out from nowhere and attacks me.

13:37 hiredman: :P

13:37 Raynes: itistoday: Plus, I never jumped on you. I'm willing to totally let bygones be bygones, because I honestly don't care what your code looks like unless I have to read it. We've already agreed to disagree, so let's not fill up this channel with more garbage than necessary.

13:38 itistoday: Raynes: great! :-)

13:38 Raynes: (P.S. Never forced you to read it)

13:38 Raynes: You most certainly did not.

13:40 * Raynes gives itistoday a big hug, stealthily slipping some neatly stacked closing parens into his pocket. ;)

13:41 * itistoday grimaces a smile. pretends like he'll leave the stacked parens as they are.

13:42 * cemerick hopes Raynes and itistoday get a room :-P

13:43 Raynes: :p

13:43 * itistoday lol'd

13:45 * raek just noticed that Clojure is 1.2

13:45 Raynes: raek: I was "there when it happened"

13:45 ;D!!

13:46 raek: congratulations, everyone!

13:48 slyrus: it's a little too early on this coast, or I'd suggest a toast to the responsible parties

13:56 tomoj: woohoo

13:57 fliebel: Congratulations with Clojure 1.2!

13:59 jcromartie: one of the most impressive things about Clojure as a project is how solid it has been

13:59 it's built like a tank

14:00 rhudson: but a lot more maneuverable!

14:02 jcromartie: Ruby has "releases" that are "sort of" supported on anything but certain versions of Ubuntu...

14:02 and they call them releases

14:02 not RC

14:08 pdk: would certain versions include 10.04

14:08 also itd be nice if we stuck little "clojure x.y is out now" notices in the topic

14:14 jcromartie: pdk: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/367983

14:14 Raynes: pdk: We can't.

14:15 pdk: it is FROZEN IN TIMEEEEEEE

14:15 Raynes: pdk: chouser is awaiting the response of the creator of this channel. Requesting a transfer of ownership or ops.

14:15 pdk: and it's not rhickey

14:16 rhudson: Owner is named Godot, I take it

14:16 chouser: Exactly. He'll be here any moment, I'm certain.

14:16 Raynes: Nope.

14:16 jcowens, actually.

14:17 rhudson: It was a joke, Raynes. Here, have some parens

14:17 Raynes: chouser: You got a response? Goodie.

14:17 * cemerick grins goofily @ chouser

14:17 Raynes: rhudson: I didn't get it. :(

14:17 chouser: I really wonder how many people will come to clojure-conj. I wonder if they'll be outnumbered by the speakers.

14:17 cemerick: Raynes: http://en.wikipedia.org/wiki/Waiting_for_Godot

14:17 one of my favorites

14:17 chouser: I guess that'd be ok -- we can all go to each others talks and have a grand old time.

14:18 cemerick: we should start a pool

14:18 fliebel: What is clojure-conj?

14:18 Raynes: fliebel: first.clojure-conj.org

14:19 pdk: no relation to phoenix wright

14:19 rhudson: It's a very clever name

14:19 cemerick: For my part, I promise a set of 100% maven talks. ;-)

14:20 Raynes: clojure-conf would have been more obvious, but less clever.

14:20 fliebel: Raynes: That is in the US is suppose?

14:20 Raynes: fliebel: North Carolina, US of A.

14:20 cemerick: I promise to not be there to see them. :p

14:20 Bjering: Unit-testing agents, I assume this is one of the good places to use the await function?

14:20 fliebel: Raynes: If it was in Europe, I'd love to come :(

14:21 cemerick: Raynes: it'll just be me, SS, and about 85 rabid Java devs.

14:21 Raynes: Naw, I'd love to be there.

14:21 Doubtful I'll be able to fund the trip though.

14:22 cemerick: Raynes: are you still in school?

14:22 raek: what fliebel and Raynes said

14:22 Raynes: cemerick: If I came, I'd walk up and give you a big hug.

14:22 chouser: Bjering: possibly. the function you send to the agent though is best when its a pure function and then can be tested without anything as clever as await.

14:22 Raynes: cemerick: Yes, but I'm home schooled. Which is why I'm here all the time.

14:22 cemerick: Raynes: OK, but I'm not joining you and itistoday! :-P

14:22 Raynes: :p

14:23 fliebel: Raynes: same for me, well… almost homeshool

14:23 Raynes: Well, most of the time. More like why I occasionally sleep during the day and am active at night.

14:23 I have no social life.

14:23 cemerick: Raynes: you should take up a collection or something

14:24 Raynes: A collection?

14:24 Bjering: Chouser: https://gist.github.com/6590b4fd7423d10781a7 , perhaps too trivial to really prove anything, but its the start of my rewrite of yesterdays failed chat-server.

14:24 fliebel: Raynes: And social life :) But I know it's harder wehn doing homeschooling

14:24 cemerick: Raynes: get donations to pay your way, etc

14:24 Raynes: fliebel: Not really. It's living in the middle of nowhere with nowhere to go. ;)

14:24 cemerick: People don't like me that much. :p

14:24 Bjering: Chouser, its more a unit-testing my understanding of agents and await are correct :)

14:25 fliebel: Raynes: where is your nowhere?

14:25 Raynes: Alabama.

14:25 fliebel: *opens google maps*

14:25 Raynes: If anywhere was a nowhere, it's there.

14:25 Eldridge, Alabama to be specific.

14:25 arkh: South

14:25 Raynes: Aproximately 550 miles from the location of the conference.

14:25 arkh: *Dakota may give you a run for your money on nowhere

14:25 Raynes: 9 hours and 41 minutes away.

14:27 cemerick: Eldridge, AL: "At the 2000 census the population was 184."

14:27 Raynes: holy crap!

14:27 Raynes: Yessir.

14:28 And people have died since then. ;)

14:28 fogus_: Raynes: At least you're the best Clojure programmer in your town.

14:28 metagov: Is lazy-cons a real macro? I see it in the cheat sheet and it's listed on the macros section but I can't find any description of it.

14:28 cemerick: I support home-schooling must be the only option there.

14:28 Raynes: fogus_: I'm the best Clojure programmer in 100 miles in either direction, at the very least.

14:28 fliebel: fogus_: That is probably true for me as well

14:29 Raynes: cemerick: Actually no. The Carbon Hill High School sends buses out here, apparently.

14:29 I've just always been home schooled. I saw no reason to go to a public school when I have more time for coding if I'm home schooled.

14:29 fliebel: Raynes: But they don't teach Clojure in.. yea, that is what I mean

14:29 Raynes: Clojure trumps a social life. I don't really like teenagers. ._>

14:30 I feel I can learn more on my own regardless.

14:30 danlarkin: nobody does :)

14:30 jcromartie: hah

14:30 edbond: what is the function for (first (remove nil? <coll>)) ?

14:30 chouser: metagov: lazy-cons is old

14:30 metagov: It's superceded by lazy-seq

14:31 cemerick: edbond: I think you just wrote it. :-)

14:31 Raynes: edbond: Eh, (first (remove nil? coll)) ought to do it. ._. I'm not sure there is an actual function for that.

14:31 metagov: chouser: thanks

14:32 edbond: cool, thanks

14:32 Raynes: I tend to do (filter identity coll) when I know that it's safe to get rid of false values, 'cause I'm a maverick.

14:32 edbond: isn't better to write (drop-while nil? ...) or something?

14:33 or its equivalent since laziness?

14:33 raek: filter is lazy too

14:33 it wont continue unless you force it too

14:34 cemerick: edbond: very roughly, everything seq-related is lazy except for reduce

14:34 Raynes: Remove is as well, I imagine. I assume it uses filter and complement's the predicate.

14:34 rhudson: I just noticed (range) in the release notes, as a replacement for (iterate inc 0). A tiny but very convenient improvement

14:34 Raynes: complements*

14:35 Did I mention that complement is an awesome function with a confusing name? It is.

14:36 tomoj: rhudson: whoa, yes.

14:36 Raynes: ->((complement true?) true)

14:36 sexpbot: => false

14:36 cemerick: tomoj, rhudson: range has been around nearly forever

14:36 Raynes: Whoa, I didn't see that.

14:36 tomoj: cemerick: nullary range too?

14:36 rhudson: Yes, but the nullary is new

14:36 raek: the function-generating-functions are easy to overlook

14:36 Raynes: Nullary is new.

14:37 cemerick: ah, I didn't catch that, sorry

14:37 fliebel: raek: what are they?

14:37 tomoj: I always felt a bit irked when writing (iterate inc 0)

14:37 Raynes: tomoj: Likewise.

14:37 raek: juxt, comp, complement, etc

14:37 cemerick: I never internalized that, so I always used (range Integer/MAX_VALUE) *blush*

14:38 Raynes: cemerick: That's adorable.

14:38 chouser: hm -- (range) is chunked, (iterate inc 0) is not

14:38 fliebel: raek: ah, of course. It's realy time for me to write loads of Clojure again.

14:38 Raynes: The code, not the blush.

14:38 rhudson: I really wish complement and identity had shorter names. 'non and 'stet maybe

14:38 raek: the functional programming chapter of Joy of Clojure is very good

14:38 cemerick: Puppies have nothing on me.

14:40 pdk: what do you mean by chunked, is this some difference in the way its results are cached

14:40 jcromartie: pdk: yes, chunked seqs calculate the sequence in "chunks" instead of one at at ime

14:40 tomoj: stet?

14:40 why not 'id?

14:41 er, really my question is what the heck is 'stet

14:41 jcromartie: tomoj: it's "tets" backwards

14:41 of course

14:42 rhudson: stet means "let it stand" -- it's an editing thing that means leave it the way it is

14:42 tomoj: latin?

14:42 rhudson: latin

14:42 Raynes: rhudson: I'm surprised "identity" isn't 'id'.

14:42 rhudson: "id" is just such a useful name for identifier

14:43 tomoj: oh, wow, I didn't even see that, haskell has poisoned my brain

14:44 fliebel: What is the use of a function the just returns its argmuent>?

14:44 tomoj: (take-while identity coll) is one example I remember

14:44 rhudson: But my real point is 'identity has too many convenient uses in filters etc. to have a long name

14:44 pdk: use it in iterate, repeat(edly) etc

14:44 tomoj: yes, I also was always a bit irked by its length

14:44 pdk: comp

14:44 Raynes: fliebel: For stuff like (filter identity [false nil true 2 1 "blah"])

14:44 -> (filter identity [false nil true 2 1 "blah"])

14:44 sexpbot: => (true 2 1 "blah")

14:45 Raynes: fliebel: There are times where you need to pass a function to another function, but you really just want that function to return it's argument.

14:46 fliebel: I see...

14:46 tomoj: pdk: (comp identity f) ?

14:47 pdk: it could be a last ditch utility :p

14:47 think of it as

14:47 you'd use it that way in a macguyver sort of situation

15:01 * technomancy wishes every? had a 1-arg version that assumed identity as its predicate

15:01 chouser: also filter

15:02 someone was just asking for that

15:04 technomancy: well, I guess the feature freeze is over

15:04 chouser: right! check it in!

15:04 technomancy: I have a big list

15:05 pdk: we'll have clojure 1.3 before sunset

15:05 all thanks to techno over here

15:05 technomancy: http://p.hagelb.org/1.3-hopes-and-dreams.html

15:05 tomoj: if I have to pick one, strange loop or clojure-conj? :/

15:07 rhudson: what's ":like in ns macro", technomancy?

15:07 technomancy: rhudson: from nstools

15:07 clojurebot: google nstools clojure

15:07 pdk: what would a 1 arg version of filter or remove do

15:07 clojurebot: First, out of 12 results is:

15:07 Managing namespaces « On Clojure

15:07 http://onclojure.com/2010/02/17/managing-namespaces/

15:07 chouser: tomoj: I would have picked clojure-conj, had I only known it was an option.

15:08 tomoj: .. aren't you a speaker?

15:08 technomancy: rhudson: basically having a base namespace so you can easily create others with the same use/require clauses

15:09 rhudson: ah. looking at the link; sounds cool and useful

15:09 technomancy: one of the few things that can't be done well in an external library, though that's what he's tried

15:16 chouser: tomoj: yeah, but they're only a week apart -- that's a lot of travel for me.

15:19 holoway: do any of you vim users have trouble with vimclojure's rainbowparens mode on the mac? I can't seem to actually turn it on.

15:21 naeu: Happy 1.2 day everyone

15:21 tomoj: chouser: oh, so grudgingly going to both?

15:22 fliebel: holoway: I had them working ages ago, but it's realy to long ago since I've written Clojure

15:22 chouser: tomoj: grudgingly sounds meaner than I'd like, but yes going to both.

15:22 holoway: yeah, everything else seems to work, but as far as I can tell 'let g:vimclojure#RainbowParens=1' has no impact at all

15:22 I'll dig further

15:23 chouser: I'm sure both will be fun

15:25 naeu: I'm struggling with a basic problem - how to generate a lazy sequence of [int square-of-int] pairs for all ints

15:27 raek: (for [x (iterate inc 0)] [x (* x x)])

15:27 chouser: raek: range

15:27 raek: ,(take 3 (range))

15:27 clojurebot: (0 1 2)

15:27 hiredman: ,(take 10 (map (juxt identity #(* % %)) (iterate inc 0))))

15:27 clojurebot: ([0 0] [1 1] [2 4] [3 9] [4 16] [5 25] [6 36] [7 49] [8 64] [9 81])

15:27 raek: I see...

15:28 naeu: I was wondering why #([%1 (* %1 %1)]) doesn't work

15:28 hiredman: ,(take 10 (map (juxt identity #(* % %)) (range))))

15:28 clojurebot: ([0 0] [1 1] [2 4] [3 9] [4 16] [5 25] [6 36] [7 49] [8 64] [9 81])

15:28 hiredman: naeu: macroexpand it

15:28 ,(macroexpand-1 '#([%1 (* %1 %1)]))

15:28 clojurebot: (fn* [p1__503246#] ([p1__503246# (* p1__503246# p1__503246#)]))

15:28 naeu: hiredman: can you macroexpand anonymous functions?

15:28 raek: naeu: that expands to (fn [%1] ([%1 (* %1 %1)])) and not (fn [%1] [%1 (* %1 %1)])

15:28 hiredman: look at the parens

15:28 pdelgallego: Have clojure anykind of interpolation string? Maybe place holders where introduce data into a string.? Ie "my name is %s" % name

15:29 raek: #(vector ...) works

15:29 hiredman: ,(doc format)

15:29 clojurebot: "([fmt & args]); Formats a string using java.lang.String.format, see java.util.Formatter for format string syntax"

15:29 tomoj: -> '#([% (* % %)])

15:29 sexpbot: => (fn* [p1__3661#] ([p1__3661# (* p1__3661# p1__3661#)]))

15:29 pdelgallego: thank hiredman

15:29 hiredman: danlarkin: thats two

15:31 naeu: hiredman: thanks for the help

15:33 danlarkin: hiredman: you're a crowd favorite

15:33 hiredman: danlarkin: thats three

15:34 Bjering: I find no def- corresponding to defn-, how do I def a private var? And is there a reason that def- isnt provided (ie is private vars a bad idea?)

15:35 technomancy: Bjering: no reason; it's a very strange omission

15:35 * technomancy adds it to his 1.3 wishlist

15:35 hiredman: well, in 1.3 you will just be able to use ^:private

15:35 wwmorgan: clojure.contrib.def has def-, iirc

15:35 technomancy: that's nine too many chars, hiredman

15:35 hiredman: (jeeze, 1.2 just landed)

15:36 chouser: wwmorgan: I think that's called defvar-

15:36 hiredman: ugh

15:36 technomancy: hiredman: http://jordi.platinum.linux.pl/piccies/unacceptable.png

15:36 hiredman: I am pretty ok with ^{:private true}

15:36 for that matter

15:36 Raynes: chouser: And defvar- isn't the same as what def- would be.

15:37 ^{:private true} is what I do.

15:37 danlarkin: technomancy: http://www.bay-of-fundie.com/img/2009/donkey-balls2.gif

15:37 hiredman: point refuted

15:38 naeu: I was just perusing fogus's 1.2 slides and came across the following snippet. Could anyone enlighten me as to how this actually works? (let [{first-thing 0, last-thing 3} '[a b c d]]

15:38 [first-thing last-thing])

15:38 chouser: that's not actually new

15:38 technomancy: danlarkin: tell it to the bot, man.

15:39 lenw: hi all

15:39 Raynes: $learn donkey-balls http://www.bay-of-fundie.com/img/2009/donkey-balls2.gif

15:39 sexpbot: My memory is more powerful than M-x butterfly. I wont forget it.

15:39 Raynes: ;)

15:39 tomoj: naeu: do you understand (let [{foo :f, bar :b} {:f 1 :b 2}] [foo bar]) ?

15:40 chouser: (let [{a 0, b 3} ...]) will use get to look up values for a and b using the keys 0 and 3

15:40 and get works fine on vectors.

15:40 ,(get '[a b c d] 3)

15:40 clojurebot: d

15:40 naeu: tomoj: I can see how it works, but I don't understand it.

15:40 tomoj: oh

15:40 maybe chouser will explain it to you :)

15:41 chouser: hmph. thought I just did.

15:41 tomoj: I suppose so

15:41 are the bot wars over?

15:42 lenw: simple question : whats the best way to poll an email folder every x minutes ?

15:42 tcrayford: use loop with Thread/sleep maybe?

15:42 lenw: yeah thats what i am doing now :)

15:43 chouser: what do you do with the results? could use repeatdly on a fn that polls and sleeps

15:43 naeu: I guess the thing I have to get out of my head is that the first map in the let statement isn't assigning a value to a map, but is really rather a fancy syntactic sugar description of the destructuring of the elements within it such that the let binds stuff to the symbols inside it based on the right hand side structure

15:43 chouser: naeu: sounds like you've got it :-)

15:43 naeu: it's really rather fancy :-)

15:43 lenw: i process the results chouser

15:44 fogus_: chouser: I tried to reword that so it's clear that assoc-destr is not new, but instead kwargs are. I guess it's still confusing :(

15:44 lenw: send them off to another system after digesting them a bit :)

15:45 naeu: ok, so how does this work then: (defn a-fn [& {fname :first, lname :last}]

15:45 [fname lname])

15:46 tcrayford: fogus: who should I talk to about speaking at the clojure conj?

15:46 Bjering: In the process of trying to write something in clojure am looking for good ways to stucture and encapsulate especially any access to stateful java-objects. Here is my start at my current attempt https://gist.github.com/06a497d95eb946ed5b62 it expose me a create method and a write method, the fact that these are delagated to agents I view as an implementation detail. Is this a reasonable approach to clojure application development?

15:48 hiredman: Bjering: are the java objects not thread safe?

15:48 Bjering: hiredman: Its more that they are not pure.

15:48 ie their methods have side effects

15:49 like sending something on a socket...

15:51 yesterdays attempt was a failure with incorrect use of refs. Agents seems like a conceptually nice fit. Will see when I get further if the implementation looks good. What I am thinking now is just that I should ask so I dont miss any abvois pattern/style-guides I should follow.

15:52 naeu: in the case of the varags fn does the let binding happen in the reverse formation as it appears in the definition? i.e. does [& {fname :first, lname :last}] gets turned into the equivalent of (let {fname :first, lname :last} {arg1 arg2 arg3 arg4}])

15:52 chouser: Bjering: you really want pods

15:53 fogus_: tcrayford: Did you see Stuart's post on the Google Group?

15:53 Bjering: For example, I can see myself using the idiom with a public function encapsulating the send to an agent with a private pure function over and over again. Is this something common, if so is there an accepted name-conventions I should use, like one used to use foo-iter inside foo in scheme. ?

15:53 AWizzArd: chouser: I didn’t follow that discussion, but: are Cells now called Pods?

15:53 chouser: AWizzArd: yes

15:53 AWizzArd: k

15:56 Bjering: Are these pods something I can use for production code now? (1.2) Or something that will come later?

15:57 naeu: Bjering: pods are still in the design stage

15:57 Bjering: lol... google clojure pods gave me this irc log 3 min ago....

15:57 ordnungswidrig: chouser: just joined the discussion, do you have a pointer about pods and pods with non-pure java objects?

15:57 Bjering: that happened to me yesterday :)

15:58 Bjering: So, until then, is this agent as monitor approach accepted wisdom or is it a bad idea?

15:58 edbond: why clutch :map function returns vector of vector?

16:01 chouser: ordnungswidrig: not really. I don't know if any code is available either.

16:01 clojurebot: cells?

16:01 clojurebot: cells is http://gist.github.com/306174

16:01 chouser: oh look -- code!

16:02 * slyrus keeps expecting #[...] to work

16:02 chouser: as what?

16:03 slyrus: #(vector ...)

16:03 chouser: ah

16:03 raek: Bjering: interesting question

16:04 slyrus: I've made the same mistake of expecting that to work dozens of times...

16:04 chouser: Bjering: it's certainly been done before. agents are idetities, which matches with the mutable java object they hold

16:05 though of course nothing but convention prevents someone for deref'ing the agent and doing any unprotected thing they want.

16:05 raek: I think that the pure function part should always be defined explicitly

16:06 that the function that is sent to the agent should have it's own (maybe private) name

16:06 at least that makes testing much more simpler, in my experience

16:07 tcrayford: fogus: should I just respond there?

16:07 Bjering: raek: Only that in my case the "pure" function is distincly un-pure in that it is its side-effect I am after.

16:08 raek: hrm, I see

16:08 Bjering: raek: My do-write: https://gist.github.com/06a497d95eb946ed5b62

16:12 edbond: is it true clutch view server doesn't run clojure code but translate it to some js?

16:13 arohner: does anyone else find themselves doing (if foo (f bar) bar) a lot? It feels like there should be an idiom for it

16:14 raek: btw, is there a name for the "splitting into a pure and none-pure part" way of doing things I keep thinking about?

16:14 slyrus: yay. (map #(names [(:top %) (:bottom %)]) (vals (configurations (smiles-test/get-molecule "Z-1,2-difluoroethane")))) works :)

16:16 tcrayford: arohner: I've done a tonne of that recently, have been pondering

16:17 arohner: (maybe foo f bar)?

16:18 tcrayford: that'd confuse me (seeing as I use the maybe monad in places)

16:19 (only pred f obj)?

16:21 arohner: tcrayford: what does only signify to you?

16:21 rhudson: (apply-if foo f bar) ?

16:22 tcrayford: rhudson: nice

16:22 arohner: rhudson: I like that

16:22 edbond: why :reduce works in futon, but not in code? http://gist.github.com/538819

16:22 tcrayford: arohner: I don't like only, was just trying to get the wheels turning

16:23 apply-if seems to signify some use of "apply" though

16:24 arohner: tcrayford: so apply it :-) [test f arg & args] `(if test (apply f arg args) arg)

16:25 tcrayford: arohner: that doesn't need to be a macro

16:25 arohner: ah, right

16:25 * tcrayford thinks anyway

16:26 tcrayford: and its tricky working out if pred is run against arg or args

16:26 arohner: IMO, don't run it against anything. pred could be something that isn't a function of arg

16:27 tcrayford: so (apply-if (zero? 0) inc 0) ?

16:28 instead of (apply-if zero? inc 0) ?

16:28 edbond: got it: futon automatically add group=true

16:29 rhudson: (apply-if *paranoid* check whatever)

16:30 tcrayford: that's not bad I guess. My use case is usually that the predicate is always run against the same argument (hence wanted to eliminate duplication there)

16:31 arohner: tcrayford: the code I'm looking at right here isn't a function of arg, so if apply-if doesn't support it, I'll need another function :-)

16:31 slyrus: now I have no excuse not to begin writing the 2d molecule layout routine

16:31 tcrayford: arohner: fair does then.

17:30 wtetzner: ,(let [x "fred"] (fn [] x))

17:30 clojurebot: #<sandbox$eval503264$fn__503265 sandbox$eval503264$fn__503265@92495f>

17:30 wtetzner: ,(.x (let [x "fred"] (fn [] x)))

17:30 clojurebot: java.lang.IllegalArgumentException: No matching field found: x for class sandbox$eval503268$fn__503269

17:32 slyrus: hmm... nested maps are kind of a pain to work with. I'm probably missing something though.

17:32 raek: slyrus: get-in, assoc-in, update-in :)

17:32 wtetzner: ,(map #(.getName %) (.getFields (class (let [x "fred" coolness ['x]] (fn [] [x coolness])))))

17:32 clojurebot: ("__methodImplCache")

17:33 slyrus: oh, thanks raek!

17:33 wtetzner: (.__methodImplCache (class (let [x "fred" coolness ['x]] (fn [] [x coolness])))

17:33 ,(.__methodImplCache (class (let [x "fred" coolness ['x]] (fn [] [x coolness])))

17:33 clojurebot: EOF while reading

17:34 wtetzner: ,(.__methodImplCache (let [x "fred" coolness ['x]] (fn [] [x coolness]))

17:34 clojurebot: EOF while reading

17:38 slyrus: raek: wow. not sure how I got by without those :)

18:48 psykotic: chouser: looks like we got the ownership issue resolved.

18:50 bmh: Does anyone have strong feelings about the testing frameworks available for clojure? I would prefer to use something similar to QuickCheck

18:52 SirNick: I am using Leiningen along with a few java-only jars (not written by me). What's the preferred way of handling such a situation since the jars will likely never be provided on Clojars or anything similar?

18:56 tcrayford: bmh: look at clojurecheck

18:56 SirNick: you can install those jars into your local mvn repo, or add another mvn server for lein to pull from

18:57 slyrus: d'oh... the other bracket/brace related bug I always make is that I expect (key {3 4}) to be 3

18:57 how do I make a single map entry like that?

18:57 tcrayford: single map entries can be made by vectors

18:57 ,(key [3 4])

18:57 clojurebot: java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.util.Map$Entry

18:57 SirNick: tcrayford: I can't say I really know anything about using mvn... How can I add to my local repo?

18:58 slyrus: tcrayford: oh?

18:58 ,(key (first {3 4}))

18:58 clojurebot: 3

18:58 slyrus: that seems ... silly

18:58 tcrayford: ,(vector? (first {3 4}))

18:58 clojurebot: true

18:59 wwmorgan: ,(key (find {3 4} 3))

18:59 clojurebot: 3

18:59 slyrus: ,(class (first {3 4}))

18:59 clojurebot: clojure.lang.MapEntry

18:59 slyrus: ,(class [3 4])

18:59 clojurebot: clojure.lang.PersistentVector

18:59 slyrus: wjat

18:59 what's the handy literal syntax for a MapEntry?

18:59 tcrayford: slyrus: vectors implement clojure.lang.mapentry, but not java.lang.mapentry (for the looks of it)

19:00 slyrus: grumble

19:00 hiredman: huh?

19:00 wwmorgan: ,(key (clojure.lang.MapEntry. 3 4))

19:00 clojurebot: 3

19:00 tcrayford: (I'm guessing here, hiredman probably actually knows)

19:00 hiredman: ,(ancestors (class [1 2]))

19:00 clojurebot: #{java.io.Serializable clojure.lang.IPersistentVector java.lang.Comparable clojure.lang.AFn clojure.lang.Counted clojure.lang.Sequential java.util.RandomAccess clojure.lang.Seqable clojure.lang.IFn java.util.Collection clojure.lang.Reversible clojure.lang.IObj clojure.lang.Associative java.lang.Object clojure.lang.IPersistentStack java.util.List java.util.concurrent.Callable clojure.lang.Indexed clojure.lang.IEditableColle

19:01 hiredman: ,((ancestors (class [1 2])) java.util.MapEntry)

19:01 clojurebot: java.lang.ClassNotFoundException: java.util.MapEntry

19:01 hiredman: ,((ancestors (class [1 2])) java.util.Map$MapEntry)

19:01 clojurebot: java.lang.ClassNotFoundException: java.util.Map$MapEntry

19:01 tcrayford: its Map$Entry

19:01 hiredman: ,((ancestors (class [1 2])) java.util.Map$Entry)

19:01 clojurebot: nil

19:02 hiredman: no kidding

19:02 tcrayford: hence:

19:02 ,(key [1 2])

19:02 clojurebot: java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.util.Map$Entry

19:03 wwmorgan: however, in many situations you can use a vector like a map entry: (reduce conj {} [[1 2] [3 4]]) => {3 4, 1 2}

19:04 tcrayford: yeah, just kinda funny that it doesn't work for key

19:09 __debaser: Hi

19:09 what is the best way to start a clojure 1.2 repl with clojure contrib?

19:09 mvn clojure:repl does not start jline

19:10 arete: IIRC you have to add jline as a dependency and then it will

19:10 __debaser: is java -cp /Users/philipp/Clojure/jline-0.9.5/jline-0_9_5.jar:/Users/philipp/Clojure/clojure-1.2.0/clojure.jar:/Users/philipp/Clojure/clojure-contrib-1.2.0/target/clojure-contrib.jar jline.ConsoleRunner clojure.main

19:10 deprecated?

19:11 this no longer loads contrib

19:12 or what is the best way for starting a repl?

19:13 wwmorgan: __debaser: if you use leiningen then "lein repl" will give you a repl with jline

19:20 slyrus: yay. _now_ we have all of the relative positioning info for complex branched molecules with double bonds.

19:22 bobbytek: so clojure

19:22 why use it over scheme?

19:25 hiredman: bobbytek: can you please go bother everyone in the irc channels of the 64 thousand other langauges you have mentioned and ask them why you should use their language over clojure

19:25 wwmorgan: bobbytek: someone asked that same question yesterday http://clojure-log.n01se.net/date/2010-08-18.html#21:07

19:27 bobbytek: hiredman: no

19:27 But seriously

19:27 I'm floundering around trying to understand where FP fits in

19:27 Any what differentiates all these lisps

19:28 and non-lisps (OCaml, ML, F#)

19:28 It's all very confusing. Some basic context might help

19:28 wwmorgan: http://clojure.org/lisps comparison of CL, Scheme, and Clojure

19:28 bobbytek: thanks my good man

19:32 __debaser: what does my project.clj have to look like?

19:32 (defproject interactive "0.1"

19:32 :dependencies [[org.clojure/clojure

19:32 "1.1.0-master-SNAPSHOT"]

19:32 [org.clojure/clojure-contrib

19:32 "1.0-SNAPSHOT"]]

19:32 :main interactive)

19:40 alienscience: debaser: http://github.com/technomancy/leiningen/blob/master/sample.project.clj

19:48 defn: bobbytek: id be interested to know what you think after reading that

19:50 * slyrus finally discovers why (#{...} ...) beats (= ...)

19:50 slyrus: ,(filter (comp #{:low} :bogosity) [{:name "moose" :bogosity :low} {:name "ape" :bogosity :high}])

19:50 clojurebot: ({:name "moose", :bogosity :low})

19:52 slyrus: or for a more useful example: (map (comp names atoms) (filter (comp #{2} :order) (bonds (smiles-test/get-molecule "tamoxifen"))))

20:14 * kencausey invests in Joy of Clojure

20:21 technomancy: clojurebot: comments is http://www.cc.gatech.edu/computing/classes/cs2360/ghall/style/commenting.html

20:21 clojurebot: Alles klar

20:25 birdspider: hi, I'm new to clojure and wondering if anyone can tell me how to pass a seq of values to a function as arguments

20:26 technomancy: ,(apply + [1 23 4])

20:26 clojurebot: 28

20:26 technomancy: birdspider: try apply ^

20:27 birdspider: technomancy: i.e (apply ^ ["1st" "2nd"]) ??

20:27 technomancy: birdspider: sorry; I mean ^ as in "look at the line above this one" =) just (apply myfunction mysequence)

20:33 birdspider: technomancy: oh my, I thought of everything but applying thisway round :)

20:34 technomancy: birdspider: you can pull them apart in the function as well using destructuring, but that's harder to demonstrate since clojurebot doesn't allow defn

20:35 birdspider: technomancy: thx, I would have another question, if you like, I do see something like this often lately '`(list ~@(seq "a" "b"))' whats up with this

20:35 technomancy: ,((fn [[a b c]] (println "a" a "b" b "c" c)) [1 2 3])

20:35 clojurebot: a 1 b 2 c 3

20:35 birdspider: technomancy: well yes thats like pattern matching in haskel :)

20:35 technomancy, but in my case I have varable args length

20:36 technomancy, that was my problem

20:36 technomancy: ,((fn [a b & c] (println "a" a "b" b "c" c)) 1 2 3 4 5 6)

20:36 clojurebot: a 1 b 2 c (3 4 5 6)

20:36 birdspider: technomancy, so I still would have a seq to pass as args in the end :)

20:38 technomancy, anyway apply solved it prefectly, any idea or good source where I could read up this ` ~@ stuff ?

20:39 technomancy: birdspider: it's called unquote-splice; it's generally used in macros

20:44 birdspider: technomancy: thx for the help, much appreciated, bye

21:27 chouser: psykotic: transfer's done. thanks for your help.

23:26 spewn: Is it possible to add a docstring with defrecord?

23:40 cemerick: chouser: I'm only 15 minutes into looking at this, but it's damn promising so far: http://djproject.sourceforge.net/ns/index.html

23:41 native components involved, but that's almost a good thing

23:43 wooby: that does look awesome

23:47 patrickdlogan: spewn: does not appear so

23:47 ,(doc defrecord)

23:47 clojurebot: "([name [& fields] & opts+specs]); Alpha - subject to change (defrecord name [fields*] options* specs*) Currently there are no options. Each spec consists of a protocol or interface name followed by zero or more method bodies: protocol-or-interface-or-Object (methodName [args*] body)* Dynamically generates compiled bytecode for class with the given name, in a package with the same name as the current namespace, the given f

23:50 spewn: patrickdlogan: I suppose my question was poorly worded. I know it's possible to add a docstring with ^{:doc "foo"}, but is it possible to view it?

23:56 pdk: call doc with the record you defined as the argument spewn?

23:58 spewn: pdk: "Expecting var, but Foo is mapped to class user.Foo"

Logging service provided by n01se.net