#clojure log - Apr 18 2013

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

0:00 patchwork: I like that luminus is kind of unifying some useful web libs

0:00 amalloy: patchwork: if you use a more complete or batteries-included framework, you'll have to override or special-case all the bits of it eventually anyway

0:01 talios: amalloy - I'd rather batteries included, than the Apple model of batteries welded in.

0:02 gdev: have you tried pedestal?

0:03 patchwork: talios amalloy: Yeah that is a key metric, can I swap things out easily? If it is modular from the beginning, I can do whatever I want with it.

0:03 gdev: Not yet

0:03 gdev: patchwork, just from your name, I knew that's what you were looking for

0:05 patchwork, yogthos thinks pedestal is closer to Rails while Luminus is more like Sinatra, so if you know what either of those are that might give you a clue

0:06 talios: need to checkout pedestal sometime

0:06 gdev: it is quite amazing

0:06 brehaut: hi talios

0:07 talios: hey hey

0:07 brehaut: hows the big smoke

0:07 talios: good good - can't say the same for my feature branch tho :(

0:07 brehaut: ouch

0:09 talios: yeh - somehow I've introduced a weird runtime dependency issue thats leaving all the services in the system unsatisfied. me think they have too many tangled pieces

0:09 brehaut: ive got one of those atm

0:10 all JS

0:10 talios: cljs?

0:10 brehaut: nope

0:10 the old stuff

0:12 ATM i'd be more tempted by a statically typed languagel ike roy than cljs

0:12 talios: fay? ;)

0:13 brehaut: i'd like to keep cabal out of my dependancies ;)

0:26 bingohead: Hi everyone. I am new to clojure. I would like to import project.ctl into eclipse. Is there a way I can do that. I am trying to use ccw, but it is not helpful.

0:26 tieTYT: bingohead: what I always do is create a new project which will overwrite the project.clj

0:26 but then I revert the file

0:29 bingohead: tieTYT: so there is no easy way to import project similiar to maven eclipse, am I correct?

0:29 I was using ccw to do, but I do not see the option to do that.

0:29 tieTYT: i'm not sure, i couldn't figure it out

0:29 another thing you could so is lein pom

0:29 to generate a pom

0:30 and the import the project from the pom

0:30 but I don't know what downsides that has

0:30 bingohead: oh i see. Thank you.

0:31 I wish there is an easy way.

0:56 n_b: every-pred applies left-to-right, correct?

0:57 ,(= true ((every-pred odd? even?) 2))

0:57 clojurebot: false

0:57 n_b: Don't know why I didn't just check that myself before asking/

1:25 danneu: I'm pretty frustrated when trying to figure out how to actually use Java libraries.

1:28 For instance, I want to hash a string into a RIPEMD-160 digest. From google I find the spongycastle lib. http://www.jarvana.com/jarvana/view/com/madgag/scprov-jdk15/1.46.99.3-UNOFFICIAL-ROBERTO-RELEASE/scprov-jdk15-1.46.99.3-UNOFFICIAL-ROBERTO-RELEASE-javadoc.jar!/org/spongycastle/crypto/digests/RIPEMD160Digest.html -- But how do you get to the equivalent of a README from there?

1:28 Sorry about the long link

1:30 I don't mean to get specific help on the hashing problem, I'm just wondering what the google workflow of a java dev would be in this case.

1:40 ivan: danneu: google spongycastle, find out it's a repack of Bouncy Castle for Android

1:41 danneu: yeah that's actually what i meant

1:41 and frankly i even arrived at a snippet: http://rosettacode.org/wiki/RIPEMD-160#Java

1:46 ivan: danneu: I had trouble finding the right artifact name to put in project.clj

1:47 http://ssutch.org/clojure-signed-strings/ suggests [bouncycastle/bcprov-jdk16 "140"]

1:47 http://search.maven.org/#search|ga|1|bouncycastle lists others too

1:52 danneu: ivan: that ssutch.org post is a good link. thanks.

3:16 similian1: errm

3:16 ist this clojure language chan ?

3:17 why are you so insanely huge ?

3:17 do you have a rail like framework ?

3:19 //j #compojure

3:19 :)

3:19 almost

4:11 noprompt: /erc-cmd-NAMES

4:11 lol whoops

4:11 *sigh* just had a rough evening trying to talk about clojure with a group of folks

4:12 "so how do you do a `for` loop?"

4:12 ejackson: noprompt: were semicolons thrown ?

4:12 noprompt: ejackson: ugh, pretty much...

4:12 * Raynes pats noprompt on the back for trying.

4:13 noprompt: one guy was asking about doing lookups with negative indexes

4:13 Raynes: &([1 2 3] -1)

4:13 lazybot: java.lang.IndexOutOfBoundsException

4:13 noprompt: and i was like, now, think about that for a minute.

4:14 Raynes: That there is what I think about that.

4:15 noprompt: Raynes: btw, been rolling with emacs and evil for the past couple weeks strong.

4:15 loving it.

4:15 ejackson: noprompt: haters gon' hate. The only response is to calmly code them into the corner, wide eyed and gibbering

4:15 Raynes: noprompt: We should start a club, dude.

4:15 I just read that in your accent, ejackson.

4:15 It was wonderful.

4:16 noprompt: the truth is, it's really hard to explain something like clojure to people coming from python/ruby/php/js

4:16 * ejackson has a fanclub. (count fans) => 1 :)

4:16 Raynes: (inc ejackson)

4:16 lazybot: ⇒ 0

4:16 noprompt: at least for me it was

4:17 Raynes: (inc ejackson)

4:17 lazybot: You want me to leave karma the same? Fine, I will.

4:17 Raynes: What

4:17 ejackson: cheeky !

4:17 Raynes: What a useless sod.

4:17 ejackson: Raynes: did I tell you I'm moving to the US ?

4:17 noprompt: but hey i tried, i think at least one guy was open to the immutabiltity thing.

4:17 Raynes: You haven't told me anything in a long time, ejackson.

4:18 ejackson: its true, I've been more than usually monastic. Trying to read a giant book :)

4:18 hows LA ?

4:18 Raynes: It's great, but it's also why we haven't chatted in a while. Timezones.

4:18 Where in the US are you moving?

4:19 ejackson: Nashville, TN. Its my wife's hometown.

4:19 Raynes: Oh yeah, you did tell me this.

4:19 ejackson: Not too far from your part of the world.

4:19 noprompt: ejackson: my uncle's from there. nice place.

4:19 Raynes: You must have told me this ages ago.

4:19 noprompt: really green, out that way.

4:19 Raynes: It isn't my part of the world anymore though.

4:19 ejackson: Or you've entered some freaky mind-meld

4:19 lol, I hear you.

4:19 Raynes: I'm in the jungle of concrete and palm trees.

4:19 ejackson: and cars !

4:19 noprompt: Raynes: i get to missing alabama every couple years.

4:20 Raynes: Oh, I miss it.

4:20 I miss everything.

4:20 I don't like change.

4:20 ejackson: in that case, tis just a waiting game, until LA is the baseline

4:21 Raynes: Ugh.

4:21 Don't talk about more change.

4:21 ejackson: i miss home too, but the world is to stay put.

4:21 noprompt: the only thing i miss in alabama is the racial diversity.

4:21 i like how there's at least 10 diffent cuisines on one street in california.

4:21 Raynes: The primary thing I miss from Alabama is that people actually spoke English there.

4:21 noprompt: Raynes: haha, yeah!

4:21 ejackson: noprompt: hell yeah. I moved to Cambridge from South Africa. Talk about diversity collapse. Ridiculous.

4:22 we have 11 *official* languages in SA, and that's just for starters

4:22 noprompt: my favorite thing is how people called the driveway a "carport"

4:22 ejackson: that's awesome.

4:22 ejackson: Raynes: English you say ?

4:22 Raynes: noprompt: Funfact: all the time I lived in Alabama I never once got attacked by religious folks trying to shove it down my throat. I move to LA and live here for two months and I nearly end up on youtube because of a couple of nutty folks.

4:22 noprompt: ejackson: it's a special kind of english.

4:23 ejackson: Raynes: Scientologist sorts ?

4:23 Raynes: Christians, which is the hilarious part. Alabama is part of the bible belt.

4:23 If it was going to happen, it should have been there.

4:23 But that's California for you.

4:24 noprompt: Raynes: it's interesting though. as rediculous as things are here, i've found people in alabama are really open minded.

4:24 ucb: unless people assumed in Alabama that you were one of them already? LA being the land of the heathen and all

4:25 noprompt: hehe.

4:25 Raynes: Anyways, it was these two guys. They stopped me on my way to work on the 3rd street promenade in Santa Monica for an 'interview'. Guy was acting like one of those "Answer this question and win $20" guys on tv. Turned out he just wanted to ask me a bunch of trick questions "Have you ever lied? Have you ever stolen anything? etc" and then point out how damned I am unless I take in the lawd.

4:25 noprompt: sinner!

4:25 Raynes: I ended up emailing the guys and convincing them to not post my video (here's hoping they comply, they said they would). I went into work immediately after that and a Christian coworker apologized for Christians everywhere and gave me a hug. It was great.

4:25 ordnungswidrig: "Do you believe in a better world"?

4:26 Raynes: the co-worker part is strange.

4:26 noprompt: ordnungswidrig: tell me more...

4:26 ejackson: Wait... the most bizarre part of this story is that you were walking ? I thought that wasn't possible in LA ? :P

4:27 Raynes: The problem is that our office is on the third street promenade. Every type. Street performers, missionaries (apparently)… It's very popular area and I work in the middle of it.

4:27 It's hard to get to work without at least one interesting thing happening.

4:27 ordnungswidrig: The other day two guys knocked on my door, for a short interview. This was the first question. They gave me a leaflet with a pictore of a nice cute farm and a panda bear..

4:27 Raynes: ejackson: You can't drive on the promenade. And it's on 3rd street. I have to walk from the bus stop on 6th street. :p

4:29 Anyways, I have no problem with Christianity or anything. It could have just as easily been Scientologists asking me to direct deposit my paychecks into their accounts or something.

4:29 * noprompt still amazed at irc inside emacs

4:29 Raynes: noprompt: So what part of Alabama are you from?

4:29 ordnungswidrig: noprompt: you should use a bot which connects on irc to your repl.

4:30 *g*

4:30 noprompt: muscle shoals

4:30 it's near tuscumbia, near florence

4:30 Raynes: noprompt: Ever been to Eldridge? Carbon Hill? Winfield? Jasper?

4:30 noprompt: but it's been ages since i lived there. mostly i go back to see my mom and brother every couple years for a week or so.

4:30 dad was in the military and all.

4:31 Raynes: If you've ever been to any of those places or ever visit them, we will have crossed paths.

4:31 Also, holy crap, I've got a really popular tweet.

4:31 noprompt: sure. anything to see there?

4:31 Raynes: https://twitter.com/IORayne/status/324784051661725696

4:31 noprompt: No.

4:31 9 retweets, 5 favorites.

4:31 noprompt: cool, my kinda town.

4:32 lmao

4:32 Raynes: 10 retweets and 6 favorites now.

4:32 This is great.

4:32 Oh, thanks ordnungswidrig.

4:33 ordnungswidrig: push it!

4:33 noprompt: you know, i've been trying to convince myself of that at work. but somehow the thought of writing an app in ruby bugs me.

4:33 Raynes: noprompt: Where do you live now?

4:33 San Francisco?

4:33 noprompt: lol

4:33 Raynes: Los Angeles is lonely.

4:33 ordnungswidrig: at work they discussed to replace java with something more modern, like *cough* ruby

4:33 Raynes: Everybody is in San Francisco.

4:33 noprompt: Fresno!

4:33 Raynes: Oh, wow, you're hipster to the max.

4:33 To cool for our schools.

4:33 noprompt: the butthole of california.

4:34 Raynes: Have you seen Hollywood?

4:34 ejackson: ordnungswidrig: ouch.

4:34 ordnungswidrig: anyone experience with speaking at strangeloop? I think of submitting a talk proposal

4:34 noprompt: sure. wasn't amuzed.

4:34 Raynes: I lived there for a month and a half. It occasionally even smells like the subject.

4:34 noprompt: honestly, the best places in california are yosemite and the sequoias.

4:34 which are like 45 mins away from where i live. good stuff.

4:34 Raynes: I watched a bird murder another bird and fly off with its bloody carcass in Hollywood.

4:35 It was really appropriate.

4:35 I'm a big fan of Santa Monica and the Santa Monica beach.

4:35 noprompt: yah, the birds here are just dropping walnuts in the road for cars to run over.

4:35 ejackson: noprompt: Sequoias, agreed! Took a really great drive a couple years back up that coast. Trees were majesty.

4:35 Raynes: I can go there after work whenever I want.

4:35 It's a 2 minute walk.

4:35 Malibu is the best.

4:35 noprompt: ejackson: it never gets old!

4:35 Raynes: Zuma beach is eye sex.

4:36 ejackson: aaah, kids :)

4:36 Raynes: I had a viewgasm when I visited that last year.

4:36 ordnungswidrig: Santa Monica always reminds me of The Three Investigators. Childhood memories.

4:36 noprompt: * notes viewgasm

4:37 ordnungswidrig: hu

4:37 noprompt: my sister lives in orange county but, honestly, i don't visit the southern part of cali much.

4:37 ordnungswidrig: noprompt: do not google for that :-)

4:37 Raynes: Last year being when I visited LA before moving.

4:37 I'm thinking of going to a Fall Out Boy concert in Anaheim.

4:37 Which would mean going to Orange County.

4:37 Only other county I've been to in California is Ventura.

4:38 noprompt: seems like every time i have a run in with some rude person.

4:38 Raynes: you should visit the sequoias or yosemite dude.

4:38 Raynes: I would love to, but I have no car.

4:38 noprompt: it's mind blowing.

4:38 Raynes: I'll keep it in mind when opens open up however.

4:38 noprompt: Raynes: i'll pick you up.

4:38 Raynes: opens open up?

4:39 Options open up.

4:39 You can pick me up? I guess I don't know where any of these places (or Fresno) are.

4:39 You're way up there.

4:39 I see.

4:40 noprompt: sure, but shit man, there's not much else to do.

4:40 :P

4:40 Raynes: Heh

4:41 Sure, pick me up at any point in the future and I'll go see mountains and things with you.

4:41 Sure is a hell of a drive to pick me up though.

4:41 noprompt: but yeah, if you know anyone else, i'd be down to do a trip or something. there's also death valley and number of other cool places.

4:41 i took a couple years of geology. lol.

4:42 Raynes: I could possibly convince Alan or someone to go with us.

4:42 matko: do people here have experience with monads in clojure? Are they useful?

4:42 Raynes: I'd have to use covert coercion tactics, but it's a possibility.

4:43 noprompt: sure. well, summer's coming up. just let me know.

4:43 my gf and i just split up too so i kinda have some free time.

4:43 Raynes: noprompt: http://goo.gl/maps/jXR8A lolol

4:44 4 hours is like a lifetime.

4:44 ejackson: matko: I'm sure they are, but they're not widely used at all.

4:44 noprompt: trust me man, i did fresno to san jose every other week for a year. i'm tough as nails.

4:44 ordnungswidrig: matko: they can be useful. But as clojure supports mutable state they need like in haskell e.g.

4:44 clojurebot: clojure is like life: you make trade-offs

4:46 noprompt: so i'm thinking about this css library. trying to figure out the best way to to do media queries.

4:46 matko: Yeah, it seems like in haskell you can't do without them, but clojure has built-in alternatives, at least for the standard monads. I was hoping someone knew of a concrete use case

4:47 noprompt: Raynes: have you had a chance to look at my source for the css lib i'm working on?

4:47 ordnungswidrig: matko: every other day I feel the urge to use state monad or maybe monad. But then I find a more idiomatic clojure solution. The ugly details I can hide with a macro

4:47 algernon: matko: I used algo.monads a few times, for some very simple stuff, worked well for what I needed it for

4:48 Raynes: noprompt: I have not! I was going to but bah

4:48 I'm forgetful

4:48 matko: algernon: such as? Do you happen to have some such code on a public repo?

4:48 noprompt: Raynes: if you get a chance, lemme know. it's my first crack at something.

4:48 Raynes: noprompt: Excellent documentation.

4:49 noprompt: what i wanna do soon is use meta to tag rules for media queries.

4:49 Raynes: noprompt: string/join = apply str

4:49 https://github.com/noprompt/garden/blob/master/src/garden/util.clj#L23

4:50 algernon: matko: mostly used the maybe monad; the only public repo I have available is: https://github.com/algernon/balabit.logstore/blob/master/logstore/src/clj/balabit/logstore/codec/chunk.clj#L48

4:50 noprompt: noted.

4:50 i borrowed a lot from hiccup.

4:50 matko: thank you, reading code now :)

4:51 noprompt: but i'm probably going to change garden.core/css in to a function instead of a macro

4:52 Raynes: btw i'm pretty good about accepting criticsm, so yeah, have it.

4:52 Raynes: Everything sucks. Start over.

4:52 ;)

4:52 matko: the maybe monad seems a bit like if-let, only allowing multiple bindings rather than just one

4:53 noprompt: hehe, i built it 3 or 4 times. so i'm up for that!

4:53 lol

4:53 Raynes: More like a burrito imo, matko.

4:53 matko: eh?

4:53 Raynes: noprompt: https://github.com/noprompt/garden/blob/master/src/garden/util.clj#L98 I'd use for here instead of map.

4:53 $google monads are like burritos

4:53 lazybot: [The Universe of Discourse : Monads are like burritos] http://blog.plover.com/prog/burritos.html

4:54 noprompt: how come?

4:54 Raynes: noprompt: In general, if you're calling map with an anonymous function, it probably looks better as a for.

4:55 (for [x xs] (if (sequential? x) (space-join x) (to-str x))

4:55 ordnungswidrig: noprompt: I'd declare comma, colon et al as a value, not as a function

4:55 Raynes: map looks prettier when you can use it with functions that are named or at least very small.

4:56 noprompt: ordnungswidrig: the reason it's like that is because those are dynamic values which change depending on the output style you want.

4:56 Raynes: noprompt: https://github.com/noprompt/garden/blob/master/src/garden/util.clj#L86 Not a big deal, but I'd name (keyword style) so I don't have to call it twice.

4:57 noprompt: originally i had a bunch of dynamic vars but that didnt' work well.

4:57 Raynes: https://github.com/noprompt/garden/blob/master/src/garden/units.clj#L25 Holy god that's awesome.

4:58 noprompt: Raynes: borrowed and improved from sass.

4:58 Raynes: noprompt: It'd be nice if frinj could do that for you.

4:58 noprompt: oh neat.

4:59 the units are nice though cause they do automatic conversion.

4:59 Raynes: Sure, nothing really wrong with that.

4:59 noprompt: dysinger is the coolest guy on the planet.

4:59 Raynes: I'm not sure how I feel about this giant thing full of nils though.

4:59 noprompt: ;)

5:00 Raynes: I'd probably have done some (repeat n nil) stuff and tied it together.

5:00 It'd probably look even uglier though. *shrug*

5:00 noprompt: Raynes: like i said, i borrowed the concept because it worked out. i could fill in those nils with values though.

5:00 might take a second.

5:00 Raynes: It's fine.

5:01 I'm not thinking out loud.

5:01 noprompt: also i think some of the *? functions could be moved to util.

5:02 but like anything it's wip.

5:02 ordnungswidrig: noprompt: oh, I see.

5:03 Raynes: noprompt: https://github.com/noprompt/garden/blob/master/src/garden/units.clj#L183 I'd probably rewrite this.

5:03 noprompt: the macro? or just the let bindings?

5:04 Raynes: noprompt: Sec.

5:04 ordnungswidrig: Isn't there a unit and conversion lib for clojure?

5:04 noprompt: k

5:05 Raynes: ordnungswidrig: firnj

5:05 frinj*

5:05 ordnungswidrig: Raynes: excuse me? :)

5:05 Raynes: $google frinj

5:05 lazybot: [martintrojer/frinj · GitHub] https://github.com/martintrojer/frinj

5:08 noprompt: frinj looks pretty damn cool. if it could do the css unit stuff i'd be open to using it in garden.

5:09 ordnungswidrig: the examples in frinj a hilarious

5:10 Raynes: noprompt: https://www.refheap.com/paste/13741 What about this?

5:10 Untested.

5:11 noprompt: oh very nice. i've got the code open. lemme try it out.

5:12 Raynes: btw, do you have evil key bindings for the paredit stuff?

5:12 Raynes: No.

5:12 noprompt: i'm still trying to find a happy place there.

5:12 ordnungswidrig: "Many days I could be replaced entirely with a 100-watt bulb and have no discernible effect on the universe." - frinj/examples.clj

5:13 Raynes: I haven't touched any of them.

5:14 clgv: ordnungswidrig: hahaha

5:17 ordnungswidrig: the superman part is funny as well

5:17 noprompt: "Take this nREPL, brother, and may it serve you well."

5:17 always get a kick out of that one. :)

5:18 ordnungswidrig: clgv: let's skipt the atomicbomb-fart-equvalence part, ok?

5:18 clgv: ordnungswidrig: just reading it ;)

5:19 why is the result of "(to :sec)" and such dimensionless?

5:20 noprompt: Raynes: yeah that worked nicely.

5:20 Raynes: noprompt: Great!

5:21 noprompt: oh wait, gotta make one small tweak

5:22 boom! :)

5:22 good stuff.

5:22 Raynes: noprompt: https://github.com/noprompt/garden/blob/master/src/garden/compiler.clj#L5 As tempting as this is, no.

5:22 :p

5:23 Just qualify it with :as u or something.

5:24 noprompt: sure thing, any reason why not?

5:25 Raynes: Because it's impossible to know where functions come from.

5:25 For example, I just looked for 'catesian-product' and didn't find it.

5:25 I just so happen to know that you did :refer all it has to be from there.

5:25 Otherwise I'd have no way of knowing.

5:25 noprompt: actually it's from clojure.math.combinatorics

5:25 Raynes: Oh

5:26 noprompt: one line up.

5:26 Raynes: Yeah, or I typed it wrong.

5:26 I typed it wrong in the find box.

5:26 noprompt: oh all good.

5:26 Raynes: I took diphenhydramine an hour and a half ago because I thought I was going to bed.

5:26 noprompt: so the best practices is avoid refering?

5:26 Raynes: I'm in a bit of a stupor at them oment.

5:26 Avoid :refer :all

5:26 noprompt: hehe no worries.

5:27 Raynes: Referring individual vars is fine.

5:27 Just not all of them at once.

5:27 noprompt: ok, seems like sound advice to me!

5:27 Raynes: Well, I think that's everything I've seen from my gentle scanning.

5:28 This is really good stuff.

5:28 I'd use this for sure if I needed to generate css.

5:28 noprompt: i really appreciate that! thanks! :)

5:28 Raynes: FWIW, I wouldn't use any of the other css libs. They're pretty blech.

5:28 jack_rabbit: Raynes, diphenhydramine can generate css?

5:29 Raynes: What was that library I wrote earlier?

5:29 Oh, least.

5:29 noprompt: aww thanks man. but you know, it's worth giving them credit for getting the ball rolling.

5:29 Raynes: Yikes.

5:29 I can't remember the name of a library I wrote 2 hours ago.

5:29 jack_rabbit: I hope not.

5:30 noprompt: Raynes: call it diphenhydramine.

5:30 Raynes: That's my next project.

5:30 noprompt: that way everyone has to copy/paste it.

5:30 Raynes: Actually, I was writing a little swing-based sleep timer thing. I should rename it to that.

5:30 It's cute.

5:31 Really? I can spell diphenhydramine from memory.

5:31 noprompt: lol.

5:32 would it be possible to have a print function that computes whatever it needs to but prints the result somewhere else?

5:32 that way you don't jam up your repl with tons of output.

5:32 Raynes: &(with-out-str (println "foo"))

5:32 lazybot: java.lang.SecurityException: You tripped the alarm! pop-thread-bindings is bad!

5:32 Raynes: Whatever.

5:33 Just bind *out* to something that prints to /dev/null

5:33 :p

5:33 I wrote something for this once.

5:33 Can't remember where I put it.

5:33 noprompt: oh yeah, i keep forgetting about that kinda thing.

5:34 but in some cases i'm actually interested in the output, just not in my repl.

5:34 i guess now i have an idea of what to do.

5:34 Raynes: Use with-out-str then.

5:35 Or do it manually with a string writer if you need the function's return value too.

5:35 Anyways, I'm about to fall over and hit my head and die. I'm going to go to sleep.

5:35 Night!

5:35 noprompt: peace!

5:35 gunface: hi guys I am new to clojure and need a bit of help, sorry for disturbing your ongoing discussion :(

5:35 noprompt: gunface: your name alone commands my immediate attention.

5:36 gunface: :P

5:36 noprompt: shoot!

5:36 gunface: actually I started off learning clojure just a week back

5:37 noprompt: cool man. :) clojure's good stuff.

5:37 gunface: read up on it and was really excited about how it inherits all the lispy magic :)

5:38 read around 200 pages of the book "clojure in action"

5:38 and started coding after getting a hang of the basic syntax

5:38 but it really is a bit difficult thinking this way

5:39 any tips for how to get better at it

5:39 noprompt: yeah, it takes a bit to get used to.

5:39 what langauge(s) did you come frome?

5:39 s/(from)e/\1

5:39 gunface: ruby and a bit of scala lately

5:40 noprompt: ah cool.

5:40 gunface: but functional noob thats why trying to learn scala and clojure

5:40 noprompt: so, for me, i had kinda messed with haskell a bit while doing ruby at the day job.

5:41 also doing javascript, i was able to mess with fp concepts.

5:41 gunface: and scala is a bit more intuitive but still clojure seems much more fun

5:41 noprompt: but prying the "OO" way of thinking out of your head will probably take a couple months.

5:41 at least for me it did.

5:42 ordnungswidrig: noprompt: *g*

5:42 noprompt: *g*?

5:42 or at least class based OO.

5:43 gunface: ahh alright

5:43 noprompt: but, i dunno, the best tip i know of when working with a new language is attempting to rewrite other projects you've done etc.

5:44 try to connect the dots between the old one and the new, see how they are different and try to play up the strenghts of the new one.

5:44 i think you will find clojure takes out a lot of the complexity you'd find in a language like ruby.

5:45 ordnungswidrig: noprompt: i was refering to your "out of your head" statement

5:45 noprompt: later you might look at ruby code and realize it's much more complicated than you originally thought.

5:45 ordnungswidrig: oh hehe. :) probably could have said that better.

5:46 s/complicated/complex

5:46 gunface: ok :)

5:46 have to pass through this awkward phase

5:46 ordnungswidrig: complected

5:46 gunface: mind always thinks in terms of loops and stuff

5:47 noprompt: just keep at it. i started with clojure back in november and i think it's been one of the best experiences i've had with a language.

5:47 ordnungswidrig: gunface: view the talks by rich hickey. you'll have to know the motivation for all this stuff.

5:47 noprompt: gunface: oh yes! do watch those!

5:48 gunface: yeah I have seen one of them, that's why started learning the language :)

5:48 will get to all

5:48 jack_rabbit: Lisps are just so pretty. I haven't found another syntax more expressive.

5:48 noprompt: definitely agree with jack_rabbit.

5:49 gunface: and also the polish notation

5:49 jack_rabbit: No doubt.

5:49 Although I do miss some features of CL in Clojure.

5:49 noprompt: gunface: but keep in mind that the notation is actually a good thing as foreign as it may seem.

5:50 gunface: I am not used to polish notation and sometimes manipulating expressions just seems unnatural

5:50 noprompt: you never have to mentally parse source in your head.

5:50 gunface: remember too it's just data.

5:50 just handle it like data.

5:51 gunface: code as data, yeah that seemed to me something out of a sci-fi book first, real cool :)

5:51 noprompt: it took a while for that to sink in.

5:52 gunface: any material you suggest I should read up

5:52 noprompt: gunface: just the books, videos, talks.

5:53 #clojure is also a good place :)

5:53 gunface: ok and have started doing problems on 4clojure

5:53 noprompt: lots of friendly, helpful people here.

5:53 gunface: yes like you :)

5:53 first time I am using irc

5:54 noprompt: good thing you came here then!

5:54 gunface: just after hearing that community is awesome :)

5:54 and it really is

5:54 and seems I will need that to get better :P

5:55 noprompt: what editor are you using?

5:55 gunface: hahaha yeah that was a real headache at first

5:56 tried counterclockwise on eclipse

5:56 but had some errors

5:56 than switched to emacs live

5:56 jack_rabbit: gunface, I began with CL, so clojure was pretty easy to pick up, once you learn the differences. If you're into Lisps in particular, check out PCL. There are a few documents out there which have converted the source in PCL to clojure.

5:56 noprompt: (PCL = Practical Common Lisp)

5:57 gunface: alright jack_rabbit

5:57 jack_rabbit: http://gigamonkeys.com/book/

5:57 Some chapters are very relevant to Clojure, and others aren't.

5:58 gunface: ok bookmarked :)

5:58 one thing about emacs live though noprompt

5:59 it has that paredit thing enabled

5:59 noprompt: someone was porting SCIP to clojure but i guess they never finished :/

5:59 jack_rabbit: I don't know emacs live.

5:59 noprompt: SICP

5:59 gunface: maybe just try vanilla emacs. pick up the starter kit and clojure mode.

5:59 jack_rabbit: SICP... That's a project.

6:00 noprompt: jack_rabbit, the book?

6:00 jack_rabbit: gunface, I'm working with nrepl. No complaints thus far.

6:00 noprompt: yah, nrepl is sweet.

6:00 gunface: it is a pre-configured emacs, so nrepl and stuff is already in there so used that

6:00 jack_rabbit: noprompt, That's what you're talking about, right?

6:01 noprompt: jack_rabbit, yeah i was talking about the book http://www.amazon.com/Structure-Interpretation-Computer-Programs-Engineering/dp/0262510871

6:01 jack_rabbit: That's what I thought.

6:01 noprompt: someone was doing a version with clojure examples but never finished.

6:01 gunface: is it working out?

6:01 jack_rabbit: Right. I was just thinking that converting a book like that would be a significant chunk of work.

6:01 gunface: yeah saw that too, people were discussing on a kickstarter on that too

6:02 noprompt: probably why they never finished!

6:02 jack_rabbit: gunface, Are you familiar with Java?

6:02 gunface: no I am not

6:02 jack_rabbit: Cool. Just curious.

6:03 gunface: maybe will learn on my way to start using the libraries

6:03 just was curious, one quick question

6:04 running clojure on jvm we have access to java libraries but does that in any way hamper the development of clojure libraries related to that stuff

6:04 jack_rabbit: In what way?

6:05 gunface: I mean if we have a solid working library in java for a domain should one more made in a more clojure way or it shouldn't be

6:06 jack_rabbit: gunface, AFAIK, a lot of the clojure libraries are wrappers around java libs.

6:07 Java interop is easy, but kind of ugly. It's fairly easy to build a simple wrapper around stuff you use a lot, though.

6:07 But that's just my opinion.

6:08 Have you read Volkmann's tutorial?

6:08 gunface: no what's that?

6:08 jack_rabbit: http://java.ociweb.com/mark/clojure/article.html

6:09 It's an excellent introduction to the language, IMO. It's what I used, and it explains a lot of the things I found confusing at first. It also has a good section on Java interoperability.

6:09 gunface: ok great thanks a lot :)

6:09 will go through it

6:10 currently was reading the book "clojure in action"

6:10 and jack_rabbit do you also use emacs? I guess you are from lisp background so you must use it?

6:11 jack_rabbit: gunface, emacs-4-lyfe

6:11 gunface: :)

6:11 noprompt: jack_rabbit that's pretty cool. wish i had stumbled upon that one earlier.

6:11 gunface: yeah have been using it for a week

6:11 jack_rabbit: Yeah. People keep trying to get me to give vim a chance, but I just hate the interface.

6:11 gunface: took some getting used to

6:12 clgv: gunface: only write a clojure wrapper if there is real benefit in it otherwise just use your existing lib via interop

6:12 noprompt: gunface: yah, emacs (+ evil) is cool.

6:12 jack_rabbit: noprompt, I thought it was pretty good.

6:12 gunface: yeah I have used vim for C and stuff it was good

6:13 noprompt: vim actually isn't a terrible environment for clojure, but i had lots of problems with vimclojure randomly crashing etc.

6:13 clgv: gunface: if you are used to eclipse from your java abckground, you can also use the counterclockwise plugin

6:13 jenshaase: hi, short question. how can I do a "MyClassName.class" in clojure with an existing Java Class?

6:13 gunface: ok got it clgv, java always seemed a bit ugly to me, that was the only thing

6:13 jack_rabbit: I just can't handle buffers the way I like in vim. Maybe if I actually did give it a chance I'd like it. Still. Writing your own macros for emacs is the best. I wrote like 4 lines of elisp that properly indents any C-like file In my buffer.

6:14 noprompt: the big downside with vim is that you can'd do awesome shit like IRC, shell, etc inside it.

6:14 jack_rabbit: noprompt, right. Emacs is it's own OS.

6:14 noprompt: plus vim's scripting language is just the worst ever.

6:14 gunface: jack_rabbit how to get used to paredit, having troubles with that though

6:14 :(

6:14 clgv: noprompt: "emacs is a great operating system. if only it had a descent editor." ;) :P

6:15 jack_rabbit: gunface, I've never used it.

6:15 clgv, funny. I've seen that one before.

6:15 noprompt: after 4 hours of hacking around with elisp, i was able to bring in most of the keybindings etc from my vimrc.

6:15 gunface: i mean automatic balncing of parentheses

6:15 noprompt: clgv: and now it does!

6:15 clgv: jack_rabbit: yep, thus the quotation marks ;)

6:16 jack_rabbit: gunface, vanilla emacs should highlight the opening paren as you insert the closing ones. Also, in the mini-buffer, it tells you which form you're closing.

6:16 As long as you're in lisp mode.

6:16 noprompt: gunface: if you get a chance, try paredit mode too.

6:16 if it isn't already on.

6:16 jack_rabbit: noprompt, he's having trouble with paredit he said.

6:17 noprompt: ah, sorry i missed that.

6:17 gunface: yeah getting trouble with that only nopropmt

6:17 noprompt: it's a bit of an adjustment but it's nice once you get the hang of it.

6:18 then you can do all kinds of fancy stuff like transposing, slurping, barfing. lol.

6:18 jack_rabbit: Even editing C in emacs is a joy. Auto-tab is such a convenient feature. I can't believe it's not standard in more editors.

6:18 gunface: yeah for now if I forget putting something in parebtheses coming back and rectifyinf only gives me hell :P

6:19 noprompt: jack_rabbit one thing i miss from vim is that closing brackets would automatically dedent

6:19 for C style code

6:19 jack_rabbit: Gotcha. Yeah, and every once in a while emacs freaks out and refuses to indent anything properly. Luckily that's rarely, and is solved by restarting emacs.

6:19 noprompt: i'm sure emacs can do that w/o me having to write something. is there something i need to turn on?

6:20 jack_rabbit: noprompt, not sure, but if you're a lisper, you can probably sort out c-mode to do what you want.

6:21 noprompt: jack_rabbit my guess is that i can just look for the } and check if anything else is on the line, if not auto dedent.

6:21 jack_rabbit: noprompt, Right. I think the challenge will be to find the proper lines to modify.

6:22 gunface: hey jack_rabbit, noprompt have any of you worked on the overtone project in clojure?

6:22 noprompt: yeah. but i know if it'll be much easier in elisp than viml.

6:22 gunface: that was the second thing that made me take up this language :)

6:22 noprompt: gunface: just for a bit. it's actually pretty amazing imho.

6:23 jack_rabbit: gunface, not I. I'm still pretty new to clojure.

6:23 noprompt: overtone is heaps of fun.

6:23 gunface: I am a guitarist and algorithmic music is just too much fun :)

6:24 maybe will make something and upload on soundclous after I get a hang of this for you guys ;)

6:24 #soundcloud

6:25 noprompt: it's funny i used to do a lot of expirimental electronic, i wish overtone had been around then.

6:25 jack_rabbit: I'll have to check that out.

6:25 gunface: yeah jack_rabbit it is good :)

6:25 jack_rabbit: I play synth, and listen to Brian Eno a lot. He did quite a bit with algorithmic music for a while.

6:26 noprompt: eno is "classic"

6:26 gunface: have you listened to "the algorithm" noprompt?

6:26 noprompt: oh i dunno, i collected so much random stuff over the years it's hard to say what i've heard.

6:27 jack_rabbit: How about Boards of Canada?

6:27 noprompt: basically i ended up stopping because i started listening to 60's/70's acid jazz and prog.

6:27 gunface: http://www.youtube.com/watch?v=dJwNfRaPp08

6:27 boards of canada is awesome :)

6:27 noprompt: then i realized music was dead.

6:27 jack_rabbit: noprompt, lol

6:27 noprompt: oh yeah boc is great stuff.

6:27 gunface: hahah

6:28 tycho is great when you are coding too :)

6:29 anyways you guys have been very helpful and fun talking too :)

6:29 thanks :)

6:29 jack_rabbit: Here's some stuff my buddy and I did a while ago: http://federalcrimes.bandcamp.com/

6:29 (Shameless self-plug)

6:29 noprompt: *tsk-tsk* ;)

6:29 gunface: hahaha

6:31 noprompt: oh holy cow! it's 3:30.

6:31 well guess i should probably sleep.

6:32 g'night!

6:32 jack_rabbit: 'night.

6:32 gunface: night :)

6:32 jack_rabbit: Heh. IRC client for Emacs.

6:57 rhinux_: it's 19:00. :)

7:27 jenshaase: hi, short question. how can I do a "MyClassName.class" in clojure with an existing Java Class?

7:28 ordnungswidrig: jenshaase: you want the class as a value?

7:29 jenshaase: in java .class is a literal and returns somethings like Class<MyClassName>. i need this in clojure

7:29 Chousuke: jenshaase: that's just MyClassName

7:29 ordnungswidrig: It's simpe MyClassName

7:30 Chousuke: ,String

7:30 clojurebot: java.lang.String

7:30 ordnungswidrig: either fully qualified: some.package.MyClassName

7:30 or use (ns foo (:import some.package.MyClassName)) then it's simply MyClassNAme

7:30 jenshaase: but its java.lang.String and not Class<java.lang.String>

7:31 Chousuke: ,(type String)

7:31 clojurebot: java.lang.Class

7:31 Chousuke: see?

7:31 ordnungswidrig: jenshaase: the repl uses the string representation of String.class

7:31 jenshaase: show us your usecase

7:33 jenshaase: I try this but its not working for me.

7:33 Chousuke: String.class is just syntactic sugar (or salt?) in java because referring to classes as values directly is not allowed

7:33 jenshaase: i will call this method from clojure http://uimafit.googlecode.com/svn-history/r623/trunk/apidocs/org/uimafit/factory/AnalysisEngineFactory.html#createPrimitive(java.lang.Class, java.lang.Object...)

7:33 Chousuke: that's a variadic method

7:34 your call syntax is probably wrong. how are you calling it?

7:34 The Object... parameter needs to be an array of the arguments

7:34 ordnungswidrig: (.createPrimitive factory MyComponent (to-array configurationData))

7:35 jenshaase: i call it this way: (AnalysisEngineFactory/createPrimitive CljAnnotator "a" "b" "c" "d")

7:35 Chousuke: yeah you need (to-array ["a" "b" ...])

7:36 another bit of Java syntactic sugar that Clojure doesn't have :)

7:36 jenshaase: that's it. thanks very much

7:36 ordnungswidrig: Chousuke: I'm confused that clojure does not support variadic invokation while for clojure functions it does

7:37 Chousuke: ordnungswidrig: Clojure functions implement a different interface for variadic functions

7:37 for apply support etc.

7:37 and java variadic methods are not variadic at all under the hood

7:37 they're just methods with an array parameter

7:38 ordnungswidrig: i know

7:46 Anderkent: is there an implementation of strict records somewhere out there? I.e. a record that throws exception when you assoc unknown keys onto it

8:02 jack_rabbit: Anderkent, Certain STM types take verification functions.

8:37 tgoossens: Since i learned using clojure i find myself creating more often a (mostly private) class that with public final fields which are completly immutable (for collections i use ImmutableCollections from java). This is in some way trying to get the advantages of using maps. But maybe i'm currently unaware of the implications of my method in java. Are there some situations in which my approach would be problematic?

8:39 AimHere: I thought that Rich Hickey did pretty much that sort of thing until he had the brainfart that created clojure

8:39 clgv: tgoossens: afaik you will have to copy on modification with java's immutable collections whereas Clojure's immutable data structures share their common data on modification

8:40 AimHere: So one problem is that you might ride off into the sunset and create Yet another new functional programming language

8:40 rbarraud: AimHere: Dem's probably foitin' werds in this channel ;-)

8:41 clgv: tgoossens: you could use clojure's data structures in java as well...

8:41 tgoossens: And what if i make these immutable map-like-thingy-classes public?

8:41 clgv: hmm i should look into that

8:42 clgv: its obvious to me i can use them but i didn't think of it :p

8:42 clgv: tgoossens: a lot of Clojure functions delegate to methods on the datastructure classes

8:43 tgoossens: some time ago I thought I might introduce them in a C# .Net project - but never had the time nor got the chance to do it

8:46 tgoossens: The comment my teammates (at university) give me is that "What if you want to change the representation of it

8:46 {int x; int y}

8:47 what if you suddenly realise that you wanted doubles but want to remain backwards compatible

8:47 that's what they taught me as well (ie. why use getters)

8:47 One approach would be to just add a new public final field i think

8:57 stuartsierra: tgoossens: The ability to change representations while keeping the same API is often overrated.

8:58 E.g. if you switch from ints to doubles, that will have a measurable impact across your whole application.

8:58 jweiss: ambrosebs: got your email, thanks, that helped :) played some more last night, I am making progress. One issue I hit was this - i wrote a simple macro to expand (mydefrecord [x :- String, y :- Number]) into both the ann-record AND the defrecord (since the former contains all the information for the latter). however, once I ran a call to this macro, the type annotations seemed to be fixed forever. if i changed it and called the macro

8:58 again, it would not redefine the type.

9:00 tgoossens: stuartsierra: hmmyes... But then the argument of my teammates is still valid I think?

9:00 ambrosebs: jweiss: Currently core.typed is a bit picky about where top-level annotations are put. I think ann-record needs to be a member of a `do` or a top-level expression.

9:01 (member of a *top-level* `do`, or recusively)

9:01 jweiss: does that describe your macro?

9:01 jweiss: ambrosebs: ah ok, it's in a do, but i don't know if it is top-level. let me look

9:01 ambrosebs: the macroexpansion is a top-level do

9:02 (do (defrecord ...) (ann-record ..))

9:03 ambrosebs: jweiss: ok, I'll try it out.

9:05 jweiss: are you running this through the repl?

9:06 jweiss: The general rule is that the only way to accumulate global type state outside of a check-ns is to wrap in cf.

9:06 jweiss: ambrosebs: no, it's in a file, and i'm compiling it via nrepl.el and then using cf in the repl afterwards

9:06 ambrosebs: ok

9:06 jweiss: ambrosebs: here's a paste https://www.refheap.com/paste/13747

9:09 ambrosebs: so is that the problem then? if i just compile the ns and don't run check-ns, it won't save any new type state?

9:11 ambrosebs: jweiss: Yes, check-ns is needed to load types in a file.

9:11 jweiss: check-ns actually wipes the global type state also.

9:11 jweiss: ambrosebs: ah, that would explain it. i hadn't finished annotating the file so i couldn't run check-ns all the way through

9:12 ambrosebs: jweiss: evaling `ann` used to be enough to change the global type system, but I recently cleaned it up/out.

9:13 *global type state

9:13 jweiss: The defrecord macro looks kinda cool :)

9:13 jweiss: ambrosebs: so how could i do this then, temporarily wrap the code in my file in cf as i work on it?

9:14 ambrosebs: thanks :) maybe you could add a macro like (deftypedrecord ... ) that is a similar shortcut for (defrecord ... )(ann-record ...)

9:15 ambrosebs: jweiss: so what's the issue? Is half of your namespace illtyped or something?

9:16 jweiss: ambrosebs: yeah, i have like 25 records, didn't want to have to annotate all of them to experiment with type-checking code that uses them

9:16 ambrosebs: jweiss: you can use tc-ignore to wrap code you want to ignore.

9:17 jweiss: ah ok i should have realized that :)

9:17 * jweiss s/comment/tc-ignore

9:17 ambrosebs: :)

9:18 jweiss: oh right, i know why i commented it out. i had redefined defrecord to use type annotations. and i hadn't changed all my calls to defrecord. so it doesn't compile :)

9:19 ambrosebs: Ah.

9:24 ordnungswidrig: what do you use to build documentation sites? jekyll? or a clojure app?

9:24 jweiss: ambrosebs: sorry to keep bothering you, i'm having trouble figuring out what this means https://www.refheap.com/paste/13750 - i would think (U nil Object) would match anything?

9:25 ambrosebs: jweiss: hmm, yes they are semantically synonymous, but core.typed doesn't do "splitting" of types, so (U nil Object) isn't a subtype of Any.

9:26 Sorry, the other way.

9:26 Any is not a subtype of (U nil Object)

9:26 Do you have a (U nil Object) directly in your annotation?

9:26 jweiss: ambrosebs: no

9:27 ambrosebs: What's at line 19?

9:27 the get?

9:28 jweiss: ambrosebs: no, it's the defrecord Organization

9:28 ambrosebs: ah. It's probably one of the methods that the defrecord is implementing.

9:29 jweiss: so it seems to be complaining about the record's implementation of IFn

9:29 specifically, the one that calls clojure.core/get

9:29 ambrosebs: jweiss: Yes the 2 arity.

9:32 I'm looking into it

9:32 jweiss: ambrosebs: ok thanks

9:33 ambrosebs: jweiss: You've probably tried more defrecord cases than I have at this point :)

9:33 jweiss: hehe i'm a QA Engineer, it's my job to break things

9:33 ambrosebs: thanks :)

9:42 jweiss: Ok, implementing IFn gets hacky quickly unless I restructure my function types, which I've been procrastinating on :)

9:43 This is a pretty good reason to work on it.

9:43 jweiss: ambrosebs: hehe sorry, ended up creating more work for you :)

9:44 ambrosebs: Right now I have a special Fn type, like [Number -> Any]. It really should be a parameter of IFn.

9:45 That brings up the question: should a bare [Any -> Any] be allowed? Would it mean (IFn [Any -> Any])? AFn? AFunction? :/

9:46 jweiss: i have no idea what i am doing with type annotations, so i don't think i can be of any help there :)

9:46 ambrosebs: :) you've done plenty already!

9:46 haha

9:48 jweiss: if you want to keep hacking, it might be best to wrap the call to clojure.core/defrecord in tc-ignore.

10:04 gdev: &(class "H")

10:04 lazybot: ⇒ java.lang.String

10:04 gdev: &(class \H)

10:04 lazybot: ⇒ java.lang.Character

10:05 gdev: &(.isUpperCase Character \H)

10:05 lazybot: java.lang.IllegalArgumentException: No matching method found: isUpperCase for class java.lang.Class

10:08 gdev: &(Character/isUpperCase \H)

10:08 lazybot: ⇒ true

10:08 clgv: gdev: so that is a static method^^

10:09 gdev: probably because \H is a primitive value

10:09 gdev: clgv, yes, yes it is

10:12 clgv: easy proof: ##(int \H)

10:12 lazybot: ⇒ 72

10:17 gdev: was trying to show someone how awesome the clojurebot is to someone at work. Some people are still skeptical of Clojure's interop

10:18 so when I demo I always demo that sort of stuff

10:26 clgv: ah ok^^

10:39 TimMc: ,(int (Long. 5))

10:39 clojurebot: 5

10:40 TimMc: ,(int (Character. \h)) for that matter

10:40 clojurebot: 104

10:40 TimMc: int happily takes objects

10:41 pl6306: clj-time how to create seq of dates from 1/1/2013 to today? I would have just done a loop in c# but not sure how to do it clojure ...

10:44 rboyd: pl6306: sounds like a case for take-while + clj-time.periodic/periodic-seq

10:46 pl6306: thanks

10:52 TimMc: pl6306: All the trickiness here is in the date logic, not in the sequence creation.

10:52 E.g., which calendar system are you using? :-P

10:59 jweiss: (fn [x] (fn [] (inc x))) - i'm pretty sure i can write this just using comp, partial, and inc, but somehow I can't quite get it right.

11:04 pyrtsa: jweiss: (partial partial inc) is close but a bit looser to the arity rules than that.

11:05 hyPiRion: (partial #(inc %)) ?

11:06 jweiss: ,(((partial partial inc) 5))

11:06 clojurebot: 6

11:06 jweiss: yeah i think that is what i wanted

11:06 TimMc: ,(((partial partial +) 5) 6)

11:06 clojurebot: 11

11:07 hyPiRion: oh, I got this

11:07 jweiss: ,(((comp partial partial inc dec) 5))

11:07 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>

11:08 jweiss: so that is the part i don't quite get

11:08 if i want to go from (partial partial inc) and change inc to be a composition of inc and dec, that doesn't seem to work.

11:10 (((partial partial (comp inc dec)) 5))

11:10 ,(((partial partial (comp inc dec)) 5))

11:10 clojurebot: 5

11:10 jweiss: ok there we go.

11:12 stuartsierra: Anybody got an explanation for lots of time spent in org.apache.xml.dtm.SecuritySupport12 when profiling a Clojure app doing XML processing?

11:32 juhu_chapa: Hi all! Is there a way to force a parameter to be of certain type i.e. (defn f [(String) s] (.toUpperCase s))

11:33 gdev: juhu_chapa, i'm not sure if type hint = forcing type

11:33 TimMc: juhu_chapa: Nope, but you can use preconditions.

11:34 gdev: There are two types of type hints; one avoids runtime reflection, the other allows for use of unboxed primitives. Neither does what juhu_chapa wants.

11:34 juhu_chapa: Thank you guys!

11:35 gdev: TimMc, thanks for the clarification

11:36 asteve: I often see (alter fn-name #(vector (second %) thing)); how do I interpret (second %)?

11:36 TimMc: ,'#(vector (second %) thing) ;; asteve

11:36 clojurebot: (fn* [p1__35#] (vector (second p1__35#) thing))

11:37 TimMc: The % is part of the #(...) form.

11:38 ,'#(% %2 %&)

11:38 clojurebot: (fn* [p1__70# p2__71# & rest__72#] (p1__70# p2__71# rest__72#))

11:38 asteve: so % is the first input?

11:39 TimMc: yep

11:39 First and only, since there aren't any other args specified.

11:39 #(...) is a reader form for function literals

11:39 stuartsierra: #(… % …) is syntactic sugar.

11:48 owengalenjones: (def *thing-that-changes*) ...later... (def *thing-that-changes* value) is the expected use of earmuffs correct?

11:51 gdev: owengalenjones, i beleive so. first time i saw it was in korma; select* lets you compose the statement over time

11:51 gfredericks: owengalenjones: not at all

11:52 earmuffs are idiomatically used for dynamic vars

11:52 TimMc: owengalenjones: Don't re-def things.

11:52 owengalenjones: hmm :( searching for earmuffs isnt returning helpful results

11:53 TimMc: Search for "dynamic vars".

11:53 Chousuke: owengalenjones: earmuffs are used for things that you dynamically rebind using binding

11:53 owengalenjones: ok thanks guys

11:53 Chousuke: re-defing things is almost never the right thing to do

11:53 naeg: is there some cool lib for clojure that visualizes, or at least nicely prints, search trees? I'd like to debug an algorithm and go through it step by step

11:53 Chousuke: unless you're working in a repl or something

11:54 TimMc: ,(binding [*print-dup* true *print-meta* true] (prn (with-meta [1 2] {:a :b})))

11:54 clojurebot: ^#=(clojure.lang.PersistentArrayMap/create {:a :b}) [1 2]\n

11:54 ambrosebs: naeg: looked at tools.trace?

11:54 TimMc: owengalenjones, gdev: ^ this is what dynamic vars allow

11:54 naeg: ambrosebs: not yet

11:54 dnolen: lynaghk: ping

11:55 owengalenjones: TimMc: thanks for clarifying!

12:09 kmicu: , (clojure-version)

12:09 clojurebot: "1.5.0-RC6"

12:26 juhu_chapa: Why there is not def- special form?

12:31 TimMc: To make people learn about metadata? I dunno.

12:34 juhu_chapa: :P

12:56 clgv: &(clojure-version)

12:56 lazybot: ⇒ "1.4.0"

13:12 gfredericks: if I end up wanting to extend a protocol to a type for a particular dynamic scope, does that sort of suggest that having a protocol was a bad idea in the first place?

13:15 e.g., cheshire has a JSONable protocol, and it seems messy that in order to make a type JSONable for a particular call I have to also do that for the entire system in a global way

13:17 hiredman: you can extend the protocol to your type in a way that checks a dynamic binding

13:17 dakrone: gfredericks: do a try-finally and use remove-encoder in the finally?

13:17 although that's not going to be thread-safe

13:17 do what hiredman said

13:41 gfredericks: hmm. that's an interesting approach

13:41 as long as I'm the only one doing it :)

13:43 pjstadig: gfredericks: could you extend the protocol to Object and have the implementation for Object check a dynamic var for it's lookup table?

13:43 gfredericks: yeah

13:55 davidchambers: is there a name for functions such as `range` which have multiple "modes"?

13:56 AimHere: 'polymorphic' is somewhere in that vicinity, though I'm not sure if it's really the word you want

13:56 technomancy: multi-arity?

13:57 TimMc: "functions what take some defaults"

13:57 davidchambers: technomancy: multi-arity applies in the case of `range`, but wouldn't apply to a function that takes one argument, say, and switches based on its type

13:58 technomancy: davidchambers: right; because that's a completely different concept =)

13:59 TimMc: That latter concept is "functions that dispatch on an argument type".

13:59 range doesn't do that.

13:59 davidchambers: technomancy: Is it, though? In both cases we're determining how to treat the arguments based on the nature of the arguments collection.

13:59 forgive me – I've been writing JavaScript for too long ;)

14:00 technomancy: davidchambers: sure, you can expand the term, but it becomes less useful the more you do so

14:00 eventually you end up at "conditional"

14:00 Okasu: technomancy: "Multy-arity" = polyadic.

14:00 JFYI.

14:00 technomancy: Okasu: huh; I've heard of variadic but not polyadic

14:01 I usually hear variadic applied when it takes rest args, but I'm not sure if it's limited to that

14:01 Okasu: technomancy: Multiple args - poly, variable number of args - vari.

14:01 davidchambers: So which term would one use to describe a function such as the jQuery function, which does one thing when passed a string and a completely different thing when passed a function? Overloaded?

14:02 naeg: is there a way to do this, but include 200: (take-while #(< % 200) [64 70 200 90]) => (64 70)

14:02 should be lazy

14:02 asteve: so I just stumbled my way to writing an exponent function to better understand recur

14:02 (defn exponent [n e] (loop [cnt e acc 1] (if (zero? cnt) acc (recur (dec cnt) (* acc n)))))

14:02 technomancy: davidchambers: unpredictable =)

14:02 davidchambers: technomancy: that's how I think of "variadic", too

14:02 asteve: what I don't really understand is why the binding acc is required

14:03 davidchambers: http://stackoverflow.com/questions/16089645/which-term-is-used-to-describe-functions-with-multiple-modes

14:03 asteve: recur is running recursion on the loop, right?

14:05 technomancy: davidchambers: "overloaded" is probably the best description of jquery

14:06 you don't see functions like that in clojure very often though

14:06 davidchambers: technomancy: thankfully!

14:06 technomancy: I agree that "overloaded" is the best description of jQuery

14:07 it doesn't apply in the case of `range`, though, as we're switching purely based on the number of arguments

14:08 but calling `range` a variadic function is confusing, as that term is generally used to refer to functions such as `+` and `*` which treat their arguments as a collection

14:08 pjstadig: i think generally any function that has the same name, but does different things depending on the context is "polymorphic"

14:09 hyPiRion: depending on the context?

14:09 ,[(+ 1 2) (+ 2 3)]

14:09 clojurebot: [3 5]

14:09 gfredericks: I just did (defmacro caught [class & body] `(try ~@body nil (catch ~class e# e#))) -- does flatland/useful have this already?

14:09 pjstadig: different amounts and/or types of arguments

14:09 hyPiRion: pjstadig: ah

14:10 dnolen: davidchambers: jQuery's behavior is polymorphic. There are many functions that are polymorphic in Clojure as well.

14:11 davidchambers: dnolen: thanks… I'm trying to draw Venn diagrams in my head :)

14:11 Raynes: hyPiRion: I've jumped into Sandman overdrive on the bus. My bus ride is really short, like 20 minutes, so I jerk the volume out and beat my eyes on it as much as possible on the way to and from work. Already half way through the second volume just with on the bus reading over the past couple of days.

14:11 TimMc: Raynes: Skimming that message was somewhat disturbing.

14:12 Raynes: TimMc: Never skim my messages.

14:12 TimMc: yessir

14:14 duckyuck: ppppaul: you there?

14:14 dnolen: ,(let [v [64 70 200 90]] (map (fn [a b] a) v (concat (take-while #(< % 200) v) [::extra])))

14:14 clojurebot: (64 70 200)

14:14 dnolen: naeg: ^

14:14 best I could come up with, probably something better

14:16 hyPiRion: Raynes: Oh, nice

14:17 pjstadig: ,(take-while #(<= % 200) [64 70 200 90])

14:17 clojurebot: (64 70 200 90)

14:17 pjstadig: hmm

14:17 i thought it seemed too easy :)

14:17 hyPiRion: ,(take-while #(< % 200) [64 70 200 90]) ;?

14:17 clojurebot: (64 70)

14:18 tieTYT2: if I've already got a javaee app, how would I go about making a clojure module in it? Is it as easy as cd'ing into a directory and typing lein new?

14:22 TimMc: ,(let [more (atom true)] (take-while #(let [end? (< % 30) ret @more] (reset! more end?) ret) [10 20 30 40])) <-- this is terrible

14:22 clojurebot: (10 20 30)

14:24 gdev: ,(take 3 [10 20 30 40])

14:24 clojurebot: (10 20 30)

14:25 jjido: TimMc: why is it written this way?

14:26 TimMc: jjido: Why did I use an atom? Is that what you're asking?

14:26 jjido: gdev: you are not using the right function. Note the (< % 30) test

14:27 TimMc: not exactly, but tell me.

14:28 gdev: jjido, i know, sorry

14:29 jjido: why did you use an atom TimMc?

14:29 hyPiRion: TimMc WHY DID YOU USE AN ATOM???

14:29 lazybot: hyPiRion: Oh, absolutely.

14:30 jjido: Hi lazybot.

14:31 TimMc: jjido: To delay the use of the information from the predicate.

14:31 You could actually bundle it up differently...

14:32 amalloy: gfredericks: no, that is not in useful

14:33 chronno: naeg: Never worked with lazy-seq's but maybe changing take-while a little bit would work? https://www.refheap.com/paste/13758

14:34 amalloy: asteve: yes, the recur form is recursively "going back to" the loop anchor

14:35 jjido: TimMc: is it to continue 1 past the predicate?

14:36 TimMc: yes

14:36 amalloy: chronno: yes, but you really just what's inside the when-let to be: (cons (first s) (when (pred (first s)) (foo pred (rest s))))

14:36 jjido: why don't you test on a shifted list

14:37 amalloy: https://github.com/flatland/useful/blob/develop/src/flatland/useful/seq.clj#L362

14:37 TimMc: jjido: That's what dnolen did.

14:37 OK, here's a cleaner version: https://gist.github.com/timmc/5415140

14:37 amalloy: TimMc: i don't get why you keep doing this thing with an atom

14:38 TimMc: heh

14:38 amalloy: i guess the delayed function is kinda cute

14:38 gdev: it's atomic???

14:38 lazybot: gdev: Yes, 100% for sure.

14:38 gdev: thanks lazybot

14:38 TimMc: Exactly. I wouldn't actually use this code.

14:38 ystael: TimMc: that looks like 'head like a hole' code

14:38 as in, you're going to get what you deserve

14:39 TimMc: :-D

14:39 I think it would work just fine, really.

14:39 chronno: amalloy: ah makes sense. I need to find time to take a good look at flatland/useful. You guys have a lot of handy things in there :-)

14:40 whilo: i have a nested datastructure of vectors, lists and maps. now when i cut a chunk out of it, the nested lists are unquoted, which means next time i pass them to a function they get wrongly evaluated. how do i automatically keep all nested lists quoted?

14:41 i am gaining this chunk through a zipper btw. if this is of any relevance

14:42 nDuff: whilo: Could you provide a reproducer?

14:42 TimMc: "unquoted"... are you writing a macro?

14:42 nDuff: whilo: passing a list to a function shouldn't _ever_ implictly evaluate it.

14:42 amalloy: yeah. "lists get unquoted" doesn't make much sense

14:42 jjido: what do you use to cut a chunk out

14:46 whilo: i use a zipper on a parse tree, but probably you are right, i can't reproduce in the simplest case i have just noticed. i have to debug again to understand why i can't access the data

14:47 thx anyway

14:48 naeg: amalloy: used (first (second (split-with pred coll))) for now

14:52 ppppaul: duckyuck,

14:52 i am there

14:53 amalloy: naeg: that's just (first (drop-while pred coll))

14:56 asteve: does the positioning of the arguments for recur reflect the position of the arguments for the loop or the function?

14:57 nDuff: asteve: if you use loop, it's those. If you don't, it's the function.

14:57 chronno: asteve: yes

14:57 nDuff: asteve: ...it's possible to have a recur without an enclosing loop.

14:57 asteve: ah, I did not know that

14:59 duckyuck: ppppaul: nevermind, had similar problems with cheshire as you had a few months back. figured it out already

15:00 ppppaul: :D

15:00 glad i could help

15:06 augustl: we seem to have an uberjar in our nexus.. I'm pretty sure we've only deployed with "lein deploy". We started on lein 1. Could this be caused by a leiningen bug?

15:09 antares_: devn: hey. You asked to start #clojurewerkz, correct?

15:10 dnolen: any opinions about bound? as a name for a CLJS macro that does what "typeof x == 'undefined'" accomplishes in JavaScript?

15:15 stuartsierra: dnolen: `bound?` may suggest parallels to Clojure's `thread-bound?` for Vars.

15:16 dnolen: stuartsierra: true, though unbound vars do appear as instances of Unbound

15:17 augustl: technomancy: it seems a "lein deploy" has deployed an uberjar to our internal nexus, wreaking all kinds of havic. This happened with the 2.0.0 release version. Not sure how it happened.. Just thought I'd mention it :)

15:22 dnolen_: stuartsierra: we have undefined? but that's a function. It's pretty common to test for things when targeting browsers, and there's no way to currently do this w/o resorting to js*

15:23 stuartsierra: dnolen: I don't have a strong feeling about it, just a comment.

15:23 dnolen_: stuartsierra: well I was hoping to get a better name out of you :)

15:24 stuartsierra: dnolen_: Do you want to test for the positive case (typeof x === 'undefined') or the negative one (typeof x !== 'undefined')?

15:24 dnolen_: I think the positive case

15:25 stuartsierra: What does the `undefined?` function do differently?

15:25 dnolen_: as that's more common, typeof TouchEvent !== 'undefined'

15:26 er typeof TouchEvent == 'undefined' I mean

15:26 stuartsierra: you can't provide this functionality as a function, it must be a macro

15:27 stuartsierra: Oh, so the `undefined?` function is for variables whereas the macro would be for "classes"?

15:27 dnolen_: stuartsierra: or just anything really, typeof jQuery == 'undefined' etc

15:28 stuartsierra: undefined? just checks for the undefined value in JS, like goog/isUndefined

15:28 the only reason we don't just use goog/isUndefined is because we want to type-hint the return value

15:29 `fogus: dnolen_: I'm partial to existy?

15:29 dnolen_: `fogus: heh

15:29 exists?

15:30 stuartsierra: `exists?` isn't bad. Seems to express the intent.

15:30 naeg: amalloy: it's not - it realizes what is behind pred

15:31 `fogus: dnolen_: The reason a macro is needed so because of the use of typeof?

15:31 dnolen_: stuartsierra: and avoids the bound connotations

15:31 * `fogus spells like gibberish

15:32 dnolen_: `fogus: yes, typeof is the only way to avoid erroring out on referring to something that doesn't exist

15:32 `fogus: dnolen_: got it

15:34 stuartsierra: `is-typeof-undefined?` :P

15:35 `fogus: is- part is redundant, but seems legit otherwise. :p

15:35 dnolen_: :P

15:35 `fogus: (inc exists?)

15:35 lazybot: ⇒ 1

15:36 stuartsierra: `be?`

15:36 `avialable?`

15:36 I love this game.

15:37 tgoossens: lol

15:37 `fogus: nihilistic?

15:38 TimMc: that-other-null?

15:38 stuartsierra: So far `exists?` is winning for me.

15:38 tgoossens: I'm going to repeat my question of earlier today because there are more people at this time of the day :) I like the way (immutable) maps are used in clojure. So In java I sometimes create Immutable classes with public final fields. So far I haven't run into any problems with this approach but maybe someone can think of a situation where it goes wrong :)

15:39 stuartsierra: Would you call it with a bare symbol? `(exists? jQuery)`

15:39 tgoossens: stuartsierra: btw, I made a (extremely small) pull request to 'dependency'.

15:39 dnolen_: stuartsierra: I think it would have to be `(exists? js/jQuery)`

15:40 stuartsierra: tgoossens: Thank you. I'll take a look. But please be aware that I rarely accept pull requests on open-source projects.

15:40 dnolen_: tgoossens: sounds reasonable to me

15:40 TimMc: What about closed-source ones?

15:41 stuartsierra: TimMc: We often use pull requests for internal code review at Relevance.

15:41 tgoossens: stuartsierra: no problem at all :) . It's something I thought of and btw It is my first ever pull request to a foreign (to me) project :D

15:41 so if it sucks just tell me :)

15:41 borkdude: tgoossens I wonder if you could just use clojure's maps in that case, updating them would be much easier than creating your own "persistent" objects

15:42 tgoossens: dnolen_: One of the critiques i get from my teammates is backwards compatibilty. "{int x, int y} what if you wanted doubles after all?"

15:42 TimMc: stuartsierra: So you're not philosophically opposed to PRs themselves. Do you accept patches of any sort?

15:42 stuartsierra: tgoossens: An immutable class with public final fields is essentially what `deftype` gives you.

15:43 TimMc: not often. I tend to take them as suggestions and re-implement the functionality or fix.

15:43 tgoossens: stuartsierra: my reaction to them is most of the time that it is immutable, and you could just add a new field just as you would create a new getter

15:44 but then again maybe someone might say that you have to store multiple data that represents the same and cannot generate it "lazily"

15:44 TimMc: Ah, I see.

15:44 tgoossens: borkdude: I haven't tried it out yet. I'm sure i'll look into that

15:45 clojure-new: hello

15:46 tgoossens: clojure-new: hi

15:46 clojure-new: how can i ensure file integerity by clojure.java.io/copy?

15:47 for example if copy operation was interupted - delete file

15:47 borkdude: objects really have to defend themselves from being changed… Rich Hickey really makes it seem hilarious that everybody is still doing it in his talk The Value of Values =)

15:47 kmicu: O co biega z tą kropką na końcu.

15:49 TimMc: kmicu: As in this? (Long. "5")

15:50 Java: new Long("5") <-> Clojure: (Long. "5")

15:50 clojure-new: is it possible?

15:50 TimMc: ,(new Long "5")

15:50 clojurebot: 5

15:51 kmicu: My weechat setup with one root bar for all buffers is not as good as clojure ;]

15:51 TimMc: :-P

15:53 kmicu: If this type of mistake will be repeated more often I will change buffer name color from orange to red ;]

15:54 clojure-new: guys?

15:55 stuartsierra: clojure-new: exception handling?

15:55 clojure-new: stuartsierra: can i handle all exceptions? What exception thrown when user hits ctrl-c?

15:56 stuartsierra1: clojure-new: Oh, interrupt handling. That's tricky on the JVM. You can find articles about how to do it in Java.

15:56 clojure-new: i need something like "no mater what interrupting event happens - delete file"

15:58 technomancy: clojure-new: like a finally clause?

15:59 gfredericks: the runtime class has shutdown hooks.

16:01 clojure-new: technomancy: nope

16:02 technomancy: finally executes it's body every time, but i need to execute body only on some interruption like exception or ctrl-c

16:02 technomancy: you can catch Throwable

16:03 it's probably better to copy it to a temporary location and only move it to the final location if it succeeds though

16:03 catching Throwable is pretty sketchy

16:03 might not be so bad if you re-throw it though; not sure

16:04 gfredericks: yeah I expect there are lots of reasonable cases for catching throwable, most of which involve re-throwing

16:04 e.g., rolling back a DB transaction

16:10 asteve: why use recur instead of calling the function directly?

16:10 tbaldridge: recur doesn't blow the stack

16:10 gfredericks: (inc recur)

16:10 lazybot: ⇒ 1

16:12 naeg: but only on tail recursion ;)

16:12 gfredericks: it doesn't blow the stack no matter where you use it. It may, however, offend the compiler.

16:13 tieTYT2: I've written a java war that uses ejbs. Is it possible to rewrite this war in Ring? I can't find anything about calling an EJB in Ring when I google

16:15 technomancy: I think maybe no one knows what EJB is?

16:15 gfredericks: only the enterprisiest of java beans

16:15 tieTYT2: enterprise java beans

16:16 a place that enterprise apps write their business logic

16:20 xeqi: I figured people in seattle would know about those fancy coffee beans

16:21 tieTYT2: more complex than fancy

16:21 gfredericks: I need there to be a coffeeshop named "Enterprise Java Beans"

16:22 tieTYT2: it looks like lein-ring has an option to specify your own web.xml https://github.com/weavejester/lein-ring

16:22 maybe that's how I have to do it

16:23 jimkcar: How can I examine the fields of a deftype from the REPL?

16:23 amalloy: jimkcar: clojure.reflect/reflect

16:26 mmitchel_: technomancy: i'm attempting to deploy to clojars, but getting this error. Do you know what this means? "No connector available to access repository releases (releases) of type default using the available factories FileRepositoryConnectorFactory, WagonRepositoryConnectorFactory"

16:28 xeqi: mmitchel_: are you attempting `lein deploy clojars` ?

16:29 mmitchel_: eamelink: actually just "lein deploy"

16:29 but yes, i want to deploy to clojars

16:29 eamelink: Scary, I'm mentioned in #clojure. But accidentally it appears :)

16:30 mmitchel_: xeqi: um, i just ran "lein deploy clojars" and it worked, wow I feel dumb :0

16:30 TimMc: I ran into that as well.

16:30 jimkcar: amalloy: I seem to just get class not found errors with (clojure.reflect/reflect ...)

16:31 xeqi: mmitchel_: `lein deploy` uses the repository named "releases", which I think doesn't exist by default.

16:32 but its there for shorthand if you want to add one to the project.clj

16:34 jimkcar: amalloy: nevermind, I got it, derp. Thanks.

16:36 Raynes: tpope: piiiing

16:37 xeqi_: mmitchel_: feel free to open up an issue saying the error message there sucks

16:43 mmitchel_: xeqi: ha thanks :)

16:44 xeqi: do you know if there is a way to remove libs from clojars?

16:44 gdev: Raynes, tpope ping timeout

16:45 Raynes: lol

16:45 tieTYT2: hi weavejester

16:47 technomancy: xeqi: all my beans are direct-trade

16:48 mmitchel_: deletion requires manual intervention

16:50 TimMc: mmitchel_: You must first defeat _ato in hand-to-hand combat.

16:50 xeqi: mmitchel_: make an issue on https://github.com/ato/clojars-web/issues and I'll get to it when possible

16:51 or email contact@clojars.org if it is particularly secretive

16:51 wink: anyone using emacs and vim? any tips how stuff like copy/paste/kill lines feels less painful in emacs?

16:51 Raynes: mmitchel_: I will be your champion. I will take _ato on in your name.

16:57 asteve: I'm having a hard time understanding the use of ~ (unquote) and ~@ (unquote splice)

16:58 ,(let [b "moop"] [b ~b])

16:58 clojurebot: #<IllegalStateException java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core/unquote>

16:58 amalloy: asteve: you cannot unquote unless you are already inside of a quoting context

16:58 asteve: ,'(let [b "moop"] [b ~b])

16:58 clojurebot: (let [b "moop"] [b (clojure.core/unquote b)])

16:59 amalloy: specifically, in a `(syntax-quoting ~context), since ' is a real, unescapable quote marker

16:59 asteve: I'm viewing it in the case of a backtick but I don't fully understand what the backtick does which could be the source of my problem

17:01 `((apply func-n ~passed-in-value1 ~computed-value1 ~@passed-in-value2) ~@computed-value2))

17:06 technomancy: wink: with paredit you never really think in terms of lines

17:06 you only think in terms of expressions and top-level defs

17:06 dakrone: cemerick: are you using clojure-opennlp for your twitter corpus?

17:07 cemerick: dakrone: that's the theory

17:07 wink: technomancy: hmm, example today, I was trying to insert [my.ns.foo :as foo] and already had something with bar. in vim that's yy P w cw foo or something

17:07 cemerick: it's running now, we'll see what comes out the other end :-)

17:09 wink: paredit.vim is a thing

17:09 TimMc: asteve: In teh context of a `, ~ and ~@ allow you to drop in forms.

17:09 Outside of that context they basically mean nothing.

17:10 wink: cemerick: hmm, I actually despise vim for clojure work now because of the broken (for me) syntax highlighting in vimclojure :(

17:10 cemerick: wink: broken, how?

17:10 wink: cemerick: missing closing parentheses not highlighted in any way

17:11 maybe I have an old version though

17:11 amalloy: why would you ever have a missing closing paren?

17:11 cemerick: dakrone: why, is something waiting to bite me? ;-)

17:11 asteve: I use vim without vimclojure

17:11 TimMc: You shouldn't be missing any. :-P

17:11 wink: amalloy: fiddling :)

17:11 maybe lack of paredit, yes

17:11 Raynes: vim-fireplace + vim-clojure-static

17:11 = win

17:11 amalloy: fiddling badly, then. learn whatever vim's structural editing commands are

17:11 dakrone: cemerick: not that I know of :), but I did just push 0.2.2, just wanted to know if you were using it

17:12 cemerick: wink: paredit, paredit :-)

17:12 Raynes: amalloy: Paredit works fine in vim, in fact. I'm using it right now.

17:12 The solution to every problem ever is simply paredit.

17:12 TimMc: paredit malkovich paredit

17:12 technomancy: IMO thinking about editing in terms of lines only makes sense in prose

17:12 amalloy: haha

17:12 wink: technomancy: worked for every other programming language for me :P

17:13 cemerick: Raynes: actually, a vim-expand-region properly configured for Clojure would be the final missing piece IMO

17:13 technomancy: every other programming language is lame

17:13 cemerick: dakrone: eh, no, 0.2.0. I guess I should upgrade :-P

17:13 wink: :|

17:13 amalloy: asking for missing end-parens to be highlighted is like asking for kneepads because it hurts to walk around on your knees all the time. just stand up

17:13 Raynes: wink: How is it broken?

17:13 wink: And are you using vim-clojure-static?

17:13 technomancy: I almost added (and languages with such convoluted structure that they might as well be prose)

17:13 wink: Raynes: no

17:14 Raynes: wink: That's your first biggest problem.

17:14 If there are problems, vim-clojure-static is likely to have them fixed. Not vimclojure.

17:14 asteve: how does one actually install vimclojure?

17:14 wink: well it's bad enough I even installed emacs

17:14 after 14 years

17:14 Raynes: asteve: One doesn't. Get vim-clojure-static and vim-fireplace.

17:14 wink: Could you screenshot or something? I'm not getting it.

17:15 asteve: Raynes: ok, I'll look at vim-clojure-static and vim-fireplace but I'm going to ask the same question

17:15 wink: Raynes: well, let's imagine I have (inc 1)) - then the last closing parenthesis is bold. highlighted.

17:15 cemerick: dakrone: have you done much training of new models?

17:15 wink: Raynes: when I have (foo (inc 1) and then more code.. I don't see it

17:15 dakrone: cemerick: some, I experimented with training models based off of java stacktraces, that was interesting :)

17:16 Raynes: wink: http://dl.dropbox.com/u/23745600/Screenshots/XFkm.png

17:16 cemerick: hah, that's funny

17:16 Raynes: I'm not getting that behavior.

17:16 With vim-clojure-static, at least.

17:17 cemerick: dakrone: One thing I'd love is to have e.g. the parts-of-speech data pulled up into the metadata of each chunk. Does that sounds like a sane thing to do?

17:18 dakrone: cemerick: that'd be nice, and I'd love to be able to do that if I could just add metadata to String types, but it'd require making it a separate datastructure

17:19 cemerick: sounds very sane though, and I'm definitely open to better ways of representing the data

17:25 technomancy: no more complaining about clojure stack traces: https://mobile.twitter.com/t_crayford/status/324992847193452544

17:26 mrb_bk: hello clojure

17:26 TimMc: The response is pretty good too.

17:26 wink: Raynes: so, I don't see a change. I have a dangling missing closing parenthesis in the file and no way to instantly spot it. rainbor parenthesis might help, will try

17:26 brehaut: technomancy: ◎_◎

17:27 wink: technomancy: brehaut: quote is from here: http://joeyh.name/blog/entry/Template_Haskell_on_impossible_architectures/

17:27 "PS, I hope nobody will ever find this blog post useful in their work." :D

17:30 technomancy: heh; nice

17:33 greenyouse: wink: for vim, can't you tell a parenthesis wasn't closed by messed up indentation?

17:35 asteve: Raynes: I've added the directory for vim-clojure-static to my runtimepath, is there something I need to do to actually turn it on?

17:35 wink: greenyouse: how would it be messed up?

17:37 Raynes: asteve: No.

17:38 asteve: pathogen worked but my runtimepath method didn't; oh well, pathogen magic

17:38 now time to add vim-fireplace

17:39 naeg: a tool for tracing/debugging tree search algorithms out there?

17:39 greenyouse: :wink my .vimrc is a mess but I'll try to find the indent function I'm using :p

17:39 naeg: already using tools.trace but it's poor if you're like 10 steps deep with 7 branches

17:39 wink: hm, this paredit does not seem to work at all

17:39 asteve: my clojure world has completely changed with all these colors

17:40 wink: maybe I have to try in a clean vim oO

17:40 greenyouse: this? autocmd FileType clojure setlocal tabstop=2 shiftwidth=2

17:46 wink: sorry, this should change indenting http://pastebin.com/pexaWgDA

17:47 wink: greenyouse: thanks, will try tomorrow.

18:08 jack_rabbit: ping

18:10 rmedlin: (def ping "pong")

18:11 clj_newb: Hi, I have a class in Java, with some static inner classes (final), can I access a random one?

18:12 hyPiRion: clj_newb: yup, just put a dollar between them

18:12 ,java.awt.geom.Point2D$Double ; like so

18:12 clojurebot: java.awt.geom.Point2D$Double

18:12 clj_newb: But can I access to a random one? without having to name then all explicitly?

18:13 hyPiRion: then you'd have to use reflection, I guess

18:13 but sure, it's possible

18:13 clj_newb: I was wondering if there was some idiomatic approach

18:14 thank you hyPiRion

18:14 hyPiRion: It's not exactly common to access a random static inner class, heh

18:14 but no problem

18:15 clj_newb: sure, I'm learning clojure and I was messing around with java interop

18:16 dnolen_: added exists? to CLJS http://github.com/clojure/clojurescript/commit/3ee148acac436dd489396fc6783ba72bbd7ff79f

18:18 cemerick: dakrone: sorry, was stuck on a call

18:18 dakrone: cemerick: no worries, it's IRC

18:19 cemerick: dakrone: I don't think the metadata should be on strings, though: I mean just putting e.g. [["big" "JJ"] ["foo" "NN"]] into the metadata of {:phrase ["big" "ball"] :tag "NP"}

18:19 lynaghk: dnolen_: thanks!

18:20 dnolen_: lynaghk: np

18:20 dakrone: oh, gotcha, I think that makes good sense

18:20 cemerick: It looks like doing so might be a bit tough, just due to the black box of the chunker API...

18:20 not that I've looked hard at the clojure-nlp fns

18:20 dakrone: cemerick: they aren't the friendliest APIs

18:21 amalloy: clj_newb: you really mean random? as in, non-deterministic? that is pretty wild

18:21 clj_newb: well, with a 'rand-nth' fashion would be enough

18:21 just learning

18:22 brehaut: amalloy: when i was at uni, one of my lecturers was messing around with a bit of J2EE software that crawled aroudn a network looking for RMI providers and then glueing them randomly together when their interfaces matched

18:22 lynaghk: cemerick, dakrone: are you guys thinking about doing machine learning on twitters using Clojure?

18:23 technomancy: brehaut: that's amazing

18:23 cemerick: lynaghk: doing it live, right now, at the Tropicana!

18:23 dakrone: lynaghk: I'd love to do some, but I haven't done anything yet

18:23 amalloy: brehaut: hope there weren't any Java(TM)-enabled nuclear power plants nearby

18:23 brehaut: not in new zealand :P

18:23 technomancy: amalloy: s/nearby//

18:23 lynaghk: cemerick, dakrone: https://github.com/lynaghk/clj-liblinear/blob/master/samples/sentiment_analysis.clj#L3

18:24 cemerick: lynaghk: LOLOL

18:24 that's fabulous

18:24 lynaghk: one of my first Clojure projects was wrapping liblinear two years ago

18:24 amalloy: java is no good for nuclear power plants

18:24 lynaghk: as you can see, I was an ass even back then =P

18:24 cemerick: lynaghk: a few more years, you'll have that perfected to an artform!

18:25 lynaghk: cemerick: I try to always be learning

18:25 brehaut: lynaghk: excellent

18:25 dakrone: heh

18:25 cemerick: lynaghk: but wait, what if we're doing ML on twitters For Good Not Evil™? :-P

18:26 lynaghk: cemerick: to be honest if we wanted to do the most good in the world we'd just teach biologists/bioinformatics guys how to use git and engage in reproducable research

18:27 cemerick: I'm almost certain the cure for cancer has been found dozens of times, but only ran on one guy's laptop and that guy graduated a few years ago...

18:27 cemerick: "disappointed that my maximum attention span is 10 seconds"

18:27 lynaghk: sorry, was busy on twitter.

18:29 jcrossley3: "busy"

18:29 cemerick: lynaghk and I really shouldn't noise up the channel trolling each other :-)

18:30 brehaut: but wait, isnt that the point of IRC?

18:30 lynaghk: brehaut: also demanding assistance from open source folks.

18:31 brehaut: MY THREADS ARE RACING!!! FIX IT

18:31 (actually i think its process and curse you python librarys)

18:32 dakrone: hugod: so, from the criterium docs, I can't figure out a way to get benchmarking to just return a clojure map of the timing data so I can massage it however I want, is that possible?

18:35 dcb: Anyone encountered "Error detected while processing function <SNR>14_Eval..fireplace#echo_session_eval..fireplace" when trying to eval with vim-fireplace? I do not have java-classpath installed.

18:40 naeg: anyone ever tried to create a tree based on the output of nested deftrace's and feed that into (inspect-tree)?

18:42 ciphergoth: OK I'm sure I'm missing something obvious, but (find-fn {1 2} [[1 2]]) => ()

18:43 there really must be an easy way to make a map from a list of key- value pairs!

18:43 amalloy: ciphergoth: (into {})

18:43 dnolen_: ciphergoth: into

18:43 ,(into {} [[1 2] [3 4]])

18:43 clojurebot: {1 2, 3 4}

18:44 ciphergoth: brill!

18:44 thank you!

19:12 hugod: dakrone: benchmark may be what you are looking for

19:21 scottj: Raynes: what's with :@attr in least? is that a valid keyword? Also why :#text instead of :text?

19:21 Raynes: scottj: That's what the API is returning.

19:21 And cheshire is converting it to keywords.

19:22 You can prevent that by passing :string-keys? true in the param map.

19:22 But the special characters will still be there, just wont be keywords.

19:23 scottj: Raynes: ok thanks

19:25 amalloy: Raynes: why string-keys? as a special thing, instead of allowing access to cheshire's generalized key-fn?

19:26 for example, you could use a key-fn that strips the weirdo characters, if it turns out they don't matter

19:26 Raynes: *shrug*

19:26 patchwork: Best way to get a deep merge of two maps?

19:26 Raynes: Sure, why not

19:27 patchwork: (deep-merge {:a {:b 2 :c 3}} {:a {:d 5}}) —> {:a {:b 2 :c 3 :d 5}}

19:27 scottj: amalloy: you'd probably want a way to add the weird characters back for write ops right?

19:27 amalloy: scottj: beats me. i have no idea how this API works, i'm just pointing out that having better control over the decoding process sounds nice

19:30 dnolen: grr 1.5.0 is seriously broken w/ respect to protocol fn's w/ leading dashes in the name.

19:36 hiredman: win 20

19:46 amalloy: dnolen: how so?

19:52 dnolen: amalloy: http://dev.clojure.org/jira/browse/CLJ-1202

19:54 amalloy: wild

19:59 dnolen: looks like the offending code is in emit-method-builder, or possibly in the call to it in emit-protocol

20:03 dnolen: yeah, easy enough to fix. i'll attach a patch to your issue shortly

20:03 dnolen: amalloy: cool thx!

20:05 Raynes: amalloy: https://github.com/Raynes/least/commit/ce104388cf3f4e42575f4a2e001a89e776695534 There you go.

20:15 tieTYT2: i'm building a seesaw app and sometimes I get runtime exceptions in the console. How can I get the stack trace in terms of my clj line numbers?

20:22 amalloy: dnolen: patch submitted, with a regression test

20:27 dnolen: amalloy: sweet

20:30 thm_prover: when reading from clojure, how do I turn off reader macros parsing?

20:31 (i.e. the thing that could cause clojure code execution / exploits)

20:32 gdev: alter-var-root #'*read-eval* (constantly false)

20:35 ivan: use the edn reader

20:43 TimMc: (inc lynaghk)

20:43 lazybot: ⇒ 2

20:43 TimMc: lynaghk: I got out of text analytics recently. Pretty pleased with that decision.

21:01 cemerick: TimMc: Oh, good, that means I can bother you with stupid questions! ;-)

21:18 TimMc: cemerick: Hmm? Is this in response to something > 1 hour ago?

21:40 ttimvisher: is it possible for me to make a multimethod implementation targeting a byte array?

21:40 the multimethod dispatch function is currently defined as `class`

21:42 gfredericks: ,(class (make-array Byte/TYPE 54))

21:42 clojurebot: [B

21:42 brehaut: ,(class (byte-array 1))

21:42 clojurebot: [B

21:43 ttimvisher: exactly

21:43 ^_^

21:44 gfredericks: ttimvisher: (defmethod foo (class (byte-array 1)) [x] ...) works for me

21:44 ttimvisher: gfredericks: ah, the trickiness. I love it!

21:44 brehaut: ,(class (class (byte-array 1)))

21:44 clojurebot: java.lang.Class

21:45 brehaut: ttimvisher: you are being tricked by the string representation

21:45 ttimvisher: exactly

21:45 paredit wouldn't even let me enter it.

21:48 clj_newb_idiot: I find myself in the position of having to write an DSL for an MIPS assembler in Clojure. Does anyone have advice of projects I shoudl look at at good example of Clojure DSL Design for assemblers?

21:48 for stupid reasons, I'd actually prefer the DSL to be more "assembly-ish" than "clojure-ish"

21:49 brehaut: what exactly does that mean

21:50 you have to abide by things the reader will let you enter, or tunnel it all through strings

21:50 ttimvisher: hmmm. so how then do I do this: [^(class (byte-array 1)) image]

21:50 is there a function I can call to do the type hinting?

21:50 brehaut: ttimvisher: ^byte-array i think

21:51 primatives are special cased?

21:51 clj_newb_idiot: brehaut: tunneling throughs trings would pereferably be avoided

21:51 brehaut: ttimvisher: it might be ^bytes

21:51 ttimvisher: brehaut: looks like it is

21:52 clj_newb_idiot: I'd prefer clojure code that looked like ... http://en.wikipedia.org/wiki/MIPS_architecture

21:52 brehaut: yeah i know what mips looks like

21:52 but what you are saying is 'i want the clojure lexer to be the mips lexer' and its not going to be

21:52 clj_newb_idiot: I agree.

21:52 I was hoping someone did some black magic with the reader macro for a similar problem

21:52 brehaut: you'll be able to use a macro to capture symbols

21:53 clj_newb_idiot: and I could just steal their framework.

21:53 brehaut: clojure doesnt have (without great evil) user definable reader macros

21:53 cemerick: TimMc: not quite; re: text analytics / NLP / etc

21:54 ivan: getting curious about this great evil

21:54 has it been done?

21:54 brehaut: clj_newb_idiot: but you are going to have to do some sort of translation for things like memory offset syntax and labels

21:55 ivan: https://github.com/klutometis/reader-macros hmm

21:55 clj_newb_idiot: brehaut: yes, there seems like there's lots of little design decisions

21:55 so I was hoping I could find someone smart and plagerize from them

21:55 brehaut: clj_newb_idiot: you'd be better off writing a simple lexer that outputs clojure data

21:56 ivan: ಠ_ಠ

21:58 clj_newb_idiot: brehaut: what's a good lexer library? I was looking at packrat parsing, but it seemed like there were 3 variants for clojure, neither of which is really maintained

21:59 brehaut: ive not written a parser in clojure in a while

21:59 it used to be fnparse

21:59 clj_newb_idiot: https://github.com/joshua-choi/fnparse updated 2 years ago :-)

21:59 brehaut: (factual's fork is probably caonical one now)

21:59 clj_newb_idiot: supporting clojure 1.2

22:00 danielglauser: nnnnnnnnn.0

22:00 .....*1

22:00 brehaut: https://github.com/factual/fnparse/

22:01 metellus: ,(rand-nth [:cat :keyboard-cleaning])

22:01 clojurebot: :cat

22:02 xeqi: I saw https://github.com/Engelberg/instaparse on the ml recently

22:06 pmonks: xeql: any comments? Been meaning to look at it - was playing with Amotoen for a bit.

22:06 xeqi: pmonks: I haven't tried it

22:07 pmonks: Cool beans. Been a loooooong time since I've done any real parsing. I usually just regexes <dons asbestos undergarments/>

22:09 jasonjck_: https://github.com/cgrand looks really good

22:10 if you're doing serious parsing, combinators parsers in my experience too slow

22:10 brehaut: i think you mean cgrand/parsley

22:11 one of the dangers with combinator parsers is that the pervasive backtracking means its easy to create a parser that is correct but frequently pathalogical

22:11 ordering and search trimming is vital to making it not sluggish

22:13 jasonjck_: exactly

22:18 brehaut: "i wrote a slow program with X, therefore X is slow" bzzt

22:18 even worse when you throw out a blanket X for an entire category of tool

22:19 clojure's parser combinator libs are all pretty immature, but if you looked at (forex) haskell's parsec variants, you'd find a different story

22:22 tieTYT: i forked seesaw and have it locally. I did a lein install for it and then added it as a dependency to my project. But, I can't seem to see the documentation. I'm not sure if this is a problem with the way I installed or the way I included it as a dependency. Does anyone know what I did wrong?

22:23 i think it's the former, I'm not sure how to say, "install with documentation"

22:23 capcrunch: anyone has used clj-native lib ?

22:33 TimMc: cemerick: Ah! Now I've made the connection. I don't know how much help I can be, though -- I have some linguistics background and a vague sense of machine learning, but no solid experience with NLP internals.

23:09 tieTYT: http://stackoverflow.com/questions/16096586/with-leiningen-how-do-i-install-documentation

23:28 asteve: ,(def make-a-list+ #(list %&))

23:28 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

23:34 jack_rabbit: ,(def make-a-list+ #(list %&))

23:34 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

23:36 Zerker: ,(def SANDBOX DENIED)

23:36 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

23:36 Zerker: ,(+ 1 2 3)

23:36 clojurebot: 6

23:37 Zerker: ,(let (Sandbox :denied)

23:37 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

23:41 tyler_: anyone know a datomic-like storage layer that interfaces with dynamo? i would use datomic but its for a personal project and i can't shell out the $

23:44 n_b: Is there a more idiomatic way to write (if (> 1 (count col) col (first col))

23:53 ambrosebs: n_b: your parens don't match.

23:56 n_b: (if (empty? col) col (first col)) ?

23:56 bjeanes_: Can anybody point me in the direction of sane advice for dealing with mutable java types from Clojure in a concurrent way?

23:57 afaict, all of clojure's mutable reference types assume some level of STM participation or being side effect free. The mutable object in question is closed over in a single function that could be called from multiple threads

23:57 (but is otherwise unshared)

Logging service provided by n01se.net