#clojure log - Sep 14 2011

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

0:29 michaelr525: hello!

0:38 icey: is there anything like a pep-8 for Clojure?

0:41 jli: icey: not AFAIK. reading clojure code is probably the best thing to do.

0:42 brehaut: icey: not clojure specific, but http://mumble.net/~campbell/scheme/style.txt they are in the right ballpark

0:43 icey: brehaut: thanks, i'll give that a read

0:43 jli: i'm starting to get into reading the clojure source now; which made me realize I've picked up a few bad habits :)

0:44 jli: that's always good :)

0:46 brehaut: icey, the biggest difference between that guide and idiomatic clojure is probably that we use vectors for literal data rather than a list, but the rules otherwise hold

0:48 icey: right now i think my biggest problem is when to apply which technique / decide which style to use

0:49 for example (defn myfun [someinput someother someother]... vs (defn myfun [{:keys [someinput someother etc]}])

0:49 brehaut: icey: so you know that the second is a destructuring right?

0:51 icey: so you'd be passing a composite argument to the fun, whereas the former cas you are passing 3 distinct values

0:52 icey: brehaut: right; i guess i'm just figuring out when it's appropriate to wrap values in maps for consumption by other functions

1:05 amalloy: brehaut: hm, i didn't follow the link to http://blog.romanandreg.com/post/2755301358/on-how-haskells-arrows-might-just-be-function last time. the "split/first" notation looks like a nice generalization/expansion of juxt

1:05 brehaut: amalloy: yeah i think thats reasonable

1:06 amalloy: let's try again. lazybot, are arrows just functions??

1:06 lazybot: amalloy: Definitely not.

1:08 amalloy: ~ping

1:08 clojurebot: PONG!

1:09 brehaut: amalloy: i'd still occasionally like to get something like (***) in clojure. probably (defn *** [& fs] (partial map #(%1 %2) fs))

1:10 hmm thats not quite right

1:10 amalloy: yeah, i think that's actually juxt, isn't it? which that link leads me to think is called &&&

1:10 brehaut: they are similar

1:10 &&& takes two funs and applies them to the same value

1:11 *** takes two funs and apples them to the first and second of its argument respectively

1:11 lazybot: java.lang.Exception: Unable to resolve symbol: && in this context

1:11 amalloy: oh, i see

1:11 brehaut: btw fun fact, did you know clojure does include a builtin that does #(%1 %2), basically funcall?

1:11 brehaut: huh no i didnt

1:11 amalloy: except afaict it was an accident: ##(doc deliver)

1:11 lazybot: ⇒ "([promise val]); Alpha - subject to change. Delivers the supplied value to the promise, releasing any pending derefs. A subsequent call to deliver on a promise will throw an exception."

1:12 brehaut: amalloy: 1.3?

1:13 amalloy: no, it's in 1.2 - it's just that promises happen to be implemented as functions which, when you call them, save their argument. so (deliver promise value) is implemented as (promise value)

1:13 &(deliver inc 10)

1:13 lazybot: ⇒ 11

1:13 brehaut: oh right

1:15 thats very cool

1:15 the problem with *** is that if you gave it a words name it would probably be something like parallel, which is going to confuse everyone

1:15 amalloy: yeah, very cool in the sense that you probably should never do it

1:16 brehaut: hehe

1:23 amalloy: brehaut: you could use a mostly-nonsense name, just to make it easier to talk about the thing

1:23 i hereby (def collude ***)

1:23 brehaut: haha

1:23 fantastic

1:29 jli: can anyone give a sense as to how patches go from jira issues to applied?

1:30 do things need to be brought up on the mailing list or voted on to get attention?

1:30 brehaut: hi joshnz; is the NZ for new zealand?

1:30 joshnz: yup

1:30 brehaut: excellent

1:30 joshnz: you to?

1:30 brehaut: yup; the tron

1:30 joshnz: lol. same here

1:31 brehaut: small world

1:31 joshnz: yup

1:31 what's your day job?

1:31 amalloy: jli: in theory they get attention just from being on jira, eventually

1:31 brehaut: joshnz: self employed web monkey (py/django)

1:32 joshnz: you?

1:34 joshnz: I help build a web app for mental health NGOs. It's in asp.net webforms, and I'm so over it. It's a horrible horrible technology. My journey this year has been exploring other technologies outside Microsoft, and once you're out you don't really want to have anything to do with MS again :)

1:34 Sadly there's not heaps of jobs in hamilton outside MS or Java.

1:34 brehaut: really not

1:35 i was doing webforms, C++ and VBScript (death) at my last job

1:36 and webforms is broken by design

1:36 joshnz: ah. This is a step up from my prior job which was VBA and VB6.... but still. I've even over c#..... too much noise and madness going on that I just don't care about. Lol.

1:36 brehaut: C# 4 is nice, and F# is great

1:36 joshnz: webforms needs to taken out back and shot.

1:37 brehaut: have you been using clojure much?

1:38 joshnz: we are at least using .net 4...but the thing with MS stuff is that if you don't use it exactly the way they intend you to use it, you're in a world of hurt. And often I find it's not how I want to work ;) When you combine it with TFS - which is a terrible source control program and horrible task management system - and all the rest of it, you find life becomes so much harder than it really needs to be. lol

1:39 brehaut: hah yes

1:39 joshnz: No, I haven't don't much at all. I've managed to get emacs set up with swank :)

1:39 brehaut: hah with swank is better than me :P

1:39 joshnz: But I really like the ideas clojure embodies, and lisp in general.

1:40 What's your clojure experience?

1:40 brehaut: ive been using it since about mid 2008 for my side projects

1:40 mostly web stuff

1:43 sean_corfield: i only started with clojure in early 2010 but we're in production with it now and loving it :)

1:43 brehaut: sean_corfield: lucky bastard :P

1:43 joshnz: I'm not sure exactly when I'm going to get around to doing much with clojure. I want to work my way through SICP sometime some also.

1:45 sean_corfield: i'm looking forward to the conj and finding out what others are doing with clojure

1:45 joshnz: brehaut: do you if there's any company in tron that uses ruby/rails for primary development?

1:45 brehaut: sean_corfield: im confident that its only social issues that would stop me actually using clojure on real client sites.

1:45 joshnz: no idea. aquis uses django

1:45 but i dont know if they are doing much these days

1:45 joshnz: The funny thing is that the client shouldn't really care too much. It's just implementation details. What they care about is the finished result doing what they require

1:46 brehaut: joshnz: its not the client who would know; its the other freelancers i work with

1:47 and its fair enough; django is a pretty good fit for a lot of the sites we build and everyone knows it

1:47 i do wish it had enlive though

1:47 joshnz: We have the "we're a MS shop..." issue, despite the fact that MS development tech is typically worse than the rest of the industry. It's like it's a marketing thing, but seems totally misdirected to me.

1:48 sean_corfield: we're using clojure for a lot of stuff... persistence (to mysql and mongodb), searching (against a json-driven search engine), mail delivery log analysis...

1:48 brehaut: i am of the opinion that the hoi polloi of developement is a morass of pain no matter the platform

1:48 sean_corfield: this week we'll take the new search code to production as well as the mysql -> xml -> search engine publisher stuff

1:49 and it'll be clojure 1.3.0-RC0

1:49 brehaut: sean_corfield: are you using clojure sql or clojureql?

1:49 sean_corfield: clojure.java.jdbc - because i maintain it :)

1:49 brehaut: wait. you maintain the sql lib now right/

1:49 sean_corfield: yeah, and i'm a committer on congomongo which we also use

1:50 brehaut: sure

1:50 sean_corfield: basically whatever we have a vested interest in, i try to help with

1:50 brehaut: cool :)

1:50 sean_corfield: and since we're on 1.3, we have a vested interest in getting contrib libraries migrated... hence my constant pushing on that

1:50 brehaut: im slowly porting my site to mysql atm. ive been using clojureql, but ive been considering switching it out

1:51 its been great when it works, but sometimes it just does unexpected thigns and i get totally baffled for ages

1:52 sean_corfield: we wrote a little "orm" (more of a data mapper) on top of c.j.jdbc so we can use that for crud... and it automatically switches to mongodb for tables / collections as needed

1:53 brehaut: ORM is a bit of a funny idea in a functional language :P

1:53 sean_corfield: hence the quotes :)

1:53 brehaut: yeah :)

1:53 joshnz: isn't mysql pretty loose? I saw a video (can't remember where) about it doing mad stuff like allowing nulls in non-null fields or something...

1:53 brehaut: how do you manage schema migrations?

1:53 sean_corfield: we traffic in sequences of maps and handle the relationships in the app layer - so that we can easily integrate with nosql stuff

1:54 currently we're using sql scripts executed by our build script

1:54 for mongodb we're writing clojure tho'

1:54 the sql scripts predate our use of clojure

1:54 brehaut: joshnz: yeah it is; postgresql is a great DB but sometimes its a bit heavy weight.

1:55 joshnz: although how loose depends on the backend you choose for a table

1:58 jli: amalloy: hum. maybe a comment will bring it to the top of the stack.

1:58 amalloy: does voting do anything?

1:59 amalloy: i don't think you can do anything to stop jira from being a bottomless pit of despair. that system makes everything hard

2:00 sean_corfield: well,voting records a vote :) then it's up to the project lead to decide whether votes are worth anything...

2:01 joshnz: really? Jira is is hard to use?

2:01 I installed a trial the other week at work, and it seems so much easier to use than TFS

2:02 brehaut: everything is easier than TFS :P

2:02 pmbauer: *sprinkles holy water at mention of TFS*

2:02 brehaut: thats built on the legacy of source safe. the slowest, most unsafe version control ever :P

2:04 amalloy: joshnz: you should try using github issues. not as all-encompassing as jira, i'm sure, but about a hundred times easier to do anything you could *actually* want to do

2:04 joshnz: It's still not much better. We lose web pages from our project due to auto merges gone wrong fairly regularly. And it's a simply text (xml) merge... and we don't even know they've been excluded!

2:05 amalloy: thanks, I'll look into it. We're not a big dev group (less than 10), so we don't need anything complicated.

2:05 it's just hard to get any change going :)

2:07 amalloy: a couple weeks ago i got tired of being unable to find a list of jira issues i'd reported, and spent 5-15 minutes finding and configuring a "custom issue filter" to find them for me

2:08 seemed like it should be built in already, or at least more discoverable than that

2:08 tsdh: amalloy: Hi Alan.

2:08 joshnz: That's not hard :) Me and another dev separately have written small console apps querying the TFS api directly in an attempt to get the info we need from it. And failed.

2:08 sean_corfield: we use Unfuddle at world singles and we love it (with git)

2:10 brehaut: thanx for the follo

2:10 w

2:10 brehaut: no problem :)

2:12 jli: amalloy: any idea why clojure/core doesn't use github issues?

2:12 I guess jira has support for milestones and releases and sstuff

2:12 tsdh: amalloy: I just got a OverConstrainedVersionException for your ordered library version [0.3,), but trying a second time it worked again. Maven sometimes likes to fool me...

2:12 brehaut: jira's been used since before githubs issues were as good as they are now i recall

2:12 sean_corfield: jira/confluence provides more control over permissions

2:13 jli: I use mantis at work. it's pretty crufty too

2:13 amalloy: what brehaut is certainly true; there may be other reasons as well

2:15 brehaut: we used salesforce at my last gig

2:15 that really underscores everything that was wrong there

2:17 khaliG: could be worse, there is always Trac ;)

2:17 brehaut: surely not

2:17 my memory of trac is mostly reasonable

2:17 bare bones, but reasonable

2:17 amalloy: ah, trac

2:18 i used pivotal tracker at my last job. kinda pretty looking, but some critical missing features, and some "features" that made me want to murder the devs

2:19 sean_corfield: when i worked at adobe, they use perforce and watson :(

2:35 jli: hurray clojurescript! http://circularly.org/mangle/

2:50 thorwil: wow, with a relevant picture from ghost in the shell, i think!

2:57 sgronblo: that's a pretty cool little page

3:02 michaelr525: jli: what's different from the original?

3:07 khaliG: gah, it shouldn't be this difficult to setup slime/swank

3:11 joshnz: khaliG - I went through these issues the other week.

3:12 It's actually quite simple

3:12 khaliG: joshnz, are you using a snapshot emacs now?

3:12 joshnz: What os are you on?

3:12 khaliG: ubuntu amd64

3:12 joshnz: no, I haven't got around to updating yet, but did download it.

3:13 Are you using lein?

3:13 khaliG: yep

3:13 i'm having the same problem as this person http://stackoverflow.com/questions/6506739/slime-mode-error

3:14 clgv: now with clojure 1.3 RC0 - who nows what intrinsics are for?

3:14 joshnz: khaliG I dunno about using the elpa. I suggest just doing it manually, it's not hard.

3:15 khaliG: joshnz, ah i might try that then

3:15 joshnz: khaliG: have you installed clojure-mode? You can get this from the elpa, that worked fine for me. Then simply lein plugin install swank-clojure 1.3.2

3:15 https://github.com/technomancy/swank-clojure

3:15 that's it

3:15 khaliG: joshnz, that's why i'm bothering actually since i want a newer clojure-mode to get jack-in which I didn't have in my elpa one

3:16 joshnz: Have you added marmalade as package source?

3:17 I'm running clojure-mode 1.10.0

3:18 khaliG: joshnz, trying to but it seems the elpa package.el doesn't support other sources

3:19 joshnz: you could just clone the clojure-mode git repo as a quick alternative. The swank-clojure link above suggests this.

3:21 * clgv is happy about CCW just needing a plugin install within eclipse. :)

3:22 joshnz: khaliG: what version of emacs are you running? I understood 24 to include package.el... and otherwise you need to obtain it yourself, since you can't use the elpa since you don't have package.el... chicken and egg syndrome

3:22 khaliG: joshnz, i've got 23 atm

3:23 joshnz: if you Mh v package-archives what do you get?

3:24 zakwilson: I'm having a problem with Apache Commons Mail that the intertubes says can be solved with

3:24 Thread.currentThread().setContextClassLoader( getClass().getClassLoader() )

3:24 That call to getClass() doesn't look like valid Java to me. Is it? How do I translate it in to Clojure if it is?

3:24 thorwil: khaliG, joshnz: this seems to work for adding sources for elpa: http://paste.pocoo.org/show/475682/

3:25 do a package-refresh-contents after changes in that regard

3:26 joshnz: this is what I have in my dotEmacs, via the starter-kit http://paste.pocoo.org/show/475684/

3:26 clgv: zakwilson: the getClass() refers to the instance of the class containing that code

3:30 thorwil: package-install-from-buffer with clojure-mode.el is a nice way to be very sure about the version you end up with

3:31 zakwilson: clgv: oh, because every class inherits from Object and that's a method of Object. I get it.

3:33 clgv: zakwilson: right

3:33 khaliG: joshnz, that didn't work for me.. it was still hitting only tromley

3:34 sorry thorwil not joshnz

3:35 thorwil: khaliG: even with marmalade listed first and after a package-refresh-contents?

3:36 khaliG: yeah

3:36 going to try the starter kit route now :)

3:36 yayitswei: is anybody still maintaining clj-facebook (https://github.com/likestream/clj-facebook) or is there a more recent fbconnect library?

3:37 thorwil: khaliG: strange, but how about skipping that and using package-install-from-buffer, then?

3:37 zakwilson: So I'm still not getting how to call getClass() from Clojure.

3:37 joshnz: khaliG: do you have paredit mode or yaml mode installed?

3:37 khaliG: nope none of those

3:38 amalloy: &(class "")

3:38 lazybot: ⇒ java.lang.String

3:38 amalloy: &(.getClass "")

3:38 lazybot: ⇒ java.lang.String

3:39 joshnz: khaliG: did you try the setup I listed in the paste link of mine above?

3:39 khaliG: joshnz, it didnt like require package

3:39 amalloy: zakwilson: they're using getClass() just to get a reference to the current classloader, it looks like

3:40 hiredman: ,((fn x [] (class x)))

3:40 clojurebot: sandbox$eval10300$x__10301

3:40 amalloy: &((fn f [] (.getClassLoader (class f))))

3:40 lazybot: ⇒ #<DynamicClassLoader clojure.lang.DynamicClassLoader@bf3c44>

3:40 joshnz: khaliG: Is package.el in ~/.emacs.d/ ? Make sure it's on the load path. Dinner for me now. Will be back in about 40 mins or so.

3:41 khaliG: joshnz, lemme double check

3:41 zakwilson: amalloy: thanks. That works, however it doesn't magically make my email send work.

3:42 amalloy: yeah, setting your classloader in order to interface with an email system sounds bona fide ridiculous

3:45 yayitswei: to answer my previous question, this works: https://github.com/maxweber/clj-facebook-graph

3:45 hiredman: zakwilson: what error? missing classes?

3:45 zakwilson: hiredman: javax.activation.UnsupportedDataTypeException no object DCH for MIME type multipart/mixed

3:46 http://blog.hpxn.net/2009/12/02/tomcat-java-6-and-javamail-cant-load-dch/ <-- page suggesting setting the classloader

4:00 clgv: zakwilson: there seem to be two other options

4:02 zakwilson: I just fixed it as you posted that, clgv.

4:02 khaliG: yay i have clojure-jack-in working :)

4:05 spoke too soon, it never brings up a repl lol

4:06 zakwilson: For anyone curious, Java's mailcap file needed to exist and have appropriate entries for multipart types.

4:13 clgv: zakwilson: seems like you can do it programatically as well -> http://www.jguru.com/faq/view.jsp?EID=237257

4:15 zakwilson: clgv: thanks. I found that page and just went with the mailcap solution as initilaly presented without reading the comments about doing it programatically. I added the mailcap thing to the project documentation and am considering it fixed.

4:38 joshnz: khaliG: what's your current status? You still don't get the repl? There should be a *slime* buffer which lists any errors. I had to add lein to my path within emacs

4:39 khaliG: joshnz, i've got a repl now thankfully! but trying to use clojure-jack-in with my existing project didn't bring up a repl - so i need to investigate that

4:40 joshnz: is it a lein project?

4:40 khaliG: it is

4:40 joshnz: with the project.clj file present?

4:41 khaliG: joshnz, yes its a lein project with project.clj

4:41 joshnz: check the relevant slime buffer and see if there are any errors, perhaps?

4:43 khaliG: joshnz, there are no slime buffers, i had a look, and the only other buffer is messages but it just says 'starting swank server'

4:46 joshnz: I get the following buffers: *slime-repl* *swank* and *slime-events*. Oh, you mean you don't get any other buffers on your existing project which doesn't work.... presumably you get these buffers on the new project where you got the repl, of course. silly me.

4:46 khaliG: joshnz, yep! :)

4:47 joshnz: When you exit emacs it will kill the swank process. Perhaps restart emacs and try again incase something got tripped up...? I had to do that once while trying to get it initially set up.

4:48 also, ensure you have a file from that project open in a buffer, and that buffer active when calling jack-in

4:49 khaliG: joshnz, i tried restarting it several times; also had open files from the project, didn't seem to make a difference. i wonder if its to do with lein plugin

4:51 joshnz: what version is the project? Does it use a recent clojure version?

4:51 khaliG: [org.clojure/clojure "1.2.0"] and :dev-dependencies [[swank-clojure "1.3.2"]

4:57 joshnz: Try removing the dev dep on swank-clojure. I don't have it in my test project and can still jack-in. It might be causing issues....?

4:58 khaliG: good idea, lets see

4:58 joshnz: You may need to remove it from the libs dir also, if there's a copy there.

4:58 khaliG: yes, i'll remove those now

4:59 joshnz: Also, check ~/.lein/plugins and remove any older swank plugins that may exist

5:01 khaliG: joshnz, nope no luck. it's funny the cpu fan goes louder just like when starting swank normally

5:01 wait, now i have a new buffer that wasn't there before *swank*

5:02 user=> Connection opened on local port 65203

5:02 #<ServerSocket ServerSocket[addr=localhost/,port=0,localport=65203]>

5:02 but no slime!

5:09 clgv: khaliG: uh, more than 2 hours now - you are pretty persistent on that.

5:09 khaliG: clgv, lol i've been multitasking but yeah i'm giving up hope :P

5:09 joshnz: it's one of those annoying things - it should be simple, but in reality it's not.

5:10 what version of clojure-mode are you running?

5:10 khaliG: 1.10.0 now :)

5:12 clgv: khaliG: and following technomancy's instructions entirely from zero doesnt work?

5:13 cees_: Hi, does anyone know how to create a full-word match in clojure?

5:13 (re-find #"^te*" "test") returns "te"

5:13 and (re-find #"^te*$" "test") returns nil

5:13 khaliG: clgv, it did for new lein projects; just not my existing one for some reason

5:13 clgv: ,(re-find #"^te.*" "test")

5:13 clojurebot: "test"

5:14 clgv: ,(re-find #"^te.*\b" "test bla")

5:14 clojurebot: "test bla"

5:14 clgv: ,(re-find #"^(te.*)\b" "test bla")

5:14 clojurebot: ["test bla" "test bla"]

5:15 clgv: ,(re-find #"^(te.*)\B" "test bla")

5:15 clojurebot: ["test bl" "test bl"]

5:15 clgv: ,(re-find #"^(te.*)\s" "test bla")

5:15 clojurebot: ["test " "test"]

5:16 cees_: Hi clgv. so the ( )\b in the reg-exp should do the trick. What does the \b mean?

5:17 clgv: cees_: no the \“ doesnt - at least not what I wanted ;)

5:17 *\b

5:17 .* does match multiple arbitrary symbols

5:18 cees_: details can be found here -> http://download.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html

5:19 cees_: Oke, I look there. I was hoping for a simple function in clojure that matches whole words instead of parts. That's easier than fiddling with the ^ and $ in the reg-exp.

5:19 clgv, thanks for the help.

5:19 joshnz: khaliG: You could try making a new lein project and copying the contents of the old one in the new dir and trying? I'm really clutching at straws... lol

5:20 clgv: cees_: you might split your string with the whitespaces that separate your words and then run a match on that sequence of words

5:22 cees_: Hi clgv, Done that part already. The problem is to prevent matches of part of the string. So "t*s" should match "tes" but shouldn't match "test".

5:23 clgv: ,(re-find #"(t.*s)" "test")

5:23 clojurebot: ["tes" "tes"]

5:24 khaliG: joshnz, haha, why not!

5:27 joshnz: clgv: if you want to match on tes but not test, you need to end with $

5:28 clgv: joshnz: cees_ wanted to match on "tes"

5:28 joshnz: ,(re-find #"^t.*s$" "test")

5:28 clojurebot: nil

5:28 joshnz: ,(re-find #"^t.*s$" "tes")

5:28 clojurebot: "tes"

5:29 joshnz: match on tes, but not on test. Is that what clgv wanted?

5:29 clgv: joshnz: I know. my example tried to do what I undestood cees_ wanted to do^^

5:30 cees_: ,(re-find #"^t*$" "tes")

5:30 clojurebot: nil

5:30 cees_: while I would expect that this would return a match.

5:30 joshnz: ah, sorry, I mixed up users. I should have been directing that at cees_

5:31 cees_: that doesn't match because t* means zero or more t characters...

5:31 clgv: cees_: I showed you already that you need to use ".*"

5:31 joshnz: ,(re-find #"^t*$" "tttt")

5:31 clojurebot: "tttt"

5:33 cees_: ,(re-find #"^t.*$" "tes")

5:33 clojurebot: "tes"

5:33 cees_: ,(re-find #"^t.e.*$" "tes")

5:33 clojurebot: nil

5:34 cees_: The user provides a simple mask using * and this needs to be translated to a set of matches on a list of strings. It seems like that I hae to do quite some translateions.

5:38 ,(re-find #"^te.*$" "tes")

5:38 clojurebot: "tes"

5:38 joshnz: can you get an example of what the user would enter cees_? Is it a single * per character, or could it be a range?

5:39 khaliG: joshnz, good call. Turns out there was one swank-clojure-1.2.0.jar lying around in dev, i had deleted the 1.3 one but the former went unnoticed. All good now! thanks for the help :)

5:39 joshnz: khaliG: good to hear you got it sorted!

5:40 cees_: The mask are like "*test" or "path*names/te*" etc... (so only the meta-characters that you expect at the linux-shell)

5:40 I think replacement of all "*" with ".*" brings me closer.

5:42 pyr: otherwise for purely analytics type stuff

5:42 joshnz: yeah, I was thinking the same, which might suffice

5:42 pyr: oops

5:43 cees_: joshnz: thanks for the help

6:49 khaliG: is there a way to write this sort of thing neater: (when (= "FOO" (.getName model)) (do-foo (.getName model)) - i wanted to use when-let but since = returns true/false and not the value compared it won't work unless i'm missing some trick

6:50 opqdonut: well you could bind (.getName model) with let

6:50 khaliG: yep

6:50 opqdonut: or use some custom macro :)

6:50 but nothing nicer comes to my mind

6:51 khaliG: when-let got my hopes up - ah well

6:52 kzar: With the -> macro what do you do when you need to use a function that takes arguments in a different order? Say if I want to thread a string through re-seq, the regexp is the second argument not the string

6:54 Oh I could use ->>, sorry

6:57 bsteuber: kzar: and in the general case, if you need -> because of other function, you can add a single function with different args by passing ((fn [x] (my-fn foo x bar))

6:57 one paren missing

6:57 you need the (( before fn, otherwise the expression will be put in the fn form ^^

6:57 kzar: bsteuber: Aha gotya

6:57 bsteuber: Yea I never really got -> and ->> before but it just clicked

6:57 bsteuber: ^^

6:57 also note that inside -> you can use ->>, but not the other way round

6:58 which makes sense when you think about it

6:58 as ->> expects the thing to thread as first param

6:59 kzar: oh yea

7:37 Is there a good example anywhere of how to structure your directory structure for a clojure web app. With Rails it's quite good in that everything has it's place but with this I'm not sure where to put Enlive templates or static files and things like that

8:09 bsteuber: kzar: you might want to use noir

8:10 http://webnoir.org/

8:10 it is built on top of ring/compojure and has some useful defaults

8:38 wunki: for those interested, just open sourced the API written in Clojure for http://www.epis.to

8:38 you can find it here: https://github.com/wunki/episto-api/

8:38 still needs a lot of documentation though

8:39 it's my first Clojure code evah, so feedback is very much appreciated

8:47 kzar: bsteuber: oo cool, that sounds perfect

8:49 Chousuke: wunki: I didn't notice anything extra weird glancing over a couple of the files, but in one place you had a cond with a single clause in it (could use when instead) and (if (not (nil? foo))) ...) in a couple places could be just (if foo ...) couldn't it?

8:50 wunki: Chousuke: yes, I wasn't sure about that list thing if I should check for nil? or if ``if`` would be sufficient

8:52 Chousuke: wunki: explicit nil checks are usually not needed. sometimes you have to differentiate between false and nil though

8:52 wunki: Chousuke: clear, thanks

8:55 Chousuke: in general most (not (nil? foo)) can be replaced with either foo or (boolean foo) if you want a boolean values

8:56 since any non-nil value that is not false is considered truthy

8:57 ,(boolean (Boolean. false)) :P

8:57 clojurebot: false

8:57 Chousuke: hm, that one works it seems

8:57 ,(when (Boolean. false) "test")

8:57 clojurebot: "test"

8:57 Chousuke: right. The point is, don't try to create new Boolean objects :P

9:00 khaliG: Chousuke, i've been enjoying some of the supplementary material referenced in Joy

9:31 clgv: ,(when (boolean (Boolean. false)) "test")

9:31 clojurebot: nil

9:31 clgv: lol hehe

9:59 a java io question: I have long running process that is writing into a file. meanwhile I want to have another program reading from that file to have a look at it during the run of the first process. is there any locking of the OS involved that could throw any kind of exception in my writing process when it wants to write the file and I am currently reading it?

10:10 humm accessing the file with vim meanwhile is working.

10:34 pjstadig: clgv: there are no file locks that I know of in java.io, but there are in java.nio

10:34 actually java.nio.channels.FileLock

10:35 clgv: pjstadig: ok. so if I dont use any I guess I am safe to read from the file without interupting the write process

10:35 pjstadig: clgv: sure, i'd guess all bets are off as to what you might see, half written data, etc.

10:36 clgv: pjstadig: I can skip the last dataset that was not read correctly, since it's only intended for getting a temporary view.

11:06 mattmitchell: Could someone tell me why this works: ({:id 1} :id) => 1

11:06 I knew that (:id {:id 1}) worked, but the other way around... Is there an advantage to one over the other?

11:07 TimMc: mattmitchell: Maps are functions of keys to values.

11:07 Use whichever is more appropriate.

11:07 joegallo: hey, there was a blog post somewhere a while back about how protocols are commonly used wrong. it particularly was calling out the definition of functions that happen to be implemented in terms of a protocol at a low level, but are not themselves members of the protocol (as the right way to do things). does that jog anybody's memory?

11:08 google leaves me unsatisfied so far

11:08 mattmitchell: TimMc: OK thanks, I think I knew that but seeing it threw me off a bit.

11:08 TimMc: mattmitchell: (:id ...) says "I want the value of the :id field", (my-map ...) says "use this as a lookup table".

11:09 mattmitchell: TimMc: OK thanks

11:09 TimMc: mattmitchell: Also consider if your key or your map might be nil -- rearrange or guard appropriately.

11:09 cemerick: mattmitchell: (:key map) is generally more idiomatic IMO, FWIW

11:10 mattmitchell: good to know, thanks

11:10 clgv: mattmitchell: the idiomatic way is to use (:id my-map)

11:10 TimMc: I think it really depends on what you know about the key and the map.

11:11 If you have a literal keyword, definitely (:id my-map)

11:20 manutter: joegallo: that sounds faintly familiar, have you skimmed back through old posts at disclojure.org? Might be a link there

11:20 joegallo: yeah, i'm back to aug 2.

11:21 and still looking :(

11:23 jweiss: technomancy: i saw you updated serializable-fn, was hoping it would fix the NPE you get if the fn is returned from within a defn form: (defn abc [] (serializable.fn/fn [x] (+ 1 x)))

11:24 pjstadig: joegallo: this? http://kotka.de/blog/2011/07/Separation_of_concerns.html

11:24 joegallo: SO GOOD! Thanks, pjstadig!

11:24 How'd you find that?

11:24 pjstadig: i have a mind like a steele trap

11:25 joegallo: ba-zing!

11:44 leeda: how do I send post data with clj-http? This isn't working: (http/post "http://localhost:8080/test" {:body "abc=def"})

11:44 and neither is: (http/post "http://localhost:8080/test" {:body (.getBytes "abc=def")})

11:45 mdeboard: hm

11:45 leeda: https://github.com/mattdeboard/clj-usdol/blob/master/src/clj_usdol/core.clj#L54

11:45 mine's GET but

11:45 really no idea, but maybe that snippet will help I guess

11:46 leeda: that's not POST nor is it sending any data...

11:46 st3fan: leeda how is it not working?

11:46 leeda: GET requests are working fine for me

11:46 st3fan: the server doesn't receive the data

11:47 st3fan: there is a POST example on http://mmcgrana.github.com/2010/08/clj-http-clojure-http-client.html but it is pretty much what you have

11:47 except they also specified the content-type

11:47 manutter: content-type might be a key there

11:47 leeda: oh wow, that worked...

11:47 that's annoying but ok

11:48 probably an HTTP thing rather than an issue with clj-http

11:48 st3fan: maybe it needs to be multipart?

11:48 mdeboard: Yes that's how HTTP works, if you'd actually looked at my code snippet you'd have realized you have to send a header

11:48 st3fan: x-form-blah-something

11:48 mdeboard: instead of dismissing it shittily.

11:48 leeda: mdeboard: haha ok man.

11:49 mdeboard: your snippet has nothing to do with this.

11:49 mdeboard: ok

12:11 leeda: oh actually, Content-Type: application/x-www-form-urlencoded header is required

12:27 mdeboard: :|

12:27 ifesdjeen: hi, does anyone know how to define a protocol with optional params?

12:27 it's possible to define protocol implementation with optional params

12:27 but not the defprotocol thing :/

12:28 for instance, that's possible in extend-protocol: [^String blob-id & { :keys [output-format, frame-size, codec] :or { output-format "avi", frame-size "qvga", codec "ffodivx" } }]

12:28 but defprotocol accepts only things like [blob-id], and that's it...

12:28 i'm not quite sure what would be the syntax for that...

12:29 mdeboard: ifesdjeen: How would a protocol with optional params work?

12:30 ifesdjeen: mdeboard: quite easily, if you pass/define keys, it uses whatever you passed, otherwise it just uses defaults

12:31 the same way usual function definition works, i'd suppose mdeboard

12:31 mdeboard: i see, I've never defined a protocol so I was thinking you'd have to at least pass a message

12:31 ifesdjeen: i mean - it picks up my optional arguments, taking default ones, that's for sure

12:31 but whenever i try to pass one of params, it says it cant find a protocol, which is quite true, since signature differs...

12:32 ok..

12:33 manutter: ifesdjeen: I don't know much about protocols, but I think I remember overhearing that you can't define a protocol with optional params, HOWEVER

12:33 you can define a function with optional params, and have that *call* your protocol

12:33 http://kotka.de/blog/2011/07/Separation_of_concerns.html

12:34 ifesdjeen: manutter: ok..

12:34 bsteuber: yes I think so, too

12:34 ifesdjeen: ok, thanks guys

12:34 it really helps!

12:34 manutter: :)

12:35 ifesdjeen: but it's still quite weird to me why default values get picked up..

12:35 jweiss: does &env not include arguments passed to the enclosing fn?

12:36 ifesdjeen: not sure...

12:39 manutter: jweiss: do you mean the arguments defined for the enclosing fn at read time, or the arguments actually passed to the fn at run time?

12:39 jweiss: manutter: run time

12:40 it looks like they are indeed part of &env, but seems like i can get the actual values of bindings set with (let []) but not arguments to the enclosing fn

12:41 manutter: hmm, I was going to suspect that &env was a read-time thingy, but reading up on it, it doesn't look that way

12:42 jweiss: i guess what i'm asking, is 'are args passed to the enclosing function set as LocalBinding values in &env the way they'd be if the enclosing form was a let'?

12:42 it appears to be no, but i'm not sure if there's a good reason for this

12:46 manutter: jweiss: I'm reading the post at http://blog.jayfields.com/2011/02/clojure-and.html, and playing in my local repl

12:46 since none of the bots will let you defmacro ;)

12:46 jweiss: manutter: that's exactly the page i'm looking at :)

12:46 manutter: when I define the (show-env) macro, and do ((fn [a b] (show-env)) 1 2), I get a and b in the printout

12:46 jweiss: i'm trying to improve the serializable-fn library so that it works with fn's inside defn forms

12:47 manutter: that sounds cool

12:47 jweiss: the current version will throw NPE's. I have a fix for the NPE, but i don't get nicely wrapped let's for the args in the defn like i would expect

12:48 somehow variables bound with a let are different than ones bound as a fn arg.

12:49 TimMc: yup

12:50 jweiss: yeah i guess that makes sense in a way, (let [x 3] ...) you know the value of x at compile time. you won't know the value of the fn arg

12:50 naeu: so, I'm trying to use the new contrib stuff - how do I get them as a dependency for my project?

12:50 khaliG: I wish clojure had objects, it's annoying wrapping closure thingies in vectors to pass around

12:51 naeu: I tried doing somethign like this in my project.clj: [org.clojure/core.incubator "0.1.1-SNAPSHOT"]

12:52 The new contrib documentation seems to be quite fragmented - and geared towards contributors rather than users

12:52 Does anyone know of a resource that tells me "If you want to use contrib X this is what you have to do..."

12:53 TimMc: khaliG: What do you mean? Clojure has objects.

12:53 khaliG: TimMc, it does?

12:53 TimMc: Uh, yeah... everything.

12:53 khaliG: oh in the sense that C has objects? right not the kind i had in mind :P

12:53 jweiss: i think khaliG wants to do object oriented

12:53 TimMc: khaliG: You know about defrecord?

12:54 khaliG: jweiss, yep but not so much oriented

12:54 TimMc: And you can do deftype if you need methods attached.

12:54 (Or wait, can defrecord take methods?)

12:54 khaliG: TimMc, vaguely, i stopped using them when i read their usage is frowned upon

12:55 TimMc: Who told you that?

12:55 Vinzent: TimMc, why methods, we have protocols!

12:55 khaliG: i can't remember :/ it was in the channel

12:56 TimMc: Vinzent: True, if you don't need Java interop.

12:57 technomancy: naeu: there's a page on confluence and a thread on the clojure mailing list about that

12:57 naeu: technomancy: I read the page on confluence, and am now working through the mailing list

12:58 technomancy: so is it the case that the new contrib stuff isn't accessible in maven yet?

12:58 technomancy: naeu: I think it varies. the vast majority should be there though.

12:58 naeu: ok, so take the incubator as an example

12:58 I know that the new ns is clojure.core.incubator

12:59 but I don't know what the maven name and current version are - is there a simple way of finding that out?

12:59 technomancy: lein search --update && lein search incubator

13:01 naeu: interesting, is it typical for `lein search --update` to take a good long while?

13:02 technomancy: yeah, the maven index mirrors are often slow

13:03 naeu: ok, it just looks hung that's all

13:04 going for dinner now, hopefully it'll be finished when I am

13:04 Vinzent: today lein search took about 10 min for me

13:04 at "Downloading index from central "

13:05 manutter: fess up: how many other lurkers all hit "lein search --update" when technomancy posted?

13:05 :)

13:07 technomancy: manutter: that must be why it's so slow--everyone hopping on at once =)

13:32 duncanm: dnolen: what do you mean by mapping problem?

13:33 dnolen: duncanm: Gregor Kiczales OOPLSA '94 talk, http://www2.parc.com/csl/groups/sda/projects/oi/towards-talk/transcript.html, as well much of the Art of the Metaobject Protocol.

13:34 duncanm: ahhh

13:34 dnolen: yes yes, i read that, that's a good talk - i wish there were a recording of it

13:35 dnolen: duncanm: yeah, at least the slides are there

14:05 core.logic with constraint logic programming additions is gonna be cool.

14:06 joly: dnolen: how soon will CLP be coming?

14:07 nickik: I just started a CS repl (with the browser) it says it started to listen to port 9000 and switched the namespace to "ClojureScript:cljs.user>" but when I enter something nothing happens.

14:08 kjeldahl`: Any pointers to recent articles that explain the whole ^:dynamic changes with examples? I'm strugglig to get rid of some warnings...

14:09 dnolen: joly: probably before the Conj. So a month or so I think.

14:09 joly: dnolen: nice

14:11 mdeboard: dnolen: I just watched your preso on the (match) library(?) from last month. I'm in a discrete math class so it was pretty awesome hearing about clojure.core.logic and predicate matching and Prolog. Definitely had no idea Prolog was anything but a toy db :P

14:12 amalloy: i wish i had so many toys i had to put them into a db

14:12 anttih: nickik: I have the same problem. No idea.

14:13 mdeboard: sextoy database

14:14 anttih: nickik: are you using a custom HTML page of some of those samples?

14:14 nickik: no

14:15 anttih: nickik: ?

14:18 nickik: @anttih Im not sure what you mean I just followd the Browser Repl read me.

14:23 kjeldahl`: Nevermind; clojureql was to blame, and not my code (we both had stuff named "db" which confused me quite a bit).

14:24 nickik: Im confused. Should the browser-repl be on the consol or on the

14:25 * or in the browser.

14:27 i got it now.

14:36 charlls: heyo

15:41 mattmitchell: I have an ugly way to convert nil items in a hash-map to an empty string, what would be the most idiomatic way to do this?

15:42 amalloy: probably to not do it

15:43 pcavs: haha, yeah, I'm not sure what your goal is here mattmitchell

15:49 thorwil: mattmitchell: perhaps (map #(or % "") m) but i does sound suspicious

15:49 bhenry: thorwil: i don't think that would work

15:49 not on a hashmap

15:50 mattmitchell: Well I have a problem where an underlying library blows up when I pass in a nil value. It likes empty strings, but removing the keys altogether works fine too.

15:51 bhenry: ,(into {} (map (fn [k v] (if (nil? v) [k ""] [k v])) {:a 1 :b nil}))

15:51 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox$eval10856$fn>

15:51 bhenry: ,(into {} (map (fn [[k v]] (if (nil? v) [k ""] [k v])) {:a 1 :b nil}))

15:51 clojurebot: {:a 1, :b ""}

15:51 bhenry: certainly yours can't be that ugly

15:52 amalloy: again, there are lots of ways to do the basic task, such as ##(into {} (remove (comp nil? val) {:a 1 :b nil}))

15:52 lazybot: ⇒ {:a 1}

15:53 mattmitchell: Very similar actually :) But I decided to just chuck the nil pairs instead, and that made it simpler.

15:53 kharrington: ,(doc replace)

15:53 clojurebot: "([smap coll]); Given a map of replacement pairs and a vector/collection, returns a vector/seq with any elements = a key in smap replaced with the corresponding val in smap"

15:55 mattmitchell: ,(replace {nil nil} [{:id 1 :val ""}])

15:55 clojurebot: [{:val "", :id 1}]

15:56 kharrington: ,(replace {nil ""} [{:id 1 :val nil}])

15:56 clojurebot: [{:val nil, :id 1}]

15:56 kharrington: err not in the []'s though

15:56 i was doing it with a zipmap actually : X

15:57 bhenry: ,(replace {nil ""} {:id 1 :val nil})

15:57 clojurebot: ([:val nil] [:id 1])

15:57 bhenry: not quite.

15:57 kharrington: i think amalloy's wins, mine works if you use the replace on the vals of the map

15:59 ,(let [m {:a nil :b "foo" :c "bar" :d nil}] (zipmap (keys m) (replace {nil ""} (vals m))))

15:59 clojurebot: {:d "", :b "foo", :c "bar", :a ""}

16:09 robermann: hello. Which IDE / shell do you prefer to work with when programming Clojure?

16:09 tufflaks: Most people prefer emacs robermann

16:09 bpr: ^

16:10 pcavs: emacs + clojure-mode + swank-clojure + lein is the usual route

16:10 kharrington: does anyone use clooj?

16:10 robermann: emacs on Windows?

16:10 joly: I've been using Counterclockwise + lein, but emacs is the more common route

16:10 cemerick: robermann: If you ask 10 people, you'll get 11 answers.

16:10 Vinzent: robermann, eclipse would be just fine imo

16:11 robermann: I know cemerick, but knowing what most people use / suggest could speed my way

16:12 tufflaks: I use vim myself, it works decently

16:12 cemerick: robermann: some actual data here FWIW http://cemerick.com/2011/07/11/results-of-the-2011-state-of-clojure-survey/

16:13 IMO, it's probably better to use what you're comfortable with, at least while you're starting.

16:14 robermann: Well, I currently I'm using the "lein repl". Tryied Counterclockwise but I'm not confortable with it

16:16 what I don't like of REPL is that it is missing an autoident feature

16:18 TimMc: robermann: I often compose in Emacs and paste into the REPL.

16:18 If you use a REPL attached to Emacs this becomes a lot easier.

16:18 joly: might be worth checking out clooj. It's straightforward and seems to have promise

16:20 jhickner: is anyone using vimclojure with clojure 1.3? I'm trying to get some vim -> browser repl action going but it doesn't look like it works yet.

16:22 tufflaks: browser repl?

16:25 dnolen: tufflaks: ClojureScript lets you use the browser as the evaluation environment

16:26 tufflaks: oh, i haven't tried clojurescript yet

16:27 jhickner: it's pretty great

16:33 dnolen: jhickner: borders on understatement ;)

16:34 robermann_: I'm just trying clojurebox

16:34 http://clojure.bighugh.com/index.html

16:34 great job

16:35 technomancy: dnolen: have you looked at mozrepl at all?

16:35 that was the only thing that made JS bearable for me back when I had to do things in a browser

16:35 wondering how clojurescript's approach compares to that

16:36 dnolen: technomancy: demolishes it

16:36 mozrepl was crap

16:36 no sane workflow

16:36 technomancy: so does it give you access to each separate browser tab as evaluation contexts?

16:37 dnolen: technomancy: no but that's not how I dev client apps anyhow, that's what sucked about mozrepl, finding the window you wanted to work in.

16:37 technomancy: dnolen: oh, well that's kind of crucial for developing browser extensions

16:38 if you're trapped in a single page then it's much more difficult

16:38 dnolen: technomancy: yes, so not really about dev'ing clientside apps - limited utility

16:38 technomancy: well, it's a superset

16:38 jhickner: I suppose each tab could make its own repl connection though couldn't it?

16:38 technomancy: if you have access to the browser innards, it's easy to just find the evaluation context you want for a given page

16:38 dnolen: browser repl also uses googele iframe hack, you can test every browser even IE6

16:38 technomancy: but if you're stuck in a page, that's all you've got

16:38 dnolen: technomancy: limitation to FF makes it worse than useless as well.

16:39 technomancy: well except mozilla is the only platform with a somewhat reasonable extension mechanism =(

16:39 dnolen: technomancy: for serious extensions yes, but Safari and Google exts cover 95% ground.

16:39 technomancy: well call me mister edge-case, because I can't stomach either of those =(

16:40 dnolen: technomancy: I like FF, but mozrepl was a tease, not useful for actual dev. browser repl is.

16:40 technomancy: i actually hate FF

16:41 cemerick: I've never seen a worthwhile Safari extension.

16:41 technomancy: but I like mozilla as a platform

16:41 because it's got its primitives in the right place and uses JS for everything it can

16:41 danlarkin: cemerick: click2flash is a safari extension and I wouldn't browse the web without it

16:41 brehaut: is click2flash an extension now?

16:41 dnolen: technomancy: well I have to use them all, they all have their issues. I'm a Safari man myself.

16:42 cemerick: danlarkin: That's pretty lightweight. My biggest peeve is the lack of corollaries for tree-style tabs (or even vertical tab strips) outside of FF.

16:42 technomancy: tabs... just do not scale

16:42 Raynes: I'm giving Safari a go, but I'm not entirely impressed at this point.

16:42 cemerick: Then there's the AWS stuff, yslow, etc.

16:43 danlarkin: yeah

16:43 no doubt ff has better extensions on the whole

16:43 cemerick: technomancy: I have 72 right now. FF's expose-esque thing in v6 + tree style tabs is very scalable IMO.

16:44 technomancy: cemerick: I added an ido-style buffer switcher to conkeror (the browser I use day to day) so I can just do 0) switch keystroke, 1) type only enough keystrokes needed to uniquely identify my target tab and 2) return.

16:45 * pjstadig wants

16:45 pjstadig: is it in your dotfiles?

16:45 technomancy: pjstadig: it was part of conkeror back in the day, but they've since rewritten it

16:45 the new one is better anyway

16:45 cemerick: technomancy: FWIW, FF's awesome bar does roughly that now.

16:45 technomancy: cemerick: oh does it? that's good news.

16:46 anyway, that's really the only context in which I'm interested in writing JS right now

16:46 but I guess it's understandable that clojurescript isn't targeting that

16:46 cemerick: Yup. Matching history pops up; if a currently-open tab has a match, it's included with a "switch to tab" subtitle.

17:17 jweiss: my swank process has grown to 515mb, any suggestions for common memory leaks? I don't know if things like recompiling namespaces should keep eating more memory (i'd hope not). Seems like as far as data does, once a value is returned to the repl and passes out of the *1 *2 *3 it should be GC'd, right?

17:19 hiredman: jweiss: grown to 515mb in what sense? if you want a smaller max heap size you should specify one

17:19 measuring real memory usage for jvms is not simple

17:19 jweiss: hiredman: in this case i'm looking at 'top' - RES column

17:20 hiredman: yeah, the jvm will just allocate up to max heap amount of ram, and the jvm never lets it go, even if it is not actively using it

17:21 jweiss: hiredman: i see, i'll try a smaller Xmx

17:21 i'm not sure what the default is

17:22 i guess lein swank probably just uses the jvm default

17:23 hiredman: the default depends on 32bit vs 64bit and how much ram you have

17:23 http://stackoverflow.com/questions/2915276/what-is-the-default-maximum-heap-size-for-suns-jvm-from-j2se-6

17:24 jweiss: i get: (-> (Runtime/getRuntime) .maxMemory) 878051328

17:24 878mb, too much for my 4gb system

17:24 * jweiss will try halving

17:37 smnirven: hey folks, im running into a strange error with lein deps, on leiningen

17:38 here's some of the error: class leiningen.core$loading__4414__auto__ overrides final method meta.()Lclojure/lang/IPersistentMap

17:38 basically after lein deps, im unable to do anything with lein

17:39 technomancy: smnirven: it's possible for corrupt plugins to cause issues; try clearing out lib/dev

17:40 smnirven: technomancy: thanks - I tried removing everything in lib and re-running

17:40 technomancy: same effect

17:41 technomancy: smnirven: right, you need to figure out which dependency is corrupt and remove it from project.clj so it doesn't keep downloading it

17:42 probably something involving clojure 1.3 (or possibly 1.1)

17:43 smnirven: technomancy: hey, I noticed that I have clojure 1.2 specified in my project.clj file, but in lib/dev clojure 1.1 is downloaded

17:43 technomancy: I removed those and lein works again

17:44 technomancy: thanks for the help

17:48 technomancy: sure

17:57 solussd: how does clojure represent irrational numbers?

17:59 ssideris: hello, does anyone know whether it's possible to "watch" all namespaces for new defs or re-defs?

18:02 I suppose it's pretty tricky...

18:09 pashields: does anyone have any advice on how to run count(distinct foo) queries with clojureql? For example, how would I output "select count(distinct foo) from bar"

18:59 leeda: hi, i need some help with writing idiomatic tests for an API. the problem i'm having is that most tests need data in a certain state before they run, but if i split into separate tests, i have to recreate the data and prepare it to the desired state before i test anything in each function.

19:01 Here's some code to show what I mean: https://gist.github.com/78d179586da96cb7406a

19:03 how can i split this up into post-task, accept-task, complete-task tests?

19:05 hiredman: http://richhickey.github.com/clojure/clojure.test-api.html#clojure.test/use-fixtures

19:05 leeda: hiredman: aha, cool!

19:55 dnolen: technomancy: I take it you've never done any serious JS development ;) Refreshing the browser means reinitializing a bunch of state.

19:56 your page may have tons of images, assets, scripts, who knows, other sources of network latency, etc.

19:57 I've written around 200,000 lines of JavaScript in 6 years. Yes, refreshing the browser is a pain.

20:07 technomancy: dnolen: sure, and that's why mozrepl helps. I understand you're excited, but it's not like interactive development in a browser is a new thing.

20:08 dnolen: technomancy: mozrepl is not development environment. There's this crazy thing called the DOM and it's not the same across browsers.

20:10 mdeboard: I don't like it when mom and dad fight

20:10 technomancy: I guess I'm just a little burned out on breathless advocacy. ClojureScript is great, but that doesn't mean everything that came before was crap.

20:10 tomoj: anyone gotten clojure-protobuf working with leiningen?

20:10 dnolen: technomancy: MozRepl is completely irrelevant to the conversation is all.

20:11 technomancy: dnolen: depends how much of your time is spent debugging cross-browser issues I guess. for me that was a smaller slice than it is for you I guess.

20:12 dnolen: technomancy: let's say I've lost many unrecoverable hours of life and continue to do so to this day.

20:14 technomancy: like I saw in the promotional materials for Programming Clojure that "Clojure has recently surpassed Scala in relative growth." -- how is that remotely helpful as advocacy?

20:14 let's take a deep breath and have some perspective.

20:14 dnolen: technomancy: as far as advocacy. To each his own. I'm jumping up and down cause everything that came before is actually pitiful … IMO. JS / DOM is innately hostile. Clojure solves that. No one else is even trying.

20:14 technomancy: because Mirah totally trounces Clojure in terms of relative growth

20:15 dnolen: technomancy: don't really see what that has to do w/ my perspective as a JS dev, saying here's a better tool … pay attention.

20:20 technomancy: as an outsider it's pretty easy to dismiss advocacy that claims no one else is even trying.

20:20 dnolen: technomancy: can't do anything about that. Same way some backend folks don't get what the big deal about Clojure is.

20:21 and I've already pointed out specific problems, not hand waving here.

20:24 I agree that "no one else is even trying", that's harsh. What I really meant was that - they're hands are tied they can't actually fix the problem.

20:29 technomancy: sure, that's more reasonable

20:47 TimMc: dnolen: Is there somewhere clojure.browser.dom is documented?

20:50 dnolen: TimMc: not that I'm aware of. But there's not a whole lot there. I recommended just using Google Closure directly. I think it's going to take a lot of thinking to figure out what the best way to deal w/ the DOM is.

20:50 TimMc: OK

20:51 I hadn't realized just how young this project is.

20:51 dnolen: TimMc: dealing w/ the DOM is a real challenge - you have string, templates, and actually DOM, perhaps they can be unified.

20:52 TimMc: No question about that.

20:52 (The challenge, that is.)

20:53 dnolen: I'm thinking this is a good opportunity to see if Out of the Tarpit can translate here.

21:30 mdal1: register

21:31 register leenam mukdal.wt@gmail.com

21:31 brett_h: mdal1: you may want to /msg NickServ that ...

21:31 mdal1: set hidemail on

21:37 TimMc: mdal1: ...

21:37 gtrak: how do you do require from the cljs repl?

22:16 mmarczyk: hi

22:17 does anybody know what might be causing JSC_DUPLICATE_INPUT errors during ClojureScript compilation?

22:45 ok, figured it out

22:45 not a good idea to put the .cljs sources on the classpath, apparently

23:52 srid: 4clojure issue -- I get "java.io.IOException: couldn't connect to [elephant.local/]" error when connecting to mongo. I think it is failing because the mongo connector uses hostname (not local IP even though that's what I passed) and mongo server refuses connection at that host.

23:53 had to comment out bind-ip from mongo conf file to workaround it.

Logging service provided by n01se.net