#clojure log - Jan 02 2013

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

0:02 callen: Deece: ugly.

0:25 Deece: callen: yeah. looks like this project has a fix for it.. just need to do CLASSPATH=$(lein classpath) -__-

0:29 callen: Deece: I usually end up making a ./scripts dir at the same level as src and stashing stuff in there.

0:34 Raynes: have I mentioned how ridiculously awesome Blood of Kingu is?

0:44 Raynes: callen: I don't think you have.

0:45 callen: But really, if it sounds like a large animal or a wood chipper being fed titanium, I probably don't like it.

1:18 wingy: i so love datomic!

1:23 callen: wingy: weirdo.

1:23 wingy: :)

1:24 callen: you can use whatever data storage as you want .. so you are not locked in right?

1:24 you still own your data

1:25 callen: wingy: that's one reason I stay away from datomic, yes.

1:26 muhoo: great. so a library specifies clj-stacktrace 0.2.4, and that conflicts with lein-cljsbuild, which wants clj-stacktrace 0.2.5. so if i exclude clj-stacktrace from the library, clj-stacktrace doesn't get included in the tree at all! and so lein check fails, because clj-stacktrace isn't there.

1:26 callen: muhoo: that's pretty weird.

1:26 * muhoo goes and just changes the library to require clj-stacktrace 0.2.5 and be done with it

1:27 muhoo: yeah, it was pretty surprising.

1:27 i wish there was a way to specify a wildcard in versions

1:27 callen: muhoo: I figured exclude would've done it.

1:27 muhoo: you should revert that change and science that shit up.

1:28 muhoo: like "use clj-stacktrace, whataever the hell is the latest stable version"

1:28 callen: muhoo: understanding > quick fix

1:28 muhoo: that wildcard stuff generally breaks things.

1:29 muhoo: true, but i've already burned too much time and haven't gotten close to touching what it is i originally set out to do. only so many hours in the day.

1:29 callen: muhoo: do you have a reproducing project.clj you can refheap?

1:29 muhoo: so that I can investigate independently?

1:30 muhoo: because *I* would like to understand.

1:30 gtrak: sometimes the yak just needs shaving

1:30 callen: gtrak: it's not about yak shaving, I just like to understand things.

1:30 muhoo: that'd be cool, hmm. i'll take a few to see if i can do that. i'll bet it can't be reproduced, because that's how my luck goes.

1:30 gtrak: I was going to suggest a particular problem I ran into, but it looks like technomancy reverted that commit here https://github.com/mmcgrana/clj-stacktrace/commit/efb73bee4fecfb072c253ebbbf9e04db5b2a2fb4

1:30 callen: muhoo: sorry, I'd just not like to lose a chance to potentially fix something wide-reaching if you can reproduce it.

1:33 Raynes: Aw, tomoj isn't here.

1:33 I wanted to shove some laser down his throat.

1:33 callen: Raynes: you got in trouble the last time you tried to shove something down somebody's throat. Best refrain.

1:34 Raynes: How was I supposed to know about the sexual harassment policy?

1:34 Bah.

1:34 muhoo: callen: https://www.refheap.com/paste/8028 here it is

1:34 and, yes, it's reproducible

1:35 Raynes: Holy god.

1:35 muhoo: callen: very much appreciate your time on this. i'm curious myself, but, man, i am finding myself with less and less time to work on clj stuff these days

1:35 Raynes: muhoo: I should write a hard rock song about that project.clj

1:35 muhoo: Raynes: oh yeah, any new mp3 files come out of Studio Raynes?

1:36 Raynes: Nope, not yet. :p

1:36 gtrak: guano is a codename for guava?

1:36 Raynes: I was singing Fine By Me a moment ago, but didn't have a mic handy, muhoo.

1:36 gtrak: Guano is poo.

1:36 callen: Raynes: I've written similar project.clj before.

1:37 Raynes: Of bats, certain birds, and seal, to be specific.

1:37 muhoo: guano, guava, whatever, it was making my life miserable

1:37 Raynes: callen: https://github.com/geni/geni-gedcom/blob/develop/project.clj Longest one I've ever written.

1:37 muhoo: cljs seems to accrete long project.clj's

1:37 gtrak: that's a long project.clj?

1:37 muhoo: all those options to lein-cljsbuild

1:38 callen: Raynes: use lein cljsbuild.

1:38 Raynes: I did once.

1:38 callen: muhoo: doesn't break for me.

1:38 Raynes: But then I realized I still hated cljs and moved on.

1:38 callen: Raynes: you'd rather use vanilla JS

1:38 ?

1:38 gtrak: ours is 135 lines

1:38 muhoo: callen: really?

1:38 Raynes: Yes. Not because I don't like cljs code, but because I don't like anything else about it.

1:38 muhoo: callen: try "lein check"

1:38 on that project.clj

1:39 callen: Raynes: please to explain?

1:39 muhoo: oh, hmm. maybe my version of lein-pedantic is bad.

1:39 callen: muhoo: yep, it's fine for me.

1:39 muhoo: [lein-pedantic "0.0.5" :exclusions [org.clojure/clojure]]

1:40 callen: muhoo: I don't use lein-pedantic.

1:40 Raynes: callen: Cljs is a bizarre box of bizarre to me, probably because I'm also not very familiar with js. I can't figure out how to use it at all, and I don't really want to spend a lot of time trying, so I just write javascript when I need it because I save time and sanity that way. I can google things I don't know about javascript, but questions I ask about cljs usually result in vague answers that assume plenty of knowledge about js.

1:40 callen: I'll try it though.

1:40 muhoo: ah, well lein-pedantic is what is failing

1:40 callen: muhoo: repro, h/o

1:41 Raynes: that makes sense, but I and my frontend guy are fairly experienced with JS and would like to bump that part of world up a notch.

1:41 part of our world*

1:41 Raynes: particularly since our apps tend to be JS heavy.

1:41 Raynes: callen: I do like the concept of cljs and think it is a nice thing, it's just that without any good documentation it is pretty useless to me.

1:41 muhoo: callen: this should repro: https://www.refheap.com/paste/8029

1:41 Raynes: It's like how people feel about Clojure sometimes.

1:41 Regarding documentation.

1:42 callen: muhoo: I already got it to repro, that's what I was telling you. h/o

1:42 muhoo: oh, ok

1:42 callen: Raynes: carthago delenda est: I still say a community wiki would help.

1:42 muhoo: well at least that refheap is now a complete minimum required to repro

1:42 Raynes: callen: A simple thing like "How would I write a library that I can distribute" resulted in a 30 minute long debate among cljsers in here that I eventually gave up on.

1:42 callen: muhoo: got it to pass, I don't see any issues here.

1:42 muhoo: want the line that fixed it?

1:43 muhoo: callen: that'd be useful, yes

1:43 callen: Raynes: normally I'd recommend looking at something like jayq or fetch to determine something like that.

1:43 aaelony: raynes: is refheap seachable? I'm sure there is a lot of good stuff in there...

1:43 callen: Raynes: since ibdknox has more cljs experience than most.

1:43 muhoo: [firealarm "0.1.2" :exclusions [[clj-stacktrace] commons-codec]]

1:43 Raynes: aaelony: Good question. You'd have to try with google.

1:43 muhoo: commons?

1:43 aaelony: i've heard of that, but still...

1:44 callen: muhoo: yes, all I did was read lein pedantic's output and follow the instructions.

1:44 muhoo: it broke twice, once with your original paste after adding lein-pedantic.

1:44 Raynes: aaelony: site:www.refheap.com seems to work somewhat.

1:44 aaelony: I need to do some robots.txt rejiggering though to make it better.

1:44 callen: muhoo: then I excluded clj-stacktrace, saw some stuff that was still breaking, then changed it one more time to produce that line. now lein-check passes.

1:44 Raynes: Because it grabs raw links and stuff.

1:44 callen: muhoo: but all of it came from just reading and understanding the output.

1:44 Raynes: aaelony: Note that the pagination on the latest pastes page is broken.

1:45 muhoo: callen: fascinating, thanks. but i did do what it said, exactly, and it gave me a different failure. hmm.

1:45 callen: muhoo: I chose the simplest solution in each case that seemed to make the most sense. I don't know what to tell you.

1:45 muhoo: callen: it said nothing about commons

1:45 callen: muhoo: you run into this again, ping me. I've been doing a lot of lein wrangling lately.

1:45 muhoo: i got this error:

1:45 Please use [firealarm "0.1.2" :exclusions [clj-stacktrace]] to get [clj-stacktrace "0.2.5"] or use [cljsbuild "0.2.10" :exclusions [clj-stacktrace]] to get [clj-stacktrace "0.2.4"].

1:45 aaelony: raynes: would something solr be useful? say, https://github.com/mikejs/clojure-solr

1:45 callen: muhoo: did for me.

1:45 muhoo: I'll paste the full project.clj

1:46 Raynes: callen: Also, it bothers me how long it took for the node.js targeting to work. It was utterly broken until I reported at least 6 issues with it. It bothered me that they included it at all with it that terribly broken.

1:46 callen: muhoo: https://www.refheap.com/paste/8030

1:46 muhoo: i'm more concerned with why lein-pedantic gave you a correct output, but didn't give me correct output

1:46 callen: Raynes: my main concern atm is sourcemaps.

1:46 Raynes: that doesn't seem to be going anywhere still. That it doesn't bother them enough to fix deeply concerns me.

1:46 muhoo: look at the damn refheap and do a differential diagnosis.

1:47 muhoo: callen: i see that. what i don't see is where you got the idea to exclude commons-codec

1:47 callen: muhoo: you will note that line 17 and adding lein-pedantic are the only things I changed.

1:47 it *told* me.

1:47 muhoo: remove the commons-codec exclusion

1:47 muhoo: it did *not* tell me

1:47 callen: run lein check

1:47 it'll bitch at you about it.

1:48 change line 17 to [firealarm "0.1.2" :exclusions [clj-stacktrace]]

1:48 you'll note that it specifically recommends the current version of line 17 towards the end of the output.

1:50 muhoo: aha. there's also another matter. the failure i'm seeing after excluding clj-stacktrace is in a file which requires firealarm

1:50 it's probably something stupid in there. will look.

1:50 thanks

1:51 callen: muhoo: np.

1:51 Raynes: http://www.youtube.com/watch?v=GtvYkyAqNfU

1:51 adu: clojure metadata is so cool

1:51 Raynes: callen: You broke my macbook's speakers.

1:52 callen: Raynes: they were sacrificed to the blood god.

1:53 muhoo: callen: can i ask one more small favor?

1:53 callen: muhoo: not unless russian hookers are involved.

1:53 muhoo: callen: what does "lein deps :tree" say to the project.clj you refheaped?

1:53 like, is clj-stacktrace *anywhere* in there? at all?

1:53 callen: I like that muhoo can tell when I'm joking.

1:54 muhoo: $ lein deps :tree | grep stack

1:54 [firealarm "0.1.2" :exclusions [[clj-stacktrace] [commons-codec]]]

1:54 muhoo: callen: yeah, but, notice something?

1:54 clj-stacktrace isn't included

1:54 so, any ns that needs clj-stacktrace, what will happen to it?

1:55 this. is. my. problem.

1:55 callen: muhoo: I don't know, do you want me to require it in my test project and see?

1:55 muhoo: well, no. here's what's confusing me.

1:55 cljsbuild says it requires clj-stacktrace.

1:55 callen: muhoo: I don't mind helping you out, but if you don't ask for something specific, I'm going to get cranky. I haven't had my coffee yet.

1:55 muhoo: in fact it says it requires 0.2.5

1:55 but then, it doesn't actually require it

1:56 callen: muhoo: submit a PR.

1:56 muhoo: i'd do that if i knew even which project to do that on :-)

1:57 callen: Raynes: Ukrainian Black Metal

1:57 muhoo: anyway, i'll go one better. i'll just explicitly require clj-stacktrace 0.2.5 in firealarm, which was my original hack, then problem will be solved.

1:57 callen: muhoo: you should submit a PR to them asking them to upgrade.

1:58 muhoo: firealarm is *me*

1:58 which, is what i originally said, oh hell, i'll just do that.

1:58 callen: muhoo: ah well. that's on you obviously.

1:59 muhoo: the yak now thorougly denuded, i'll call this one done :-)

1:59 callen: as thou wilt.

1:59 muhoo: be careful with those russian hookers

1:59 callen: muhoo: always.

2:00 * callen goes back to working

2:10 dyreshark: lithuanian hookers are where it's at

2:10 that is all

2:16 Raynes: dyreshark: And you know this by experience?

2:18 callen: careful, Raynes will call the cawps.

2:18 dyreshark: Raynes: one of my friends who grew up there tells many stories

2:18 Raynes: I bet.

2:19 dyreshark: callen: will he backtrace my IP and call the cyber police?

2:21 callen: dyreshark: CYBER SHERIFF

2:21 dyreshark: OSHIT

2:22 callen: I wonder what it's like to grow up in a country where it's the norm to lose your virginity to a hooker instead of your high school sweetheart.

2:22 probably depressing.

2:22 muhoo: this topic of discussion is interesting, because it reminds me so much more of #emacs than #clojure

2:23 anyway, my first cljs hello world now works. may god have mercy on my soul.

2:23 callen: muhoo: I'm an #emacs refugee, if that explains anytihng.

2:23 muhoo: my dotfiles repo is legend.

2:23 aaelony: (drop topic)


2:24 callen: I cackled.

2:24 muhoo: that actually explains quite a lot. and yes, i do believe your name is familiar to me, and i may have pinched some of your code for my .emacs.

2:25 dyreshark: didn't she get on some huge reality TV show at some point?

2:25 for that incident?

2:25 Raynes: dyreshark: She was on ABC news, IIRC.

2:25 Not sure about a huge reality show.

2:25 Maybe a huge reality *check*.

2:27 callen: muhoo: the repo is bitemyapp on github, but yeah.

2:27 Raynes: whodathunkit, antagonizing /b/ isn't a great idea.

2:28 a young couple tried to do the same, pictures of them having sex ended up getting sent to relatives, including some fairly religious ones.

2:28 dyreshark: Raynes: ah. i could've sworn somewhere i saw that she got on oprah for it

2:28 i know she made an "i'm back, bitches" video

2:28 Raynes: Everybody got on Oprah.

2:28 dyreshark: true

2:29 p_l: Bees for everyone!

2:29 n_b: What did I just walk into

2:29 p_l: Bees.

2:29 callen: dyreshark: that is fantastically stupid.

2:30 dyreshark: callen: are you even remotely surprised?

2:31 callen: dyreshark: I suppose not, but I figured the parents might've gotten a hold over her. Guess not.

2:31 Raynes: callen: Did you... you know... see her parents?

2:31 dyreshark: ^^^^

2:31 Raynes: They weren't exactly model sane beings.

2:32 callen: I remember that.

2:32 dyreshark: probable chain of events:

2:32 "NO MORE COMPUTER" -(1 week)> "ok you can use your computer with a webcam but be careful and backtrace anyone who talks to you funny"

2:32 p_l: callen: I recall once seeing mention of organizing either a "gentleman friend of family" or father-assisted visit to high-class brothel (depending on gender) for one's kid :>

2:33 callen: p_l: in what context/culture?

2:33 dyreshark: I once got grounded for like 2 months man. Some kids get raised with no discipline at all.

2:34 p_l: callen: western europe, and probably in france

2:34 muhoo: n_b: it seems #clojure has gone temporarily #emacs.

2:34 * n_b flees

2:34 callen: p_l: meh/ick.

2:34 muhoo: yeah, guys, probably best to cut this out before more people flee.

2:34 dyreshark: i remember getting grounded for 1.5 months because i accidentally my parents files once when i was 7. i also had to retype lots of budgeting stuff in excel

2:35 because that was among what was deleted :p

2:35 callen: dyreshark: I think mine was probably about not having come home for a week or something.

2:35 ivan: https://github.com/cykl/infoqscraper

2:35 callen: I don't really remember, but I remember thinking it was hella stupid.

2:36 dyreshark: but now getting grounded is more like "omg im grounded now i only have my iphone, laptop, tv, gaming console, etc. fml"

2:36 p_l: callen: I sometimes wonder if it's not a better option than constantly bombarding with the message of "do not" but expecting it to not be followed and for random shit to happen

2:36 dyreshark: ah

2:36 callen: ivan: me. gusta.

2:36 ivan: I did not try it yet because CentOS and EPEL lack ffmpeg

2:36 callen: p_l: I prefer, "proper sex education about safety et al" but encourage they stick to people their own age and cohort.

2:37 ivan: makes me think of Knuth.

2:37 p_l: callen: tends to get "authority" riled up

2:37 callen: ivan: "I have only proven it correct, not tried it."

2:37 p_l: not in my country.

2:37 p_l: anyway, EOT from me :)

2:37 callen: lucky

2:37 callen: p_l: not really. Cheers.

2:38 * p_l goes back to figuring wth should he do now after closing last giant task

2:39 callen: is there something like fabric/capistrano/saltstack for Clojure?

2:39 and don't say pallet.

2:40 vijaykiran: what do you use for deployment?

2:44 nightfly_: Are clojure's set operations optimized when working with sorted sets?

2:45 callen: nightfly_: probably? it's PersistentTreeSet I think.

2:45 https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentTreeSet.java

2:46 dyreshark: so, question. if (eval '(* 3 2)) is 6, and (class (first '(* 3 2))) is symbol, then why is (eval '((symbol "*") 3 2)) 2? >.<

2:46 vijaykiran: callen: sorry - I don't understand - deployment of what ?

2:46 callen: vijaykiran: clojure web apps.

2:47 I don't like pallet and I'm not sure what else to use. Most of my experience is with things like Fabric.

2:47 vijaykiran: callen: Ah, heroku for playing, and others - "just zip upload, lein deps .. blah blah " < shell script

2:47 very primitive

2:48 callen: vijaykiran: yeah I have a background in dev-ops, so that won't swing it.

2:49 vijaykiran: callen: I don't think there's more clojure-y option than pallet

2:50 callen: vijaykiran: it's not clojure-y ness that is the problem, it's what pallet assumes.

2:50 vijaykiran: pallet assumes you bringing machines up and down via something like AWS

2:50 what I need is "existing" machine deployment, configuration, compliance.

2:51 I don't often find myself firing up 50 machine clusters on the fly.

2:52 nightfly_: Dang, looks like they aren't optimized at all. https://github.com/clojure/clojure/blob/master/src/clj/clojure/set.clj

2:52 vijaykiran: callen: in that case Fabric looks like a better tool for the job.

2:53 callen: vijaykiran: I don't really want to use Python and Fabric is deeply flawed in a lot of ways.

2:53 vijaykiran: callen: may be you can use clj-ssh and see what you can use in that

2:54 callen: I'm investigating it.

2:54 there's gantry too.

2:56 vijaykiran: callen: gantry is still using 1.2

3:05 Raynes: callen: I think https://github.com/mislav/git-deploy does what I want with regards to deploying with a git push like I do on Heroku. I really wish I had an actual Heroku-like thing running on my server though. Something that'd handle nginx and stuff.

3:06 dyreshark: ##((symbol "*") 3 2)

3:06 lazybot: ⇒ 2

3:07 Raynes: dyreshark: Looks like it is just returning the last thing.

3:09 callen: vijaykiran: yeah I was considering bringing it up to date.

3:09 Raynes: fuckin' ruby.

3:09 I'll use fabric before I do that.

3:09 Raynes: callen: There is also...

3:10 callen: https://github.com/peterkeen/dokuen

3:10 callen: But I don't trust dokuen at all because it was originally just a thing that only worked on OS X.

3:10 callen: still Ruby.

3:10 Raynes: You can probably understand why that makes no sense at all.

3:10 Yeah, I think the fact that it is Ruby is the least of my worries. You can write nice things in Ruby.

3:10 callen: Raynes: yes.

3:11 Raynes: the point is that the moment Clojure is removed from consideration, I'll just use Fabric.

3:11 which is python and I have a ton of experience in it.

3:11 Raynes: callen: I'm talking about my personal use for refheap.

3:11 callen: Raynes: ah okay.

3:11 Raynes: did you move off heroku yet

3:11 ?

3:11 Raynes: Also, dokuen's readme says it supports 'Mac and Ubuntu'

3:11 It supports... Ubuntu.

3:12 callen: Raynes: ...

3:12 Raynes: How do you support Ubuntu?

3:12 callen: by supporting Debian and not knowing it I guess?

3:12 Raynes: Also, no, haven't moved it off of refheap.

3:12 callen: using Ubuntu specific repos?

3:12 heroku?

3:12 Raynes: I said that backwards, yes.

3:12 I haven't moved refheap off of it.

3:12 callen: I'm considering using Heroku just so I don't have to futz around.

3:13 Raynes: But if I do, I'd probably use git-deploy.

3:13 callen: I think the moment I considered flipping the switch for a more expensive dyno, I'd go back to a nice SSD VPS or something though.

3:13 Raynes: Yeah, I pay $20 a month just for them to let me use SSL. That's getting old.

3:14 callen: LOL

3:14 I didn't know they charged for that.

3:14 Raynes: do they still not allow you to use a custom domain with SSL?

3:14 Raynes: It's actually AWS that charges for it.

3:14 callen: ELB?

3:14 Raynes: They've always allowed you to use a custom domain with ssl, iirc. In fact, that's what the charge is for. You can use piggyback ssl for free.

3:14 Whatever. I don't understand those stupid amazon acronyms.

3:15 callen: ah okay.

3:15 I'm just trying to figure out which Amazon service is responsible for charging for it.

3:16 noidi: dyreshark, evaluation of (symbol "*") results in the symbol *, not the function *

3:16 dyreshark, you have to evaluate the symbol to get the function

3:17 Raynes: callen:

3:17 http://www.activestate.com/stackato

3:17 noidi: ##(eval '((symbol "*") 2 3))

3:17 lazybot: java.lang.SecurityException: You tripped the alarm! eval is bad!

3:17 noidi: ah, figures :)

3:17 callen: Raynes: k, I'll just use Fabric.

3:17 or Heroku until it gets old, then Fabric.

3:17 dyreshark: noidi: i got it. i have to call (resolve (symbol "*"))

3:17 but thanks :)

3:19 noidi: and the behavior of returning the second argument is caused by the fact that symbols are functions that look themselves up in the collection given as the first argument and the second argument is a not-found value

3:19 ##('foo 1 :not-found)

3:19 lazybot: ⇒ :not-found

3:19 noidi: ##('foo {'foo :bar} :not-found)

3:19 lazybot: ⇒ :bar

3:20 dyreshark: ohh, that makes sense

3:20 cool

3:20 Raynes: noidi: TIL

3:21 noidi: Raynes, yeah, that's kind of strange as I've never seen anyone use that feature :)

3:21 but it makes sense that symbols work like keywords

3:26 Raynes: dyreshark: Also, (eval `(~(symbol "*") 3 3))

3:26 Sgeo: That looks completely unsurprising

3:26 dyreshark: TIL you can use those outside of macros :p

3:26 Raynes: Indeed.

3:27 &`(~(symbol "*") 3 3)

3:27 lazybot: ⇒ (* 3 3)

3:27 Raynes: dyreshark: ^ Bask in the glory.

3:27 * dyreshark basks

3:28 dyreshark: so, because this isn't legal code, what's the best way to do something like (def foo ([ [a] ] :bar) ([ [a b] ] :baz) ([ prior-destructures-failed ] :oh-noes))

3:30 just to take a, b, etc as args themselves and use & more at the end?

3:30 Raynes: Those spaces between brackets make it almost completely unreadable to me.

3:30 dyreshark: my apologies :p

3:30 i can amend if you'd like

3:31 Raynes: I can't forgive you.

3:31 dyreshark: D:

3:31 nuuuuuu

3:31 Raynes: I can't tell what you're trying to do here.

3:32 callen: okay this sucks.

3:32 dyreshark: do different things essentially depending on the length of a passed in seq

3:32 callen: I need Korma's connection pooling (because fuck using c3p0 directly) but it's configured in a retarded fashion.

3:33 noidi: dyreshark, I think you'll need to use something like core.match for that

3:33 Raynes: You won't be able to do that with arities, dyreshark.

3:33 * Sgeo wonders if Racketeers should be jealous of Korma

3:33 noidi: Clojure only does destructuring, not pattern matching

3:33 Raynes: Ugh, I wouldn't use core.match just for that.

3:33 Sgeo: The "db" library that Racket has is ... literally writing SQL

3:34 Raynes: (case (count s) 1 foo 2 bar)

3:34 If you actually need the elements, on the other hand.

3:34 I wish core.match was in Clojure itself.

3:34 It's silly that it isn't.

3:34 Pattern matching is the bee's knees.

3:34 dyreshark: ^

3:35 i'll look into it though. thanks

3:35 Sgeo: What's wrong with just ... specifying the library in leiningen

3:35 tufflax: I think Rich said "that's very bad" of pattern matching in Simple Made Easy :P

3:35 noidi: Raynes, I'd use core.match a lot more often, but just like you said, I don't like to add it as a dependency just to match one form

3:35 Sgeo: Ah

3:35 Raynes: Sgeo: What he just said.

3:36 * Sgeo hasn't look at either core.match or racket/match closely

3:36 Sgeo: So no idea how they compare

3:37 Incidentally, someone has started a racket-clojure project https://github.com/takikawa/racket-clojure

3:38 https://github.com/takikawa/racket-clojure/blob/master/tests/test.rkt

3:39 Using the native Racket require rather than hobbling a Clojure-like one probably makes more sense, really

3:39 It shouldn't be an exact match, should it?

3:39 This lang does not use a custom reader. It probably should

3:40 Although doing the paren stuff at a higher level does make sense, come to think of it

3:40 Raynes: It doesn't look like it is trying to be serious.

3:41 Sgeo: Yeah, but it's a start

3:41 Does it do anything in a way that wouldn't make sense for a more serious attempt?

3:42 Well, besides the little things that make it more Rackety

3:42 Raynes: I don't guess. I've never written a Clojure implementation before.

3:42 Sgeo: I assume def and defn just expand to define. Meaning no vars for those, and no declare

3:43 I have no idea what this ~and stuff is

3:44 Hmm, I think I see a bug

3:45 They redefine what function application means such that, if the function application uses [] it's not a function application but a vector

3:45 Same with {}

3:46 But [some-thing-thats-normally-a-macro 1 2 3] is not a function application, and thus not processed by that mechanism

3:46 Meaning it will try to do the macro rather than error

3:46 ,[-> 1 2 3]

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

3:47 Anonny: Hey Raynes, what pattern would you go with to create a bunch of links in laser from a seq containing urls and link titles?

3:47 I got it to work with a fn but it seems clunky.

3:47 Raynes: Could you show me what you've got?

3:47 Anonny: One sec

3:50 Sgeo: "Sgeo opened this issue in 2 minutes"

3:50 I really need to fix my system clock

3:50 Raynes: lol

3:51 Anonny: It doesn't have to actually work or anything, I just wanted a reference point. :p

3:52 Anonny: simlified (fn [node] (for [file files] (let [node-content (first (:content node)) new-content [(-> node-content (assoc :attrs new-attrs)(assoc :content new-content))]] (assoc node :content new-content)))

3:53 Parens horrible there.. but ignore that

3:53 It works.

3:53 Just not pretty.

3:53 Raynes: Anonny: What are you selecting? A blank <a> tag in your html?

3:53 Anonny: Just a random a tag, yea.

3:53 * Raynes cracks his knuckles and writes Anonny some code.

3:54 Anonny: BTW, I should say... except for the fact that I have to write html, I'm LOVING laser.

3:55 And I'm a devout hiccuper

3:55 So nice job.. :)

3:56 Raynes: Anonny: That code you gave me doesn't actually make sense, does it? :p

3:57 Also, thanks! I love hearing that. <3

3:57 Anonny: It doesn't run, no.

3:57 But it does on my real code

3:57 :P

3:57 Raynes: Regarding the code, you appear to not be using 'file' at all, and referring to new-content in new-content.

3:57 So I'm not sure what it is doing.

3:57 Anonny: Yea, I cut out the long part in the middle that did that.

3:57 Lemme just say what it's doing

4:02 I'm selecting an <a> node and then running a for loop on it for a group of files that I make links/titles out of. Inside the for loop I select the content of the <a> node, and inside of that content I then assoc {:href url} to :attrs and the title to :content. Finally re-assoc each of those newly created things back to the original <a>'s :content.

4:02 Bloody hell, that's still not clear.

4:03 Raynes: That's plenty clear.

4:03 Sec.

4:03 One thing that isn't clear is: are do you have a nested <a> here?

4:03 Anonny: No

4:03 Raynes: Like, it looks like your code would produce <a><a href..>..

4:03 Anonny: Just the one, but I need to get into that original <a>'s content to get to it's attrs and content.

4:04 That's the weird part.

4:04 Raynes: That doesn't make sense.

4:04 Anonny: one sec.

4:04 lol

4:04 Raynes: What does your selector look like?

4:05 It looks like you're not selecting the <a>, but the tag above the <a>.

4:05 Anonny: Ah.. bloody hell.

4:05 No wonder it's complicated

4:06 Okay, doesn't make sense because I'm actually selecting a li surrounded an <a>

4:06 surrounding*

4:07 I'm selecting something like <li=class><a></a></li>

4:07 Raynes: Anonny: Here is what you'd want to to replace an <a> tag with a bunch of <a> tags (if you actually select the <a> tag ;)): (laser/replace (for [file files] (let [link dosomethingwithfile title dosomethingwithfile] (node :a :attrs {:href link} :content title))))

4:08 (laser/child-of (laser/class= "li's class") (laser/element= :a)) ; something like this would match the :a there.

4:08 Anonny: Would it also replicate the li?

4:09 Raynes: No, not as long as you select the actual <a> tag.

4:09 Anonny: Yea, that's why I did it the way I did.

4:09 Raynes: You want to replicate the li tag too?

4:09 Anonny: I wanted each one to be an <a> inside of the <li>

4:09 Raynes: Oh, then you're not dumb at all.

4:10 Anonny: Good to hear.

4:10 I wonder some times.

4:10 Raynes: We can do that.

4:11 (fn [node] (for [file files] (let [stuff with file to get title and link] (assoc node :content (laser/node :a :attrs {:href link} :content title))))

4:12 Something like that, Anonny?

4:12 Anonny: That looks about right.

4:13 Raynes: Well, it'd be like [(laser/node :a :attrs {:href link} :content title)], but you get the point.

4:13 Anonny: So you'd just make an fake node in there instead of selecting for the original?

4:13 Or am I misunderstanding.

4:13 Raynes: What do you mean fake?

4:14 Anonny: Does node select a node?

4:14 Or mock one?

4:14 Raynes: laser/node?

4:14 Anonny: yea

4:14 Raynes: It creates a node.

4:15 It's the same as doing {:type :element, :tag :a, :attrs {:href link} :content [title]}

4:15 Anonny: So if your original html had an <a> already inside of the <li> you're ignoring it's data and replacing it, correct?

4:15 Raynes: Yes.

4:15 Anonny: Which is what I meant about it being a fake node.

4:15 Raynes: If you have a class or something on the old dummy <a> tag, your code would be what you'd want, unless you wanted to add the class in the (laser/node) call too.

4:16 Anonny: I suppose that works better than what I have, though mine would work to preserve classes or such

4:16 Raynes: But if your <a> tag is just a dummy tag sitting there, you can just replace it and not bother.

4:16 Anonny: er

4:16 as you said.

4:16 Raynes: Anonny: Your code can be improved too.

4:16 callen: why can't I use any of the required symbols in my ns when I C-c M-n the namespace?

4:16 Anonny: I have no doubt of that!

4:16 How would you do it?

4:16 Raynes: (assoc node-content :attrs new-attrs :content new-content)

4:16 callen: I can only reference symbols that are def'd in my file.

4:17 Raynes: Anonny: You can assoc multiple keys, so no need for the (-> node-content ..) stuff./

4:17 callen: hrm, yeah, it's an in-ns. Okay. this is annoying.

4:17 Anonny: Dur.

4:17 :d

4:17 Thanks Raynes.. :)

4:18 ejackson: morning folks

4:18 Raynes: No problem. If you need any other help, let me know. Also, be sure to report any nasty boogs.

4:18 callen: ejackson: morning.

4:18 Anonny: Haven't found any yet. Works... surprisingly... unsurprisingly.

4:18 No gotchas.

4:19 Raynes: Anonny: Also, look for a new release later this morning/tomorrow with improved descendant-of, adjacent-to, and child-of combinators (among other things).

4:19 Anonny: I will.

4:28 jaju: Hello folks - I am running into a problem I need help with. I'm trying to define a class in Clojure that derives from another base class, and needs to over-ride one polymorphic method.

4:28 ejackson: there isn't inheritence in Types in clojure

4:29 but, if your class is in Java then you may be in luck

4:29 jaju: I'm using gen-class - and whatever it provides to derive from a Java class.

4:29 ejackson: ok, that'll do it

4:29 jaju: Yes - I'm trying to implement some replacement stuff for existing code - but in Clojure.

4:29 ejackson: but its really painful :

4:29 jaju: :)

4:30 Yeah - the idea is to take this pain for a while but see how we can use more Clojure in our Java app!

4:30 I have an embedded nrepl server to connect to the app.

4:30 ejackson: that's always fun

4:30 jaju: And emacs to try and fix with a lot less pain.

4:31 Yes, and now I'm in a situation I haven't been able to figure out the cause of.

4:31 The method I override has 3 variants - one without any argument, and two with one argument of different types each.

4:31 I only am over-riding the argument-less method

4:42 Anonny: Raynes: This isn't a bug, just a bit of complication I can imaging tripping somebody up. (laser/content "Lolol") is the same as (fn [node] (assoc node :content ["Lolol"])), not (fn [node] (assoc node :content "Lolol"])). The latter raises a "No matching clause" IllegalArgumentException.

4:44 Raynes: Don't really think you can do much about it, but maybe a better exception message would let people know what the problem is.

4:51 Er. The second one was supposed to be (fn [node] (assoc node :content "Lolol")) I don't think I should be allowed to talk this late at night.

5:19 Raynes: Anonny: Aye, that is Hickory exploding.

5:23 Anonny: At least, I think it is. I need to get around to rewriting its hickory-to-html function. Hopefully I can add some better error handling when I do.

5:30 Sgeo: If Clojure had lightweight threads, would there be as much desire to have something like Lamina?

5:36 jaju: Sgeo: How light is "lightweight"? There's always some overhead in maintaining more runtime state that needs to be processed as an overhead when switching context.

5:37 thorwil: is there a better way to get :roles out of a request map passed through Friend than (-> r :session :cemerick.friend/identity :authentications vals first :roles) ?

5:38 the map looks like this: {:session {:cemerick.friend/identity {:authentications {"admin" {:roles #{:tlog.data.account/admin}, :identity "admin", :username "admin"}}, :current "admin"}}}

5:40 callen: Sgeo: I don't get the impression that threading on Clojure is bad or anything, most of the concurrency stuff is built on it.

5:43 jaju: thorwil: Relying on order in maps isn't a good idea unless you know it is ordered and you know which element you want.

5:44 thorwil: (If I read it right) I'm talking about the 'first' in your code

5:44 thorwil: A better way could be (get-in <your-map> [:session :cemerick.friend/identity :authentications "admin" :roles] nil) etc.

5:46 thorwil: jaju: i would like to not rely on the name "admin"

5:46 that is, get roles independent on the account name

5:46 jaju: Sure - even I wasn't sure what you want, so I added the "etc." at the end. :)

5:47 thorwil: the sole reason for the vals, first combo is that i get the map independent of its string-key

5:49 svedubois: (new topic) I would like to compute the md5 hash of an image. I have tried this, but it doesn't work:

5:49 (org.itk.simple.HashImageFilter$HashFunction/MD5 image)

5:49 The C++ API of this class is here:

5:49 http://www.itk.org/SimpleITKDoxygen/html/classitk_1_1HashImageFilter.html

5:51 Raynes: callen: Have you seen this? http://news.ycombinator.com/item?id=4994208

5:51 callen: The comments make me never want to get another of my blog posts on HN.

5:52 Guy is just showing an example of macros in Clojure, and all the of the comments are like "Why do this in Clojure when it already has list comprehensions? Bluuuuh" and at least one calls him self-impressed.

5:52 callen: Raynes: I'm usually the negative one, but this is pretty ridiculous.

5:52 why would you trash the guy over something he wasn't even trying to do?

5:52 fucking wackos.

5:53 >Also, this fucking hippy culture of "classes suck; functional programming rockz; lolz" need to die.

5:53 >Someone's very happy to have authored Clojure's for special form.

5:53 since when is for a special form?

5:53 if you're going to nitpick at least do it correctly.

5:53 Raynes: stop making me read HN, it makes me angry.

5:54 I'm trying to figure out why I'm retarded and can't get this thing to work in Clojure.

5:54 Raynes: callen: Several people are complaining because his list comprehension macro isn't exactly the same as the 80 line version in clojure.core. This is ridiculous.

5:54 ejackson: yup, HN is filled with humans, no good ever comes of that.

5:54 Raynes: ejackson: In my experience, it is filled with idiots. Not humans.

5:54 Not human idiots, in fact.

5:54 A special breed.

5:55 ejackson: you may be on to something there

5:55 Raynes: callen: There is a guy there complaining about the keyword directives in doseq, for, etc.

5:55 He makes me a little angry.

5:55 svedubois: Any advice about what's wrong with (org.itk.simple.HashImageFilter$HashFunction/MD5 image) ?

5:55 Raynes: I enjoy a good (for [x y :let [foo (* x x)]] ..)

5:56 thorwil: Raynes: it will surely calm you to consider that the niveau on HN is already an improvement over slasshdot or most of reddit :>

5:56 Anonny: On the other hand, two of the top 30 on there right now are clojure related. And clojure articles get on the front an awful lot. Idiots or not there seems like there is a lot of clojure love on HN.

5:57 tufflax: svedubois: It looks like you are missing a `.`

5:58 Raynes: Anonny, callen: The '2012 in review' post on HN has two comments, one of which is that Clojure needs RoR clone, which is the utter antithesis of what Clojure needs.

5:58 I hope Clojure never becomes the language that people *think* they need, but the one that they do need.

5:59 callen: Raynes: Clojure needing a RoR clone? jesus christ.

5:59 Raynes: New people frequently think they want this.

5:59 Until they actually start using Compojure and a few libraries.

6:00 And their face promptly melts.

6:00 ejackson: yes, its a horrible balance: not popular enough you die out, too popular you die of idiots

6:02 svedubois: tufflax: Nope, I had tested with dots and doesn't work neither.

6:02 algernon: hn in adblock helps a lot, I found. if one's too weak to resist the temptation, adblock saves him, because laziness prevails and one will not remove the blocking then put it back on.

6:02 tufflax: svedubois: with dots? It is a call right?

6:03 svedubois: I don't mean that you should replace $ or / with dots, but you need one dot in the beginning

6:03 svedubois: It is a static method MD5 of an image

6:04 tufflax: I have tested this, and they don't work: (. org.itk.simple.HashImageFilter$HashFunction/MD5 caster)

6:04 (.. org.itk.simple.HashImageFilter$HashFunction/MD5 caster)

6:04 (org.itk.simple.HashImageFilter$HashFunction/MD5. caster)

6:04 (org.itk.simple.HashImageFilter$HashFunction/MD5 caster)

6:04 tufflax: svedubois: hm, ok, maybe I'm wrong :P

6:05 Anonny: Raynes: If Clojure is going to become a language people NEED we have to build libraries that make it REALLY fast to jump in and get a project off the ground. I'm not saying there needs to be a ROR clone, but tools (or lein templates) that take care boring/slow stuff is what will make people NEED the language.

6:05 tufflax: What error do you get?

6:05 Raynes: Anonny: Luminus is a template that is doing just that.

6:05 A RoR clone or other giant framework is just not the way to go about it.

6:06 Anonny: Raynes: I know about Lum, yes. It is a step in the right direction. I think the lein plugin for lobos might be another one of those steps.

6:06 svedubois: tufflax: java.lang.IllegalArgumentException: No matching field found: image for class org.itk.simple.HashImageFilter$HashFunction

6:06 (. org.itk.simple.HashImageFilter$HashFunction/MD5 image)

6:07 tufflax: svedubois: What is that function signature in java?

6:08 or, wait, that looks weird

6:08 field image?

6:09 Anonny: Raynes: It's things like that... simple command line stuff that makes import things happen... like project frameworks appear or databases build, that needs to be created. The clojure culture would be a lot more friendly to beginners, or just people who want to get things done, if creating lein plugins/templates was standard practice.

6:10 Raynes: IM-very questionable-O, at least.

6:11 tufflax: svedubois: is there javadoc of that class anywhere?

6:12 svedubois: tufflax: Yes there is a javadoc local generated in the building time. I have found this in the javadoc:

6:12 protected HashImageFilter(long cPtr, boolean cMemoryOwn) {

6:12 swigCMemOwn = cMemoryOwn;

6:12 swigCPtr = cPtr;}

6:12 public final static HashImageFilter.HashFunction MD5 = new HashImageFilter.HashFunction("MD5");

6:12 private static HashFunction[] swigValues = { SHA1, MD5 };

6:18 callen: I don't suppose anybody has implemented a session store in terms of Korma, have they?

6:25 svedubois: tufflax: Here is the javadoc of HashImageFilter: http://jsfiddle.net/svedubois/tA4tJ/

6:28 tufflax: svedubois: Hm, what about the HashFunction inner class? :P

6:28 svedubois: tufflax: And here the info about HashImageFilter.HashFunction: http://jsfiddle.net/svedubois/kgpLP/

6:31 tufflax: Strange class, I don't understand how to use it. The HashImageFilter$HashFunctio/MD5 is a class not a method

6:33 svedubois: maybe you should you setHashFunction of HashImageFilter, and then do something with it :P

6:33 s/should you/should use/

6:35 svedubois: tufflax: Something like that: (-> (org.itk.simple.HashImageFilter.)

6:35 (.setHashFunction org.itk.simple.HashImageFilter$HashFunction/MD5)

6:35 (.execute image))

6:36 tufflax: yeah, but I'm just guessing. It doen't say what execute is supposed to do

6:37 hyPiRion: It's probably better to use `doto` here

6:38 Not sure if .setHashFunction returns the image filter or void, but if void, then doto woould work

6:38 and -> wouldn't

6:39 svedubois: hyPiRion: With doto:

6:39 (doto (org.itk.simple.HashImageFilter.)(.setHashFunction org.itk.simple.HashImageFilter$HashFunction/MD5)(.execute image))

6:39 I obtain no errors but I obtain only this:

6:39 #<HashImageFilter itk::simple::HashImageFilter

6:39 HashFunction: MD5

6:40 hyPiRion: right. doto returns the first argument

6:40 tufflax: how is -> working?

6:41 hyPiRion: (-> (a) (b c) (d)) == (d (b (a) c))

6:41 svedubois: What how I can compute the md5 hash of this image?

6:42 hyPiRion: ,(macroexpand-1 '(-> a b c))

6:42 clojurebot: (clojure.core/-> (clojure.core/-> a b) c)

6:42 svedubois: tufflax: With ->

6:42 (-> (org.itk.simple.HashImageFilter.)(.setHashFunction org.itk.simple.HashImageFilter$HashFunction/MD5)(.execute image))

6:42 tufflax: I meant working for svedubois

6:42 svedubois: I obtain this:

6:42 hyPiRion: ,(require '[clojure.walk :as walk])

6:42 clojurebot: nil

6:42 svedubois: "3dcb8bce1c174f358608927212aa4cf7"

6:42 hyPiRion: ,(walk/macroexpand-all '(-> a b c))

6:42 clojurebot: (c (b a))

6:42 hyPiRion: ,(walk/macroexpand-all '(-> a (b e f) c))

6:42 clojurebot: (c (b a e f))

6:42 svedubois: With no errors

6:42 tufflax: svedubois: that looks about right, svedubois no?

6:43 svedubois: Yes thanks, it works

6:43 tufflax: ok ;)

6:44 svedubois: Anyway I don't understand the difference between -> and doto, when I have to use each one ?

6:45 tufflax: doto returns the first agument (the following forms are for side-effects), while -> turns (a (b (c d))) into (-> d c b a)

6:47 svedubois: this is a nice site for documentation, sadly it does not include all the new functions in 1.4 and 1.5

6:47 http://clojuredocs.org/quickref/varsonly/Clojure%20Core

7:23 ejackson: otfrom: 'grats on the coverage :)

7:24 otfrom: ejackson: thanks!

7:30 Raynes: callen: Man. I need to stop playing Half Life. I've been quick saving so much that I just tried to hit F6 to save a file in Emacs.

7:31 wingy: Raynes: you should start with StarCraft2

8:18 callen: cemerick: shoreleave-remote-ring, how stable is it?

8:39 cemerick: callen: how do you mean?

8:39 it works as it should

8:39 but, it's, what, 0.0.2?

8:40 That said, it's not like the API is large, and the domain isn't complicated, so any changes probably won't be earth-shattering

8:51 bpr: I'm getting intermittent "Namespace not found" from nrepl.el. Does anyone know what some possible causes for that might be?

8:54 xeqi: bpr: I get that sometimes when I kill the *nrepl-server* and re nrepl-jack-in

8:54 bpr: Ah. In my current case, it's being caused by a compile error in a required namespace

8:54 yes, i've done that :]

8:54 the issue was no information about the compile error was getting returned to me

8:55 i had to run: lein repl and connect to it and then the exception was printed to the terminal running the lein process

8:56 oddly, (pst *e) in the nrepl.el doesn't print anything, but running that in the terminal repl works (ie. prints the compiler error)

9:00 callen: cemerick: I'm having an issue where _fetch is 404'ing

9:01 well now it's throwing a null pointer exception.

9:07 bpr: i think nrepl.el might not be shutting down properly, because all is fine after restarting emacs

9:08 * bpr thought the nrepl shutdown issues were fixed?

9:10 callen: cemerick: ^{:remote-name :validations/blah} is breaking things.

9:16 justincampbell: <-- clojure noob, what am i doing wrong? https://gist.github.com/996d5207b527c6a25d59

9:16 i get a Long cannot be cast to IFn error

9:16 joegallo: (n)

9:16 You are calling (4), for instance.

9:17 4 is not a function.

9:17 You can't call it.

9:17 You want n, not (n).

9:17 justincampbell: ahh

9:17 thanks!

9:17 the n looked all naked and alone without the parens

9:18 Sgeo: There's a Haskell bot that used to have numbers be functions

9:18 bpr: justincampbell: what that error is saying is that Long isn't a function (ie. IFn)

9:18 Sgeo: Because it considered all functions from a number to a number to themselves be numbers

9:18 borkdude: numbers don't implement IFn? ridiculous ;)

9:18 Sgeo: So a regular number like 4 would ignore its argument and return 4

9:18 The arrangement meant you could do something like (sin + cos) 5

9:18 Which would be the same as sin 5 + cos 5

9:19 justincampbell: my ruby-mind was just assuming i could infinitely put parentheses anywhere i want

9:19 but it makes sense that it evals the contents

9:19 Sgeo: Probably confused a lot of newbies though, especially since that's not how Haskell is set up by default

9:19 borkdude: justincampbell you can put indefinite , and spaces though

9:19 justincampbell: speaking of whitespace

9:20 using vim and on a newline, it indents to the first argument/or something of the previous line

9:20 Sgeo: Do note that there are some whitespacing possibilities that we'd get mad at

9:20 justincampbell: http://cl.ly/image/2d0G2X0e2x2v

9:20 if prefer the former but its doing the later

9:20 Sgeo: Since indentation is more critical than with other languages for reading code

9:20 justincampbell: i'd* prefer

9:21 borkdude: I prefer to indent with , instead of spaces… so much clearer

9:21 justincampbell: any vim users have a fix? im using vimclojure already

9:21 borkdude: (defn foo [x]

9:21 ,,(+ x 10))

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

9:22 hugod: callen: pallet can work with existing machines

9:23 see the node-list provider, and http://palletops.com/doc/how-tos/using-pallet-with-existing-servers/

9:27 callen: hugod: not really worth it when compared to fabric in terms of complexity.

10:03 Raynes: callen: I can't sleep.

10:03 callen: Raynes: me either.

10:03 ejackson: Raynes: I think this may be a trained behaviour... :P

10:03 Raynes: Life is hard.

10:03 callen: Raynes: seems so.

10:04 Raynes: tpope: You should write a pure-viml version of refheap.vim.

10:15 He probably isn't going to take my bait.

10:15 What do you bait viml authors with?

10:15 Rat tails?

10:17 jocrau: In ClojureScript: Is there a reason why (type …) doesn't take (with-meta something {:type MyType}) into account?

10:17 Raynes: Really? That sounds bugish, but too much of a big deal to be something that was overlooked.

10:17 So I'm curious now too.

10:17 * Raynes shines his dnolen signal.

10:19 ejackson: hehe

10:19 jocrau: :-)

10:19 Raynes: ejackson: You know, your Clojure machine learning talk didn't have much Clojure in it. It just occurred to me.

10:19 ejackson: As a superhero dnolen would have to be "The Unifier"

10:20 Raynes: bollocks to that ! I have a 20minute coding session !

10:20 Raynes: I remember considering bringing you some of my spare parentheses, but didn't to look like Kanye West.

10:20 didn't want*

10:20 ejackson: lol

10:21 son, i'd a whooped you right back into your seat !

10:21 Raynes: I'd have been too you saying "PUT YA DUKES UP, BOY" in your fantastic accent to fight.

10:21 too distracted

10:22 ejackson: and it was glorious information theory, not slutty machine learning...

10:22 Raynes: Wow, I'm hemorrhaging words today.

10:23 ejackson: my my, the youth are restless in here today

10:23 Raynes: I'll be 19 in a month, old man.

10:24 ejackson: enjoy it while it lasts....

10:24 Raynes: Did you just tell me to go get plastered?

10:24 ejackson: soon you'll be spitting out teeth, and forgetting your words... oh wait !

10:24 `fogus: 19 is practically one foot in the grave

10:24 Raynes: `fogus: Yeah, my knees are starting to get weak.

10:25 jocrau: I am over 40 yrs old, so no jokes about feet in graves here, ok? ;-)

10:25 ejackson: i wont tell you how old I am Raynes, you'd suffer an overflow

10:26 Raynes: I bow to your elder glory, sirs.

10:26 * ejackson fetches his pipe and slippers

10:27 ejackson: so when's the LA move ?

10:27 Raynes: Early February.

10:27 ohpauleez: ejackson is older than time itself - he's been here since the birth of matter (he is a timelord)

10:27 * `fogus adjusts his mummification wrappings

10:28 ejackson: but I moisturise generously, so it doesn't show

10:28 ohpauleez: haha

10:28 justincampbell: so if im testing a function that returns a function

10:28 with speclj

10:28 id like to test the function it returns

10:28 ohpauleez: fogus! It's good to see you in here!

10:28 ejackson: Raynes: enjoy, what an exciting time !

10:28 justincampbell: and the describe "original-function" seems not right for that

10:29 Raynes: ejackson: http://www.youtube.com/watch?v=kXiY1_H7NkQ

10:29 ejackson: I *love* that one !

10:29 Raynes: I recalled it when you said you moisturize.

10:29 justincampbell: i guess i could nest describes

10:30 ejackson: when they wheel me up, all translucent like, to speak at Conj 3012, you'll be lucky to be looking so goooood.

10:30 ohpauleez: hahaha

10:31 Raynes: Yeah, I'll only need one guy to moisturize me at that point.

10:31 ejackson: eeeew

10:31 Raynes: I bet poor justincampbell is thinking "Wtf, they're making jokes about being old and I"m here with a real problem…"

10:32 TIL that speclj is a thing.

10:32 ejackson: me too

10:33 Raynes: The TDD part scares me.

10:33 It is well known that I cannot think far enough ahead to do TDD>

10:33 Furthermore, I am fascinated at the variety of words these libraries use to say "this thing should be true". is, should, expect, etc

10:34 justincampbell: Raynes: lol

10:34 Raynes: I'm going to write one of these libs and alias it to all of is, should, will, can, hopefully, expect, maybe, better, promise, and ensure.

10:35 algernon: Raynes: the trick is to think backwards. Imagine you're a logic program, driven by webyrd, ran backwards. There. TDD.

10:35 Raynes: Speclj looks nice.

10:36 It's really just a testing thing, the header shouldn't imply it is only good for TDD/BDD.

10:36 It'd be better just saying that "btw, it's excellent for tdd"

10:36 "and it won't give you an std"

10:36 etc

10:37 justincampbell: Raynes: its just familiar to me coming from ruby

10:37 although speclj is a little weird because in rspec you describe classes and methods, and there is value from that because you have a lazily evaluated subject that you can reference

10:37 Raynes: This is by far the best website I've seen for a library.

10:38 justincampbell: but in speclj it only seems to make your test output pretty

10:39 Raynes: I like it.

10:39 It's a thousand times simpler than midje.

10:40 I use midje in one project, but never in any others because midje was confusing as hell.

10:40 justincampbell: ive heard of midje, isnt the advantage of midje stubbing?

10:41 ejackson: i still just use clojure.test. Luddite.

10:41 Raynes: *shrug*

11:39 beffbernard: Why is it that rest and cons always return sequences?

11:39 AimHere: What should they return?

11:39 beffbernard: ,(class (reset [1 2 3 4]))

11:39 ohpauleez: beffbernard: Are you using cons when you really mean to be using conj?

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

11:40 AimHere: Also, cons returns a 'cons'

11:40 S11001001: beffbernard: because overspecification of the results of the API limits the potential for future improvements

11:40 beffbernard: ohpauleez: I was just asking out of curiosity

11:40 ohpauleez: ahh gotcha

11:41 Raynes: I'd venture to guess that one reason is that cons is only fast on lists, right?

11:41 S11001001: Raynes: cons is just Cons.

11:41 Raynes: Blew my mind.

11:42 AimHere: Cons is probably reasonably fast on sets

11:42 S11001001: its big benefit is it doesn't force the seq you give it

11:42 ,(cons 42 #{1,2,3})

11:42 clojurebot: (42 1 2 3)

11:43 AimHere: ,(cons 3 #{1 2 3})

11:43 clojurebot: (3 1 2 3)

11:43 AimHere: Okay, might not be that fast

11:43 S11001001: AimHere: it's entirely fast

11:43 since it just constructs a Cons

11:43 maybe it seqs non-seqs

11:44 AimHere: ,(car (cons 3 #{1 2 3}))

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

11:44 S11001001: ,(cons 1 "hi")

11:44 clojurebot: (1 \h \i)

11:44 AimHere: ,(first (cons 3 #{1 2 3}))

11:44 clojurebot: 3

11:44 AimHere: ,(rest (cons 3 #{1 2 3}))

11:44 clojurebot: (1 2 3)

11:44 AimHere: Seems to convert the set to a list though

11:44 S11001001: AimHere: I doubt it

11:44 beffbernard: ,(class (rest (cons 3 #{ 1 2 3})))

11:44 clojurebot: clojure.lang.APersistentMap$KeySeq

11:45 AimHere: ,(rest #{1 2 3})

11:45 clojurebot: (2 3)

11:45 metellus: ,(rest (cons 4 #{1 2 3}))

11:45 clojurebot: (1 2 3)

11:46 TimMc: AimHere: You're geting back a seq view over that set, so of couse it prints as a seq.

11:47 AimHere: So I see

11:47 beffbernard: Is there an equivalent 'conj' for rest?

11:47 Raynes: I wish I could get a seq view of TimMc.

11:47 metellus: ,(seq "TimMc")

11:47 clojurebot: (\T \i \m \M \c)

12:02 TimMc: Raynes: You already are.

12:19 hyPiRion: beffbernard: 'conj' for rest?

12:19 TimMc: s/are/have one/ ;; dammit Raynes your word-fail is infectious

12:20 llasram: hyPiRion, beffbernard: `pop` maybe?

12:22 hyPiRion: pop is kind of like rest, but without the seq in between

12:22 ,(pop '(1 2 3))

12:22 clojurebot: (2 3)

12:22 hyPiRion: ,(pop [1 2 3]) ; [1 2]

12:22 clojurebot: [1 2]

12:22 hyPiRion: cons always add in front, so that's kind of like 'conj' for rest, though I'm not entirely sure what he asked for

12:23 (that's why I asked in the first place :)

12:52 bosie: any brazilians in here?

13:04 callen: bosie: god I hope not.

13:04 bosie: callen: huh?

13:04 callen: bosie: que?

13:04 bosie: callen: i see, guess you are brazilian? ;)

13:05 callen: bosie: HUE HUE HUE HUE HUE no.

13:05 bosie: k

13:05 bawr: stereotypes

13:05 stereotypes everywhere

13:05 callen: I don't see any

13:11 nDuff: When using autocompletion in nrepl.el, a bunch of newlines get injected into the output of the next command I run. Anyone familiar with this issue / know where it might be coming from?

13:17 ghengis: is there a pure-clojure implementation of a BlockingQueue anywhere? I've got this library that's very close to pure-clojure except for this LinkedBlockingQueue

13:17 seems like it'd be a tricky thing to write correctly

13:18 technomancy: why do you want it to be pure clojure?

13:18 noidi: ghengis, I've got the impression that using java.util.concurrent stuff is the way to go in Clojure

13:18 technomancy: java's LinkedBlockingQueue is very good

13:21 ghengis: not really a great reason.. I've trying to make a general-purpose api, and if i wanted it to be useful in clojurescript or some non-java clojure, it'd be nice to avoid java dependencies

13:22 technomancy: any code that uses queues is probably going to depend on concurrency semantics in some way, making it unsuitable for a JS runtime

13:24 lucian: you can just use an array for the JS version

13:24 or a clojure list

13:24 ghengis: yeah, good points.. i'll just leave it in there

13:28 cgranger had a clever pipes implementation on his blog that seemed close to what I was trying to do.. using promises to provide the blocking instead of polling

13:29 technomancy: most of what makes it difficult to implement a proper queue on the JVM (actual (or even fake) concurrency) simply isn't possible in JS

13:31 ghengis: now i'm just trying to figure out how it could be done in clojure

13:32 so there's not a lot of code reuse between clojurescript and clojure, i take it?

13:32 Foxboron: So, my new years resolution is too learn Clojure well enough to use it for hobby projects. Lets hope this goes well ^^

13:33 ghengis: good luck! that was my 2012 resolution and it was a fun year :)

13:34 Foxboron: Lets hope my mind can handle functional programming and LISP.

13:35 alexbaranosky: Foxboron you're in the right place; lots of people to learn from on this IRC channel

13:35 ghengis: it took 4 or 5 months for my brain to switch

13:35 Foxboron: alexbaranosky, been lurking the past months and bought books. So well prepared, just had problems balancing code time and school :P

13:38 btw, anyone running a emacs and clojure setup on windows? attempted getting one up but i encounter a few problems here and there as most guides assume you sit on a *unix box.

13:39 ihodes: technomancy: hey phil! i was wondering if you may know of an updated guide to getting a clojure app up and running on Heroku? i'm having major trouble using the DB on my app (my local pg DB works fine, but if i try to use the Heroku DB (locally or on heroku), i cannot connect to it.)

13:40 Foxboron: not to be the guy that says "use something else", because people definitely have success using emacs with clojure on windows (it's doable!), but if it's possible and okay for you to try using Linux (maybe in a VM), you may find developing a bit easier (just because of those assumptions people make when they write blog posts, etc). but hopefully someone else here can help you!

13:41 technomancy: ihodes: no known issues afaik; if you pm me with the app name I can take a look.

13:42 justincampbell: does it make sense to compare functions in tests?

13:42 ihodes: technomancy: i'm sure it's an issue with my app in particular, so i don't want to waste your time! thanks, though :) i may do a SO post at some point…it's been a bit of a mystery to me

13:42 justincampbell: for instance, i have a function that returns a function, and i have another function that returns a sequence of those functions * n

13:42 technomancy: ihodes: no worries; it's my day job.

13:43 justincampbell: i want to write a test that its returning what i asked it to

13:43 can you compare functions?

13:43 AimHere: ,(compare + -)

13:43 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.core$_PLUS_ cannot be cast to java.lang.Comparable>

13:44 justincampbell: ,(compare (fn [] true) (fn [] true))

13:44 clojurebot: #<ClassCastException java.lang.ClassCastException: sandbox$eval53$fn__54 cannot be cast to java.lang.Comparable>

13:44 ihodes: technomany: haha, alright. thank you very much (messaging)

13:44 amalloy: justincampbell: no

13:44 i mean, you can compare them for pointer-equality

13:44 justincampbell: amalloy: for a test, whats the best way to test the return value if the return value is a function?

13:44 AimHere: You could probably write some sort of function that compares the outputs given fixed inputs

13:44 justincampbell: call the function returned?

13:45 amalloy: wow, did clojurebot get restarted recently? eval53$fn__54 are really low numbers

13:45 justincampbell: indeed. verify that the function works as expected

13:45 hiredman: the oom killer kills clojurebot sometimes, and I have it launched in shell while loop

13:46 AimHere: If you're doing this in clojurescript, there's probably a way of comparing the resulting javascript functions as strings

13:47 amalloy: oh hiredman, did you notice my feature request for some kind of in-message clojurebot notifier, like so i could mention ~~flatten now and have him spout the factoid?

13:48 Foxboron: ihodes, haha. I know, i am in the process of getting a Zenbook and putting Arch on it.

13:48 hiredman: amalloy: I'll think about it, I would prefer some kind of more automatic pos tagging, but it would require running every line through it and responding to every line, which I doubt people would like

13:49 amalloy: pos?

13:49 clojurebot: (def transpose (partial apply map vector))

13:49 hiredman: parts of speech

13:49 nDuff: Hrm. I get the distinct feeling that there's something in the standard library I should be using to make this simpler; I'm trying to reduce a series of [key set] 2-tuples into a map with a union for each key, and my current implementation is as such: (reduce (fn [x y] (let [[y-k y-v] y] (update-in x [y-k] clojure.set/union y-v))) {} input-key-set-sequence)

13:49 ihodes: Foxboron: awesome! I'm jealous. definitely come back here if you have q's about Arch—i haven't run it on my own box, but lots of people here have iirc, and i've run it on my linode for 5 years now haha

13:50 Foxboron: it's a challenge in itself setting it up, esp on your own box, but i guess it'll be more doable with a zenbook :) that's awesome

13:51 amalloy: nDuff: (apply merge-with union (for [[k s] things] {k s}))?

13:52 or merge-with into, if that's your preference

13:53 nDuff: amalloy: (merge-with clojure.set/union input-key-set-sequence) is perfect; thanks!

13:54 amalloy: uhhhhh, really? it shouldn't work without the two changes necessary to turn your code into mine

13:54 Foxboron: ihodes, i have so far failed 4-5-6 times on a VM ;P So i am not looking forward to it, so to speak.

13:54 nDuff: *shrug* -- does work in practice. Perhaps I misrepresented something in the question?

13:55 technomancy: Foxboron: arch is kind of finicky. if you're having trouble with it why not use something that isn't designed to be hard to set up?

13:55 amalloy: apparently. because, say, ##(merge-with clojure.set/union '([a #{b c}] [a #{d e}])) shouldn't work afaik

13:56 lazybot: ⇒ ([a #{c b}] [a #{d e}])

13:56 amalloy: which is the structure you alleged to have

13:56 Foxboron: technomancy, whats the fun in that?

13:56 ihodes: Foxboron: oh boy haha, you may want to try something else to start :) but if you really want to do arch, their irc is great

13:57 Foxboron: and i'm sure you've checked, but they also have a superb wiki

13:57 Foxboron: ihodes, been using Ubuntu for a few years on other PC's etc. So yeah, i think the guide is failing somewhere or i am not reading between the lines.

13:57 ihodes, i did follow the wiki btw.

14:03 DaReaper5: Hi is there any way o pass a list of args to a macro?

14:03 to*

14:03 while keeping it lazy

14:04 justincampbell: is there a better way of doing option args than [arg1 & arg2] … (or (first arg2) "default")

14:04 default* args

14:05 Raynes: (defn foo ([arg1] (foo arg1 "default")) ([arg1 arg2] dostuff)))

14:05 justincampbell: ermagerd

14:05 so cool

14:05 thanks! Raynes

14:05 Raynes: I am to please.

14:06 aim

14:06 Definitely aim.

14:08 DaReaper5: Is there any way to pass arguments lazily to a function (which expects lazy args)

14:08 ex: (fields :client.luid) want: (apply fields `(client.luid))

14:09 but apply is not lazy

14:09 amalloy: yes it is

14:09 DaReaper5: ... well why is it trying to eval client.luid gah

14:09 amalloy: &(apply (fn [& args] (first args)) (range))

14:09 lazybot: ⇒ 0

14:09 DaReaper5: "client.luid" does not exist

14:10 llasram: DaReaper5: I think you're confusing lazy vs. strict evaluation with macro-expansion time vs evaluation time

14:13 DaReaper5: llasram no i just mixed up apply, i realized what i did. Now i have a different issue/question

14:13 technomancy: https://www.ioncannon.net/projects/code2012/

14:13 ppppaul: is it easy to get pretty printing for failing test assertions?

14:14 DaReaper5: i need to splice into a list without unquoting (that might be a weird condition but I cant surround the call with a `)

14:14 technomancy: clojure and haskell neck and neck

14:15 DaReaper5: if i do use a ` i need to either unquote it or eval

14:15 llasram: DaReaper5: Example?

14:15 ppppaul: technomancy, that page doesn't work for me (console error "d3 is not defined")

14:15 TimMc: DaReaper5: I get the feeling you're asking for a chainsaw so that you can get into your front door, when all you really need is a locksmith.

14:15 ppppaul: info.js line 6

14:16 DaReaper5: TimMC probably

14:16 i am fighting with korma lol

14:16 callen: oh yeah, macros on top of korma. That'll end well.

14:17 DaReaper5: works (fields :address.state), but what if i want to pass a list of fields to ... "fields" (instead of defining them statically)

14:17 ihodes: DaReaper: maybe avoid korma (cc technomancy)

14:17 technomancy: callen: well macros are infectious. it's hard to abstract over something that over-uses macros without resorting to macros yourself.

14:17 ihodes: DaReaper5: though if it's working for you, stick to it

14:17 DaReaper5: ihodes, cant

14:17 ihodes: DaReaper5: I

14:17 DaReaper5: i've lost about 5 hours to korma :(

14:17 DaReaper5: ya it is mostly working for me

14:18 i think my issue is with clojure knowledge

14:18 ihodes: i envy you.

14:19 DaReaper5: http://pastebin.com/dqEtu0F3

14:19 that works but i need to build the list of fields

14:19 like this:

14:20 http://pastebin.com/BKqMFnQH

14:21 that works if the condition is true

14:21 null error if false

14:21 zilti: DaReaper5: (defmacro fieldlist [ent lst] `(fields ~ent ~@lst)) ?

14:22 DaReaper5: zilti i cant surround fields with `

14:22 error is thrown

14:22 zilti: Weird stuff happening

14:23 llasram: DaReaper5: Your macro is producing some sort of quoted output, yes?

14:23 DaReaper5: clojure.lang.ArityException: Wrong number of args (2) passed to: core$seq

14:23 Rich_Morin: Is there a consensus regarding the terms clojurist, clojurista, etc?

14:23 llasram: (defmacro macro-name [args...] `(stuff))

14:23 TimMc: Rich_Morin: Conjurer. :-P

14:23 gfredericks: &((fn works-anyways [] {these symbols aren't defined anywhere man} :still-works))

14:23 lazybot: ⇒ :still-works

14:23 DaReaper5: llasram i am assuming that fields is a macro. It is from korma and it expects lazy fields

14:24 llasram: Again with that term "lazy"

14:25 DaReaper5: llasram ya your right that is not the best term for my scenario

14:25 zilti: DaReaper5: Fields is a function

14:25 https://github.com/korma/Korma/blob/master/src/korma/core.clj#L152

14:26 llasram: DaReaper5: So it looks like the problem is really that you can't call `fields` with no fields

14:26 DaReaper5: if i used apply then i get this: org.postgresql.util.PSQLException: ERROR: relation "client.luid" does not exist|

14:27 llasram i know i cant but that error still happens if i have an additional static field

14:27 llasram: DaReaper5: If you just add `apply` to the snippet you have, then the `->` macro will thread the previous expressions between `apply` and `fields`

14:28 zilti: DaReaper: ##(eval (flatten (cons '(identity) [1 2 3])))

14:28 lazybot: java.lang.SecurityException: You tripped the alarm! eval is bad!

14:28 zilti: warg. But that'll work. Although it's a pretty ugly hack.

14:28 llasram: What' no

14:28 There's no need to eval or unquote or anything

14:29 DaReaper5: llasram so you are saying that my use of apply within -> is causing an issue (due to the other things before the apply and after the ->)

14:29 llasram: DaReaper5: If I understand you correctly, then yes

14:29 DaReaper5: how would i best call apply in my scenario?

14:30 or should i do it outside of the ->

14:30 llasram: (let [q (select* client)] (apply fields q whatever sequence))

14:30 Or maybe even (-> (select* client) (#(apply fields %&) whatever-sequence))

14:30 although I'm not a fan of the latter

14:31 OH, and it doesn't work

14:31 heh

14:31 You get the idea though

14:38 DaReaper5: llasram sorry i still cant get it to work. Why does that one nto work?

14:38 not*

14:39 llasram: Hmm? Oh, because ##((juxt #(apply + %&) +) 2 2)

14:39 lazybot: ⇒ [4 4]

14:41 llasram: DaReaper5: Can you refheap/pastie a whole function showing what you have so far?

14:44 DaReaper5: works: http://pastebin.com/dqEtu0F3, does not work when false: http://pastebin.com/index/dqEtu0F3, does not work: http://pastebin.com/09zDB4XA

14:45 llasram: The second link is the same as the first

14:46 DaReaper5: http://pastebin.com/BKqMFnQH sorry

14:47 thorwil: is there a variant of and that will return nil as soon as it sees a false?

14:48 bawr: uhh, doesn't and already do that?

14:48 amalloy: indeed

14:49 thorwil: my repl claims it uses false, not nil

14:49 nDuff: DaReaper5: Could you consider using something with fewer ads than pastebin.com? We tend to be fans of refheap here.

14:49 gfredericks: &(and false false false)

14:49 lazybot: ⇒ false

14:49 amalloy: thorwil: it returns the first falsey thing it sees

14:49 gfredericks: &(or (and false false false) nil)

14:49 lazybot: ⇒ nil

14:49 DaReaper5: nDuff sure, bookmarked

14:50 amalloy: hah, very good gfredericks

14:50 nDuff: &[(and nil false) (and false nil)]

14:50 lazybot: ⇒ [nil false]

14:50 llasram: DaReaper5: I'm sorry, but I think you have some misunderstanding which exceeds my level of #clojure volunteerism to untangle. Hopefully someone else can help you out

14:50 gfredericks: (defmacro orandnil [& args] `(or (and ~@args) nil))

14:50 bawr: thorwil: well, false and nil are both falsy

14:50 thorwil: but anyway

14:50 thorwil: you're perhaps better off explaining what you're doing ;)

14:51 DaReaper5: llasram probably but im getting closer (#(apply fields %&) :client.luid) works

14:51 thorwil: bawr: it's for a conditional into

14:51 into doesn't like to see false

14:51 llasram: DaReaper5: Yeah, but that's exactly the same as just (fields :client.luid)

14:51 bawr: aah

14:51 justincampbell: any vim users have refactoring tips/tricks?

14:51 DaReaper5: llasram exactly im wondering what the usage is to pass a list

14:51 justincampbell: id like to visual select the outer form with a keystroke

14:52 and hopefully refactor it to a defn with a given name

14:52 llasram: DaReaper5: Ok, I'll bite one more time. What are you actually trying to get to happen, at a higher level? Is the function not supposed to call `fields` at all depending on the value of your condition?

14:52 DaReaper5: like: (#(apply fields %1) `(:client.luid) )

14:52 llasram i just need to pass it a list of arguments

14:53 llasram: DaReaper5: Where is there a list? All the examples you've shown so far just have the single `:client.luid`. That's why I asked for a full function

14:53 amalloy: gfredericks: maybe you could rearrange the letters a bit and call it inland-or

14:53 thorwil: gfredericks: but of course! ty

14:53 DaReaper5: here is a simple one: (#(apply fields %1) `(:client.luid :client.luid) )

14:54 that wont break to mention the same field twice

14:54 (it just works without defining a bunch of other stuff

14:54 )

14:54 hmm one second

14:56 works: (#(apply fields %1 %2) (list :client.luid :client.luid :client.luid) )

14:57 only works because %2 is mentioned

14:57 is that due to the "->" and "(select* client)"

14:57 llasram: Yes

14:57 DaReaper5: (sorry half thinking out loud here)

14:58 llasram so if ther was another thing above/before it %3 has to be defined

14:58 ... how do i directly pass the list wihtout knowing its place/ordering?

14:59 llasram: DaReaper5: I'm getting the impression that you don't have an entirely solid grasp of what `->` is doing. I think that if you look into that a bit further, you'll be able to sort it out

15:00 Anyway, I need to shift back to focusing mostly on work. Best of luck!

15:01 DaReaper5: -> recursivly add defines arguments

15:01 gfredericks: amalloy: that sounds practically mandatory

15:02 DaReaper5: -> recursivly defines arguments **

15:02 llasram thanks btw~!!

15:05 Sgeo: Ooh, nice example of how it could be nice to be able to specify keyword arguments before required arguments

15:07 Being able to, in a function called call-with-output-file, specify keywords like #:exist 'truncate before the lambda form that makes most sense to leave at the end

15:09 nDuff: amalloy: ...as an aside/follow-up: Your solution was correct; I wasn't paying enough attention when testing the cut-down version.

15:14 callen: if I've got a pattern where I've got a tree of parent and children functions (children calling parents) and I want to passing a context map of potential default argument overrides, is there a clean way to do this?

15:15 because doing this over and over in the args syntax is sapping my sanity.

15:15 SegFaultAX: callen: Paste an example perhaps?

15:15 callen: SegFaultAX: I was hoping to avoid that, but I'll dig something up.

15:16 SegFaultAX: https://www.refheap.com/paste/8036

15:16 something like that.

15:17 SegFaultAX: there's eventually going to be a lot more children and layering and overriding going on.

15:18 SegFaultAX: and having to if-case and call out within the template to utility functions and poking into session/db state is ugly as hell.

15:19 SegFaultAX: callen: I'm not even sure I fully understand what you're trying to accomplish.

15:20 callen: SegFaultAX: see that title thing?

15:21 SegFaultAX: in order to handle the possibility that a caller might want to override it, every single child has to include that default arg syntax

15:21 SegFaultAX: blows.

15:24 llasram: callen: Just have a global dictionary of defaults ?

15:24 er, map

15:24 callen: llasram: global?

15:25 llasram: Well, namespace-level

15:25 zilti: Does "fn" set a recur-point as well?

15:25 callen: right but how would I handle fiddling with/changing it?

15:25 every time I'd brought up something like that, people rent their clothes to shreads

15:25 shreds*

15:26 amalloy: zilti: try it and see

15:26 llasram: How would you update something now? Wouln't you need to change values in <n> functions now vs 1 map?

15:26 callen: I'm asking how to safely mutate a namespace global map from afar.

15:27 I would guess an atom or something, but it's something I'd avoided.

15:27 llasram: Who said anything about mutation?

15:27 Oh, you still want keyword args

15:27 callen: not necessarily, how do my route handlers change what the template renderers see?

15:27 without passing the state/map?

15:27 should I drop the keyword args and pass a map/

15:28 I still have to manually chuck the map around.

15:28 llasram: You need to pass something, this really seems like a map sort of use-case

15:28 callen: okie-dokie.

15:37 zilti: &(apply dissoc (cons {:a 1 :b 2 :c 3} [:a :b]))

15:37 lazybot: ⇒ {:c 3}

15:37 zilti: Is there a more elegant way to achieve this?

15:39 gfredericks: woah

15:39 apply lets you give initial args

15:39 so at worst, ##(apply dissoc {:a 1 :b 2 :c 3} [:a :b])

15:39 lazybot: ⇒ {:c 3}

15:40 zilti: Is there an alternative to apply?

15:40 gfredericks: not if it's a runtime list of keys

15:40 obviously you can also ##(dissoc {:a 1 :b 2 :c 3} :a :b)

15:40 lazybot: ⇒ {:c 3}

15:40 gfredericks: but that's only if you have the list of keys at code-time

15:41 zilti: Thanks!

15:41 gfredericks: np

15:41 amalloy: it all depends how much knowledge you have at compile time. the easiest way to get there if you have all the information is to just write {:c 3} to begin with

15:41 gfredericks: haha

15:41 maybe he's obfuscating

15:41 pendlepants: if I've got two lein projects - project A and project B - and I want to use code from project A in project B, what's the best way to do that?

15:42 I imagine lein compile or building a jar or something?

15:42 gfredericks: are you dev'ing on them in parallel?

15:42 or is one of them stable?

15:42 pendlepants: gfredericks: I'm building them in parallel.

15:42 gfredericks: I guess either way you'll be running `lein install` on the dependency

15:43 to get it into your local maven repo

15:43 and then you can use it as a checkout dependency in the other project so you don't have to lein install with each change

15:44 amalloy: i just lein-install, myself

15:44 pendlepants: okay, so lein install gives me a pom, and then I point to that in the second project's project.clj?

15:44 amalloy: a bit cumbersome, but that way i don't have to understand the subtleties of checkouts

15:44 pendlepants: yes

15:45 TimMc: callen: What if you apply defaults at retrieve time?

15:45 i.e. supply a default value when you ask for an option's value

15:46 pendlepants: thanks gfredericks/amalloy.

15:49 callen: TimMc: the inversion wouldn't match the structure

15:50 TimMc: I didn't understand that, so I'll explain my suggestion more explicitly.

15:50 callen: ideally there'd be some kind of global state that resets with each fulfilled request.

15:51 that would solve a number of problems.

15:51 and reduce the amount of inter-dependence

15:51 TimMc: Oh, the defaults are stateful?

15:51 zilti: Huh. I didn't expect that it's possible to build an infinite loop out of reduce and recur.

15:51 callen: no, I just remembered a related problem.

15:51 TimMc: callen: Sounds like something kiln might help with.

15:52 amalloy: you don't even need reduce, zilti: ##(recur)

15:52 callen: TimMc: oh, yeah. This guy gets it.

15:52 lazybot: Execution Timed Out!

15:52 callen: he knows mah paiiiin

15:53 TimMc: Back to the defaults... instead of (defn base [& {:keys [title] :or title "Garbwell"}] title), you'd do (defn foo [opts] (opts :title (global-defaults :title)))

15:54 That double-lookup could be stuck into a helper fn.

15:54 callen: a better templating library and a simple request global would've done the trick rather than kiln, but I might be able to make it work.

15:55 TimMc: that's what I had in mind after somebody'd said to use a map. Seems better.

15:55 defaulted kwargs in Clojure are fuckin' painful.

15:55 TimMc: Yeah, and they

15:56 they're even more painful to call than to consume.

15:57 I really prefer [foo bar {:keys [title]}] instead of [foo bar & {:keys [title]}].

15:58 amalloy: indeed. & keys is marginally useful in a small set of cases, but it *looks* like it's really awesome in a large set of cases

15:58 so you end up with most uses of it eventually making someone sad

16:00 callen: I'm surprised it made it into the language.

16:00 francis: technomancy: I was using s3-wagon-private on a lein1 project and am attempting to upgrade to lein2, following the README is causing me to get the following error. https://www.refheap.com/paste/8037

16:00 thoughts?

16:01 gfredericks: slamhound is useful for removing unused requires?

16:01 alexbaranosky: is there a link about moving from lein1 to lein2?

16:01 gfredericks: yes it is

16:02 gfredericks: alexbaranosky: I expect there's a lein file under /doc

16:02 alexbaranosky: I think my expectation has been violated

16:02 https://github.com/technomancy/leiningen/wiki/Upgrading

16:03 linked from the main README

16:03 alexbaranosky: gfredericks you should totally try slamhound, it is pretty awesome

16:04 amalloy: alexbaranosky: i hear you improved the require/as handling. how did you make it work?

16:04 * gfredericks runs slamhound on all his files

16:06 SegFaultAX: Oh man, slamhound is awesome.

16:06 I'm so happy this is a thing.

16:06 gtrak: is there a way to create a compojure bindings as a function of the request? like, (context nil [identity (friend/identity %)]...

16:08 SegFaultAX: Although, what's "No Dutch surgeon required" referencing in the slamhound README?

16:08 francis: SegFaultAX: It's based off a book. In which a Dutch surgon puts the protagonist back together

16:09 SegFaultAX: francis: Oh, hah. Any idea of the title?

16:09 alexbaranosky: amalloy: hey. this code does it: https://github.com/technomancy/slamhound/blob/master/src/slam/hound/regrow.clj#L68 basically it looks for any symbol that looks like 'foo/bar then looks a for namespace on the classpath that contains all the bars

16:09 TimMc: SegFaultAX: It's explained at the top of the README

16:10 djwonk: are there general guidelines or conventions when it comes to naming functions when it comes to "getting" and "setting"? for example, is it recommended to use (defn get-status) or (defn status)?

16:10 SegFaultAX: TimMc: Pffff, my eyes totally glazed over the quote.

16:10 TimMc: Derp derp, thanks.

16:10 amalloy: so, it can't work for, eg, s/reverse?

16:10 francis: technomancy: nevermind - stupid mistake.

16:11 alexbaranosky: amalloy: why not?

16:11 amalloy: because clojure.string and clojure.core both have a reverse

16:11 alexbaranosky: yes, exactly

16:11 that's an issue.

16:11 djwonk: I tend to prefer `status` because it is shorter

16:11 alexbaranosky: amalloy: the way it currently works you have to look over the namespaces is creates and make sure they still make sense after running it

16:12 amalloy: it always seemed to me that slamhound should just stop throwing away the information in the original ns form. the knowledge that the file *used* to start with (:require [clojure.string :as s]) is plenty sufficient to resolve the ambiguity

16:12 alexbaranosky: it actually does use that info. So when disambiguating it would choose string/reverse in that case

16:12 callen: TimMc: Kiln is fucking sweet.

16:12 alexbaranosky: the problem becomes when you have say clojure.string and clojure.set in athe ns form

16:13 amalloy: oh. complaint withdrawn, then

16:13 alexbaranosky: then ou have problems with `join`

16:13 TimMc: callen: scgilardi gave a talk on it at a Boston Clojure Meetup. :-)

16:13 callen: TimMc: this solves like 1/3 of my problems with Clojure Ring/Compojure apps.

16:13 amalloy: so it remembers that they were both there, but not which aliases they had?

16:14 alexbaranosky: amalloy: currently, I think that is correct. But is does keep the alises around as well, but might not be using them intelligently at the moment

16:15 tufflax: Does anyone by any chance know what's going on here? http://stackoverflow.com/questions/14118380/lein-repl-makes-my-clojure-source-files-readonly-in-vim-on-windows

16:15 amalloy: well, i'm glad to see you've gotten it as far as you have. i made a desultory effort shortly after phil first released it

16:16 alexbaranosky: amalloy I just checked out the `disambiguate` function. It just looks at the namespace, not the old alias: https://github.com/technomancy/slamhound/blob/master/src/slam/hound/regrow.clj#L100

16:16 maybe when I get excited about it I'll revisit it, and improve the heuristic a little

16:17 djwonk: tufflax: if you can reproduce, which it looks like you can, I would file an issue with lein

16:18 tufflax: djwonk: Yeah it happens every time. But I'm not sure it it's lein's fault

16:18 s/it it/if it/

16:19 technomancy: feel free to file an issue with lein, but we don't really have the expertise in any of the common maintainers for debugging windows issues unfortunately

16:19 djwonk: tufflax: well, from what you wrote it is at least correlated with leiningen, perhaps a dependency, perhaps lein itself

16:20 tufflax: technomancy, djwonk ok

16:20 systemfault: What is a good tutorial to learn clojure?

16:20 djwonk: i'm scratching my head at what part of lein repl would make a file read only

16:21 gfredericks: I think slamhound just deleted the last half of my source file?

16:21 maybe this would be a good time to learn how to use git

16:21 systemfault: Unfortunately, the "Getting Started" section of the main website doesn't help at all for that.

16:21 tpope: Raynes: if I do yet another pastebin client, it'll be some general purpose extensible one. and I don't really have the energy for that right now

16:21 tufflax: systemfault: If you are an experienced programmer I recommend clojure.org's doc

16:21 technomancy: tufflax: eeeeeeehh

16:21 I would be very hesitant to recommend clojure.org as a learning resource

16:21 tufflax: technomancy: that's what I found the most helpful, and I read 2 books

16:21 djwonk: systemfault: have you looked over http://learn-clojure.com/clojure_tutorials.html ?

16:22 hyPiRion: gfredericks: half your source file? that's kind of unfortunate.

16:22 systemfault: djwonk: Not really, just read the channel's topic :/

16:22 technomancy: systemfault: Mark Volkmann's is very good as are most of the ones on http://clojure-doc.org

16:23 gfredericks: hyPiRion: yeah; it was a particularly big file. Maybe slamhound is passive aggressive about large namespaces?

16:23 TimMc: eeep

16:23 systemfault: technomancy: Thank you, I just needed something to learn the basics, after I'll be able to just use the official documentation.

16:23 TimMc: Better get the Dutch surgeon.

16:23 gfredericks: Not under source control?

16:23 (or backup)

16:23 gfredericks: TimMc: it is; I was making a jokes :)

16:24 technomancy: systemfault: there are political reasons for the official documentation not being as good as it could be. there's no substitute for asking in IRC =)

16:24 TimMc: Hrm, OK.

16:24 gfredericks: I mean it did delete the stuffs. But git checkout is easy.

16:24 I'll make a patch to slamhound that makes it delete stuff from the git repo as well.

16:24 alexbaranosky: gfredericks: weird. If you want to file an issue, I'll take a look at it later

16:24 gtrak: tufflax: windows likes to 'lock' files more eagerly than linux/mac, check out http://www.emptyloop.com/unlocker/ for a dirty hack workaround

16:24 TimMc: It could still have deleted uncommitted work, of course.

16:24 tufflax: gtrak: sounds interesting, thanks

16:26 nDuff: gtrak: that's a much more generous description of Microsoft's gratuitously POSIX-incompatible filesystem semantics than I usually give. :)

16:26 tmciver: TimMc: was it scgilardi that gave the talk on kiln? I didn't think so. Was it the author . . . straszheimjeffrey perhaps?

16:26 nDuff: (well, not _that_ gratuitously... goes back to the lack of support for inodes in FAT16, and backwards-compatibility for same...)

16:26 gtrak: nDuff: yea... my answer is just to use a VM, cygwin's a hassle anyway

16:27 TimMc: tmciver: Oh, maybe. I remember being confused about this at one point.

16:27 scgilardi: I talked about the organization of our Clojure code in Sonian's software

16:27 TimMc: That was *at* Sonian, right?

16:27 gtrak: it takes less time to get an ubuntu VM up and running with clojure than it does to do anything in cygwin.

16:27 systemfault: I'm using the IntelliJ plugin at the moment, works nicely (Windows)

16:27 tmciver: I thought is was at Basho . . .

16:27 TimMc: kiln talk was at Basho

16:27 scgilardi: Yes, in a small auditorium in the building where Sonian lives.

16:27 systemfault: Still.. I just started so it might explode in the next minute

16:28 hiredman: scgilardi: where the part of sonian that doesn't write software lives?

16:29 scgilardi: zactly :)

16:30 technomancy: bbloom: seajure tomorrow dude

16:30 bbloom: technomancy: heh, thanks :-)

16:30 technomancy: bbloom: thinking about getting dinner at that mongolian place beforehand if you're up for it

16:30 djwonk: tufflax: if you can recreate your problem only with tools.nrepl then that will at least reveal that it is not lein's problem

16:31 tufflax: djwonk: ok... let me try

16:32 djwonk: btw it happened before when I was using lein vimclojure too

16:34 TimMc: scgilardi: Do you think it was Jeffrey who gave the Kiln talk, then?

16:34 technomancy: hiredman: are you planning on coming?

16:35 TimMc: Oh wait, Kiln is out of Akamai or something. Never mind.

16:36 I have no idea how I got that all mixed up.

16:36 hiredman: technomancy: I have no plans yet, I think it would be nice, where is it this time?

16:36 technomancy: hiredman: zoka at 7; thinking of mongolian for dinner beforehand.

16:37 lemme know if you want a ride; thinking of going down to Trabant in the afternoon

16:37 scgilardi: boston clojure meetups have a breadcrumb trail. Here's the one I spoke at: http://www.meetup.com/Boston-Clojure-Group/events/53233492/ (others nearby)

16:40 hiredman: technomancy: wait, the mongolian on the ave?

16:40 technomancy: hiredman: aye

16:41 TimMc: scgilardi: Huh. When I looked through the list of past meeups, I didn't see those detailed descriptions.

16:41 hiredman: I think I'll make my own way to zokas

16:42 bja: -=recall=-

16:47 emidln: is there an alternate way to construct a map from a sequence of itself besides (conj {} (seq {"k" "v"}))?

16:48 gtrak: into {}, apply hash-map

16:48 hyPiRion: would conj work?

16:48 ,(conj {} (seq {:a :b :c :d}))

16:48 clojurebot: {:c :d, :a :b}

16:48 gtrak: conj is special-cased for that, I think. It's weird.

16:49 hyPiRion: gtrak: even weirder

16:49 maio: ,(into {} (seq {:a :b :c :d}))

16:49 clojurebot: {:a :b, :c :d}

16:49 hyPiRion: ,(= (list [:a :b] [:c :d]) (seq {:a :b, :c :d}))

16:49 clojurebot: true

16:49 hyPiRion: ,(conj {} (list [:a :b] [:c :d]))

16:49 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.util.Map$Entry>

16:50 gfredericks: ,(conj {} [[:a :b] [:c :d]])

16:50 clojurebot: {[:a :b] [:c :d]}

16:50 hyPiRion: The crème de la crème of Clojure.

16:51 ahh.

16:51 gtrak: yea... don't use conj for that, it's bizarre

16:51 hiredman: that is an unfornate bug in the case logic in .cons for APMap

16:51 * emidln takes note of into

16:52 emidln: err

16:52 gtrak: conj should be thought of as taking a single bit and putting it into a collection

16:52 technomancy: it works on bytes too though

16:52 djwonk: how do I execute a previous command in the nrepl emacs mode? I looked and tried various keybindings. No luck yet.

16:52 technomancy: and also objects consisting of multiple bytes

16:52 emidln: it looks like into is implemented in terms of (reduce conj {} seq) in terms of (into {})

16:52 amalloy: hiredman: i'd argue that the mere existence of that case logic is a bug in the api for APMap

16:53 gtrak: makes more sense to just say ##(reduce conj {} {:a :b :c :d})

16:53 lazybot: ⇒ {:c :d, :a :b}

16:53 gtrak: technomancy: a single unit I guess :-P

16:53 things with elements

16:54 which is an entry in context of a map

16:55 hiredman: I dunno that I ever conj on to any thing that is not a vector, come to thing of it

16:55 gtrak: I use 'into' a lot, but sometimes there nice things like 'set' and 'vec'

16:55 amalloy: sets

16:55 hiredman: ah, yes, sets

16:55 amalloy: and possibly other custom collection types, like queues

16:57 systemfault: inline-block sucks for columns.

16:57 amalloy: now a totally unrelated question: is there a convention for formatting an 'if with fewer newlines? eg, i have a small one in the middle of an expression, where writing (if test RET y RET z) looks ugly

16:57 technomancy: amalloy: and+or =)

16:57 amalloy: i sometimes do (if test then, else)

16:58 callen: you really don't want to use inline-block.

16:58 you think you do, but you don't.

16:58 hiredman: I once started to write a custom collection type, which was a kind of List with fast sorting via indexed element components, and the rest of the element components where kept as compressed bytes, then I realized it was crazy and just embedded derby

16:58 pjstadig: amalloy: i just do (if test then else), does that make me bad?

16:59 callen: I have this conversation with my frontend guy monthly like clockwork.

16:59 amalloy: technomancy: leaving aside that you weren't serious: that doesn't really work, does it?

16:59 emidln: was just trying to get a handle on the built-in types for clojure

16:59 hyPiRion: amalloy: You could do (or (and test then) else)

16:59 technomancy: amalloy: sure it does

16:59 amalloy: (or (and test then) else) is not the same as (if test else)

16:59 er, (if test then else)

16:59 emidln: never quite sits well with me if I don't know how to construct, deconstruct, then reconstruct something

16:59 technomancy: amalloy: well, it conflates false+nil

16:59 pjstadig: also (if test then else) is learer

16:59 amalloy: technomancy: it also returns else if then was false

16:59 pjstadig: er

16:59 clearer

17:00 callen: pjstadig: migratus has "just worked" for me of late, fyi.

17:00 amalloy: i do like to write these "clever" trees of or/and when they come out nicer than if, but you can't do that for every if

17:00 pjstadig: callen: good to hear

17:01 hyPiRion: huh, is it impossible to create if by and/or?

17:01 S11001001: amalloy: church encode all your booleans then leave off the if :)

17:01 gtrak: we could make a nil-conscious logic ops with nor and nand

17:03 hiredman: amalloy: a nice linear cond is almost always nicer than a tree

17:03 S11001001: (def true (fn [_ f _ _] (f))) (def false (fn [_ _ _ f] (f))) (someb #(then) #(else))

17:03 (if test conseq #_else altern)

17:03 (someb :then #(then) :else #(else)) rather

17:03 technomancy: hiredman: except the formatting dilemma of cond is even worse =\

17:03 hiredman: (if you really want to take the disucssion off in to the weeds)

17:04 S11001001: but I don't adorn one-line ifs :)

17:04 amalloy: actually, in my current case i should just use cond. i was confused because a previous version of the code was shaped wrong for cond to work

17:04 pjstadig: i usually just write a macro to parse C's ternary operator into an if

17:05 ^ problem solved in the best way possible

17:05 S11001001: pjstadig: we should have a discussion on the meaning of "best" :]

17:05 amalloy: so thanks for the easy fix, hiredman

17:05 hiredman: if we just used core.logic we'd all have condos now

17:05 pjstadig: i already have a condo

17:05 callen: S11001001: SIMPULL IS BESTT

17:05 pjstadig: but i want a houseo

17:05 hiredman: (joke ruined)

17:06 conde or condv or conda

17:06 callen: jesus christ lol

17:06 technomancy: pattern matching, my friends.

17:06 gtrak: (? test :< then else)

17:06 callen: I always though core.logic was esperanto for Clojure.

17:06 dnolen_: :P

17:06 hyPiRion: defmulti to the rescue

17:06 amalloy: cond isn't a cure-all either, though. (or (and allow-foo? (find-foo)) (bar)) doesn't come out well as either cond or if

17:07 hiredman: yeah, defmulti is nice

17:07 anything that pulls conditional logic up towards the top level and out of function bodies

17:08 borkdude: callen cxu vi parolas Esperanton?

17:09 hyPiRion: amalloy: (if allow-foo? (find-foo), (bar)) ?

17:09 or may find-foo return nil/false?

17:09 amalloy: hyPiRion: no good: what if we allow foos but can't find a foo

17:10 right

17:11 callen: borkdude: Mi ne parolas hundo-lango.

17:14 amalloy: hyPiRion: it gets more fun if you want to reuse values across clauses too, like (or (and test1 (expensive-f)) (and test2 (expensive-g)) (combine (expensive-f expensive-g)))

17:14 aphyr: Hi folks. Any idea how I'd go about extracting only the *non-basis* entries from a defrecord?

17:14 amalloy: er, got the parens wrong in the combine clause, but i think you see what i mean

17:15 aphyr: e.g. in (assoc (Foo. 1) :custom-attr 2), I want to get only :custom-attr

17:17 hyPiRion: amalloy: (let [f' (delay (expensive-f)) g' (delay (expensive-g))] (or (and test1 @f') (and test2 @g') (combine @f' @g')))

17:17 I suppose.

17:17 amalloy: hyPiRion: yes, indeed

17:18 i also wrote let-later to make that prettier: (let-later [^:delay f (expensive-f) ^:delay g (expensive-g)] (or (and test1 f) (and test2 g) (combine f g)))

17:18 jlewis: aphyr: this is silly, but you could just say (apply dissoc your-record (keys (Record. :doesn't :matter :what :these :are)))

17:19 llasram: jlewis, aphyr: or more generically, (apply dissoc record (keys (map->Record {})))

17:19 gtrak: jlewis: aphyr: you'd want to use the map constructor to generalize it

17:19 aphyr: Yeah, I was hoping to reach into its internal hashmap directly for speed

17:20 I know it's in there, just can't figure out where the source is

17:20 hyPiRion: amalloy: But when you're turning down that logic alley, I seem to find code a bit hairy regardless of what language I use

17:20 aphyr: this is in a tight parser loop, would really prefer not to waste any cycles

17:21 amalloy: aphyr: so create (keys (map->Record {})) once, close over it, and use it over and over in the tight loop

17:21 dnolen_: aphyr: (.__extmap (Foo. 1 2))

17:22 gtrak: that seems a little... undocumented

17:22 aphyr: HA! Thanks dnolen!

17:22 jlewis: also seems like exactly what aphyr wanted :)

17:22 gtrak: ha.. reminds me of python

17:22 aphyr: Yeah, avoiding object allocation here is of the essence, need to push a few million of these/sec :)

17:23 dnolen_: only mutable fields of deftype/record are ever hidden, I doubt that .__extmap will change anytime soon. but yes some risk.

17:23 jonasen: kovas: ping

17:24 kovas: jonasen: hey, just composing a response on the github issue right now :)

17:24 jonasen: kovas: heh.. I'll probably work on it tomorrow (if you think it's worthwile)

17:25 kovas: jonasen: definitely worth doing

17:25 amalloy: anyone happen to know if (let [^long x 1] ((fn ^long [^long n] (inc n)) x)) keeps you in primitives or boxes everything?

17:25 zilti: If someone in here has some minutes to spare: Is this idiomatic? Or incredibly ugly? https://gist.github.com/4438765

17:25 kovas: jonasen: I've been putting it off since i wanted to take the time to understand nrepl (haven't worked with it before)

17:26 amalloy: zilti: that is too long to be anything but vile

17:26 jonasen: kovas: I've not used it either.. but it seems well designed and documented

17:26 kovas: jonasen: yup. a fair amount to read and digest

17:27 jonasen: though probably very easy to hack a simple version

17:27 * zilti sighs

17:27 kovas: jonasen: just to replace the evaluation "service"

17:27 amalloy: for the merge function, anyway. contains-map? is short enough to say that it's going about things the wrong way

17:28 jonasen: kovas: yep. I think it would be a good idea to make the datomic schema play well with it

17:28 kovas: jonasen: that is my instinct as well, though I worry about that forcing incompatibility with other people's middleware

17:28 amalloy: it seems to be a bad way of writing (some #{cmap} coll)

17:29 technomancy: kovas: curious: have you thought at all about what a common nrepl middleware stack would look like for multiple (possibly different) clients connecting to a single server and wanting to be aware of what others are doing?

17:30 kovas: technomancy: yes

17:30 zilti: amalloy: What's so wrong about "contains-map?"?

17:30 kovas: technomancy: though i think the answer depends on a lot of factors

17:30 amalloy: zilti: i already answered that

17:30 kovas: technomancy: like how many people..

17:30 technomancy: kovas: it would be good to get some common conventions in place. I've noticed a couple of independent implementations recently

17:30 kovas: technomancy: and do you force everyone to see everything, or is it more pull than push

17:31 technomancy: kovas: you're thinking it would get too crowded/noisy?

17:31 jonasen: kovas: the maps submitted and returned to/from nrepl could be turned into tx-data. Maybe we even could do codeq style schema evolution for nrepl middleware

17:31 kovas: technomancy: my humble opinion is that the sessions should be stored, and then people can retrieve them at will

17:31 dnolen_: zilti: in spirit looks ok, but I would break it apart, two reductions makes it noisy.

17:31 kovas: technomancy: yes

17:32 jonasen: kovas: https://github.com/clojure/tools.nrepl#talking-to-an-nrepl-endpoint-programmatically

17:32 technomancy: kovas: I think you'd want both; having to poll for stored sessions doesn't sound like much fun

17:32 kovas: jonasen: yes, that would be one way to go. I'm also not totally happy with the current session schema

17:32 technomancy: though I guess since it's interactive it wouldn't be a bottleneck

17:33 kovas: technomancy: right. you don't want to poll for the updates. But what if you join in the middle of a session?

17:33 technomancy: right; it needs to be reified; makes sense

17:34 kovas: technomancy: if everyone is sharing the same evaluator there is probably a reasonable simple solution

17:34 ravster: hello everyone

17:34 kovas: technomancy: but that scenario is scary :)

17:34 technomancy: kovas: we do it all the time at seajure =)

17:35 kovas: technomancy: is it not a problem?

17:35 technomancy: well, it's very primitive in our case. we just share a tmux instance. =)

17:35 kovas: technomancy: i think when everyone is in the same room, that is workable

17:36 technomancy: since we're all in the same room it's easy to pass around control to whomever has an idea, and the group is small enough that we don't want subgroups hacking asynchronously

17:36 right

17:36 zilti: kovas: About multiple people using the same nREPL, I've done a proof-of-concept, it's actually pretty simple: https://github.com/munrepl/server

17:36 kovas: technomancy: if you have remote people joining, then who knows what they might try to eval

17:36 right

17:36 amalloy: i know i would try to evaluate technomancy's patience limits

17:36 technomancy: kovas: well I put it in a dummy user account on my box anyway

17:36 heh

17:36 kovas: haha

17:37 callen: lolcathost: not bad.

17:37 technomancy: kovas: unfortunately my illness made me miss your conj talk, but it sounds like you've got a bigger design in mind here than just a single client implementation?

17:37 hiredman: kovas: are you worried from a security stand point? or something else? security can be delegated to the transport layer

17:37 kovas: technomancy: yes, repl sessions should be first class things we can pass around

17:38 technomancy: aw man... it's not a full OSS stack =\

17:38 bleaugh

17:39 kovas: hiredman: basically the same principle as we apply to code collaboration: what you do shouldn't clobber someone else

17:39 hiredman: unless they want it to

17:39 zilti: thx will check it out

17:39 yeah i know

17:39 gtrak: how do you detect clobberness?

17:40 zilti: kovas: It's just an aleph-wrapper around the nREPL

17:40 kovas: gtrak: i think thats a personal decision

17:40 jonasen: kovas: You also talked (somewhere?) about some cljs refactorings... How's that work going? I tried to dig in to the client part of session but I found it quite difficult to follow.

17:41 kovas: like, if i define some function, and someone else uses the same name for another function, i shouldn't automatically lose my definition by default

17:41 jonasen: yeah, me too :)

17:41 ppppaul: i'm trying to do nested destructured binding for maps... can someone help me out with it. 'company-id and user-id' is coming out nil

17:41 [{:keys [{:keys [company-id user-id]} params] :as request}]

17:41 kovas: jonasen: we don't have a great cljs web paradigm yet

17:41 gtrak: it seems like if you don't want to clobber in-memory state, everyone needs their own process and namespaces, then coordination of the central memory is a separate issue.

17:42 kovas: jonasen: what i want to do there is to find a simple way to just mirror datomic into the UI

17:42 jonasen: and make the client-side UI totally minimal

17:42 gtrak: yes

17:42 TimMc: ppppaul: Input looks like {:params {:company-id 1 :user-id 2}}?

17:42 Sgeo: ppppaul, :keys is for taking a key from the map and binding it to a variable named the same as the key

17:42 gtrak: share text, separate processes, manual central-eval

17:43 that everyone can see

17:43 Sgeo: You should instead use the form where you specify the variable directly, and use the inner pattern there

17:43 kovas: gtrak: I imagine you could follow someone's session, and then fork at a certain point into your own evaluator

17:43 gtrak: yea, as long as nothing relies on external data or things like timestamps, you could replay a log locally

17:44 technomancy: git seems like it could be a natural backing store

17:44 Sgeo: {{:keys [company-id user-id]} :params :as request}

17:44 I think

17:44 kovas: gtrak: the plan is to have an abstraction for external data

17:44 gtrak: "values are location independent"

17:44 gtrak: the sense I'm using is 'user input'

17:44 hiredman: the problem with git is (ironically?) the lack of an index

17:44 Sgeo: ,(let [{{:keys [company-id user-id]} :params :as request} {:params {:company-id 1 :user-id 2}}] [company-id user-id])

17:44 clojurebot: [1 2]

17:44 kovas: technomancy: i would love to find a way to use git

17:45 technomancy: but I'm short of ideas there

17:45 hiredman: so doing queries that are not just "what blob does this sha match too?" is difficult

17:46 kovas: datomic is a great fit, apart from not being OSS and not being easily storable in a git repo

17:47 gtrak: codeq is most of the way there already, no?

17:47 technomancy: yeah I was thinking of noodling on collaborative nrepl at seajure, but not if it's going to bring in a proprietary dependency

17:48 kovas: technomancy: if its possible to do this stuff another way, I'l all ears. But better to use datomic than not do it at all

17:48 technomancy: eh; I'm OK with not doing it

17:49 kovas: technomancy: fair enough.. I'm pretty desperate for this stuff

17:49 callen: kovas: for what?

17:49 kovas: callen: https://github.com/kovasb/session

17:51 rdrey: hi everyone

17:51 I'm a newb and created a little code review question, here: http://codereview.stackexchange.com/questions/20028/idiomatic-clojure-performant-functional-enough

17:52 if anyone had a moment to give me feedback, that'd be amazing

17:53 callen: kovas: just needs an iPhone app.

17:53 kovas: lol

17:53 S11001001: technomancy: :)

17:53 kovas: android more likely to come first :)

17:53 flight boarding, later yall

17:54 callen: kovas: whatever bro, I'd totally crush some code on iOS.

17:54 jonasen: kovas: websockets doesn't work on android if I remember correctly

17:54 kovas: callen: alright, we will count on you for that ;)

17:54 doh

17:54 gtrak: rdrey: why does neighbours need to call vec?

17:54 ne1_1: Hi - is there a way to check how much of a lazy-seq is realised? I thought I could just call realized? on rest, but that doesn't seem to work for chunked seqs

17:54 rdrey: points are little vecs

17:54 [x y]

17:55 S11001001: ne1_1: I doubt anything's built-in

17:55 djwonk: I've been following along with http://clojure-doc.org/articles/tutorials/emacs.html but I'm having trouble with C-x C-e : Symbol's function definition is void: lisp-eval-last-sexp

17:55 S11001001: ne1_1: I think iterating over rest and checking realized? as you acc an int would be defined for all well-behaved seqs.

17:55 technomancy: djwonk: is nrepl-interaction-mode active?

17:56 S11001001: ne1_1: since rest *specifically* doesn't force its result

17:56 gtrak: ne1_1: there's no way to know 'how much' unless you count

17:57 djwonk: technomancy: I see (nREPL ElDoc Paredit) as my modes. C-h m shows: Auto-Composition Auto-Compression Auto-Encryption

17:57 Eldoc File-Name-Shadow Font-Lock Global-Font-Lock Ido-Ubiquitous

17:57 Line-Number Menu-Bar Mouse-Wheel Paredit Recentf Show-Paren

17:57 Transient-Mark

17:57 sorry for the mess

17:57 S11001001: ne1_1: however, be warned that your function would by necessity not be referentially transparent, as realized? is not

17:58 realized? should be called realized?!

17:59 callen: S11001001: call it the OhFuck monad.

18:01 gtrak: rdrey: try shuffle instead of rand-nth

18:02 ne1_1: S1100100: so that works fine if none of the items are realised, but fails if some of them are because (type (rest (range 20) )) is clojure.lang.ChunkedCons and that doesn't support realized?

18:03 S11001001: I don't know, but if that's the case you'll just have to assume an answer for any seq that doesn't implement whatever realized? uses

18:03 while iterating

18:03 rdrey: @gtrak will try, thanks

18:04 gtrak: thanks, will try. (haven't used IRC in a while)

18:07 ne1_1: S11001001: OK, thanks sounds I'll take a look at ChunkedCons and see if it has anything I can use for this

18:08 rdrey: gtrak: `(let [current (first (shuffle candidates))] …` is 25% faster, thanks! Any other suggestions?

18:08 S11001001: ne1_1: ChunkedConses can't possibly be lazy

18:09 gtrak: rdrey: I'm trying to figure out if by some combination of shuffle, cycle and take you can create a lazy seq of shuffles, but having trouble

18:09 I might leave it as an exercise to the reader :-)

18:10 ne1_1: S11001001: ah, OK that makes more sense

18:10 rdrey: gtrak: I was also looking into lazy-seq, but I haven't found any examples of using lazy-seq to make sets. (And having sets is neat, because I need so many "within tests"

18:10 S11001001: ne1_1: like I said, you can't enumerate all the seq implementations; you'll just have to assume some things about some seqs

18:10 gtrak: rdrey: yea, sets realize a seq, if it's possible to reuse it over and over again, then it's worthwhile

18:11 that's where the 'take' would come in on your stream of shuffles

18:11 TimMc: S11001001: Where does realized? mutate things?

18:11 gtrak: perhaps your stream can be shuffled less often than you think

18:11 leave it to the generator

18:11 S11001001: TimMc: realized-length, given the same input multiple times, ...

18:11 rdrey: gtrak: yupp. I'm wondering how "pseudo random" the first item in a set is

18:12 gtrak: should be fine

18:12 TimMc: S11001001: And what is realized-length ?

18:12 S11001001: TimMc: the function we're talking about

18:13 but skipping to realized

18:13 gtrak: there should be no difference between concatenating randomly shuffled collections and picking a random index each time, except there is no lookup, and in seqs, lookup is not constant time

18:13 S11001001: TimMc: exists s. (second [(count s) (realized? s)]) != (first [(realized? s) (count s)]), just for example

18:13 amalloy: TimMc: his claim is not that realized? mutates anything, but that it's not referentially transparent. call it on the same (identical?) seq twice, and you may get different results

18:13 TimMc: Oh, OK.

18:14 I was confused by S11001001's use of "!", which generally indicates mutation or side effects, not other causes of referential... opacity.

18:14 rdrey: gtrak: I tried removing the shuffle completely and the current implementation now produces 3 vertical stripes, no more random island.

18:15 S11001001: TimMc: none of them are friends with laziness :)

18:15 ne1_1: S11001001: yup, that works nicely, thanks

18:15 TimMc: sure

18:15 realized? is inherently asking about the state of something, so it doesn't seem that interesting to me.

18:16 S11001001: I've never used it

18:16 TimMc: I've never heard of a use for it.

18:17 Maybe a print fn that only prints out the realized portions of a data structure...

18:17 gtrak: rdrey: yes, putting it into a set is not random

18:17 rdrey: gtrak: http://cl.ly/code/4133091e2w41 here is the full source, should be self-contained, if you want to play around with it, too

18:17 gtrak: I might check it out, looks fun, thanks

18:17 but not right now

18:17 rdrey: no worries

18:17 thanks for the first little improvement

18:19 djwonk: technomancy: did my modes look ok to you?

18:20 technomancy: djwonk: yeah, nREPL should be enough

18:24 djwonk: technomancy: ok, now that I am practicing and reading closer, it works great. I think I was trying inappropriate commands in the wrong window (nREPL instead of Clojure buffer and vice versa)

19:04 technomancy: wow, the new gist is awful

19:09 hyPiRion: hm. There's no short way of doing (if (x foo) (y foo) (z foo))?

19:10 technomancy: hyPiRion: useful has something

19:10 hyPiRion: I think I should start look in useful before asking. Thanks

19:10 amalloy: yeah, i think that's (fix foo x y z)

19:11 hyPiRion: yep, it is. flatland.useful.fn/fix

19:12 hyPiRion: amalloy: Thanks

19:24 technomancy: concerned about how hard it is to get started using Clojure? could be worse: https://gist.github.com/c7c5fd1df3524704287c / https://gist.github.com/7f3142fd076b308042df

19:33 amalloy: technomancy: yes, the new gist sorta suggests that maybe they broke gist.el a while back so that people would stop using gist before it became unpleasant

19:36 technomancy: the look is improved, but I literally cannot click any of the buttons in both the browsers I tried, and I couldn't even paste in one

19:38 tpope: by both browsers, do you mean "the browser that runs in emacs" and "the other browser that runs in emacs"?

19:38 :)

19:38 amalloy: my biggest objection is that it keeps signing me out

19:39 technomancy: tpope: close, but not quite. it's actually "the browser that pretends to be emacs, and the browser I hate using."

19:39 amalloy: i've definitely had problems with the formatting, where i had to horizontally scroll to get to a button i wanted, but i can't repro at the moment

19:39 technomancy: anyway, gist.el is working for me now

19:39 but it stores creds in plaintext

19:39 $kill

19:39 lazybot: KILL IT WITH FIRE!

19:40 amalloy: i stopped using it when, after it broke, a sincere effort didn't make it start working. Raynes offers an alternative that works, so i'm happy

19:42 technomancy: I use scpaste for non-sensitive things

19:43 xeqi: .. and what do you use for your sensitive things?

19:43 amalloy: family-friendly channel!

19:43 Foxboron: xeqi, birds.

19:43 technomancy: heh

19:44 xeqi: probably will install refheap.el

19:44 xeqi: Foxboron: careful, they might get stuck in a fireplace in England for 50+ years, and when found people will still fail to crack them

19:44 Foxboron: its cracked

19:44 technomancy: I put it off since refheap's auth also doesn't work with my browser

19:44 xeqi: oh? link?

19:48 TimMc: Last I heard, *someone* had proposed a solution. Doesn't mean it was confirmed...

19:50 Foxboron: well, i cant find the news article about it :/

19:50 never knew 'bird ww2 code decrypted' would yeild this many bad results

19:51 TimMc: Last I heard: http://www.bbc.co.uk/news/uk-20749632

19:52 I moderate reddit.com/r/codes, so I heard an endless stream of crap about that damn pigeon. :-P

19:52 Foxboron: haha.

19:53 TimMc: I figure if there was anything official, I'd know about it 3 times over.

19:53 Foxboron: well, the current solution sounds reasonable

19:53 xeqi: latest thing I can find is http://www.telegraph.co.uk/news/uknews/defence/9766130/GCHQ-dismisses-claims-D-Day-pigeon-riddle-has-been-cracked.html

19:55 Foxboron: ah, i had only heard the news that it had been decoded. Didn't see they dissmissed those claims

20:09 TimMc: I wish `lein new org.timmc/foo.bar` would create a project called org.timmc/foo.bar with src/org/timmc/foo/bar.clj

20:10 in a folder called foo.bar

20:11 technomancy: TimMc: me too

20:11 pull req plz?

20:11 TimMc: Oh, hmmm -- lein2 almost does it.

20:11 Maybe I misremembered.

20:11 technomancy: I hate having to rm src/whatevs/core.clj and the test

20:11 to add an actually meaningful name

20:12 TimMc: I was going to actually start a project tonight, but maybe I'll shave this yak instead. :-P

20:13 * technomancy needs to start telling people to do his bidding more often; surprising how often it works.

20:14 TimMc: Well, I'll certainly open an issue, at the very least.

20:17 technomancy: Should the test stub be test/org/timmc/test/foo/bar.clj?

20:17 Raynes: technomancy: refheap.el will consume your soul.

20:18 technomancy: TimMc: oh man... I get so confused by that =(

20:18 TimMc: I don't know what your philosophy is on where "test" goes in the namespace.

20:18 technomancy: TimMc: I get pull requests on clojure-mode.el on a regular basis offering to switch it "back to how it was"

20:19 TimMc: What changed?

20:19 Oh, I guess I can check the issues...

20:19 technomancy: at one point it was test/foo/bar_test.clj, then test became a directory, but it gets inserted in the N-1th segment or something?

20:19 and then it changed again?

20:19 I don't know

20:20 I always just ask pjstadig how it's supposed to work =)

20:20 hm

20:20 I wonder if linking tests and implementation would be a good fit for ns-level metadata

20:20 at least on the tests themselves

20:20 TimMc: Oh hey, nice idea.

20:21 Just make sure slamhound preserves metadata. :-P

20:21 technomancy: oh dang

20:21 I don't think it does

20:21 TimMc: *Nothing* does. :-/

20:21 technomancy: well, it preserves the docstrings

20:21 loganlinn: Quick concurrency/race-condition question: I have 2 threads accessing an atom, where 1 thread accumulates data into the atom, and the other flushes the data periodically by writing the snapshot to database then reset! the atom. Do I need to worry about race-conditions when flushing where new data is added between, (persist @data)(reset! data {}) ?

20:22 technomancy: but most ns-level metadata is :author, which I deliberately didn't want to support because it's dumb

20:22 TimMc: It's a feature, not a bug!

20:22 technomancy: loganlinn: why not have the persist function return an empty map?

20:22 TimMc: also: clojure itself doesn't support ns-level metadata if you AOT

20:23 xeqi: loganlinn: I expect you could lose data with that

20:23 TimMc: technomancy: Oh, curious.

20:23 loganlinn: technomancy: then do (swap! data persist) ?

20:23 technomancy: loganlinn: right

20:23 loganlinn: needs to be idempotent though; it'll retry

20:24 TimMc: loganlinn: Might be better to use a dedicated queue of some sort.

20:24 loganlinn: yeah, that would work, thanks

20:24 TimMc: technomancy: Why not refs and dosync?

20:25 technomancy: TimMc: if all you're doing is idempotent persistence, why get fancy?

20:25 easy enough to collapse it into a single atomic operation

20:25 if you need refs, use refs of course =)

20:28 loganlinn: I was under the assumption that doing IO inside dosync is disallowed

20:29 TimMc: loganlinn: You could return the new data from the dosync and persist it outside.

20:29 technomancy: if you send to an agent inside dosync it's not triggered until the transaction succeeds

20:30 loganlinn: It seems like using an atom is most appropriate for my situation, no?

20:30 technomancy: but don't fool yourself into thinking it's ACID; the agent doesn't participate in the transaction, so it's not truly atomic

20:30 loganlinn: yeah

20:30 TimMc: (let [data (dosync (let [d @someref] (ref-set d []) d))] (persist data))

20:31 loganlinn: TimMc: Ah, i see

20:31 TimMc: (ref-set someref []), rather

20:34 Anonny: Is there a way to run a series of functions that don't depend on each other except that the next can not run until the current is finished?

20:35 TimMc: Anonny: agents

20:35 No wait... that's overkill.

20:35 amalloy: (do (a) (b) (c))?

20:36 TimMc: (doseq [f [a b c]] (f))

20:36 ibdknox: amalloy: too easy, clearly should use a monad there

20:36 hiredman: Anonny: single threaded executor

20:37 SegFaultAX: Anonny: I'm assuming these are side-effecting functions?

20:37 Anonny: SegFaultAX: yes.

20:38 SegFaultAX: Anonny: Perhaps (io! (a) (b) (c)) then?

20:39 amalloy: ibdknox: maybe @@@@@@@@@@(last (map (nth 10 (iterate (fn [f] (fn [] (delay (f)))) identity)) fs)) is complicated enough?

20:40 i guess it doesn't work at all, which is probably a downside, although it probably *looks* like it works

20:42 TimMc: technomancy: Where the hell is leiningen.new?

20:43 technomancy: TimMc: https://github.com/Raynes/lein-newnew

20:43 * TimMc dubious

20:43 technomancy: it's treated like a plugin to allow for a quicker release cycle

20:43 though that's probably no longer necessary

20:44 TimMc: magic

20:44 So I probably should have created that issue over there.

20:45 technomancy: either way

20:46 SegFaultAX: Is anyone other than datomic using edn? Like, forealrealz using it.

20:46 Because it's pretty awesome IMHO.

20:47 TimMc: SegFaultAX: Doubtful. It sounds incredibly specific.

20:47 *to clojure

20:51 SegFaultAX: It doesn't really need to have support for lists AND vectors, or symbols AND keywords. One ordered list type and one symbol/atom/keyword type is enough for a generic data format.

20:53 Deece: Is it possible to do something like 'read-string' tht just returns the form, without evaluating it?

20:53 SegFaultAX: Deece: slurp?

20:53 amalloy: yes, read-string does that

20:54 &(read-string "(+ 1 1)")

20:54 lazybot: ⇒ (+ 1 1)

20:54 Deece: amalloy: welp, you're right. thanks.

21:05 justincampbell: is there a way to have a lein dependency in a path for development purposes

21:05 similar to bundler's gem 'mygem', path: "../mygem"

21:06 bpr: i'm not familiar with ruby, but maybe lein checkouts does what you want?

21:08 here's the link: https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#checkout-dependencies

21:09 hyPiRion: justincampbell: use the :dev profile, I suppose?

21:09 justincampbell: hyPiRion, bpr: thanks! ill check those out

21:10 hyPiRion: justincampbell: Example use here: https://github.com/michaelklishin/langohr/blob/master/project.clj#L12

21:15 Deece: I'm looking at the source for clojure.string/reverse and I can't understand why it would create an instance of the mutable java StringBuilder and call reverse on that instead of just doing (str/join (reverse s)). Is it for performance reasons? I just find it surprising that library functions don't seem always to build upon each other.

21:17 ibdknox: Deece: it's for perf, seqs are really slow

21:17 relatively speaking

21:38 Deece: ibdknox: makes sense, thanks

21:40 TimMc: Deece: Specifically, that approach would involve allocating a cons cell for every character of the string, then iterating over them. StringBuilder is specifically designed for fast string munging.

21:40 justincampbell: can i interpolate strings somehow?

21:41 TimMc: justincampbell: Like format, or like a templating lib?

21:41 justincampbell: instead of doing (str "my name is " first-name " " last-name)

21:41 in ruby: "my name is #{first} #{last}"

21:42 ibdknox: ,(doc format)

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

21:42 TimMc: ,(format "lib-%04d" (rand-int 1e4))

21:42 clojurebot: "lib-2768"

21:42 justincampbell: ah perfect, thanks!

21:47 amalloy: Deece: you might want to read the design notes at the top of clojure/string.clj

21:51 i wonder why delay objects don't implement IFn. seems like it could be handy to treat them like thunks

21:51 dyreshark: where can i submit a feature request for a --do-what-i-mean-not-what-i-say flag?

21:52 xeqi: jira?

21:52 clojurebot: to be fair I dunno that I've ever had code out right rejected, it just sits in jira or assembla or where ever, or if I ask if there is any interest (before writing any code) I get told to go write alioth benchmarks

22:01 amalloy: try perl

22:02 TimMc: Raynes: In newnew, why does sanitize-ns do s/_/-/?

22:15 Yak shaved.

22:33 tmciver: newb macro question: what's the idomatic way around this problem: https://www.refheap.com/paste/8046

22:35 amalloy: tmciver: no problem is evident, just some code that does nonsense. without a goal in mind, who can direct you around the problem?

22:35 #accidentalzen

22:36 tmciver: amalloy: it's a contrived example of a problem I'm running into in a 'real' project. Am I supposed to make vectors out of the lists?

22:36 amalloy: i don't know, man, because i don't know what you want the macro to expand to, or what it should do

22:37 tmciver: OK, let me think on it and come back.

23:03 TimMc: tmciver: Provide an example input and output and we can talk. :-P

23:07 alexbaranosky: TimMc: parts# is not inside the syntax quote.

23:08 TimMc: no need for an autogensymmed binding in that case

23:11 TimMc: alexbaranosky: Hey, don't tell me, tell tmciver. :-)

23:12 alexbaranosky: TimMc oh, hey, my bad :)

23:12 tmciver

23:13 Sgeo: syntax quote?

23:13 Is this #clojure ?

23:14 alexbaranosky: tmciver it IS a little hard to understand what you are trying to achieve. As is, the code sample given is not something you should usually do with a macro. IT's blowing up because it expands to a list, and that list w/ a number at the front, and numbers cannot be called as fns

23:14 tpope: this is #clojure

23:14 alexbaranosky: Sgeo yes

23:14 * alexbaranosky is lost as well

23:14 * alexbaranosky can't find his pants

23:15 Sgeo: Oh, I call that quasiquote

23:15 The word "syntax" makes me think Scheme now

23:15 I'm becoming a Racket person maybe

23:16 TimMc: Sgeo: I thought it was called quasiquote in Scheme as well.

23:16 alexbaranosky: Sgeo I don't know what quasiquote is, but i think it is not the same as syntax-quote

23:17 ...after a brief googling

23:17 Sgeo: TimMc, ` is

23:17 But syntax-quote makes me think something other than `

23:17 Maybe it's racket-specific

23:17 But #' makes a syntax object

23:17 Similarly to how ' makes a list

23:19 amalloy: uh, ' doesn't make a list in any meaningful sense, in clojure or racket

23:20 Sgeo: Results in a list when evaluated

23:20 Erm

23:20 aaelony: I'm processing lines of a large file with a function that i call on each line. The output of each call to this function will go to a log. I'd like the lines to be processed asynchronously and am looking into using Agents because each line will output to the log, or potentially multiple log files. I'm reading this link, http://lethain.com/a-couple-of-clojure-agent-examples/, but curious if others can point me to references or exampl

23:20 that tackle this kind of thing.

23:20 Sgeo: Well, when passed a form that is a list syntactically, evaluates to a list

23:22 TimMc: Sgeo: The relationship between ` and ' in Clojure is not the same as in Scheme.

23:22 At least, I don't recall ` having anything to do with namespaces in Scheme... :-)

23:22 aaelony: One thing that is strange to me is that a couple examples I've seen with Agents seem to have a let statement with defn definitions inside the let...

23:22 Sgeo: TimMc, similar except for the namespace thing and Scheme actually defines non reader-syntax names for those

23:23 I think

23:23 justincampbell: tmux users: https://github.com/justincampbell/speclj-tmux

23:23 TimMc: ,''foo

23:23 clojurebot: (quote foo)

23:23 TimMc: ,'`foo

23:23 clojurebot: (quote sandbox/foo)

23:23 Sgeo: aaelony, those create a thing called a "closure". Basically, within the function made by defn, you can access the things bound (defined) by the let

23:23 TimMc: ^ the latter would be (syntax-quote foo) or similar in Scheme.

23:24 Sgeo: TimMc, oh

23:24 TimMc: So you're right -- ` is reader sugar in Scheme, but not in Clojure.

23:24 Sgeo: I'm not that familiar with Scheme really, just all this syntax-case syntax-blah etc. makes me think syntax objects

23:24 TimMc: It *could* be -- hiredman has written a more or less drop-in replacement, IIRC, but it isn't.

23:24 * Sgeo is learning Racket, a Scheme derivative but not quite Scheme

23:25 Sgeo: aaelony, do you know what an atom is? (If you don't, no big deal, I just wanted to use it in an example)

23:25 aaelony: sgeo: i guess i would have expected an fn rather than a defn, because i tend to use defn when a function will also be a stand alone

23:26 sgeo: I use atoms frequently, this is my first foray into agents

23:26 from what i've read, agents are good for handling io

23:26 Sgeo: aaelony, defn is (kind of) def + fn

23:26 aaelony: sgeo: i realize this :)

23:27 Sgeo: aaelony, well, if you want a standalone function that has a bit of hidden state, you could use let over defn

23:27 aaelony: i see

23:28 Sgeo: (let [a (atom 0)] (defn inc-counter [] (swap! a inc)))

23:28 This will define, in the namespace, a function called inc-counter

23:28 Only inc-counter has access to that a

23:28 aaelony: another thing I've noticed is that you can send wtrs to agents, but it doesn't acutally go to the file until the (close) is called

23:29 i wonder if this is desirable for a (very) large file

23:29 sgeo: i think i understand atoms

23:29 agents seem different to me

23:29 Sgeo: aaelony, they are. I just wanted to illustrate let over defn

23:30 aaelony: i see, i rarely see defn within a let, but then again it's nice to learn :)

23:31 Sgeo: I'm not going to claim it's idiomatic, just that it's possible

23:31 aaelony: is there something about agents that makes clojsures more desirable?

23:31 closures

23:32 Sgeo: Could just be the style of the examples, rather than due to anything about agents. But I'm not sure.

23:32 * Sgeo should be quiet and let people who know why that idiom would be used answer

23:33 aaelony: sgeo: i definitely appreciate your comments

23:33 amalloy: i can't think of any reason it would be more prevalent for agents

23:34 aaelony: i'm also looking at this (https://raw.github.com/clojurebook/ClojureProgramming/master/ch04-concurrency-game/src/com/clojurebook/concurrency/game_validators.clj) example of agents and writing to file

23:35 amalloy: thanks, maybe I'm not looking in the right places. the clojurebook link above seems to be a better example… looking to understand that better now.

23:37 technomancy: Sgeo: how are you finding racket?

23:39 dcb: tpope: Having a problem with vim-foreplay.  Every once in a while (probably every 25 times or so) when I :Eval, vim crashes saying "Vim: Caught Deadly Signal ABRT".  Sometimes the terminal shows the process and the status as aborted after it crash/exits.

23:39 tpop:  I'm running on OS X with vim an a terminal.  I have updated the plugin within the last few hours.  I know this isn't a lot to go on, but I was hoping you might have some insight.  Other than this issue I really like foreplay, much better than vim-clojure

23:40 Sgeo: technomancy, the ecosystem sometimes feels abandoned (there are a lot of libraries on PLaneT that still call it "PLT Scheme"). I do like the whole using internal defines for lexical scope. Also really like the thought of the lightweight threads, but haven't touched them. Still trying to understand macros. Simple syntax-rules stuff is easy enough, easier than defmacro for that sort of simple substitution, but no idea how to do anything more com

23:40 plicated

23:40 dcb: tpope:  I'm running on OS X with vim an a terminal.  I have updated the plugin within the last few hours.  I know this isn't a lot to go on, but I was hoping you might have some insight.  Other than this issue I really like foreplay, much better than vim-clojure

23:42 tpope: dcb: is it macvim?

23:42 dcb: tpope: yes, macvim

23:43 tpope: macvim likes to crash :/

23:43 Sgeo: technomancy, in Racket, there's a very good reason to use (let ((x 1) (y 2)) ...) and not (let (x 1 y 2) ...)

23:43 Well, that sort of thing in general, not necessarily that specific example

23:43 tpope: dcb: you might try ruling out plugins (any that use the ruby interface are great candidates)

23:44 Sgeo: Because if you're defining the form, it's easier to pattern match on

23:44 tpope: dcb: you could also try deleting the part of nrepl/foreplay_connection.vim after the final finish, so that it doesn't use the ruby interface

23:44 dcb: tpope: OK, I'll deactivate them and let you know if that doesn't fix it

23:45 tpope: dcb: also let me know if it does

23:45 dcb: tpope: okay I'll try that too

23:45 tpope: OK

23:45 technomancy: Sgeo: thinking of picking it up in a year or two to teach my kids

23:46 Sgeo: do I remember correctly that it ships with a Logo implementation?

23:46 Sgeo: I believe it does, yes

23:47 Or at least a logo-like language

23:47 Hrm

23:47 ihodes: technomancy: good evening—i was wondering if you might have an idea of what the issue is here. i'm using c.j.jdbc now, but when i try to connect to even my local DB, i get this: http://cl.ly/LunU, which results in this error: db-spec postgresql://localhost:5432/cloblot is missing a required parameter. However, the local DB is definitely there and running nicely: http://cl.ly/LuC5

23:48 Sgeo: technomancy, http://docs.racket-lang.org/turtles/index.html

23:48 ihodes: man…i learned to program with turtles

23:48 good times

23:49 technomancy: ihodes: postgres:// vs postgresql:// maybe?

23:49 ihodes: technomancy: nope :\ hah

23:50 hah, oh well. i'll keep at it. thanks though!

23:50 haha putting the blog together: couple hours. making the DB stuff work: days.

23:50 er, *trying* to make it work

23:51 technomancy: the ecosystem still has a long way to go in that area

23:52 xeqi: ihodes: jdbc:postgresql://localhost:5432/clobot ?

23:53 ihodes: xeqi: still the following: db-spec jdbc:postgres://localhost:5432/cloblot is missing a required parameter

23:57 technomancy: postgres://localhost:5432/db-name works for me

23:58 xeqi: I've moved to using {:connection-uri "jdbc:..."} to avoid the c.j.j connection parsing

23:58 forgot about that part

23:59 ihodes: technomancy: which version of clojure, c.j.jdbc, and postgres/postgresql are you using?

Logging service provided by n01se.net