#clojure log - Jun 12 2013

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

0:00 Raynes: It's a long drive, devn.

0:00 callen: devn: I'm in MV.

0:00 devn: Raynes: im looking forward to the drive

0:00 callen: I just did the Bay area <---> LA pipe. It's a long drive.

0:00 Raynes: It's true, callen is not an axe murderer.

0:00 He has been in my apartment.

0:00 devn: i enjoy the drive south

0:00 callen: it's a boring drive.

0:00 devn: i disagree :)

0:00 SegFaultAX: callen: Is an axe murderer. I've seen his axe collection.

0:00 * futile sighs

0:00 Raynes: futile: Dude, it's okay.

0:00 apricots: futile: that sounds really neat. didn't realize osx let you build your own window managers

0:00 devn: (-<> futile)

0:00 Raynes: Hugs all around.

0:01 devn: apricots: it doesn't lol

0:01 futile: apricots: it doesn't easily.

0:01 Raynes: devn: Well, cool.

0:01 devn: Ever been to LA before?

0:01 futile: You have to enable Accessibility mode for it to work.

0:01 devn: Raynes: long time ago when i was a wee one

0:01 futile: apricots: which meant I couldn't put it in the App Store.

0:01 callen: SegFaultAX: actually, I should've shown you Katya.

0:01 Raynes: devn: Ever seen the third street promenade and/or Santa Monica pier?

0:01 SegFaultAX: Isn't there a spaces or places or whatever app that does window partitioning for OSX?

0:01 callen: SegFaultAX: I feel like you and Katya would get along.

0:01 devn: ive been to santa monica and carmel

0:02 but im not sure about the promenade

0:02 Raynes: devn: You should come down on a weekend and I can give you the Santa Monica tour grown-up style.

0:02 devn: like i said it's been a long time, so i'm looking forward to looking around

0:02 Raynes: And a tour of the Geni office on the promenade, of course.

0:02 devn: i wanna go to the damned aquarium again

0:02 SegFaultAX: Oh wait, is that was we're talking about?

0:02 callen: SegFaultAX: there's a third party thingamajig for OS X I used to use to split windows. It worked okay.

0:02 devn: in carmel

0:02 callen: I forget the name of it though.

0:03 devn: callen: there are a dozen o fthem

0:03 of them*

0:03 callen: devn: I've used most, I had one in particular I liked.

0:03 Raynes: devn: I don't have a car though, so if you want to hang out you'll have to make like callen and drive me around too. :p

0:03 callen: it worked well for multi-monitor.

0:03 devn: Raynes: im renting one and driving around

0:03 so of course, free rides!

0:03 futile: Aww, someone PMed me an hour ago, but thanks to rcirc I had no idea and now he's offline.

0:03 * futile is gonna run out of sighs soon

0:03 SegFaultAX: Raynes: Santa Monica is fun.

0:04 Raynes: SegFaultAX: I work there. :D

0:04 callen: SegFaultAX: I liked it when I visited.

0:04 Raynes: <3 Santa Monica.

0:04 SegFaultAX: Raynes: I dated a girl whose family lived in Hawthorn so we partied all over that area.

0:04 devn: i gotta run, but Raynes and callen -- i'll bug you guys closer to my arrival. let's write some codes and hang out.

0:04 cheers all

0:04 SegFaultAX: (Btw, Hawthorn is the fucking ghetto)

0:04 Raynes: devn: Cheers

0:04 futile: Cya devn

0:04 SegFaultAX: And she had friends who lived in fucking Compton and Inglewood or however it's spelled.

0:04 callen: devn: definitely!

0:05 SegFaultAX: devn: See ya!

0:06 * SegFaultAX wonders if devn knows that Raynes and callen live 600 miles apart.

0:06 SegFaultAX: Err, 300

0:06 Raynes: SegFaultAX: I told him and he said he was looking forward to the drive.

0:06 SegFaultAX: Raynes: That's quite a commute to hack. :)

0:07 futile: ugh. i hate irc. i was so much happier when nobody knew i was crazy

0:12 wei_: is a monad the right tool for a series of side effects where each task could fail? or is there a more clojure-y way to handle this

0:12 seancorfield: back...

0:12 callen: wei_: a monad is a way to possibly accomplish what you described.

0:12 seancorfield: SF->LA is a nice "zen" drive... I like I-5... very relaxing!

0:13 callen: seancorfield: I actually recited zen koans and listened to podcasts when I was driving to and fro.

0:13 seancorfield: My wife lived in Santa Monica when she was at Pepperdine and most weekends she drove back up to the Bay Area to hang with friends because she hated LA so much :)

0:13 SegFaultAX: seancorfield: You're like the only person ever who likes I-5. Woohoo 280 miles of orchards and cows!

0:13 callen: seancorfield: that's some impressive hatred for LA.

0:13 seancorfield: I've driven nearly all 1,500 miles of it

0:14 SegFaultAX: seancorfield: You too!? :)

0:14 seancorfield: we do LA for the weekend pretty often for cat shows

0:14 callen: seancorfield: is cat show a euphemism for strip club?

0:14 seancorfield: we used to drive up to Portland for cat shows too but we haven't been up there for years

0:14 Raynes: I don't get all the LA hate.

0:15 Especially if you live in Santa Monica.

0:15 seancorfield: no, my wife is a cat show judge...

0:15 Raynes: I guess if you like crackheads a whole lot or something.

0:15 SF ftw.

0:15 SegFaultAX: Raynes: You've only been there a short while probably.

0:15 callen: SegFaultAX: yeap.

0:15 SegFaultAX: It's still fresh.

0:15 Raynes: Eh

0:15 wei_: callen: thanks. checking out algo.monads now

0:15 callen: seancorfield: I love cats.

0:15 Raynes: I can't have an opinion on LA until I've lived here how long then, SegFaultAX?

0:15 callen: wei_: there's other stuff worth poking around in for monads, like core.async.

0:16 pmonks: Raynes: until you get pulmonary edema from the smog.

0:16 Should only take a couple of weeks.

0:16 seancorfield: callen: we used to breed Bengals... we still show some... mostly we go to cat shows b/c Jay is judging... which got us to Australia, England, Malta and Russia last year

0:16 Raynes: Have any of you ever lived in Alabama?

0:16 SegFaultAX: Raynes: Until you hate it, naturally. :)

0:16 callen: seancorfield: now I want a kitty in my lap :(

0:16 seancorfield: Some ppl love LA, some ppl hate it. I haven't found many without an opinion...

0:16 SegFaultAX: Raynes: No true scottsman etc.

0:16 Raynes: You can have an opinion on Los Angeles once you've lived there 10 years.

0:16 callen: Raynes: the more I live in cities, the more I'm trapped in them yet hate them.

0:17 seancorfield: callen: http://bangles.com - our cattery site but it's very out of date (since we stopped breeding)

0:17 wei_: my use case is transferring money. make a db entry, wire the money, notify recipients. if any piece fails, i need to abort

0:17 SegFaultAX: wei_: Well in that case you're looking for transactionality.

0:17 callen: wei_: nil = failure + maybe monad == happy funtimes.

0:17 wei_: but yeah, you need rollbacks bro.

0:18 SegFaultAX: wei_: And you probably don't want the maybe monad in that case.

0:18 seancorfield: wei_: you should read http://www.eaipatterns.com/docs/IEEE_Software_Design_2PC.pdf

0:18 callen: seancorfield: easy there killer, don't scare him.

0:18 SegFaultAX: I don't know if there is something like Either already implemented, but you almost certainly want that.

0:18 seancorfield: Your Coffee Shop Does Not Use Two-Phase Commit

0:19 callen: wei_: wait a second, what exactly is this?

0:19 wei_: is this for bitcoin?

0:19 SegFaultAX: seancorfield: That's an excellent article.

0:19 wei_: callen: yes!

0:19 seancorfield: classic piece about why transactions don't scale to real world scenarios ;)

0:19 SegFaultAX: seancorfield: Informative and entertaining.

0:19 wei_: You've been working on this for a while now I think, right?

0:20 seancorfield: ok, I need to go watch TV with my wife and drink wine... I'll be back on my Win8 tablet shortly... (be afwaid, be wery wery afwaid)

0:20 wei_: SegFaultAX: bitcoin-related stuff yes, but new project

0:21 pmonks: Banks use an interesting alternative for 2PC that might be worth looking into.

0:21 SegFaultAX: wei_: So here's the rub. Merely having monads doesn't imply anything about distributed transactions (which is what you're really looking for)

0:21 wei_: Monads are more like plumbing in that sense. You'll still have quite a lot of other synchronization work ahead of you.

0:21 pmonks: Basically each step in the process returns a "rollback callback" that can be called for to rollback the txn.

0:22 tomjack: Either is implemented via zero code, right?

0:22 pmonks: So if step N fails, you can call the rollback callbacks for steps 0..N-1

0:22 tomjack: and is broken in a similar way to the Maybe we didn't implement

0:22 SegFaultAX: pmonks: You mean N-1..0

0:23 callen: wei_: well okay so first thing

0:23 SegFaultAX: pmonks: You want to unwind the transaction.

0:23 callen: wei_: if you're not an expert at security and you actually plan to handle other peoples' money (bitcoin), you're fucked

0:23 pmonks: Yeah - it's basically just a way to generalise compensating transactions.

0:23 callen: wei_: you will get hacked, you will lose their money, and it will be your fault.

0:23 wei_: but if this is just a learning project, god bless.

0:23 wei_: well, for the actual transactions I'm using an API

0:23 pmonks: Order shouldn't matter (the assumption being that the callbacks can't fail)

0:24 callen: wei_: then why do you need to...implement...

0:24 pmonks: It's basically 2PC but without all the standards rigmarole.

0:24 (and your code is the txn mgr - there's not some 3rd party software doing that)

0:25 SegFaultAX: wei_: Doesn't matter, you still need to manage the distributed transactions so you can stay in sync with whomever actually /is/ processing the transactions.

0:25 wei_: SegFaultAX: yes, that's true

0:27 SegFaultAX: wei_: Read that article on 2 phase commit. It's a gem.

0:27 Honest.

0:27 wei_: thanks

0:28 SegFaultAX: wei_: (It isn't sufficient to get you started, but it will at least give you a groundwork in how others have tried and failed to do what you're about to attempt)

0:28 SeanCorfield: win8 tablet in the house :)

0:33 callen: SeanCorfield: I don't know how you can type on those things.

0:34 SeanCorfield: Pretty well really. It's a Dell XPS 12

0:34 callen: so it's a laptop?

0:34 SeanCorfield: A convertible

0:34 Using it in tablet mode right now

0:36 wei_: are you the guy from the Bay Area meetup that showed off the Bitcoin scratch game?

0:37 wei_: yes that's me

0:38 SeanCorfield: Cool. That was a great demo!

0:39 wei_: thanks! so far my projects have all been learning projects. no sum of money I can't afford to lose :) but appreciate you guys' help with doing things correctly.

0:40 SeanCorfield: Did you go to the last meetup? With Tom Faulhaber... I couldn't make it but it looked like it was very well attended and well received...

0:45 wei_: couldn't make it to the last one unfortunately

0:46 SeanCorfield: No meetup in July in SF. Although San Mateo and the dojo in SF will happen.

0:46 futile: How do you test a testing lib...

0:46 This is confusing

0:47 SeanCorfield: We'll be back in SF for Amit Rathore and Domain Driven Design

0:47 wb futile :)

0:47 futile: Hi.

0:47 I've had bad luck in the past testing my lib using itself.

0:47 Makes things really confusing.

0:47 But testing individual components is also hard.

0:48 And testing the whole thing at once is just crazy.

0:48 What would you guys do?

0:49 SeanCorfield: I'd be tempted to create three parallel test suites, one with clojure.test, one with Expectations, and one with Midje

0:49 That will give you really good insight into each framework as well as highlighting weaknesses

0:50 futile: Hmm. I like that idea a lot.

0:51 Actually that complicates the test base too much.

0:52 Because some of the tests will actually be written in Expectations-like and Midje-like styles.

0:52 So it'll be hard for this test lib and those ones to tell the tests apart.

0:52 For clojure.test I got around it by using test-hook-fn, which I just haven't implemented yet so there's no ambiguity over which lib it's for.

0:52 This is so tricky.

0:53 It's like performing surgery on an armed robber underwater while he's working out.

0:53 SeanCorfield: That's precisely why it's a good idea

0:53 tricky, not surgery

0:55 if you can't write the test suite in each of the three styles, that's a lack of feeling for what you're trying to create a bedrock for...

0:55 we have clojure.test suites for webdriver, and expectations suites for other stuff

0:56 one of my team is doing the brian marick workshop at lambda jam so i expect us to consider midje as well going forward

0:56 futile: It's just that I'm not a smart guy, so I get confused easily, and keeping things simple and easily understandable has always been my solution to that.

0:56 SeanCorfield: so stretch yourself

0:56 futile: And this plan isn't simple enough for my brain to wrap around.

0:56 SeanCorfield: seriously, this is a great opportunity to grow

0:57 futile: This is one of those places I think tricky techniques should be avoided for everyone's sake.

0:57 Not just mine.

0:57 SeanCorfield: focusing on testability in all three styles will really help you keep things simple and well-designed

1:01 futile: Oops.

1:01 Just realized I hard-coded asserters needing to be macros into the spec.

1:01 So they can give the reporter more info for failures.

1:07 These can't be combined into the function's argslist, can it? https://github.com/evanescence/test2/blob/master/src/test2/run.clj#L39-L40

1:12 ddellacosta: &((fn [{dog :dog cat :cat}] (println (str "DOG: " dog ", CAT: " cat))) {:dog "DOG!" :cat "CAT!"})

1:12 lazybot: ⇒ DOG: DOG!, CAT: CAT! nil

1:12 ddellacosta: futile: does the above help?

1:13 Raynes: DOG! DOG! CAT! CAT! MEOW! WOOF! OMFG

1:13 ddellacosta: ha, for some reason I always end up with animals in my example code

1:13 Raynes: I like to use famous serial killers.

1:13 ddellacosta: I guess it's not that unusual though.

1:14 http://blog.fogus.me/2013/06/04/fun-js-bilby/

1:14 Serial killers! You are sick sir, sick.

1:14 but, that is funny.

1:14 Raynes: &((fn [{toole :toole dahmer :dahmer}] (println (str "TOOLE: " toole ", DAHMER: " dahmer))) {:dog "TOOLE!" :cat "DAHMER!"})

1:14 lazybot: ⇒ TOOLE: , DAHMER: nil

1:15 ddellacosta: hahaha

1:15 nice

1:16 guess you need to map your serial killers not to animals

1:16 that makes sense in some alternate universe

2:54 tomjack: &(let [x 3 y 42] (cond-> x (even? x) inc :else (do y))) ; hmm

2:54 lazybot: java.lang.RuntimeException: Unable to resolve symbol: cond-> in this context

2:54 tomjack: lazybot: :P

2:56 ,(cond-> 3 false :else when)

2:56 clojurebot: #<AssertionError java.lang.AssertionError: Assert failed: (even? (count clauses))>

2:56 tomjack: ,(cond-> 3 false inc :else when)

2:56 clojurebot: nil

3:02 tomjack: https://www.refheap.com/f6d7758b7af3be352b7ad5b0c

3:31 amalloy: tomjack: i don't think that does what you intend

3:32 since cond-> doesn't "stop" at the first truthy test, you are just unconditionally returning (/ (inc y) 10), ignoring the value of x

3:33 tomjack: oh, duh :(

3:33 thanks

3:33 that would have bit me later

3:33 amalloy: personally i don't like cond-> very much

3:34 if it stopped at the first truthy test, it would be easy to write a macro over it that does what cond-> *actually* does; given the current definition of cond-> there's not really any way to get it to stop at the first truthy test

3:34 on top of that, the name strongly implies that it will act like a cond

3:35 tomjack: I remember arguing that threadiness implied that it won't act like cond

3:35 :(

3:36 I think I delete more cond->'s than I keep

3:37 amalloy: tomjack: have you looked at the cond->-like stuff in useful? it's been there for years, and is more flexible than cond-> (although, admittedly, not as pretty)

3:37 tomjack: nope, will do

3:38 I saw some text like "the algebra of arrow macros" somewhere

3:38 but it was a teaser like "feel free to ask me about that"

3:38 amalloy: eg, (fix x even? inc (fn [_] (-> y inc (/ 10))))

3:38 tomjack: fix?

3:38 amalloy: in useful

3:38 tomjack: I mean, what is the connotation?

3:38 repair?

3:38 amalloy: yeah

3:39 "this function wants integers, but sometimes some dope passes a string; fix that with read-string"

3:39 noprompt: amalloy: said who?

3:40 amalloy: me, just now. scroll up about thirty seconds for the genuine original source

3:40 noprompt: hehe, just logged in actually.

3:41 but it's a good coincidence i guess because i was acutally hoping you or Raynes would be on.

3:41 amalloy: $whatis logs

3:41 lazybot: logs is is http://logs.lazybot.org/irc.freenode.net/%23clojure

3:41 noprompt: ah, nice.

3:42 amalloy: though it sounds like you don't actually need the logs

3:42 noprompt: not really but, it's good to know.

3:42 :)

3:43 so that fs code with the macro technique you showed me to conditionally load the java 7 fns.

3:43 tomjack: I think I have looked at useful.fn before

3:43 but forgot it. interesting

3:43 amalloy: tomjack: not much new stuff has gone into useful.fn in a while, but useful.seq has some new gems

3:45 tomjack: rate-limited seems so much simpler than rate-gate

3:45 I wonder why rate-gate is the way it is

3:45 noprompt: amalloy: it's a neat technique, but it feels, eh hackish. i'm wondering if fs could deprecate java 6 in 2.0.0?

3:46 or, well, just what thoughts, if any, you might have regarding that.

3:46 amalloy: ask Raynes. i have no horse in that race

3:46 tomjack: rate-gate?

3:46 noprompt: amalloy: sure thing, thought i'd ask. :)

3:46 Raynes: I've said on multiple occasions that I don't really care about 1.6 support.

3:47 tomjack: https://github.com/jkk/rate-gate/blob/master/src/rate_gate/core.clj

3:47 Raynes: amalloy is the one who brought it up, and you thought it was important enough to fix it.

3:47 :p

3:47 noprompt: Raynes: fixed my tab completion. :)

3:48 Raynes: Nice.

3:49 amalloy: tomjack: rate-gate looks like it's queueing up too-fast requests, rather than discarding them like rate-limit

3:49 tomjack: I don't understand the look in the thread yet

3:49 loop

3:50 amalloy: and also allowing stuff like "five times per minute"

3:50 whereas rate-limit just says "if it's been less than X amount of time since your last call, i won't handle it"

3:50 noprompt: Raynes: i'm still interested in that directory walk problem with the "billions" of files, just haven't had a chance to really get in to it yet.

3:51 Raynes: noprompt: That can be the 2.0.0 where we remove 1.6 support. ;)

3:51 tomjack: oh you have to understand RateGate too :(

3:51 amalloy: I see

3:51 noprompt: Raynes: that's what i was thinking.

3:52 tomjack: and, ah, it's not a concurrent queue, so it can peek and then poll, I get it

3:53 noprompt: Raynes: anyhow, i _finally_ pushed the rest of that patch.

3:53 Raynes: noprompt: I'll merge it tomorrow. Currently watching a depressing documentary about Skid Row.

3:54 noprompt: Raynes: indeed. i can't remember seeing a documentary that wasn't depressing somehow.

3:55 amalloy: you have a horse?

3:55 :P

3:55 callen: Raynes: SF?

3:55 Raynes: callen: Downtown LA.

3:55 amalloy: look again, now i'm in a boat?

3:56 Raynes: amalloy: Don't you wish your man was like m?

3:56 me*

3:56 noprompt: callen: been reading "Language, Logic and Truth" by A.J. Ayers.

3:57 Raynes: callen: The particular documentary is Lost Angeles.

3:59 noprompt: callen: so far it's been a good read and worth the time.

4:01 callen: the book is definitely restoring my interested in reading philosophy again.

4:01 ugh, i'm not even gonna bother trying to correct my typing. ykwim.

4:12 callen: noprompt: :)

4:12 noprompt: now I just need to turn you on to some Foucault and Zen Buddhism.

4:13 tomjack: LEIN_BREAK_CONVENTION= lein new _CARET__LBRACE__COLON___RBRACE_

4:13 callen: tomjack: wut

4:13 noprompt: callen: i stumbled upon Ayers while reading up on NLP oddly enough.

4:15 callen: noprompt: I'm not really an adherent of his particular brand of logical positivism, but it's cool stuff.

4:15 noprompt: callen: but the first chapter of the book is a scathing critique of metaphysics which i ab-so-lutely love.

4:15 callen: noprompt: my fav in that realm is probably Popper.

4:15 noprompt: yeah Ayers was pretty clear-headed about subjects like that.

4:15 noprompt: callen: yeah, i haven't gotten to the parts where he talks about positivism yet, but he has made some mention of it.

4:16 what i love is how he points out that entertaing a discussion on dualism/monism is nonsensical.

4:17 mthvedt: the wikipedia page on monism has 'monad' in the see also section

4:17 noprompt: nice.

4:18 mthvedt: reality is just a monoid in the category of endofunctors, what's the problem?

4:18 noprompt: *for example.

4:19 anyway, good stuff, totally loving it. well worth the $7 i paid for the book.

4:19 dover books generally don't dissapoint.

4:19 although i do have a few dry ones that i just couldn't, for the life of me, get through.

4:20 greek mathematical thought being one.

4:37 samrat: has anyone here used clodiuno?

4:41 tomjack: mthvedt: thanks, I had never heard that

4:49 ro_st: yogthos: are you aware of a ring util fn that gives you a full url suitable for storing as a redirect-after-foo uri?

4:49 ie, composes :uri and :query-string

4:50 i'm busy refactoring our wrap-access-rules to work with 0.6.2 (much nicer api, thanks!)

4:52 found it. ring.util.request/request-url

4:57 ?! it's not in 1.1.8

4:59 callen: ro_st: there isn't a chance in hell yogthos is awake right now.

5:00 ro_st: ignore his away/back thing, I think his cat walks on his keyboard or something.

5:00 clgv: Does enlive support selectors like [:table.class1 :tr.class2]? I always get an empty selection with that one whereas the selection for [:table.class1] is not empty and has the desired <tr> tags with the specified class2.

5:01 ro_st: callen: tx :-)

5:03 clgv: it totally does

5:04 clgv: ro_st: well why does it not work on a table like <table class="class1"><tr class="class2">...</tr></table>?

5:05 I checked that those <tr>s are there

5:05 ro_st: i'm not sure. i just know that it does work for me. we've just refactored part of our views system to use enlive in some places and we defo do this

5:07 clgv: I wanted to use it fro extrating information from a website but I already failed implementing that first selector for the table rows I am interested in

5:07 ro_st: try [:body :table] to see if you get the table?

5:10 clgv: I get the table

5:15 ro_st: oh might that be due to a parsing error? there is a misplaced <input> between the <tr>s

5:15 ro_st: yes, that's quite likely

5:15 if the html is malformed

5:16 clgv: but there is no syntax error. so I'd think tagsoup should be able to handle that

5:16 ro_st: try just selecting :table :tr

5:19 clgv: that way I only get the first <tr> before that stupid <input>. so thats the reason

5:19 amalloy: enlive uses jsoup, not tagsoup

5:19 clgv: well, I do not need those <input>s so I just remove them via regexps

5:20 amalloy: ah ok. does that matter? I read tagsoup somewhere.

5:20 amalloy: i don't think it matters, really

5:20 clgv: actually, I think the parsing is fine except those check constraints like "<input> must not appear between <tr>s"

5:21 amalloy: afaik both of them read in rubbish html, and output valid html

5:21 so there's no way it could produce an <input> in the wrong place

5:22 callen: amalloy: it's like an anti-proof of GIGO.

5:22 Magical.

5:30 clgv: amalooy: hm ok it's pretty weird than. even removing the <input> in advance does not help.. seems to be another error...

5:31 the seletor works in firefox' inspector

5:55 tomjack: interesting.. https://www.refheap.com/c103ad88c6a803aa280acb179

5:55 wonder how well that will actually work out

5:57 https://www.refheap.com/36f68b88fba6e7fa2d6ceac23

6:05 coder11: what's up guys

6:06 can somebody help me with emacs ad clojure setup?

6:18 callen: coder11: github.com/bitemyapp/dotfiles/

6:20 coder11: thanks, callen!

6:21 there is a lot of stuff you have in your .emacs config :)

6:22 callen: coder11: I have 380,000 lines of elisp in my dotfiles repo.

6:25 dnolen: coder11: there's not much do beyond installing clojure-mode and nrepl via the Emacs 24 package manager.

6:25 coder11: I assume you have Leiningen installed

6:28 coder11: dnolen. sure I have lein installed. I've installed clojure-mode and nrepl

6:28 using this tutorial: http://ianeslick.com/2013/05/17/clojure-debugging-13-emacs-nrepl-and-ritz/

6:28 dnolen: coder11: that's a lot more than the basic setup

6:29 coder11: My problem is that i don't have auto-completion in clojur mode

6:29 here is my .emacs config http://pastebin.com/nEiQ3mfw

6:29 dnolen: coder11: k that's more specifc, I don't use autocomplete, someone else might know something about that.

6:31 coder11: I guess I should add auto-complete mode to some sort of list or add a hook. I'm new to emacs and elisp unfortunately

6:31 thanks for help anyway :)

6:32 hyPiRion: coder11: https://github.com/hyPiRion/emacs.d/blob/master/hypirion-clj.el#L20-L23

6:45 coder11: well, it seems like I have ac mode enabled. It works for symbols across one file, But it doesn't auto-complete others. eg. map, reduce, mapcat etc

6:45 callen: coder11: it's not necessarily Clojure aware unless you add that./

6:45 hyPiRion: well, auto-complete cannot do that yet

6:46 (afaik)

6:50 coder11: Well it's definitely not needed for standart clojure functions. But I really want autocomplete to work with other libraries like seesaw

8:32 CookedGryphon: Ugh, does anyone know how to make emacs properly display ansi escape strings? It's really annoying for midje, I want to run autotest in my emacs repl and see the colours

8:32 Surely it should just be a set of font locks? But I can't seem to find anyone anywhere who's done it

8:37 magnars: CookedGryphon: You'll have to find somewhere to hook in `ansi-color-process-output` from the 'ansi-color package. For regular comint buffers, that would be `comint-output-filter-functions, but I'm not sure how nrepl does things.

8:39 CookedGryphon: there's also ansi-color-apply-on-region

8:43 CookedGryphon: thanks for the hints

8:49 BeLucid: I have (what I think) is an interesting little question. In the following code: https://gist.github.com/belucid/5764932 I'm creating a ClojureScript CouchDB view from some Clojure code. To avoid a lot of repetition, I'm creating multiple views using 1 function called from a doseq.

8:50 Here's the dilemma, the var named "type" on line 7 needs to be a string literal by the time it makes it into CouchDB as a view (think of it like a ClojureScript map/reduce stored procedure).

8:51 So... how do I take my string var, and turn it into a string literal?

8:51 Without just repeating that code 3 times w/ different string literals (which works fine by the way)

8:51 any thoughts?

8:56 Here's the version that works fine, but it's pretty obvious why I'm working towards something better: https://gist.github.com/belucid/5764991

9:25 jweiss: is there an example somewhere of a good way to express a list like [a, b, c, (things-named "foo")] - where it's one list but some of the items are described with a single expression?

9:26 i know i can write it just like that, but trying to decide how to expand into the full list. protocol+mapcat?

9:47 Steve973: wow, it's cool to see so many people here

9:48 joegallo: ,(list* 1 2 [3 4 5])

9:48 clojurebot: (1 2 3 4 5)

9:50 jweiss: ,(list* 1 2 [3 4 5] 6)

9:50 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>

9:50 futile: Steve973: most of them are not really here.

9:51 Good morning.

9:51 cbp`: Hi

9:51 Steve973: good morning. I've just begun looking into Clojure. I have the In Action book

9:53 futile: Steve973: I've only heard the Joy of Clojure book is good

10:02 Steve973: futile, I like the Clojure In Action book so far. But I'm only about 50 pages in

10:04 dhm_: i recommend 'clojure programming' by emerick, carper and grand

10:04 xeqi: I've heard good things about clojurebook.com

10:04 babilen: Steve973: I would recommend "Clojure Programming" and "Joy of Clojure"

10:05 Steve973: for those of you who are making the recommendations, have you read Clojure In Action?

10:05 babilen: Yeah, Clojure Programming is one of the best books around.

10:06 Steve973: and have you found it to be lacking in some respect(s)?

10:06 I'm just curious because I'd rather finish it so that the $30 doesn't go to waste ;)

10:06 cbp`: I don't think any book goes beyond clojure 1.3 atm

10:07 dhm_: i have not read clojure in action

10:08 futile: I read the first chapter of Clojure Programming I think, where it gave the example of finding indexes in a string, and gave a Java example and a functional Clojure example.

10:08 That one example really sold me on Clojure.

10:08 VFe: yeah, the only major lacking thing is no recently updated ones for 1.4/1.5, though 1.3 -> 1.5 is less of a jump than 1.1->1.3

10:09 babilen: Steve973: I haven't read "Clojure in Action" (but meant to do it for a while now). I did, however, read "Programming Clojure (1st)" and "Practical Clojure" and strongly prefer "Clojure Programming" -- Currently reading https://leanpub.com/fp-oo and http://www.packtpub.com/clojure-data-analysis-cookbook/book

10:09 VFe: Since a lot of early examples no longer work correctly

10:10 supersym: thats a shame but expected problem with unstable programming interfaces, stuff changes ><

10:12 I like Github allows you to search on code now too, so I look for functions like say defprotocol, or multimethod or defmacro to see how others used them

10:12 babilen: Steve973: I would recommend to eventually read "Programming Clojure" and "The Joy of Clojure" -- The latter is a little bit dated by now, but a book that really explains the "why" rather than the "how" .. quite the eye opener (I think I read it a bit too early and missed out a little) -- http://pragprog.com/book/shcloj2/programming-clojure might be great too, but I haven't read the 2nd edition

10:15 futile: Oh wait, I thought I bought Joy of Clojure but I have Clojure Programming sitting here as a PDF. Oops.

10:28 alandipert: bbloom: is it your intention to require reducers for fipp 0.3+?

10:28 bbloom: i ask becuase the require in fipp.printer makes some things of ours not work (without fiddling) w/ jdk 1.6

10:40 piranha: is there any good library for html form handling? if it matters, I use hiccup for templating

10:47 futile: piranha: compojure makes getting params really easy

10:48 piranha: https://github.com/weavejester/compojure/wiki/Destructuring-Syntax

10:48 piranha: futile: yeah, I'm more interested in skipping all this dance with marking fields which are not correct, displaying errors and similar stuff

10:49 getting data from request is not a problem :)

10:52 clgv: piranha: there were some libs on the mailing list.

10:52 piranha: yep, I'm trying to find them, but no success yet

10:52 ah, https://github.com/codedreams/formula

10:53 found at least one :)

10:53 clgv: http://github.com/alienscience/form-dot-clj

10:53 http://github.com/Kaali/pour

10:54 piranha: clgv: thanks!

10:55 clgv: piranha: "html form validation" was my search phrase

10:55 piranha: heh :) I used 'processing' and that was wrong :))

11:04 mpenet: valip is also nice, lower level, but simple is good

11:05 $google valip

11:05 lazybot: [weavejester/valip · GitHub] https://github.com/weavejester/valip

11:05 futile: technomancy: do you use c.t's ability to call tests from within other tests often? and if so, do you use this in conjunction with fixtures tied to either the inner or outer tests?

11:19 thickey: nice design, re: clojure.org

11:21 gfredericks: futile: I've never once called one test from within another

11:21 seancorfield: mornin'

11:21 gfredericks: that is probably the weirdest advertised feature of c.t from my perspective

11:21 futile: gfredericks: I think most people don't use that feature of clojure.test, but I think technomancy mentioned he does

11:21 seancorfield: Good morning.

11:21 gfredericks: seancorfield: good 10:18

11:22 hyPiRion: good 17:19

11:22 futile: Good 10:19

11:22 gfredericks: US central wins

11:22 futile: woot

11:22 cbp`: mexico central :D

11:22 llasram: That's an unexpected outcome

11:22 futile: I think I'm slightly west of gfredericks by 1 minute

11:22 clgv: good 17:19 as well ;)

11:22 futile: Tie?

11:22 gfredericks: aw crap

11:22 clojurebot: count arities is http://groups.google.com/group/clojure/msg/fb9930ba2a25d2dd

11:22 futile: seancorfield is the tiebreaker

11:22 llasram: I'm going to blame it on all the PST people being asleep and all the EST people being about to head to lunch

11:23 hyPiRion: well, he's certainly not 17:19

11:23 mthvedt: gfredericks: i think the idea is that it's a simpler way of doing test suites

11:23 futile: Woot.

11:23 gfredericks: I assume he's either in US central or the swedernetherdenmarks

11:23 mthvedt: if a test is a group of assertions, why have a separate 'suite' concept

11:23 hyPiRion: gfredericks: Europe in general, really

11:23 gfredericks: mthvedt: rather than grouping via metadata you mean? or namespaces?

11:23 seancorfield: lazybot: UGT is Universal Greeting Time http://www.total-knowledge.com/~ilya/mips/ugt.html

11:23 hyPiRion: seancorfield: clojurebot*

11:23 seancorfield: bah!

11:24 gfredericks: seancorfield: why are time zones always amusing to people?

11:24 seancorfield: clojurebot: UGT is Universal Greeting Time http://www.total-knowledge.com/~ilya/mips/ugt.html

11:24 clojurebot: Ik begrijp

11:24 seancorfield: ~UGT

11:24 clojurebot: UGT is Universal Greeting Time: http://www.total-knowledge.com/~ilya/mips/ugt.html

11:24 mthvedt: gfredericks: yes, the docs advertise using nested tests instead of the default way of running all tests in an ns

11:24 futile: Wow. I really like the idea of UGT.

11:24 Yes, let's move on.

11:25 hyPiRion: seancorfield: that is a nice page and good concept

11:25 * seancorfield is a grizzled veteran of IRC

11:25 seancorfield: I took a decade off tho'... you know, for good behavior...

11:25 * futile used to be one but then got banned from every channel 5 years ago

11:26 futile: seancorfield: me too!

11:26 or the opposite, depending on what you meant

11:26 seancorfield: futile: why am i not surprised? (you got banned)

11:26 futile: seancorfield: because you were *there*

11:26 Anyone going to LambdaJam?

11:26 seancorfield: yes

11:27 and one of my team

11:27 i'm taking vacation to go - we get two conferences a year so i got clojure/west and will go to strange loop

11:27 gfredericks: futile: yep

11:27 hyPiRion: I'm going to conj, which means I can't afford any other conference except EuroClojure

11:28 seancorfield: my whole team went to clojure/west, then other team members chose appnation/internetweek, lambda jam, and clojure/conj

11:28 gfredericks: hyPiRion: aw man now I mant to go

11:28 want*

11:28 seancorfield: i'll be at clojure/conj too - also vacation

11:28 hyPiRion: gfredericks: You won't be thar?

11:28 gfredericks: unlikely; I'll have a newborn at the time

11:29 futile: gfredericks: congrats

11:29 hyPiRion: :D

11:29 gfredericks: thx

11:30 hyPiRion: That's a fair reason to not go

11:30 futile: If my employer can help, I might go. Would be nice to meet some Clojure folks too.

11:30 to #(jam)

11:34 gfredericks: Groupon has some 10 or 15 people going

11:34 afaik at least. I haven't exhaustively asked everybody.

11:48 bbloom: alandipert: in theory it can work w/ lazy seqs, but it would be slower. i have no interest in back porting it myself, but if it's a relatively small patch, i'd consider integrating

11:49 TimMc: gfredericks: We're trying to decide between Lambda Jam, Strange Loop, the Conj, and CUFP. Probably ~ one person to each.

11:51 futile: Hey can someone PM me quick to test this?

11:51 Thanks.

11:51 Okay someone did.

11:55 seancorfield: TimMc: I hope you already have a Strange Loop ticket - they sold out ages ago...

11:55 TimMc: Oh! Hmm.

11:55 Lamda Jam, the Conj, and CUFP. :-P

11:57 gfredericks: TimMc: welp I'll probably be going to just the first

11:58 owengalenjones: if I am including a java file in lein project.clj with src/java but when I run lein repl it says no such namespace, am I correct that I need to aot compile the java?

11:58 sorry, included with :java-source-paths

12:01 terom: owengalenjones: https://github.com/technomancy/leiningen/blob/master/doc/MIXED_PROJECTS.md this may help you

12:04 piranha: mpenet: valip is not bad, but it's a bit frustrating that there is no ready-to-use tool which would help generate hiccup tree with errors and such; it's a fairly basic task which requires quite a bit of manual work if there is no good library...

12:04 juhu_chapa: Hi all!

12:04 gfredericks: juhu_chapa: good (UGT) morning

12:05 juhu_chapa: What does it meaning #' in (meta #' var)

12:05 hyPiRion: juhu_chapa: #'foo is a short form of writing (var foo)

12:05 gfredericks: ,'#'foo

12:05 clojurebot: (var foo)

12:06 XPherior: owengalenjones!

12:07 juhu_chapa: hyPiRion: :O thanks

12:09 technomancy: futile: actually I don't call one test from within another; I just call functions which contain `is` calls from multiple deftests.

12:09 futile: technomancy: perfect.

12:10 technomancy: I guess it depends on how you define test; maybe that counts

12:10 futile: So, nobody uses the "call a test from within a test" feature.

12:10 technomancy: "deftest"

12:10 That was one of the scarier, more confusing features I was worried about not being able to port.

12:11 technomancy: anyway the lib is done, all we need now are extensions that let you migrate away from c.t and the others

12:11 technomancy: (which I'm working on and expect to be done in a few days)

12:18 mthvedt: futile: i think clojure.test tests are the same as your runners.

12:18 futile: mthvedt: oh? how so?

12:18 mthvedt: in that they run code that pushes assertions as side effects, then return a result

12:18 futile: hmm

12:19 mthvedt: per the docs, you can only assert inside a deftest or with-test

12:19 and you make assertions by a side effecting call

12:19 futile: mthvedt: that sounds like the same as my asserters/definers

12:20 mthvedt: in test2, a test-fn is just a function housing some assertions, and they push assertion results side-effectily

12:21 mthvedt: you have to call test-fns to get the assertions to happen though, in both test2 and c.t

12:21 mthvedt: futile: deftest wraps this in a fn that returns test results

12:21 futile: mthvedt: oh!

12:21 thats kinda cool

12:21 mthvedt: futile: https://github.com/clojure/clojure/blob/c6756a8bab137128c8119add29a25b0a88509900/src/clj/clojure/test.clj#L692

12:22 no sorry

12:22 wrong anchor

12:22 hang on

12:22 futile: mthvedt: oh, so deftest is kinda like my run-test-fn: https://github.com/evanescence/test2/blob/master/src/test2/api/runners.clj#L17-L21

12:22 I mean, c.t's deftest wraps c.t assertions in something like my run-test-fn

12:24 mthvedt: futile: i might be wrong--i'm trying to follow the code now

12:25 however, i think that treating test runners as first-class test suites would make it easy to nest, recombine, &c

12:25 futile: mthvedt: im not sure about nesting, but combining tests seems like nothing but trouble

12:26 mthvedt: fuitle: when i worked in big java, being able to group and recombine test suites was a killer feature.

12:26 futile: mthvedt: then what do you mean by "recombine"?

12:26 maybe we have different ideas

12:27 mthvedt: basically, being able to make groups of tests out of other tests or groups of tests.

12:27 in an arbitrary fashion

12:28 futile: mthvedt: but what was the purpose?

12:29 mthvedt: futile: exposing abstractions is its own purpose… but if you have a big app, you might have a unit test suite, then some suites that take longer to run.

12:29 you might also have the DB tests, integration tests, &c.

12:29 futile: mthvedt: okay so one purpose is running only certain tests

12:29 mthvedt: another purpose, it sounds like, is to group related tests for the sake of navigating your test suite

12:29 mthvedt: does this sound right?

12:29 mthvedt: another purpose is running tests under different configurations, and being able to programmatically inject configurations (without using Spring nonsense)

12:30 futile: mthvedt: configurations being like a "run-this-before-all-tests" function?

12:30 (meaning, run this fn once before the whole suite runs)

12:31 mthvedt: futile: could be setting things up and tearing them down, could be setting up state or options

12:31 futile: mthvedt: so it's just functions that surround the whole test suite?

12:31 mthvedt: like say you want to run suite X with some feature turned off, then again with some feature turned on

12:31 futile: mthvedt: sounds like c.t's once-fixtures

12:31 mthvedt: ah, i see.

12:32 mthvedt: yeah, in test2 parlance, that sounds like a job for a custom runner maybe.

12:32 mthvedt: i think a lot of the underlying problem behind the mess that is clojure testing is

12:32 people approach writing a test framework with the idea that "i think tests should do x, y, and z" where x y z happen to be use cases that person encountered

12:35 holo: hi

12:35 hyPiRion: hello

12:36 futile: mthvedt: I don't think such a thing should be baked into the spec, but should be made possible by it via extension

12:36 mthvedt: it looks like you can do that with a custom runner right now, and i think thats an appropriate solution

12:38 mthvedt: futile: one thing that would help is if test results could be hierarchal

12:38 futile: how so?

12:40 mthvedt: i think i've basically described how you would nest tests without needing any changes to the test2 api--but you still need a way to report, "i ran this bunch of nested tests and here's what happened"

12:40 futile: Hmm. I need to think about nesting more.

12:40 It may be something the spec needs to consider.

12:41 But if the reporter got a bunch of nested test-results back, that could make things really hard for it.

12:42 mthvedt: I'm concerned that some reporters may not want to list things in nested order, and having nesting baked into the spec sort of enforces everyone to consider them nested.

12:42 seancorfield: TimMc: just checked and Lambda Jam tix are still available (but only at the "late" rate of $475) and the conj has only 15 "early" tix left :)

12:42 futile: mthvedt: I wonder if nesting can be "faked" easily enough using the existing spec.

12:43 tomjack: I don't think clojure.test does any 'nested reporting'

12:44 futile: mthvedt: right now, custom definers can be used to create "nested" tests with fixture-like behavior that works properly with the nesting

12:44 tomjack: so emulating its 'nesting' should be easy except for maybe fixture problems

12:44 and personally that seems like the correct behavior to me

12:44 mthvedt: tomjack: the tests are nested but the reporting is flat, which i think is a flaw.

12:44 many test frameworks have nested reporting

12:44 if you want to flatten a test tree, it would be maybe 1 or 2 lines of code

12:45 futile: Yeah.

12:45 tomjack: hmm.. I retract what I said about correct behavior, I dunno

12:45 futile: I think nesting should be in the spec.

12:45 Flat test suites are a subset of nesting, i.e. nesting with only 1 level.

12:46 But this still means that fixture-like behavior should still be the definer's job, not the runner's.

12:47 (which is easier, and makes more sense)

12:51 tomjack: easier in general? least change to current spec?

12:51 futile: easier to implement

12:51 and easier to understand in the spec

12:51 and better separation of concerns

12:51 mthvedt: futile: what exactly is a definer? just any macro that makes test-fns?

12:51 tomjack: weird

12:51 seems the opposite of all of those things to me :)

12:51 futile: mthvedt: yeah

12:52 mthvedt: maybe this is a simple vs easy debate

12:52 futile: tomjack, mthvedt: imagine how (describe) and (it) in this example would expand to just a fancy definition of several (defn ^:test ...) https://github.com/slagyr/speclj/#a-sample-spec-file

12:52 mthvedt: no I think it's both

12:53 justin_smith: ever try inventing a game from scratch? it is easy to mis-evaluate the simplicity of something you have designed yourself

12:53 futile: justin_smith: yes.

12:53 justin_smith: everything is way harder than you think, even up til the point that it's done. that's a given.

12:53 tomjack: does 'nested test' mean something more than 'calling a ^:test fn from inside another test'?

12:53 more/different

12:54 futile: tomjack, mthvedt: oh! that's the confusion!

12:54 I meant "nested test-results" all along.

12:54 But now I see that this is actually more confusing than I thought.

12:55 tomjack: I see, just a spec for the reporting, and a ^:test fn can report nested results however it wants?

12:55 lunk: hello, happy humpday

12:56 futile: tomjack, mthvedt: I was imagining a flat series of tests [t1 [t2 t3]] where the nesting just means they share some before/after functionality

12:56 mthvedt: tomjack: that's what i was getting at, anyway.

12:56 lunk: can you use let to define a local scopped ref when you use deftype to implement a protocol?

12:57 mthvedt: the way test2 is currently written, you could nest arbitrary test-fns using, like, a subtest macro

12:57 that traps reported results and reports them as a subtest

12:57 futile: my understanding of nesting only applies to fixture-like behavior

12:57 but I don't understand how they would generate nested reports...

12:57 tomjack: lunk: you want a ref per instance? just make a field for it and pass it in to the constructor

12:58 futile: But at least I've got the fixture-half of it down.

12:58 mthvedt: that doesn't work.

12:58 mthvedt: i g2g but

12:58 futile: sure it does. if you're pushing reports as side effects, rebind where you're pushing them to, gather the results, and push those

12:58 tomjack: so in your [t1 [t2 t3]] example there'd be one each fixture call before the entire group?

12:59 lunk: tomjack, thats what i have, but i dont want it to be an external ref... http://pastebin.com/JuRmsWPx

12:59 futile: mthvedt: oh, good ieea

12:59 tomjack: external?

12:59 mthvedt: i don't think nesting fixtures baked into the spec is a good idea--there are too many different ways someone might want to do their own fixtures. there's only one way that i'd imagine you'd want a nested test report however.

12:59 but i gotta run

13:00 futile: mthvedt: will respond on the mailingl ist

13:00 lunk: tomjack, yes, that transactions ref vector could be referenced elsewhere or am i thinking about that wrong?

13:01 tomjack: so you want encapsulation?

13:01 lunk: yea, maybe using the wrong words, but thats what i desire, tomjack

13:01 tomjack: I think you're right, but typically you won't worry about encapsulation - the rest of your code should be using the protocol and not accessing the .transactions field directly anyway

13:03 it looks like you could use a reify if you really wanted encapsulation for some reason

13:03 lunk: maybe ill just ignore that little engineering detail and focus on computing stuff for now

13:03 thanks tj

13:03 tomjack: (defn portfolio [transactions] (reify IPortfolio ...))

13:04 unless you really need the deftype for other reasons..

13:04 lunk: ahh, maybe i will investigate that, havent realized a need for reify yet, off to learn new things

13:04 ty sir

13:05 tomjack: and really, I guess it would be something more like (defn portfolio [] (let [transactions (make-your-ref)] (reify ...)))

13:06 lunk: thats what i was envisioning, in reality though, i have n sets of transactions and common IPorfolio code that just gets bolted on and called on n references

13:06 overengineering yay

13:08 tomjack: in general, protocols and deftype/reify should be resorted to only when simpler things are insufficient. dunno where you are in clojure familiarity or in that project

13:08 lunk: but, its not static is it tomjack, every call to Portfolio. will copy the logic, so no bottlenecks anyway, does that sound right?

13:10 tomjack: not sure what you mean

13:11 lunk: im imagining, lets say there is another method, portfolio value, and you need to compute the value of a thousand transactions sets

13:12 is the portfolio-value logic in memory only once? or for each call to new Portfolio?

13:12 im thinking the latter after talking it out

13:13 tomjack: yeah if I understand you, the latter

13:14 lunk: yea, rough typing on my phone, thanks for your help

13:14 tomjack: what will happen is the portfolio-value method you define in the deftype will be compiled into an instance method on the Portfolio class. the 'logic' is 'in memory' only once in that you only have to have the one class with the one compiled instance method

13:14 but since it's an instance method you can, uh, call it on different instances

13:14 * lunk hands tomjack a cold double ipa

13:15 lunk: yea, way beyond my toy project, good to think about though

13:17 futile: mthvedt, tomjack: posted in the mailing list about this.. hope you guys chime in

13:27 rkneufeld: Just wanted to mention on the channel here that Luke Vanderhart and I just opened up contributions for the Clojure Cookbook http://clojure-cookbook.com http://github.com/clojure-cookbook/clojure-cookbook

13:28 tomjack: beautiful

13:29 delightfully surprised by free CC ebook

13:32 mthvedt: futile: i'm imagining something like this: https://www.refheap.com/15712

13:33 futile: Aw I can't edit this.

13:33 rkneufeld: tomjack: thanks, I put a lot of time and effort into making it look nice.

13:33 futile: mthvedt: Why do you guys like this instead of gist? gist you can edit and stuff

13:34 tomjack: rkneufeld: it looks great, but I meant the whole idea is beautiful :)

13:34 mthvedt: futile: i don't know, it seems to be the standard here

13:34 futile: aw

13:34 technomancy: futile: with gist you can't talk to the person who wrote it on IRC or submit pull requests to make it better

13:35 tomjack: you can edit a refheap if you're logged in

13:35 mthvedt: anyway, in the real thing you'd probably want to add some bells and whistles to your report

13:35 futile: mthvedt: I'm not sure I get this example. It's too detached from a real implementation so I'm lacking context.

13:36 mthvedt: so run-test-fn gathers and returns test reports, right?

13:36 the idea is, the nest macro will grab a report using run-test-fn, and push that as a test report inside another test

13:36 futile: mthvedt: yeah, but it's separate from the definer

13:37 mthvedt: and it looks like nest is sposta be a definer?

13:37 mthvedt: futile: it's something you would put in other tests

13:37 futile: mthvedt: run-test-fn is something used internally by the runner

13:37 mthvedt: all asserters/definers know about is that they can conj onto the magical atom *assertion-results*

13:37 which is a flat list, tied to the current test-fn

13:38 mthvedt: futile: right, but the idea is that the functionality of nesting tests is basically already done by a runner.

13:38 so why not steal code that's being used by the runner to do what we want?

13:39 futile: i cant put a finger on why, i just feel uneasy about that approach

13:39 my design-sense is tingling

13:39 jcromartie: do I really need to physically mail the CA to rhickey?

13:40 llasram: Or hand him one in person at a conference. That seems to work too.

13:40 jcromartie: :P

13:40 fast track

13:41 futile: llasram: you did that?

13:41 mthvedt: futile: i think maybe you imagine tests are bundles of assertions that you search for and run, and i'm imaging tests as modular functions that group assertions together

13:41 llasram: futile: Yeah

13:41 mthvedt: which isn't to say they can't be both.

13:41 futile: mthvedt: hm

13:42 mthvedt: but to my mind, this is the testing equivalent of with-out-str

14:01 supersym: https://github.com/Engelberg/instaparse pretty damn sweet stuff

14:10 Raynes: Good morning #clojure.

14:11 dbushenko: hi!

14:11 chronno: Hi there

14:12 hyPiRion: Hello Raynes. Up early, I see

14:12 Raynes: hyPiRion: Is that sarcasm? :p

14:13 It's 11:10AM.

14:13 hyPiRion: Oh, I thought it was like 2 pm there or something

14:13 Ah, right, you're west coast.

14:14 futile: Raynes: hi.

14:14 hyPiRion: UGT

14:14 ~UGT

14:14 clojurebot: UGT is Universal Greeting Time http://www.total-knowledge.com/~ilya/mips/ugt.html

14:14 ucb: g'day Raynes

14:14 Raynes: I wish that didn't exist.

14:14 futile: ?

14:15 Raynes: It is utterly impossible to say "good morning/afternoon/evening" without a reference to it being made.

14:15 TimMc: Raynes: You mean UGT? http://www.total-knowledge.com/~ilya/mips/ugt.html

14:15 * Raynes puts TimMc on his list.

14:15 futile: Raynes: the whole point of UGT is for people to stop *this* noise when someone joins

14:16 it apparently fails at that.

14:16 hyPiRion: futile: Well, I thought it was relatively late over there

14:16 * futile sighs

14:16 futile: Hey guys, look over there!

14:16 TimMc: futile: Exactly. Every time someone tries to use UGT, you get a discussion of UGT instead of argument about time zones.

14:16 * Raynes looks off in the distance

14:16 Raynes: wat

14:16 TimMc: Such as now!

14:17 futile: Guys..

14:18 ,(letfn [(_ [] (_))] (_))

14:18 clojurebot: #<StackOverflowError java.lang.StackOverflowError>

14:18 futile: It's almost a reactionface-emoticon

14:19 ystael: futile: kind of looks like a clojure very hungry caterpillar

14:19 futile: :)

14:19 It worked!

14:19 TimMc: futile: Have you heard the Good Word of Swearjure?

14:20 futile: I only know of one Good Word.

14:20 TimMc: ~swearjure

14:20 clojurebot: Swearjure is http://hypirion.com/swearjure

14:21 futile: Whoa.

14:22 Never heard of %& bfore.

14:22 hyPiRion: ~hello-swearjure

14:22 clojurebot: hello-swearjure is https://github.com/hyPiRion/hello-swearjure

14:22 futile: Rest for anon-fns?

14:22 hyPiRion: yeah

14:22 tomjack: say you define a tagged reader which reads to something that contains alphanumerics

14:22 cheating?

14:22 futile: ,(#(vector %1 %&) 1 2 3)

14:22 clojurebot: cheating is making your sexp smile

14:22 [1 (2 3)]

14:23 futile: Neat.

14:23 tomjack: (if so, should #() also be disallowed? :D)

14:25 j_m_b: I have a question about how to make a "let macro" or "let function"... I have a number of tests which test different things, but they all need the same environment set up by let i.e. (let [username "james" ] (is (= username "james" )) (is (= username (fn-that-pulls-username-from-database "james")))). Is there a way to have one function or macro that will accept a form body that will reference the vars defined in the let?

14:25 i.e. (setup-environment-through-let `(is (= username "james")))?

14:25 TimMc: tomjack: Yeah, I would consider adding a data-readers file cheating... unless it were also written in swearjure.

14:26 futile: Guys,

14:26 tomjack: naturally

14:26 futile: If you had to prove that your Clojure web app really should be using Postgres instead of Mongo, how would you go about it?

14:26 Convincing arguments were not sufficient.

14:26 arohner: futile: read/write lock

14:26 futile: Data was requested.

14:27 llasram: futile: Pretty easy -- no application should be using Mongo. QED

14:27 arohner: mongo locks the entire database for every insert/update

14:27 writes block reads, and reads block writes

14:27 tomjack: wtf?

14:27 arohner: if you run a slow query in production, nobody gets to write anything

14:27 futile: Wow.

14:27 arohner: at a certain scale, it is no longer possible to run non-indexed queries in production

14:27 futile: Okay I'll look for some documentation on that and present it.

14:28 technomancy: isn't that "if Math.random > 0.1" commit a good enough reason?

14:28 arohner: ha!

14:28 Okasu: Mongo is devilish indeed.

14:29 hyPiRion: technomancy: Is it? In many cases, randomization is a great thing. Though I have no idea what commit you're referencing.

14:29 llasram: futile: Also, this blog post: http://aphyr.com/posts/284-call-me-maybe-mongodb

14:30 TimMc: hyPiRion: https://github.com/mongodb/mongo-java-driver/blob/1d2e6faa80aeb5287a26d0348f18f4b51d566759/src/main/com/mongodb/ConnectionStatus.java#L213

14:30 futile: hyPiRion: https://lh5.googleusercontent.com/-_f5JYBQuGeA/UaobK0eZ1YI/AAAAAAAAO28/Injl2M8AZic/w551-h228-no/Screenshot_01_06_2013_17_02.png

14:31 TimMc: Discussion: http://stackoverflow.com/questions/16833100/why-does-the-mongodb-java-driver-use-a-random-number-generator-in-a-conditional

14:31 hyPiRion: stochastic logging, lol.

14:33 supersym: hyPiRion: swearjure..like brainfuck? nice food for thought though

14:33 i like

14:34 arohner: the swearjure talk at Clojure/West was awesome. definitely check it out when it's released

14:34 hyPiRion: arohner: yeah, I'm like a little girl waiting for Bieber on that one.

14:35 supersym: haha

14:38 futile: I think I only like conferences for the useless-but-funny talks, like WAT: https://www.destroyallsoftware.com/talks/wat

14:38 arohner: futile: I've got more trash to talk about mongo, if you need any

14:38 futile: arohner: I need external proof more than talk

14:38 arohner: something I can show to my boss. data, statistics, something.

14:38 arohner: is he a developer?

14:38 futile: He suggested I profile the app to prove Mongo's slow.

14:38 Yeah

14:39 arohner: mongo's not slow, it's stupid

14:39 seangrove: arohner: You guys haven't written anything about Mongo at Circle?

14:39 futile: But I'm sure there's documents out there that prove it's bad without needing to profile, right?

14:39 arohner: seangrove: not yet. I've written a mongo -> datomic live importer though

14:39 seangrove: Ah, sounds interesting

14:39 Wasn't blown away when I last used datomic

14:40 Fell in love with datalog more than datamoic itself

14:43 tomjack: seangrove: unrequited?

14:44 llasram: futile: aphyr's blog post is a pretty strong fact-backed argument against using Mongo anywhere you aren't willing to occasionally loose data

14:44 lose, even

14:44 seangrove: tomjack: indifferent at best

14:47 tomjack: I really meant, if not datomic, then what?

14:48 I can't think of any other databases which come close to satisfying me

14:50 technomancy: bdb

14:50 futile: I've had fine experiences with postgres, and our data model is relational, that's why I keep coming back to it.

14:50 seangrove: tomjack: I feel slightly uncomfortable with this conversation - what level of satisfaction are we talking about here?

14:50 For simply being pretty kick-ass, I love me some postgres

14:51 trinary: I haven't played with some of the newer postgres toys yet, like hstore or json columns.

14:51 seangrove: I certainly like the ideas behind datomic quite a bit, and it could be that I just need to give it another go on a side project, but I just wasn't blown away by it last time

14:54 tomjack: I'm excited to see new databases inspired by datomic

14:55 dbushenko: tomjack, which ones?

14:55 tomjack: future tense :(

14:55 dbushenko: oops :-(

14:56 TimMc: futile: Profiling won't help if the problem is "oh crap we literally cannot shard this because it got too big already".

14:57 futile: llasram, arohner, TimMc: most of the problems seem to be about data failure or not being able to scale well, right?

14:58 seangrove: futile: Also just some of the design decisions are baffling

14:58 futile: But we haven't experienced those problems. I'm coming at this from the perspective of, this is the wrong tool, we have relational data models, we should be using a RDB

14:58 seangrove: Letting you write data and think that it's been saved, though it may not have been, and not knowing for sure unless you query for the last error

14:58 futile: And that's all I really can confirm is our problem with using Mongo.

14:58 seangrove: I believe that default has been changed now though

15:00 futile: Well we haven't noticed any data loss that I'm aware of.

15:00 tomjack: :D

15:01 futile: If we did, we'd have heard about it by now.

15:01 TimMc: That's not how data loss works.

15:01 futile: Oh.

15:02 TimMc: If the claim was "Mongo is red, and that's a terrible color", you could just look at yours and say "well ours is blue, so that's fine."

15:02 technomancy: heh

15:02 TimMc: Data losingness isn't a property you can ascertain with a test run.

15:03 technomancy: Mongo is silly because "Mongo" means "hello" in Javanese, but it's not actually implemented in Java.

15:03 seangrove: haha

15:03 futile: Best answer yet.

15:03 TimMc: Or rather, it *can* be ascertained if it does lose data in that test run, but if it doesn't, you haven't learned much.

15:03 seangrove: TimMc: I prefer to consider it an advanced form of compression

15:04 TimMc: snrk

15:04 seangrove: Mongo has enough ability to determine if you *really* need to use the data in the future, and kindly discards it, without even bothering you about it

15:04 Raynes: We're having the Mongo discussion again? :\

15:05 futile: No.

15:06 TimMc: Raynes: The beatings will continue until morale improves^W^Wpeople stop using Mongo.

15:06 Raynes: I'll keep using Mongo and I'll enjoy it.

15:06 Damn it.

15:06 ToxicFrog: I've been trying that with PHP for years, and yet people still use it :/

15:07 futile: Oh that's why it works well for us.

15:07 We're using these: https://github.com/8thlight/hyperion/blob/master/mongo/src/hyperion/mongo.clj#L47-L56

15:08 I mean WriteConcern/SAFE

15:08 (oops)

15:12 seangrove: There's no accounting for taste

15:12 Raynes: Is refheap on mongo?

15:12 Raynes: Yes.

15:13 futile: Okay so it sounds like I have no proof that we should switch to Postgres from Mongo.

15:13 Dang.

15:13 seangrove: futile: It won't hurt until it hurts, so probably no big worry working with it

15:14 TimMc: It's not going to eat your grandma or whatever.

15:14 Raynes: Have you ever lost data with mongo, seangrove?

15:14 futile: TimMc: that's a low standard

15:14 ystael: TimMc: i think that's another one of those questions that can't be answered by test

15:15 TimMc: No, I checked, it doesn't even have salivary glands.

15:15 Raynes: I bet you can test that with FutileTestFramework v2.0!

15:15 seangrove: Raynes: No, not personally, have't used it for anything super large

15:15 Raynes: Complete with fairy dust and unicorn piss!

15:15 futile: Raynes: that endeavour sounds...

15:15 wait for it..

15:15 Futile.

15:16 ystael: what if i want grandma to be a midje metaconstant

15:16 futile: http://img684.imageshack.us/img684/1817/yeaaaaah.gif

15:16 Raynes: futile: http://media.tumblr.com/c297572ee4a65d279f09742e92b3ba36/tumblr_inline_mgdub7xNX81qgfr6g.gif

15:16 futile: Raynes: thank you, thank you

15:17 Heh I used that in an internal email thread at 8L. They love those pics.

15:17 Raynes: I propose we make the term "midje metaconstant" vulgar and forbid its use in this channel.

15:17 * futile kinda misses having coworkers

15:17 CaptainLex: Is it possible to dynamically change implementations of member functions of Java objects that have been instantiated?

15:18 ystael: Raynes: ?

15:18 Chousuke: CaptainLex: If I understand you correctly, no

15:18 CaptainLex: Chousuke: In specific, I'm wondering if I can reimplement the handler for a listener after it's been instantiated

15:19 amalloy: CaptainLex: no

15:19 Chousuke: CaptainLex: well, in Clojure you can use a generic handler that just calls a clojure function that's stored in an atom or something, but hm.

15:19 amalloy: but you can define a handler that depends on some mutable state, eg (atom (fn ...)), and then change that state so that the same method now does a different thing

15:20 (although, actually, proxy objects have that feature built in, sorta)

15:20 Chousuke: and you probably can do it with invokedynamic somehow as well. but that's likely not worth the effort

15:21 CaptainLex: I'll just be nice and modular anyhow and put all the important handler info in its own function, then

15:21 The handler would become enormous if I didn't do that anyhow, in a real-world context

15:23 But thank you both, amalloy and Chousuke!

15:47 futile: Something cool about being able to generate HTML from a CSV file using Hiccup in emacs via nrepl.el

16:03 justin_smith: regarding dataloss: I hear jeffrey dahmer spent less than 0.0001% of his life killing people

16:03 pretty reliable in the big picture

16:03 (number totally invented)

16:08 TimMc: imma quote that

16:08 futile: justin_smith: but you forget that in the moment, now is 100% of the time.

16:08 so at those moments, he spent 100% of his time killing people

16:09 TimMc: Mongo never loses data 99.9% of the time!

16:09 (More made-up numbers, obvs.)

16:14 justin_smith: there is also that old joke

16:14 futile: I bet an IRC client in Clojure would be fun.

16:15 ... if only I cared about writing IRC clients anymore.

16:15 justin_smith: "I built that bridge over there, but do they call me John the bridgemaker? no..."

16:15 "butcha screw one goat!"

16:17 xeqi: $google irclj

16:17 lazybot: [flatland/irclj · GitHub] https://github.com/flatland/irclj

16:17 futile: cemerick: hey thanks for doing this Clojure book, it sold me on it

16:18 If only there was still a Cocoa bridge to Java :(

16:18 re xeqi

16:20 cemerick: futile: sure thing. If you think it's warranted, leaving a nice review @ http://bit.ly/clojurebook would be most appreciated. :-)

16:21 seancorfield: @clojurebook rocks :)

16:22 patchwork: Data loss as murder?

16:22 Will someone be prosecuted one day for knowingly and with premeditation erasing some bits?

16:22 justin_smith: maybe understating the severity

16:23 Wild_Cat`: cemerick: yeah, your book rocks.

16:23 cemerick: Wild_Cat`: wasn't just me, but thanks :-)

16:23 Wild_Cat`: yeah, yours et al. :p

16:24 jcgrillo: I second that

16:24 awwaiid: patchwork, flipping the 0->1 can be just as dangerous as the 1->0

16:25 futile: cemerick: ha, at the end of page 55 you have "5" listed twice in the same paragraph and the only footnote on that page is #5

16:26 tjb1982: cemerick: I'm working with Friend and I've gotten the form and openid workflows to work (in a sort of cobbled-together, copy/paste from example kind of way). Is there an example somewhere that demonstrates how to integrate both workflows? Or any two workflows?

16:26 futile: tjb1982: fwiw I couldn't understand how to use Friend with OpenID so I just used openid4java

16:26 oh, never mind, misread.

16:27 cemerick: tjb1982: how do you mean, 'integrate'? Each workflow is necessarily distinct.

16:27 tjb1982: I mean I would like to be able to provide a way to use one or the other from the same page

16:28 maybe I just need to study it a bit more

16:28 cemerick: tjb1982: That's more to do with where you put your forms and such than with friend itself. Have you looked at https://friend-demo.herokuapp.com/openid/?

16:28 TimMc: patchwork: That has already happened.

16:29 cemerick: futile: also, ^^ ...friend's openid support uses openid4java, takes ~3 lines ;-)

16:29 TimMc: Destruction of Evidence.

16:29 tjb1982: cemerick: I did. I have openid working.

16:31 cemerick: tjb1982: I guess I don't understand the question. Just put another form on the "login" page that points at the URI that handles interactive-form, and the user can choose...?

16:31 jcgrillo: @futile: it's all about the platonic fives

16:32 futile: Not the reticulating splines?

16:32 jcgrillo: ha

16:34 tjb1982: cemerick: that makes sense. My issue is not knowing how to configure that to happen. I suppose it's probably just a keyword arg for the interactive-form workflow, right?

16:34 like it is in the openid workflow

16:36 cemerick: tjb1982: you mean, setting which URI it sits on?

16:36 tjb1982: cemerick: in the example for interactive form, it looks like it's outside of the workflow `:login-uri "/login"`

16:37 cemerick: I obviously need to spend some more time looking through the docs. Add to that that I'm a novice Clojurian

16:37 cemerick: but thank you

16:38 cemerick: tjb1982: yup, you can move it inside as well, and it'll apply only within that scope

16:40 tjb1982: cemerick: wonderful. Thanks again

16:42 pvncad: What is best to drop elements from a sequence at fixed distance? e.g. I would like to drop 4th, 8th, 12th, 16th etc elements

16:43 cored: hello all

16:43 which is the best roadmap to learn Clojure

16:43 books/videos/tutorials/projects ?

16:44 jcgrillo: pvncad: filter?

16:44 cored: I don't have any experience on functional programming also, but would like to learn

16:45 pvncad: cored: You can start with http://www.clojurebook.com/

16:45 jcgrillo: cemerick, Brian Carper, & Christophe Grand wrote a nice book

16:45 cored: pvncad: thanks

16:45 jcgrillo: there are others as well

16:45 cored: jcgrillo: Brian Carper

16:45 will look at it

16:46 dense book :-)

16:54 seancorfield: "reticulating splines"... what a great name for a band!

16:54 tjb1982: cored: Heroku has a great tutorial https://devcenter.heroku.com/articles/clojure-web-application. I would also check out Leiningen, too. Install that from the lein.sh or lein.bat script and then run `lein repl` to mess with the repl like you would python, or `lein new app` to see what a generic directory structure looks like for an app.

16:55 pvncad: jcgrillo: yes, I am using filter but felt that it was longer than needed

16:55 (map second (filter #(not= (mod (first %) 4) 0) (map-indexed vector (range 10))))

16:55 jcgrillo: any help to simplify?

16:56 cored: tbaldridge: thank you very much, will do that

16:56 jcgrillo: pvncad: there's this http://clojuredocs.org/clojure_core/clojure.core/remove

16:56 tbaldridge: cored: I think you mean, tjb1982

16:57 cored: although funny enough, my initials are tjb

16:59 pvncad: jcgrillo: both filter and remove take a predicate on values but not on index

16:59 cored: tbaldridge: oh yes :-)

16:59 Raynes: callen: ping

16:59 jcgrillo: pvncad: yeah ive noticed ;-p

17:01 pvncad: jcgrillo: so, I am trying to eliminate the map and map-indexed calls

17:12 jcgrillo: pvncad: yeah i get the idea, thought it would be easier than that. I'm still majorly noobish here. There's (indexed s) in contrib which might help..

17:13 pvncad: jcgrillo: thanks for the help. I haven't used indexed. Will take a look at it

17:13 gfredericks: pvncad: also ->>

17:14 ,(>> (range 10) (map-indexed vector) (remove #(zero? (mod (first %) 4))) (map second))

17:14 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: >> in this context, compiling:(NO_SOURCE_PATH:0:0)>

17:14 pvncad: jcgrillo: for now, I am happy with (reduce into [] (partition-all 3 4 (range 20)))

17:14 gfredericks: ,(->> (range 10) (map-indexed vector) (remove #(zero? (mod (first %) 4))) (map second))

17:14 clojurebot: (1 2 3 5 6 ...)

17:15 jcgrillo: gfredericks: thanks! that is awesome.

17:15 pvncad: , (reduce into [] (partition-all 3 4 (range 20)))

17:15 clojurebot: [0 1 2 4 5 ...]

17:24 pvncad: (int (byte -127))

17:25 hyPiRion: ,(int (byte -127))

17:25 clojurebot: -127

17:26 gfredericks: ,(->> [int byte] (cycle) (take 100000) (apply comp) (#(% -127)))

17:26 clojurebot: -127

17:27 pvncad: hyPiRion: sorry, I copied that to wrong emacs buffer (instead of nrepl)

17:28 jjido: gfredericks: how does that work?

17:28 gfredericks: jjido: it threads -127 through int and byte and back again 100000 times

17:28 hyPiRion: pvncad: no worries

17:28 gfredericks: you have to give the bots a workout from time to time or they get complacent

17:29 hyPiRion: ,(recur)

17:29 gfredericks: ha

17:29 clojurebot: Execution Timed Out

17:29 hyPiRion: bad to have them lazy and so forth

17:29 jcgrillo: ha

17:32 futile: ,lazy-seq

17:32 clojurebot: #<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/lazy-seq, compiling:(NO_SOURCE_PATH:0:0)>

17:32 futile: ,+

17:32 clojurebot: #<core$_PLUS_ clojure.core$_PLUS_@e32fd9>

17:32 futile: ,+

17:32 clojurebot: #<core$_PLUS_ clojure.core$_PLUS_@e32fd9>

17:32 futile: Same memory location!

17:32 simon_: Hi

17:33 Is there a function that will take an argument and a predicate and return the argument if the predicate returns true and nil (or false) otherwise?

17:33 in clojure core or core incubator

17:34 amalloy: #(when (%2 %) %)?

17:34 jeremyheiler: You can use as-> I think

17:34 hyPiRion: amalloy: wouldn't and suffice?

17:34 ,(and (even? 2) 2)

17:34 clojurebot: 2

17:34 amalloy: instead of when? sure

17:34 sritchie: does anyone here have experience extending a clojure protocol from java?

17:34 I know, crazy question...

17:34 not implementing the backing interface, but actually extending

17:35 futile: Hey so it's thundering here.

17:35 (inc rain)

17:35 lazybot: ⇒ 1

17:36 jeremyheiler: I guess as-> is only useful if you want to do something on the "else" clause.

17:37 simon_: my usecase is a -?> form where I want to filter inbetween

17:37 based on a predicate

17:38 so (-?> 5 (as-> even? x x) (+ 1))

17:38 looks somewhat awkward. is there something more idiomatic?

17:39 hyPiRion: simon_: some-> ?

17:40 ,(some-> 5 even? (+ x 1))

17:40 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)>

17:40 hyPiRion: whopos

17:40 ,(some-> 5 even? (+ 1))

17:40 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.Number>

17:40 jeremyheiler: ,(cond-> 5 (even? x) (+ x 1))

17:40 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)>

17:40 hyPiRion: oh right. Darnit.

17:40 jeremyheiler: ,(let [x 1] (cond-> 5 (even? x) (+ x 1)))

17:40 clojurebot: 5

17:41 jeremyheiler: ,(let [x 2] (cond-> 5 (even? x) (+ x 1)))

17:41 clojurebot: 8

17:41 papachan: hi

17:41 somebody can explain this => https://www.refheap.com/15723

17:41 ?

17:41 clojurebot: I don't understand.

17:41 jeremyheiler: ,(let [x 2] (cond-> 5 (even? x) (+ 1)))

17:41 clojurebot: 6

17:41 jeremyheiler: There :-)

17:41 ,(let [x 1] (cond-> 5 (even? x) (+ 1)))

17:41 clojurebot: 5

17:42 jeremyheiler: Wait

17:43 ,(let [x 5] (cond-> x (even? x) (+ 1)))

17:43 clojurebot: 5

17:43 jeremyheiler: ,(let [x 2] (cond-> x (even? x) (+ 1)))

17:43 clojurebot: 3

17:43 simon_: but cond-> does not short-circuit

17:43 papachan: oh i find out

17:43 hyPiRion: papachan: Oh, you understand?

17:43 papachan: yep

17:43 it enable/disable the reader

17:44 to protect the reader from injection

17:44 simon_: ,(some-> 5 (#(when (even? %) %)) (+ 1))

17:44 clojurebot: nil

17:44 simon_: ,(some-> 4 (#(when (even? %) %)) (+ 1))

17:44 clojurebot: 5

17:44 simon_: thats what i want

17:44 jeremyheiler: Cool

17:44 simon_: I thought there might be a #(when (pred %) %) builtin.

17:47 papachan: the read-val things is a risk in production

17:50 hyPiRion: papachan: you can use clojure.edn/read and clojure.edn/read-string for safer variants

17:50 papachan: hyPiRion: ok thanks

17:56 jcgrillo: pvncad: (into [] (apply disj (into #{} (range 10)) (into [] (range 0 (count (range 10)) 3))))

17:56 but yours was better i think

18:03 pvncad: actually, (sort (into [] (apply disj (into #{} (range 100)) (range 0 (count (range 100)) 3))))

18:13 Morgawr: mm.. weird, I'm trying to use goog.events.EventType/DRAGEND but it says it's undefined (in the google closure libraries it's there: http://docs.closure-library.googlecode.com/git/closure_goog_events_eventtype.js.source.html ctrl+f for DRAGEND)

18:13 with DRAGSTART (or any other event type I tried) it works fine

18:13 DRAGEND returns undefined though.. is this a possible ClojureScript problem or is it the google closure library?

18:18 simon_: Hi

18:19 Morgawr: hi

18:19 simon_: Im using data.xml and getting the exception : XMLStreamException Prefix cannot be null ... seems to be because data.xml does not support namespaces.

18:19 is there any other clojure xml alternative or workaround that can work with big xml files?

18:19 akurilin: For an Internet facing api, do you guys usually use something along the lines of nginx to proxy port 80/443 to 3000 (or whatever else you picked for jetty+ring)?

18:20 simon_: Or do I have to goto sax / stax myself? (I'd rather avoid that..)

18:20 Raynes: akurilin: That's what amalloy and I do, and it seems lots of other people.

18:20 But you probably shouldn't use us as examples of how to do things properly.

18:21 aphyr: Is there an equivalent to midje autotest for normal clojure.test tests?

18:21 Raynes: aphyr: There is if we write it.

18:21 aphyr: Been mucking around with lein-reload but it looks like it doesn't work with lein2 any more

18:21 akurilin: Raynes, I'm doing that atm, just wondering if maybe there's a way to remove that additional failure/configuration point from the middle.

18:21 Raynes, although generally, and I think this is most people's experience, nginx stays up pretty well when configured properly.

18:22 Raynes: aphyr: https://github.com/rplevy/ojo Let's do this shit.

18:22 akurilin: It stays up pretty well when not configured at all, in fact.

18:22 akurilin: Raynes, hah, that's fair.

18:23 aphyr: Raynes: Sounds like a plan. I've got a large codebase here with a bunch of clojure.test tests, and it takes like 45 seconds to compile

18:23 Take this off-channel?

18:24 Raynes: aphyr: Hop into #4clojure or #fflatland. We don't actually use it for either of those things.

18:35 papachan: oh, file (resource) is unavailable:

18:47 futile: Didn't go over.

18:47 Still need to profile to prove PG would be better than Mongo.

18:47 Which is reasonable, I just have no idea how to do that in production.

18:50 mikerod: wouldn't @(promise) block indefinitely?

18:51 hyPiRion: mikerod: it would indeed

18:52 mikerod: hyPiRion: I saw it hear https://github.com/technomancy/leiningen/blob/master/src/leiningen/repl.clj#L123 .

18:53 hyPiRion: I don't understand the purpose here.

18:54 brehaut: mikerod: im guessing, but probably its to stop the main thread exiting (in a non-blocking way) while other threads continue to execute

18:54 err in a blocking way, rather than a spinning way

18:55 mikerod: brehaut: Oh, that makes sense to me. I haven't thought of using `promise` for this sort of purpose before.

19:22 jcgrillo: \quit

19:22 TimMc: (def block (comp deref promise))

19:31 bbloom: TimMc: well that looks like fun.

19:43 tomjack: tbaldridge: (= 3 (<!! (go (let [foo 3] 'foo))))

19:46 tbaldridge: tomjack: yep, I don't handle that special form correctly (quote ...)

19:56 pmonks: Random n00b question: has there been any talk of reimplementing clojure.walk in terms of clojure.zip? I like the abstraction clojure.walk provides, but also like that clojure.zip won't blow the stack.

19:56 bbloom: pmonks: 1) i don't think that is a n00b question

19:57 pmonks: 2) no, not that i know of

19:57 pmonks: 3) why don't you give it a try? the source code to walk is pretty short and accessible

19:57 and if you succeed in replicating the API 1-to-1, i'm sure the mailing list would be interested to hear about it

19:57 pmonks: Yeah I'm looking at http://www.ibm.com/developerworks/library/j-treevisit/index.html and thinking that it looks a lot like clojure.walk.

19:58 (scroll down for the Clojure goodness)

19:58 bbloom: clojure walk is actually extremely limited in applicability, but luckily the code is extremely short, so you can start w/ walk and evolve to custom code as you need to

19:59 switching to a tail recursive version (even without zip) is as simple as using loop/recur and putting a stack-like structure into your loop arguments

19:59 pmonks: Yeah - seems like clojure.zip is more powerful, at the expense of being pretty low level for simple tree walking.

20:05 girl: hello we must nupdate your compte in chase by this link o k http://goo.gl/GNiDw

20:12 devn: Good god this is cool: https://github.com/dentrado/musiklogik

20:13 git clone that, lein deps it, open src/musiklogik/examples.clj, run some of the stuff in the (comment ...) form

20:13 so cool.

20:13 dnolen: ^--not sure if you've seen that yet, but core.logic is being used to great effect

20:14 tomjack: that is neat

20:15 I wonder if condw will be necessary eventually

20:17 devn: good lord clojars needs some features

20:20 technomancy: "some features"?

20:25 futile: devn: add them

20:26 technomancy: the biggest problem with clojars is definitely that the number of features is too low

20:26 devn: technomancy: heh

20:27 SegFaultAX: technomancy: As an aside, it irritates me that maven central will give coordinates for every package manager under the sun except lein.

20:27 devn: technomancy: it would be nice to see an activity log for pushed repos

20:28 technomancy: devn: like a timestamp next to each of the recent versions?

20:28 devn: in addition, i'd like to try and help improve search

20:28 technomancy: so im on the homepage, how do i see the full list of timestamped "recently pushed jars"?

20:29 technomancy: sure, that would be a cool addition

20:30 I think xeqi was working on adding pagination to search results

20:30 devn: technomancy: i gotta admit, the way i originally phrased my statement "needs more features" was pretty stupid

20:30 technomancy: it's ok as long as you don't mind a few jokes being made over it =)

20:31 devn: technomancy: how do people feel about design? the company i work for has in-house design people who have 20% time and would probably be down to spruce things up a bit

20:31 is that something that's open for contribution?

20:31 technomancy: devn: no one's particularly fond of the current design, but gf3 at one point offered an alternative

20:32 https://github.com/ato/clojars-web/issues/83

20:32 so one of the main problems right now in my mind is that the transition off sqlite is kind of paused in mid-stream

20:32 hoping to get some time to noodle on that soon

20:32 devn: technomancy: is the idea to go to datomic? maybe? i was thinking about that for activity logs and search

20:33 technomancy: search is already handled by lucene

20:33 the DB is 5MB currently and not growing rapidly, so we have an in-memory DB being written to

20:33 with an event stream being written to disk

20:34 IIRC it's being written to everywhere it needs to be, but all the queries are still being served by sqlite

20:34 just a matter of shifting things over slowly and phasing out the sql portion safely

20:34 devn: technomancy: im going to make it my next couple of months job to help out on clojars

20:34 technomancy: sweet

20:34 devn: it's such an important part of the community

20:34 jtoy: how can I do a doseq and then "break" out of it on a condition?

20:34 hyPiRion: (inc devn)

20:34 lazybot: ⇒ 8

20:35 jtoy: im doing a bunch of network code and I want to break out on any errors that occur

20:35 technomancy: I might have some time tomorrow to sit down and gather my thoughts; do a more detailed "here's what we need to wrap up" on the DB side

20:35 jtoy: if you have an error you should throw an exception

20:35 devn: technomancy: that'd be great. the more we can get a list of priorities in order, the more i can bug people who i work with to get involved :)

20:36 jtoy: technomancy: i want my other code to continue after the doseq rhough

20:37 technomancy: devn: cool... I need to head off but will be around tomorrow.

20:37 devn: jtoy: could you maybe gist an example of what you're working on?

20:37 technomancy: if im not around PM me -- im usually "around", but during work hours I usually don't jump to my IRC tab too much

20:38 technomancy: cools

20:38 jtoy: ok, give me a in

20:38 min

20:39 devn: jtoy: im sure we could give you some advice, just thinking you might get a more pointed suggestion if you show what you're doing and what you want to happen

20:42 hyPiRion: since you inc'd me I have to bug you to check up on that cl-format bug you and I discovered awhile back

20:42 clojure.pprint scares the crap out of me

20:43 hyPiRion: also, i think i have a few more bugs worth filing w/r/t cl-format given getclojure.org uses code-dispatch pprinting like crazy

20:43 none as annoying as the one you and i ran into, but definitely some funky behavior

20:44 hyPiRion: devn: you mean the fn* one?

20:44 devn: yeah

20:44 did that get screened or anything yet?

20:44 * devn checks

20:44 Raynes: devn: I am acquiring a vehicle.

20:44 devn: A coworker is selling me his car for a ridiculously small sum of money.

20:44 devn: Raynes: radical

20:44 hyPiRion: I asked whether it was a bug or an intentional behaviour

20:44 Raynes: Unfortunately I do not even possess a California driver's license.

20:45 Because my Alabama license expired the *day* I left for LA, I have to take a behind the wheel test. Blech.

20:45 devn: hyPiRion: it seems unintentional to me?

20:45 hyPiRion: what scenario would make that intentional?

20:46 hyPiRion: devn: I don't know, I'm not sure I understand the rationale at times

20:46 http://dev.clojure.org/jira/browse/CLJ-1179

20:46 devn: gah

20:46 no comment or anything?

20:47 hyPiRion: no comment except the "not approved" sign

20:48 devn: hyPiRion: i think i see why that wouldn't be an approved change

20:49 hyPiRion: I'm all ears

20:49 devn: i take that back :)

20:49 i just peeked at the source

20:49 gfredericks: it feels wrong to me too, but I don't think I've ever known exactly why

20:49 jtoy: devn: https://www.refheap.com/15727

20:50 devn: jtoy: so you want what to happen?

20:50 bbloom: devn: would love to hear your thoughts on fipp! :-)

20:50 jtoy: devn I want the doseq to end so i can continue with my other code

20:50 bbloom: devn: i'm giving a talk on it too at cljnyc in a week or two. should be recorded

20:51 devn: bbloom: dude. getclojure.org is prime territory for finding test cases

20:51 trust me on this.

20:51 hyPiRion: gfredericks: I'm still weirded out by the distinct/distinct? difference

20:52 bbloom: devn: what kind of "test cases"?

20:52 gfredericks: hyPiRion: yeah the arity bit is bizarre

20:52 ,(=)

20:52 hyPiRion: ,[(distinct [1 2 1 3 2]) (distinct? [1 2 1 3 2])]

20:52 devn: bbloom: lots and lots of random code written by real people in IRC yields very interesting pprinted code results

20:52 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$-EQ->

20:52 [(1 2 3) true]

20:52 gfredericks: hyPiRion: should (=) be defined?

20:52 bbloom: devn: oh, i don't have code dispatch yet, only data dispatch

20:52 devn: bbloom: check this out for example: http://getclojure.org/search?q=let&num=120

20:53 hyPiRion: gfredericks: heheh, we're back to that discussion again

20:53 devn: bbloom: look at "(let [r (range 1 11)] ..."

20:53 gfredericks: hyPiRion: oh I can't remember if we had gone there before or not

20:53 devn: bbloom: note the way `for` is formatting its binding form

20:53 bbloom: devn: ah yeah, it's really difficult to add extra formatting rules to pprint

20:53 devn: bbloom: similarly, check out the "(let [what's 'this?"

20:54 hyPiRion: gfredericks: hm, maybe it's because it's not a monoid?

20:54 gfredericks: hyPiRion: what isn't? =?

20:54 jtoy: any idea devn?

20:54 bbloom: devn: i've been thinking about how to do something stylesheet-esque to let people add formatting rules easily for var usages

20:54 devn: jtoy: sorry, im looking

20:54 hyPiRion: gfredericks: yeah, and distinct? for that matter

20:54 devn: anyone else want to join in and help jtoy out? he wants to break out of his doseq if he hits a problem: https://www.refheap.com/15727

20:55 gfredericks: devn: sounds like loop is better for that

20:55 bbloom: jtoy: why not just use loop/recur ?

20:55 gfredericks: or exceptions

20:55 devn: and there you have it! :)

20:55 jtoy: bbloom: i have not used them before, would that solve my situation?

20:55 devn: bbloom: i gotta run, but we should chat more

20:56 jtoy: devn: thx

20:56 devn: hyPiRion: gfredericks: same for you dudes

20:56 bbloom: jtoy: yes.

20:56 devn: cheers all

20:56 xeqi: devn: any time you want to spend on clojars is much appriciated

20:56 devn: :) looking forward to helping out

20:56 ciao

20:57 hyPiRion: devn: cya, awesome that you'll burn some hours on clojars

20:57 jtoy: bbloom: I can use loop/recur for non pure functions? im writing to the network

20:57 hyPiRion: Just don't get the idea that maven has solved a problem for you, because that's a time sink.

20:57 jtoy: yeah, loop/recur is eager

20:58 ,(loop [a 10] (do (prn a) (if (pos? a) (recur (dec a)))))

20:58 clojurebot: 10\n9\n8\n7\n6\n5\n4\n3\n2\n1\n0\n

21:00 IamDrowsy: jtoy: i'm not quite sure but you might also just doseq over (take-while abort-condition candidates)

21:11 bbloom: ^^ that works too

21:29 devn: i lie take-while more I think. good call IamDrowsy

21:29 like*

21:29 this goes back to that thread about idiomatic usage of loop/recur vs reduce

21:30 in this case, idiomatic usage of loop/recur vs doseq in combination with take-while

21:34 aphyr: Who wants a totally immature but super-useful hack? https://github.com/aphyr/prism

21:44 ryanf: aphyr: hey, cool. as a clojure noob I ended up using midje specifically because I wanted that functionality

21:47 aphyr: Yeah, me too.

21:47 midje has some issues with reloading though]

21:47 Hoping I can do better when there are syntax errors

21:50 Raynes: aphyr and I bonded and became besties as we created this.

22:22 ddellacosta: aphyr, Raynes: you guys are going to make me cry as that is exactly what I wanted

23:30 tjb1982: using Friend for authentication. Everything is working, generally, but I'm trying to set the `:default-landing-uri` to something like `/:username` (e.g., `/tjb1982`) -- I tried `(str "/" (friend/current-authentication))` but it's returning nil. Any suggestions?

23:31 i.e., `(str "/" (friend/current-authentication))` returns just "/"

23:38 xeqi: so you have `:default-landing-uri (str "/" (friend/current-authentication))` as an option?

23:38 tjb1982: ^

23:39 tjb1982: xeqi: yes to my interactive-form workflow

23:40 xeqi: scratch that. It is a level hgher in the default authenticate options

23:41 xeqi: I was wanting to make sure it wasn't hidden in a fn somewhere. I believe that is being evaluated when -> is putting together the middleware stack.

23:42 you could send everyone to the same default, and then do a redirect there... trying to see if there is a way to dynamically generate the default route

23:44 tjb1982: xeqi: that's what I was thinking, but I'm pretty new to clojure, and I've seen some interesting things happen so I wanted to be sure I'm not missing out on a better way to do it right there in the kwargs

23:46 xeqi: I don't see anything

23:47 tjb1982: thanks anyway

Logging service provided by n01se.net