#clojure logs

2013-04-18

00:00patchworkI like that luminus is kind of unifying some useful web libs
00:00amalloypatchwork: 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
00:01taliosamalloy - I'd rather batteries included, than the Apple model of batteries welded in.
00:02gdevhave you tried pedestal?
00:03patchworktalios 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.
00:03patchworkgdev: Not yet
00:03gdevpatchwork, just from your name, I knew that's what you were looking for
00:05gdevpatchwork, 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
00:06taliosneed to checkout pedestal sometime
00:06gdevit is quite amazing
00:06brehauthi talios
00:07talioshey hey
00:07brehauthows the big smoke
00:07taliosgood good - can't say the same for my feature branch tho :(
00:07brehautouch
00:09taliosyeh - 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
00:09brehautive got one of those atm
00:10brehautall JS
00:10talioscljs?
00:10brehautnope
00:10brehautthe old stuff
00:12brehautATM i'd be more tempted by a statically typed languagel ike roy than cljs
00:12taliosfay? ;)
00:13brehauti'd like to keep cabal out of my dependancies ;)
00:26bingoheadHi 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.
00:26tieTYTbingohead: what I always do is create a new project which will overwrite the project.clj
00:26tieTYTbut then I revert the file
00:29bingoheadtieTYT: so there is no easy way to import project similiar to maven eclipse, am I correct?
00:29bingoheadI was using ccw to do, but I do not see the option to do that.
00:29tieTYTi'm not sure, i couldn't figure it out
00:29tieTYTanother thing you could so is lein pom
00:29tieTYTto generate a pom
00:30tieTYTand the import the project from the pom
00:30tieTYTbut I don't know what downsides that has
00:30bingoheadoh i see. Thank you.
00:31bingoheadI wish there is an easy way.
00:56n_bevery-pred applies left-to-right, correct?
00:57n_b,(= true ((every-pred odd? even?) 2))
00:57clojurebotfalse
00:57n_bDon't know why I didn't just check that myself before asking/
01:25danneuI'm pretty frustrated when trying to figure out how to actually use Java libraries.
01:28danneuFor 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?
01:28danneuSorry about the long link
01:30danneuI 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.
01:40ivandanneu: google spongycastle, find out it's a repack of Bouncy Castle for Android
01:41danneuyeah that's actually what i meant
01:41danneuand frankly i even arrived at a snippet: http://rosettacode.org/wiki/RIPEMD-160#Java
01:46ivandanneu: I had trouble finding the right artifact name to put in project.clj
01:47ivanhttp://ssutch.org/clojure-signed-strings/ suggests [bouncycastle/bcprov-jdk16 "140"]
01:47ivanhttp://search.maven.org/#search|ga|1|bouncycastle lists others too
01:52danneuivan: that ssutch.org post is a good link. thanks.
03:16similian1errm
03:16similian1ist this clojure language chan ?
03:17similian1why are you so insanely huge ?
03:17similian1do you have a rail like framework ?
03:19similian1//j #compojure
03:19similian1:)
03:19similian1almost
04:11noprompt/erc-cmd-NAMES
04:11nopromptlol whoops
04:11noprompt*sigh* just had a rough evening trying to talk about clojure with a group of folks
04:12noprompt"so how do you do a `for` loop?"
04:12ejacksonnoprompt: were semicolons thrown ?
04:12nopromptejackson: ugh, pretty much...
04:13nopromptone guy was asking about doing lookups with negative indexes
04:13Raynes&([1 2 3] -1)
04:13lazybotjava.lang.IndexOutOfBoundsException
04:13nopromptand i was like, now, think about that for a minute.
04:14RaynesThat there is what I think about that.
04:15nopromptRaynes: btw, been rolling with emacs and evil for the past couple weeks strong.
04:15nopromptloving it.
04:15ejacksonnoprompt: haters gon' hate. The only response is to calmly code them into the corner, wide eyed and gibbering
04:15Raynesnoprompt: We should start a club, dude.
04:15RaynesI just read that in your accent, ejackson.
04:15RaynesIt was wonderful.
04:16nopromptthe truth is, it's really hard to explain something like clojure to people coming from python/ruby/php/js
04:16Raynes(inc ejackson)
04:16lazybot⇒ 0
04:16nopromptat least for me it was
04:17Raynes(inc ejackson)
04:17lazybotYou want me to leave karma the same? Fine, I will.
04:17RaynesWhat
04:17ejacksoncheeky !
04:17RaynesWhat a useless sod.
04:17ejacksonRaynes: did I tell you I'm moving to the US ?
04:17nopromptbut hey i tried, i think at least one guy was open to the immutabiltity thing.
04:17RaynesYou haven't told me anything in a long time, ejackson.
04:18ejacksonits true, I've been more than usually monastic. Trying to read a giant book :)
04:18ejacksonhows LA ?
04:18RaynesIt's great, but it's also why we haven't chatted in a while. Timezones.
04:18RaynesWhere in the US are you moving?
04:19ejacksonNashville, TN. Its my wife's hometown.
04:19RaynesOh yeah, you did tell me this.
04:19ejacksonNot too far from your part of the world.
04:19nopromptejackson: my uncle's from there. nice place.
04:19RaynesYou must have told me this ages ago.
04:19nopromptreally green, out that way.
04:19RaynesIt isn't my part of the world anymore though.
04:19ejacksonOr you've entered some freaky mind-meld
04:19ejacksonlol, I hear you.
04:19RaynesI'm in the jungle of concrete and palm trees.
04:19ejacksonand cars !
04:19nopromptRaynes: i get to missing alabama every couple years.
04:20RaynesOh, I miss it.
04:20RaynesI miss everything.
04:20RaynesI don't like change.
04:20ejacksonin that case, tis just a waiting game, until LA is the baseline
04:21RaynesUgh.
04:21RaynesDon't talk about more change.
04:21ejacksoni miss home too, but the world is to stay put.
04:21nopromptthe only thing i miss in alabama is the racial diversity.
04:21noprompti like how there's at least 10 diffent cuisines on one street in california.
04:21RaynesThe primary thing I miss from Alabama is that people actually spoke English there.
04:21nopromptRaynes: haha, yeah!
04:21ejacksonnoprompt: hell yeah. I moved to Cambridge from South Africa. Talk about diversity collapse. Ridiculous.
04:22ejacksonwe have 11 *official* languages in SA, and that's just for starters
04:22nopromptmy favorite thing is how people called the driveway a "carport"
04:22nopromptejackson: that's awesome.
04:22ejacksonRaynes: English you say ?
04:22Raynesnoprompt: 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.
04:22nopromptejackson: it's a special kind of english.
04:23ejacksonRaynes: Scientologist sorts ?
04:23RaynesChristians, which is the hilarious part. Alabama is part of the bible belt.
04:23RaynesIf it was going to happen, it should have been there.
04:23RaynesBut that's California for you.
04:24nopromptRaynes: it's interesting though. as rediculous as things are here, i've found people in alabama are really open minded.
04:24ucbunless people assumed in Alabama that you were one of them already? LA being the land of the heathen and all
04:25noprompthehe.
04:25RaynesAnyways, 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.
04:25nopromptsinner!
04:25RaynesI 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.
04:25ordnungswidrig"Do you believe in a better world"?
04:26ordnungswidrigRaynes: the co-worker part is strange.
04:26nopromptordnungswidrig: tell me more...
04:26ejacksonWait... the most bizarre part of this story is that you were walking ? I thought that wasn't possible in LA ? :P
04:27RaynesThe 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.
04:27RaynesIt's hard to get to work without at least one interesting thing happening.
04:27ordnungswidrigThe 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..
04:27Raynesejackson: 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
04:29RaynesAnyways, 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.
04:29Raynesnoprompt: So what part of Alabama are you from?
04:29ordnungswidrignoprompt: you should use a bot which connects on irc to your repl.
04:30ordnungswidrig*g*
04:30nopromptmuscle shoals
04:30nopromptit's near tuscumbia, near florence
04:30Raynesnoprompt: Ever been to Eldridge? Carbon Hill? Winfield? Jasper?
04:30nopromptbut 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.
04:30nopromptdad was in the military and all.
04:31RaynesIf you've ever been to any of those places or ever visit them, we will have crossed paths.
04:31RaynesAlso, holy crap, I've got a really popular tweet.
04:31nopromptsure. anything to see there?
04:31Rayneshttps://twitter.com/IORayne/status/324784051661725696
04:31Raynesnoprompt: No.
04:31Raynes9 retweets, 5 favorites.
04:31nopromptcool, my kinda town.
04:32nopromptlmao
04:32Raynes10 retweets and 6 favorites now.
04:32RaynesThis is great.
04:32RaynesOh, thanks ordnungswidrig.
04:33ordnungswidrigpush it!
04:33nopromptyou know, i've been trying to convince myself of that at work. but somehow the thought of writing an app in ruby bugs me.
04:33Raynesnoprompt: Where do you live now?
04:33RaynesSan Francisco?
04:33nopromptlol
04:33RaynesLos Angeles is lonely.
04:33ordnungswidrigat work they discussed to replace java with something more modern, like *cough* ruby
04:33RaynesEverybody is in San Francisco.
04:33nopromptFresno!
04:33RaynesOh, wow, you're hipster to the max.
04:33RaynesTo cool for our schools.
04:33nopromptthe butthole of california.
04:34RaynesHave you seen Hollywood?
04:34ejacksonordnungswidrig: ouch.
04:34ordnungswidriganyone experience with speaking at strangeloop? I think of submitting a talk proposal
04:34nopromptsure. wasn't amuzed.
04:34RaynesI lived there for a month and a half. It occasionally even smells like the subject.
04:34noprompthonestly, the best places in california are yosemite and the sequoias.
04:34nopromptwhich are like 45 mins away from where i live. good stuff.
04:34RaynesI watched a bird murder another bird and fly off with its bloody carcass in Hollywood.
04:35RaynesIt was really appropriate.
04:35RaynesI'm a big fan of Santa Monica and the Santa Monica beach.
04:35nopromptyah, the birds here are just dropping walnuts in the road for cars to run over.
04:35ejacksonnoprompt: Sequoias, agreed! Took a really great drive a couple years back up that coast. Trees were majesty.
04:35RaynesI can go there after work whenever I want.
04:35RaynesIt's a 2 minute walk.
04:35RaynesMalibu is the best.
04:35nopromptejackson: it never gets old!
04:35RaynesZuma beach is eye sex.
04:36ejacksonaaah, kids :)
04:36RaynesI had a viewgasm when I visited that last year.
04:36ordnungswidrigSanta Monica always reminds me of The Three Investigators. Childhood memories.
04:36noprompt* notes viewgasm
04:37ordnungswidrighu
04:37nopromptmy sister lives in orange county but, honestly, i don't visit the southern part of cali much.
04:37ordnungswidrignoprompt: do not google for that :-)
04:37RaynesLast year being when I visited LA before moving.
04:37RaynesI'm thinking of going to a Fall Out Boy concert in Anaheim.
04:37RaynesWhich would mean going to Orange County.
04:37RaynesOnly other county I've been to in California is Ventura.
04:38nopromptseems like every time i have a run in with some rude person.
04:38nopromptRaynes: you should visit the sequoias or yosemite dude.
04:38RaynesI would love to, but I have no car.
04:38nopromptit's mind blowing.
04:38RaynesI'll keep it in mind when opens open up however.
04:38nopromptRaynes: i'll pick you up.
04:38Raynesopens open up?
04:39RaynesOptions open up.
04:39RaynesYou can pick me up? I guess I don't know where any of these places (or Fresno) are.
04:39RaynesYou're way up there.
04:39RaynesI see.
04:40nopromptsure, but shit man, there's not much else to do.
04:40noprompt:P
04:40RaynesHeh
04:41RaynesSure, pick me up at any point in the future and I'll go see mountains and things with you.
04:41RaynesSure is a hell of a drive to pick me up though.
04:41nopromptbut 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.
04:41noprompti took a couple years of geology. lol.
04:42RaynesI could possibly convince Alan or someone to go with us.
04:42matkodo people here have experience with monads in clojure? Are they useful?
04:42RaynesI'd have to use covert coercion tactics, but it's a possibility.
04:43nopromptsure. well, summer's coming up. just let me know.
04:43nopromptmy gf and i just split up too so i kinda have some free time.
04:43Raynesnoprompt: http://goo.gl/maps/jXR8A lolol
04:44Raynes4 hours is like a lifetime.
04:44ejacksonmatko: I'm sure they are, but they're not widely used at all.
04:44noprompttrust me man, i did fresno to san jose every other week for a year. i'm tough as nails.
04:44ordnungswidrigmatko: they can be useful. But as clojure supports mutable state they need like in haskell e.g.
04:44clojurebotclojure is like life: you make trade-offs
04:46nopromptso i'm thinking about this css library. trying to figure out the best way to to do media queries.
04:46matkoYeah, 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
04:47nopromptRaynes: have you had a chance to look at my source for the css lib i'm working on?
04:47ordnungswidrigmatko: 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
04:47algernonmatko: I used algo.monads a few times, for some very simple stuff, worked well for what I needed it for
04:48Raynesnoprompt: I have not! I was going to but bah
04:48RaynesI'm forgetful
04:48matkoalgernon: such as? Do you happen to have some such code on a public repo?
04:48nopromptRaynes: if you get a chance, lemme know. it's my first crack at something.
04:48Raynesnoprompt: Excellent documentation.
04:49nopromptwhat i wanna do soon is use meta to tag rules for media queries.
04:49Raynesnoprompt: string/join = apply str
04:49Rayneshttps://github.com/noprompt/garden/blob/master/src/garden/util.clj#L23
04:50algernonmatko: 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
04:50nopromptnoted.
04:50noprompti borrowed a lot from hiccup.
04:50matkothank you, reading code now :)
04:51nopromptbut i'm probably going to change garden.core/css in to a function instead of a macro
04:52nopromptRaynes: btw i'm pretty good about accepting criticsm, so yeah, have it.
04:52RaynesEverything sucks. Start over.
04:52Raynes;)
04:52matkothe maybe monad seems a bit like if-let, only allowing multiple bindings rather than just one
04:53noprompthehe, i built it 3 or 4 times. so i'm up for that!
04:53nopromptlol
04:53RaynesMore like a burrito imo, matko.
04:53matkoeh?
04:53Raynesnoprompt: https://github.com/noprompt/garden/blob/master/src/garden/util.clj#L98 I'd use for here instead of map.
04:53Raynes$google monads are like burritos
04:53lazybot[The Universe of Discourse : Monads are like burritos] http://blog.plover.com/prog/burritos.html
04:54noprompthow come?
04:54Raynesnoprompt: In general, if you're calling map with an anonymous function, it probably looks better as a for.
04:55Raynes(for [x xs] (if (sequential? x) (space-join x) (to-str x))
04:55ordnungswidrignoprompt: I'd declare comma, colon et al as a value, not as a function
04:55Raynesmap looks prettier when you can use it with functions that are named or at least very small.
04:56nopromptordnungswidrig: the reason it's like that is because those are dynamic values which change depending on the output style you want.
04:56Raynesnoprompt: 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.
04:57nopromptoriginally i had a bunch of dynamic vars but that didnt' work well.
04:57Rayneshttps://github.com/noprompt/garden/blob/master/src/garden/units.clj#L25 Holy god that's awesome.
04:58nopromptRaynes: borrowed and improved from sass.
04:58Raynesnoprompt: It'd be nice if frinj could do that for you.
04:58nopromptoh neat.
04:59nopromptthe units are nice though cause they do automatic conversion.
04:59RaynesSure, nothing really wrong with that.
04:59nopromptdysinger is the coolest guy on the planet.
04:59RaynesI'm not sure how I feel about this giant thing full of nils though.
04:59noprompt;)
05:00RaynesI'd probably have done some (repeat n nil) stuff and tied it together.
05:00RaynesIt'd probably look even uglier though. *shrug*
05:00nopromptRaynes: like i said, i borrowed the concept because it worked out. i could fill in those nils with values though.
05:00nopromptmight take a second.
05:00RaynesIt's fine.
05:01RaynesI'm not thinking out loud.
05:01nopromptalso i think some of the *? functions could be moved to util.
05:02nopromptbut like anything it's wip.
05:02ordnungswidrignoprompt: oh, I see.
05:03Raynesnoprompt: https://github.com/noprompt/garden/blob/master/src/garden/units.clj#L183 I'd probably rewrite this.
05:03nopromptthe macro? or just the let bindings?
05:04Raynesnoprompt: Sec.
05:04ordnungswidrigIsn't there a unit and conversion lib for clojure?
05:04nopromptk
05:05Raynesordnungswidrig: firnj
05:05Raynesfrinj*
05:05ordnungswidrigRaynes: excuse me? :)
05:05Raynes$google frinj
05:05lazybot[martintrojer/frinj · GitHub] https://github.com/martintrojer/frinj
05:08nopromptfrinj looks pretty damn cool. if it could do the css unit stuff i'd be open to using it in garden.
05:09ordnungswidrigthe examples in frinj a hilarious
05:10Raynesnoprompt: https://www.refheap.com/paste/13741 What about this?
05:10RaynesUntested.
05:11nopromptoh very nice. i've got the code open. lemme try it out.
05:12nopromptRaynes: btw, do you have evil key bindings for the paredit stuff?
05:12RaynesNo.
05:12noprompti'm still trying to find a happy place there.
05:12ordnungswidrig"Many days I could be replaced entirely with a 100-watt bulb and have no discernible effect on the universe." - frinj/examples.clj
05:13RaynesI haven't touched any of them.
05:14clgvordnungswidrig: hahaha
05:17clgvordnungswidrig: the superman part is funny as well
05:17noprompt"Take this nREPL, brother, and may it serve you well."
05:17nopromptalways get a kick out of that one. :)
05:18ordnungswidrigclgv: let's skipt the atomicbomb-fart-equvalence part, ok?
05:18clgvordnungswidrig: just reading it ;)
05:19clgvwhy is the result of "(to :sec)" and such dimensionless?
05:20nopromptRaynes: yeah that worked nicely.
05:20Raynesnoprompt: Great!
05:21nopromptoh wait, gotta make one small tweak
05:22nopromptboom! :)
05:22nopromptgood stuff.
05:22Raynesnoprompt: https://github.com/noprompt/garden/blob/master/src/garden/compiler.clj#L5 As tempting as this is, no.
05:22Raynes:p
05:23RaynesJust qualify it with :as u or something.
05:24nopromptsure thing, any reason why not?
05:25RaynesBecause it's impossible to know where functions come from.
05:25RaynesFor example, I just looked for 'catesian-product' and didn't find it.
05:25RaynesI just so happen to know that you did :refer all it has to be from there.
05:25RaynesOtherwise I'd have no way of knowing.
05:25nopromptactually it's from clojure.math.combinatorics
05:25RaynesOh
05:26nopromptone line up.
05:26RaynesYeah, or I typed it wrong.
05:26RaynesI typed it wrong in the find box.
05:26nopromptoh all good.
05:26RaynesI took diphenhydramine an hour and a half ago because I thought I was going to bed.
05:26nopromptso the best practices is avoid refering?
05:26RaynesI'm in a bit of a stupor at them oment.
05:26RaynesAvoid :refer :all
05:26noprompthehe no worries.
05:27RaynesReferring individual vars is fine.
05:27RaynesJust not all of them at once.
05:27nopromptok, seems like sound advice to me!
05:27RaynesWell, I think that's everything I've seen from my gentle scanning.
05:28RaynesThis is really good stuff.
05:28RaynesI'd use this for sure if I needed to generate css.
05:28noprompti really appreciate that! thanks! :)
05:28RaynesFWIW, I wouldn't use any of the other css libs. They're pretty blech.
05:28jack_rabbitRaynes, diphenhydramine can generate css?
05:29RaynesWhat was that library I wrote earlier?
05:29RaynesOh, least.
05:29nopromptaww thanks man. but you know, it's worth giving them credit for getting the ball rolling.
05:29RaynesYikes.
05:29RaynesI can't remember the name of a library I wrote 2 hours ago.
05:29Raynesjack_rabbit: I hope not.
05:30nopromptRaynes: call it diphenhydramine.
05:30RaynesThat's my next project.
05:30nopromptthat way everyone has to copy/paste it.
05:30RaynesActually, I was writing a little swing-based sleep timer thing. I should rename it to that.
05:30RaynesIt's cute.
05:31RaynesReally? I can spell diphenhydramine from memory.
05:31nopromptlol.
05:32nopromptwould it be possible to have a print function that computes whatever it needs to but prints the result somewhere else?
05:32nopromptthat way you don't jam up your repl with tons of output.
05:32Raynes&(with-out-str (println "foo"))
05:32lazybotjava.lang.SecurityException: You tripped the alarm! pop-thread-bindings is bad!
05:32RaynesWhatever.
05:33RaynesJust bind *out* to something that prints to /dev/null
05:33Raynes:p
05:33RaynesI wrote something for this once.
05:33RaynesCan't remember where I put it.
05:33nopromptoh yeah, i keep forgetting about that kinda thing.
05:34nopromptbut in some cases i'm actually interested in the output, just not in my repl.
05:34noprompti guess now i have an idea of what to do.
05:34RaynesUse with-out-str then.
05:35RaynesOr do it manually with a string writer if you need the function's return value too.
05:35RaynesAnyways, I'm about to fall over and hit my head and die. I'm going to go to sleep.
05:35RaynesNight!
05:35nopromptpeace!
05:35gunfacehi guys I am new to clojure and need a bit of help, sorry for disturbing your ongoing discussion :(
05:35nopromptgunface: your name alone commands my immediate attention.
05:36gunface:P
05:36nopromptshoot!
05:36gunfaceactually I started off learning clojure just a week back
05:37nopromptcool man. :) clojure's good stuff.
05:37gunfaceread up on it and was really excited about how it inherits all the lispy magic :)
05:38gunfaceread around 200 pages of the book "clojure in action"
05:38gunfaceand started coding after getting a hang of the basic syntax
05:38gunfacebut it really is a bit difficult thinking this way
05:39gunfaceany tips for how to get better at it
05:39nopromptyeah, it takes a bit to get used to.
05:39nopromptwhat langauge(s) did you come frome?
05:39noprompts/(from)e/\1
05:39gunfaceruby and a bit of scala lately
05:40nopromptah cool.
05:40gunfacebut functional noob thats why trying to learn scala and clojure
05:40nopromptso, for me, i had kinda messed with haskell a bit while doing ruby at the day job.
05:41nopromptalso doing javascript, i was able to mess with fp concepts.
05:41gunfaceand scala is a bit more intuitive but still clojure seems much more fun
05:41nopromptbut prying the "OO" way of thinking out of your head will probably take a couple months.
05:41nopromptat least for me it did.
05:42ordnungswidrignoprompt: *g*
05:42noprompt*g*?
05:42nopromptor at least class based OO.
05:43gunfaceahh alright
05:43nopromptbut, i dunno, the best tip i know of when working with a new language is attempting to rewrite other projects you've done etc.
05:44noprompttry 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.
05:44noprompti think you will find clojure takes out a lot of the complexity you'd find in a language like ruby.
05:45ordnungswidrignoprompt: i was refering to your "out of your head" statement
05:45nopromptlater you might look at ruby code and realize it's much more complicated than you originally thought.
05:45nopromptordnungswidrig: oh hehe. :) probably could have said that better.
05:46noprompts/complicated/complex
05:46gunfaceok :)
05:46gunfacehave to pass through this awkward phase
05:46ordnungswidrigcomplected
05:46gunfacemind always thinks in terms of loops and stuff
05:47nopromptjust 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.
05:47ordnungswidriggunface: view the talks by rich hickey. you'll have to know the motivation for all this stuff.
05:47nopromptgunface: oh yes! do watch those!
05:48gunfaceyeah I have seen one of them, that's why started learning the language :)
05:48gunfacewill get to all
05:48jack_rabbitLisps are just so pretty. I haven't found another syntax more expressive.
05:48nopromptdefinitely agree with jack_rabbit.
05:49gunfaceand also the polish notation
05:49jack_rabbitNo doubt.
05:49jack_rabbitAlthough I do miss some features of CL in Clojure.
05:49nopromptgunface: but keep in mind that the notation is actually a good thing as foreign as it may seem.
05:50gunfaceI am not used to polish notation and sometimes manipulating expressions just seems unnatural
05:50nopromptyou never have to mentally parse source in your head.
05:50nopromptgunface: remember too it's just data.
05:50nopromptjust handle it like data.
05:51gunfacecode as data, yeah that seemed to me something out of a sci-fi book first, real cool :)
05:51nopromptit took a while for that to sink in.
05:52gunfaceany material you suggest I should read up
05:52nopromptgunface: just the books, videos, talks.
05:53noprompt#clojure is also a good place :)
05:53gunfaceok and have started doing problems on 4clojure
05:53nopromptlots of friendly, helpful people here.
05:53gunfaceyes like you :)
05:53gunfacefirst time I am using irc
05:54nopromptgood thing you came here then!
05:54gunfacejust after hearing that community is awesome :)
05:54gunfaceand it really is
05:54gunfaceand seems I will need that to get better :P
05:55nopromptwhat editor are you using?
05:55gunfacehahaha yeah that was a real headache at first
05:56gunfacetried counterclockwise on eclipse
05:56gunfacebut had some errors
05:56gunfacethan switched to emacs live
05:56jack_rabbitgunface, 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.
05:56noprompt(PCL = Practical Common Lisp)
05:57gunfacealright jack_rabbit
05:57jack_rabbithttp://gigamonkeys.com/book/
05:57jack_rabbitSome chapters are very relevant to Clojure, and others aren't.
05:58gunfaceok bookmarked :)
05:58gunfaceone thing about emacs live though noprompt
05:59gunfaceit has that paredit thing enabled
05:59nopromptsomeone was porting SCIP to clojure but i guess they never finished :/
05:59jack_rabbitI don't know emacs live.
05:59nopromptSICP
05:59nopromptgunface: maybe just try vanilla emacs. pick up the starter kit and clojure mode.
05:59jack_rabbitSICP... That's a project.
06:00nopromptjack_rabbit, the book?
06:00jack_rabbitgunface, I'm working with nrepl. No complaints thus far.
06:00nopromptyah, nrepl is sweet.
06:00gunfaceit is a pre-configured emacs, so nrepl and stuff is already in there so used that
06:00jack_rabbitnoprompt, That's what you're talking about, right?
06:01nopromptjack_rabbit, yeah i was talking about the book http://www.amazon.com/Structure-Interpretation-Computer-Programs-Engineering/dp/0262510871
06:01jack_rabbitThat's what I thought.
06:01nopromptsomeone was doing a version with clojure examples but never finished.
06:01nopromptgunface: is it working out?
06:01jack_rabbitRight. I was just thinking that converting a book like that would be a significant chunk of work.
06:01gunfaceyeah saw that too, people were discussing on a kickstarter on that too
06:02nopromptprobably why they never finished!
06:02jack_rabbitgunface, Are you familiar with Java?
06:02gunfaceno I am not
06:02jack_rabbitCool. Just curious.
06:03gunfacemaybe will learn on my way to start using the libraries
06:03gunfacejust was curious, one quick question
06:04gunfacerunning 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
06:04jack_rabbitIn what way?
06:05gunfaceI 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
06:06jack_rabbitgunface, AFAIK, a lot of the clojure libraries are wrappers around java libs.
06:07jack_rabbitJava interop is easy, but kind of ugly. It's fairly easy to build a simple wrapper around stuff you use a lot, though.
06:07jack_rabbitBut that's just my opinion.
06:08jack_rabbitHave you read Volkmann's tutorial?
06:08gunfaceno what's that?
06:08jack_rabbithttp://java.ociweb.com/mark/clojure/article.html
06:09jack_rabbitIt'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.
06:09gunfaceok great thanks a lot :)
06:09gunfacewill go through it
06:10gunfacecurrently was reading the book "clojure in action"
06:10gunfaceand jack_rabbit do you also use emacs? I guess you are from lisp background so you must use it?
06:11jack_rabbitgunface, emacs-4-lyfe
06:11gunface:)
06:11nopromptjack_rabbit that's pretty cool. wish i had stumbled upon that one earlier.
06:11gunfaceyeah have been using it for a week
06:11jack_rabbitYeah. People keep trying to get me to give vim a chance, but I just hate the interface.
06:11gunfacetook some getting used to
06:12clgvgunface: only write a clojure wrapper if there is real benefit in it otherwise just use your existing lib via interop
06:12nopromptgunface: yah, emacs (+ evil) is cool.
06:12jack_rabbitnoprompt, I thought it was pretty good.
06:12gunfaceyeah I have used vim for C and stuff it was good
06:13nopromptvim actually isn't a terrible environment for clojure, but i had lots of problems with vimclojure randomly crashing etc.
06:13clgvgunface: if you are used to eclipse from your java abckground, you can also use the counterclockwise plugin
06:13jenshaasehi, short question. how can I do a "MyClassName.class" in clojure with an existing Java Class?
06:13gunfaceok got it clgv, java always seemed a bit ugly to me, that was the only thing
06:13jack_rabbitI 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.
06:14nopromptthe big downside with vim is that you can'd do awesome shit like IRC, shell, etc inside it.
06:14jack_rabbitnoprompt, right. Emacs is it's own OS.
06:14nopromptplus vim's scripting language is just the worst ever.
06:14gunfacejack_rabbit how to get used to paredit, having troubles with that though
06:14gunface:(
06:14clgvnoprompt: "emacs is a great operating system. if only it had a descent editor." ;) :P
06:15jack_rabbitgunface, I've never used it.
06:15jack_rabbitclgv, funny. I've seen that one before.
06:15nopromptafter 4 hours of hacking around with elisp, i was able to bring in most of the keybindings etc from my vimrc.
06:15gunfacei mean automatic balncing of parentheses
06:15nopromptclgv: and now it does!
06:15clgvjack_rabbit: yep, thus the quotation marks ;)
06:16jack_rabbitgunface, 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.
06:16jack_rabbitAs long as you're in lisp mode.
06:16nopromptgunface: if you get a chance, try paredit mode too.
06:16nopromptif it isn't already on.
06:16jack_rabbitnoprompt, he's having trouble with paredit he said.
06:17nopromptah, sorry i missed that.
06:17gunfaceyeah getting trouble with that only nopropmt
06:17nopromptit's a bit of an adjustment but it's nice once you get the hang of it.
06:18nopromptthen you can do all kinds of fancy stuff like transposing, slurping, barfing. lol.
06:18jack_rabbitEven 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.
06:18gunfaceyeah for now if I forget putting something in parebtheses coming back and rectifyinf only gives me hell :P
06:19nopromptjack_rabbit one thing i miss from vim is that closing brackets would automatically dedent
06:19nopromptfor C style code
06:19jack_rabbitGotcha. 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.
06:19noprompti'm sure emacs can do that w/o me having to write something. is there something i need to turn on?
06:20jack_rabbitnoprompt, not sure, but if you're a lisper, you can probably sort out c-mode to do what you want.
06:21nopromptjack_rabbit my guess is that i can just look for the } and check if anything else is on the line, if not auto dedent.
06:21jack_rabbitnoprompt, Right. I think the challenge will be to find the proper lines to modify.
06:22gunfacehey jack_rabbit, noprompt have any of you worked on the overtone project in clojure?
06:22nopromptyeah. but i know if it'll be much easier in elisp than viml.
06:22gunfacethat was the second thing that made me take up this language :)
06:22nopromptgunface: just for a bit. it's actually pretty amazing imho.
06:23jack_rabbitgunface, not I. I'm still pretty new to clojure.
06:23nopromptovertone is heaps of fun.
06:23gunfaceI am a guitarist and algorithmic music is just too much fun :)
06:24gunfacemaybe will make something and upload on soundclous after I get a hang of this for you guys ;)
06:24gunface#soundcloud
06:25nopromptit's funny i used to do a lot of expirimental electronic, i wish overtone had been around then.
06:25jack_rabbitI'll have to check that out.
06:25gunfaceyeah jack_rabbit it is good :)
06:25jack_rabbitI play synth, and listen to Brian Eno a lot. He did quite a bit with algorithmic music for a while.
06:26noprompteno is "classic"
06:26gunfacehave you listened to "the algorithm" noprompt?
06:26nopromptoh i dunno, i collected so much random stuff over the years it's hard to say what i've heard.
06:27jack_rabbitHow about Boards of Canada?
06:27nopromptbasically i ended up stopping because i started listening to 60's/70's acid jazz and prog.
06:27gunfacehttp://www.youtube.com/watch?v=dJwNfRaPp08
06:27gunfaceboards of canada is awesome :)
06:27nopromptthen i realized music was dead.
06:27jack_rabbitnoprompt, lol
06:27nopromptoh yeah boc is great stuff.
06:27gunfacehahah
06:28gunfacetycho is great when you are coding too :)
06:29gunfaceanyways you guys have been very helpful and fun talking too :)
06:29gunfacethanks :)
06:29jack_rabbitHere's some stuff my buddy and I did a while ago: http://federalcrimes.bandcamp.com/
06:29jack_rabbit(Shameless self-plug)
06:29noprompt*tsk-tsk* ;)
06:29gunfacehahaha
06:31nopromptoh holy cow! it's 3:30.
06:31nopromptwell guess i should probably sleep.
06:32nopromptg'night!
06:32jack_rabbit'night.
06:32gunfacenight :)
06:32jack_rabbitHeh. IRC client for Emacs.
06:57rhinux_it's 19:00. :)
07:27jenshaasehi, short question. how can I do a "MyClassName.class" in clojure with an existing Java Class?
07:28ordnungswidrigjenshaase: you want the class as a value?
07:29jenshaasein java .class is a literal and returns somethings like Class<MyClassName>. i need this in clojure
07:29Chousukejenshaase: that's just MyClassName
07:29ordnungswidrigIt's simpe MyClassName
07:30Chousuke,String
07:30clojurebotjava.lang.String
07:30ordnungswidrigeither fully qualified: some.package.MyClassName
07:30ordnungswidrigor use (ns foo (:import some.package.MyClassName)) then it's simply MyClassNAme
07:30jenshaasebut its java.lang.String and not Class<java.lang.String>
07:31Chousuke,(type String)
07:31clojurebotjava.lang.Class
07:31Chousukesee?
07:31ordnungswidrigjenshaase: the repl uses the string representation of String.class
07:31ordnungswidrigjenshaase: show us your usecase
07:33jenshaaseI try this but its not working for me.
07:33ChousukeString.class is just syntactic sugar (or salt?) in java because referring to classes as values directly is not allowed
07:33jenshaasei 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...)
07:33Chousukethat's a variadic method
07:34Chousukeyour call syntax is probably wrong. how are you calling it?
07:34ChousukeThe Object... parameter needs to be an array of the arguments
07:34ordnungswidrig(.createPrimitive factory MyComponent (to-array configurationData))
07:35jenshaasei call it this way: (AnalysisEngineFactory/createPrimitive CljAnnotator "a" "b" "c" "d")
07:35Chousukeyeah you need (to-array ["a" "b" ...])
07:36Chousukeanother bit of Java syntactic sugar that Clojure doesn't have :)
07:36jenshaasethat's it. thanks very much
07:36ordnungswidrigChousuke: I'm confused that clojure does not support variadic invokation while for clojure functions it does
07:37Chousukeordnungswidrig: Clojure functions implement a different interface for variadic functions
07:37Chousukefor apply support etc.
07:37Chousukeand java variadic methods are not variadic at all under the hood
07:37Chousukethey're just methods with an array parameter
07:38ordnungswidrigi know
07:46Anderkentis there an implementation of strict records somewhere out there? I.e. a record that throws exception when you assoc unknown keys onto it
08:02jack_rabbitAnderkent, Certain STM types take verification functions.
08:37tgoossensSince 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?
08:39AimHereI thought that Rich Hickey did pretty much that sort of thing until he had the brainfart that created clojure
08:39clgvtgoossens: 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
08:40AimHereSo one problem is that you might ride off into the sunset and create Yet another new functional programming language
08:40rbarraudAimHere: Dem's probably foitin' werds in this channel ;-)
08:41clgvtgoossens: you could use clojure's data structures in java as well...
08:41tgoossensAnd what if i make these immutable map-like-thingy-classes public?
08:41tgoossensclgv: hmm i should look into that
08:42tgoossensclgv: its obvious to me i can use them but i didn't think of it :p
08:42clgvtgoossens: a lot of Clojure functions delegate to methods on the datastructure classes
08:43clgvtgoossens: 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
08:46tgoossensThe comment my teammates (at university) give me is that "What if you want to change the representation of it
08:46tgoossens{int x; int y}
08:47tgoossenswhat if you suddenly realise that you wanted doubles but want to remain backwards compatible
08:47tgoossensthat's what they taught me as well (ie. why use getters)
08:47tgoossensOne approach would be to just add a new public final field i think
08:57stuartsierratgoossens: The ability to change representations while keeping the same API is often overrated.
08:58stuartsierraE.g. if you switch from ints to doubles, that will have a measurable impact across your whole application.
08:58jweissambrosebs: 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
08:58jweissagain, it would not redefine the type.
09:00tgoossensstuartsierra: hmmyes... But then the argument of my teammates is still valid I think?
09:00ambrosebsjweiss: 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.
09:01ambrosebs(member of a *top-level* `do`, or recusively)
09:01ambrosebsjweiss: does that describe your macro?
09:01jweissambrosebs: ah ok, it's in a do, but i don't know if it is top-level. let me look
09:01jweissambrosebs: the macroexpansion is a top-level do
09:02jweiss(do (defrecord ...) (ann-record ..))
09:03ambrosebsjweiss: ok, I'll try it out.
09:05ambrosebsjweiss: are you running this through the repl?
09:06ambrosebsjweiss: The general rule is that the only way to accumulate global type state outside of a check-ns is to wrap in cf.
09:06jweissambrosebs: no, it's in a file, and i'm compiling it via nrepl.el and then using cf in the repl afterwards
09:06ambrosebsok
09:06jweissambrosebs: here's a paste https://www.refheap.com/paste/13747
09:09jweissambrosebs: 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?
09:11ambrosebsjweiss: Yes, check-ns is needed to load types in a file.
09:11ambrosebsjweiss: check-ns actually wipes the global type state also.
09:11jweissambrosebs: ah, that would explain it. i hadn't finished annotating the file so i couldn't run check-ns all the way through
09:12ambrosebsjweiss: evaling `ann` used to be enough to change the global type system, but I recently cleaned it up/out.
09:13ambrosebs*global type state
09:13ambrosebsjweiss: The defrecord macro looks kinda cool :)
09:13jweissambrosebs: so how could i do this then, temporarily wrap the code in my file in cf as i work on it?
09:14jweissambrosebs: thanks :) maybe you could add a macro like (deftypedrecord ... ) that is a similar shortcut for (defrecord ... )(ann-record ...)
09:15ambrosebsjweiss: so what's the issue? Is half of your namespace illtyped or something?
09:16jweissambrosebs: 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
09:16ambrosebsjweiss: you can use tc-ignore to wrap code you want to ignore.
09:17jweissah ok i should have realized that :)
09:17ambrosebs:)
09:18jweissoh 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 :)
09:19ambrosebsAh.
09:24ordnungswidrigwhat do you use to build documentation sites? jekyll? or a clojure app?
09:24jweissambrosebs: 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?
09:25ambrosebsjweiss: 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.
09:26ambrosebsSorry, the other way.
09:26ambrosebsAny is not a subtype of (U nil Object)
09:26ambrosebsDo you have a (U nil Object) directly in your annotation?
09:26jweissambrosebs: no
09:27ambrosebsWhat's at line 19?
09:27ambrosebsthe get?
09:28jweissambrosebs: no, it's the defrecord Organization
09:28ambrosebsah. It's probably one of the methods that the defrecord is implementing.
09:29jweissso it seems to be complaining about the record's implementation of IFn
09:29jweissspecifically, the one that calls clojure.core/get
09:29ambrosebsjweiss: Yes the 2 arity.
09:32ambrosebsI'm looking into it
09:32jweissambrosebs: ok thanks
09:33ambrosebsjweiss: You've probably tried more defrecord cases than I have at this point :)
09:33jweisshehe i'm a QA Engineer, it's my job to break things
09:33ambrosebsthanks :)
09:42ambrosebsjweiss: Ok, implementing IFn gets hacky quickly unless I restructure my function types, which I've been procrastinating on :)
09:43ambrosebsThis is a pretty good reason to work on it.
09:43jweissambrosebs: hehe sorry, ended up creating more work for you :)
09:44ambrosebsRight now I have a special Fn type, like [Number -> Any]. It really should be a parameter of IFn.
09:45ambrosebsThat brings up the question: should a bare [Any -> Any] be allowed? Would it mean (IFn [Any -> Any])? AFn? AFunction? :/
09:46jweissi have no idea what i am doing with type annotations, so i don't think i can be of any help there :)
09:46ambrosebs:) you've done plenty already!
09:46ambrosebshaha
09:48ambrosebsjweiss: if you want to keep hacking, it might be best to wrap the call to clojure.core/defrecord in tc-ignore.
10:04gdev&(class "H")
10:04lazybot⇒ java.lang.String
10:04gdev&(class \H)
10:04lazybot⇒ java.lang.Character
10:05gdev&(.isUpperCase Character \H)
10:05lazybotjava.lang.IllegalArgumentException: No matching method found: isUpperCase for class java.lang.Class
10:08gdev&(Character/isUpperCase \H)
10:08lazybot⇒ true
10:08clgvgdev: so that is a static method^^
10:09clgvgdev: probably because \H is a primitive value
10:09gdevclgv, yes, yes it is
10:12clgveasy proof: ##(int \H)
10:12lazybot⇒ 72
10:17gdevwas trying to show someone how awesome the clojurebot is to someone at work. Some people are still skeptical of Clojure's interop
10:18gdevso when I demo I always demo that sort of stuff
10:26clgvah ok^^
10:39TimMc,(int (Long. 5))
10:39clojurebot5
10:40TimMc,(int (Character. \h)) for that matter
10:40clojurebot104
10:40TimMcint happily takes objects
10:41pl6306clj-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:44rboydpl6306: sounds like a case for take-while + clj-time.periodic/periodic-seq
10:46pl6306thanks
10:52TimMcpl6306: All the trickiness here is in the date logic, not in the sequence creation.
10:52TimMcE.g., which calendar system are you using? :-P
10:59jweiss(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:04pyrtsajweiss: (partial partial inc) is close but a bit looser to the arity rules than that.
11:05hyPiRion(partial #(inc %)) ?
11:06jweiss,(((partial partial inc) 5))
11:06clojurebot6
11:06jweissyeah i think that is what i wanted
11:06TimMc,(((partial partial +) 5) 6)
11:06clojurebot11
11:07hyPiRionoh, I got this
11:07jweiss,(((comp partial partial inc dec) 5))
11:07clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
11:08jweissso that is the part i don't quite get
11:08jweissif 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:10jweiss(((partial partial (comp inc dec)) 5))
11:10jweiss,(((partial partial (comp inc dec)) 5))
11:10clojurebot5
11:10jweissok there we go.
11:12stuartsierraAnybody got an explanation for lots of time spent in org.apache.xml.dtm.SecuritySupport12 when profiling a Clojure app doing XML processing?
11:32juhu_chapaHi all! Is there a way to force a parameter to be of certain type i.e. (defn f [(String) s] (.toUpperCase s))
11:33gdevjuhu_chapa, i'm not sure if type hint = forcing type
11:33TimMcjuhu_chapa: Nope, but you can use preconditions.
11:34TimMcgdev: 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:34juhu_chapaThank you guys!
11:35gdevTimMc, thanks for the clarification
11:36asteveI often see (alter fn-name #(vector (second %) thing)); how do I interpret (second %)?
11:36TimMc,'#(vector (second %) thing) ;; asteve
11:36clojurebot(fn* [p1__35#] (vector (second p1__35#) thing))
11:37TimMcThe % is part of the #(...) form.
11:38TimMc,'#(% %2 %&)
11:38clojurebot(fn* [p1__70# p2__71# & rest__72#] (p1__70# p2__71# rest__72#))
11:38asteveso % is the first input?
11:39TimMcyep
11:39TimMcFirst and only, since there aren't any other args specified.
11:39TimMc#(...) is a reader form for function literals
11:39stuartsierra#(… % …) is syntactic sugar.
11:48owengalenjones(def *thing-that-changes*) ...later... (def *thing-that-changes* value) is the expected use of earmuffs correct?
11:51gdevowengalenjones, i beleive so. first time i saw it was in korma; select* lets you compose the statement over time
11:51gfredericksowengalenjones: not at all
11:52gfredericksearmuffs are idiomatically used for dynamic vars
11:52TimMcowengalenjones: Don't re-def things.
11:52owengalenjoneshmm :( searching for earmuffs isnt returning helpful results
11:53TimMcSearch for "dynamic vars".
11:53Chousukeowengalenjones: earmuffs are used for things that you dynamically rebind using binding
11:53owengalenjonesok thanks guys
11:53Chousukere-defing things is almost never the right thing to do
11:53naegis 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:53Chousukeunless you're working in a repl or something
11:54TimMc,(binding [*print-dup* true *print-meta* true] (prn (with-meta [1 2] {:a :b})))
11:54clojurebot^#=(clojure.lang.PersistentArrayMap/create {:a :b}) [1 2]\n
11:54ambrosebsnaeg: looked at tools.trace?
11:54TimMcowengalenjones, gdev: ^ this is what dynamic vars allow
11:54naegambrosebs: not yet
11:54dnolenlynaghk: ping
11:55owengalenjonesTimMc: thanks for clarifying!
12:09kmicu, (clojure-version)
12:09clojurebot"1.5.0-RC6"
12:26juhu_chapaWhy there is not def- special form?
12:31TimMcTo make people learn about metadata? I dunno.
12:34juhu_chapa:P
12:56clgv&(clojure-version)
12:56lazybot⇒ "1.4.0"
13:12gfredericksif 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:15gfrederickse.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:17hiredmanyou can extend the protocol to your type in a way that checks a dynamic binding
13:17dakronegfredericks: do a try-finally and use remove-encoder in the finally?
13:17dakronealthough that's not going to be thread-safe
13:17dakronedo what hiredman said
13:41gfrederickshmm. that's an interesting approach
13:41gfredericksas long as I'm the only one doing it :)
13:43pjstadiggfredericks: could you extend the protocol to Object and have the implementation for Object check a dynamic var for it's lookup table?
13:43gfredericksyeah
13:55davidchambersis there a name for functions such as `range` which have multiple "modes"?
13:56AimHere'polymorphic' is somewhere in that vicinity, though I'm not sure if it's really the word you want
13:56technomancymulti-arity?
13:57TimMc"functions what take some defaults"
13:57davidchamberstechnomancy: 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:58technomancydavidchambers: right; because that's a completely different concept =)
13:59TimMcThat latter concept is "functions that dispatch on an argument type".
13:59TimMcrange doesn't do that.
13:59davidchamberstechnomancy: Is it, though? In both cases we're determining how to treat the arguments based on the nature of the arguments collection.
13:59davidchambersforgive me – I've been writing JavaScript for too long ;)
14:00technomancydavidchambers: sure, you can expand the term, but it becomes less useful the more you do so
14:00technomancyeventually you end up at "conditional"
14:00Okasutechnomancy: "Multy-arity" = polyadic.
14:00OkasuJFYI.
14:00technomancyOkasu: huh; I've heard of variadic but not polyadic
14:01technomancyI usually hear variadic applied when it takes rest args, but I'm not sure if it's limited to that
14:01Okasutechnomancy: Multiple args - poly, variable number of args - vari.
14:01davidchambersSo 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:02naegis there a way to do this, but include 200: (take-while #(< % 200) [64 70 200 90]) => (64 70)
14:02naegshould be lazy
14:02asteveso I just stumbled my way to writing an exponent function to better understand recur
14:02asteve(defn exponent [n e] (loop [cnt e acc 1] (if (zero? cnt) acc (recur (dec cnt) (* acc n)))))
14:02technomancydavidchambers: unpredictable =)
14:02davidchamberstechnomancy: that's how I think of "variadic", too
14:02astevewhat I don't really understand is why the binding acc is required
14:03davidchambershttp://stackoverflow.com/questions/16089645/which-term-is-used-to-describe-functions-with-multiple-modes
14:03asteverecur is running recursion on the loop, right?
14:05technomancydavidchambers: "overloaded" is probably the best description of jquery
14:06technomancyyou don't see functions like that in clojure very often though
14:06davidchamberstechnomancy: thankfully!
14:06davidchamberstechnomancy: I agree that "overloaded" is the best description of jQuery
14:07davidchambersit doesn't apply in the case of `range`, though, as we're switching purely based on the number of arguments
14:08davidchambersbut 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:08pjstadigi think generally any function that has the same name, but does different things depending on the context is "polymorphic"
14:09hyPiRiondepending on the context?
14:09hyPiRion,[(+ 1 2) (+ 2 3)]
14:09clojurebot[3 5]
14:09gfredericksI just did (defmacro caught [class & body] `(try ~@body nil (catch ~class e# e#))) -- does flatland/useful have this already?
14:09pjstadigdifferent amounts and/or types of arguments
14:09hyPiRionpjstadig: ah
14:10dnolendavidchambers: jQuery's behavior is polymorphic. There are many functions that are polymorphic in Clojure as well.
14:11davidchambersdnolen: thanks… I'm trying to draw Venn diagrams in my head :)
14:11RayneshyPiRion: 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:11TimMcRaynes: Skimming that message was somewhat disturbing.
14:12RaynesTimMc: Never skim my messages.
14:12TimMcyessir
14:14duckyuckppppaul: you there?
14:14dnolen,(let [v [64 70 200 90]] (map (fn [a b] a) v (concat (take-while #(< % 200) v) [::extra])))
14:14clojurebot(64 70 200)
14:14dnolennaeg: ^
14:14dnolenbest I could come up with, probably something better
14:16hyPiRionRaynes: Oh, nice
14:17pjstadig,(take-while #(<= % 200) [64 70 200 90])
14:17clojurebot(64 70 200 90)
14:17pjstadighmm
14:17pjstadigi thought it seemed too easy :)
14:17hyPiRion,(take-while #(< % 200) [64 70 200 90]) ;?
14:17clojurebot(64 70)
14:18tieTYT2if 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:22TimMc,(let [more (atom true)] (take-while #(let [end? (< % 30) ret @more] (reset! more end?) ret) [10 20 30 40])) <-- this is terrible
14:22clojurebot(10 20 30)
14:24gdev,(take 3 [10 20 30 40])
14:24clojurebot(10 20 30)
14:25jjidoTimMc: why is it written this way?
14:26TimMcjjido: Why did I use an atom? Is that what you're asking?
14:26jjidogdev: you are not using the right function. Note the (< % 30) test
14:27jjidoTimMc: not exactly, but tell me.
14:28gdevjjido, i know, sorry
14:29jjidowhy did you use an atom TimMc?
14:29hyPiRionTimMc WHY DID YOU USE AN ATOM???
14:29lazybothyPiRion: Oh, absolutely.
14:30jjidoHi lazybot.
14:31TimMcjjido: To delay the use of the information from the predicate.
14:31TimMcYou could actually bundle it up differently...
14:32amalloygfredericks: no, that is not in useful
14:33chronnonaeg: Never worked with lazy-seq's but maybe changing take-while a little bit would work? https://www.refheap.com/paste/13758
14:34amalloyasteve: yes, the recur form is recursively "going back to" the loop anchor
14:35jjidoTimMc: is it to continue 1 past the predicate?
14:36TimMcyes
14:36amalloychronno: 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:36jjidowhy don't you test on a shifted list
14:37amalloyhttps://github.com/flatland/useful/blob/develop/src/flatland/useful/seq.clj#L362
14:37TimMcjjido: That's what dnolen did.
14:37TimMcOK, here's a cleaner version: https://gist.github.com/timmc/5415140
14:37amalloyTimMc: i don't get why you keep doing this thing with an atom
14:38TimMcheh
14:38amalloyi guess the delayed function is kinda cute
14:38gdevit's atomic???
14:38lazybotgdev: Yes, 100% for sure.
14:38gdevthanks lazybot
14:38TimMcExactly. I wouldn't actually use this code.
14:38ystaelTimMc: that looks like 'head like a hole' code
14:38ystaelas in, you're going to get what you deserve
14:39TimMc:-D
14:39TimMcI think it would work just fine, really.
14:39chronnoamalloy: 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:40whiloi 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:41whiloi am gaining this chunk through a zipper btw. if this is of any relevance
14:42nDuffwhilo: Could you provide a reproducer?
14:42TimMc"unquoted"... are you writing a macro?
14:42nDuffwhilo: passing a list to a function shouldn't _ever_ implictly evaluate it.
14:42amalloyyeah. "lists get unquoted" doesn't make much sense
14:42jjidowhat do you use to cut a chunk out
14:46whiloi 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:47whilothx anyway
14:48naegamalloy: used (first (second (split-with pred coll))) for now
14:52ppppaulduckyuck,
14:52ppppauli am there
14:53amalloynaeg: that's just (first (drop-while pred coll))
14:56astevedoes the positioning of the arguments for recur reflect the position of the arguments for the loop or the function?
14:57nDuffasteve: if you use loop, it's those. If you don't, it's the function.
14:57chronnoasteve: yes
14:57nDuffasteve: ...it's possible to have a recur without an enclosing loop.
14:57asteveah, I did not know that
14:59duckyuckppppaul: nevermind, had similar problems with cheshire as you had a few months back. figured it out already
15:00ppppaul:D
15:00ppppaulglad i could help
15:06augustlwe 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:09antares_devn: hey. You asked to start #clojurewerkz, correct?
15:10dnolenany opinions about bound? as a name for a CLJS macro that does what "typeof x == 'undefined'" accomplishes in JavaScript?
15:15stuartsierradnolen: `bound?` may suggest parallels to Clojure's `thread-bound?` for Vars.
15:16dnolenstuartsierra: true, though unbound vars do appear as instances of Unbound
15:17augustltechnomancy: 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:22dnolen_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:23stuartsierradnolen: I don't have a strong feeling about it, just a comment.
15:23dnolen_stuartsierra: well I was hoping to get a better name out of you :)
15:24stuartsierradnolen_: Do you want to test for the positive case (typeof x === 'undefined') or the negative one (typeof x !== 'undefined')?
15:24dnolen_I think the positive case
15:25stuartsierraWhat does the `undefined?` function do differently?
15:25dnolen_as that's more common, typeof TouchEvent !== 'undefined'
15:26dnolen_er typeof TouchEvent == 'undefined' I mean
15:26dnolen_stuartsierra: you can't provide this functionality as a function, it must be a macro
15:27stuartsierraOh, so the `undefined?` function is for variables whereas the macro would be for "classes"?
15:27dnolen_stuartsierra: or just anything really, typeof jQuery == 'undefined' etc
15:28dnolen_stuartsierra: undefined? just checks for the undefined value in JS, like goog/isUndefined
15:28dnolen_the only reason we don't just use goog/isUndefined is because we want to type-hint the return value
15:29`fogusdnolen_: I'm partial to existy?
15:29dnolen_`fogus: heh
15:29dnolen_exists?
15:30stuartsierra`exists?` isn't bad. Seems to express the intent.
15:30naegamalloy: it's not - it realizes what is behind pred
15:31`fogusdnolen_: The reason a macro is needed so because of the use of typeof?
15:31dnolen_stuartsierra: and avoids the bound connotations
15:32dnolen_`fogus: yes, typeof is the only way to avoid erroring out on referring to something that doesn't exist
15:32`fogusdnolen_: got it
15:34stuartsierra`is-typeof-undefined?` :P
15:35`fogusis- part is redundant, but seems legit otherwise. :p
15:35dnolen_:P
15:35`fogus(inc exists?)
15:35lazybot⇒ 1
15:36stuartsierra`be?`
15:36stuartsierra`avialable?`
15:36stuartsierraI love this game.
15:37tgoossenslol
15:37`fogusnihilistic?
15:38TimMcthat-other-null?
15:38stuartsierraSo far `exists?` is winning for me.
15:38tgoossensI'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:39stuartsierraWould you call it with a bare symbol? `(exists? jQuery)`
15:39tgoossensstuartsierra: btw, I made a (extremely small) pull request to 'dependency'.
15:39dnolen_stuartsierra: I think it would have to be `(exists? js/jQuery)`
15:40stuartsierratgoossens: Thank you. I'll take a look. But please be aware that I rarely accept pull requests on open-source projects.
15:40dnolen_tgoossens: sounds reasonable to me
15:40TimMcWhat about closed-source ones?
15:41stuartsierraTimMc: We often use pull requests for internal code review at Relevance.
15:41tgoossensstuartsierra: 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:41tgoossensso if it sucks just tell me :)
15:41borkdudetgoossens 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:42tgoossensdnolen_: One of the critiques i get from my teammates is backwards compatibilty. "{int x, int y} what if you wanted doubles after all?"
15:42TimMcstuartsierra: So you're not philosophically opposed to PRs themselves. Do you accept patches of any sort?
15:42stuartsierratgoossens: An immutable class with public final fields is essentially what `deftype` gives you.
15:43stuartsierraTimMc: not often. I tend to take them as suggestions and re-implement the functionality or fix.
15:43tgoossensstuartsierra: 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:44tgoossensbut then again maybe someone might say that you have to store multiple data that represents the same and cannot generate it "lazily"
15:44TimMcAh, I see.
15:44tgoossensborkdude: I haven't tried it out yet. I'm sure i'll look into that
15:45clojure-newhello
15:46tgoossensclojure-new: hi
15:46clojure-newhow can i ensure file integerity by clojure.java.io/copy?
15:47clojure-newfor example if copy operation was interupted - delete file
15:47borkdudeobjects 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:47kmicuO co biega z tą kropką na końcu.
15:49TimMckmicu: As in this? (Long. "5")
15:50TimMcJava: new Long("5") <-> Clojure: (Long. "5")
15:50clojure-newis it possible?
15:50TimMc,(new Long "5")
15:50clojurebot5
15:51kmicuMy weechat setup with one root bar for all buffers is not as good as clojure ;]
15:51TimMc:-P
15:53kmicuIf this type of mistake will be repeated more often I will change buffer name color from orange to red ;]
15:54clojure-newguys?
15:55stuartsierraclojure-new: exception handling?
15:55clojure-newstuartsierra: can i handle all exceptions? What exception thrown when user hits ctrl-c?
15:56stuartsierra1clojure-new: Oh, interrupt handling. That's tricky on the JVM. You can find articles about how to do it in Java.
15:56clojure-newi need something like "no mater what interrupting event happens - delete file"
15:58technomancyclojure-new: like a finally clause?
15:59gfredericksthe runtime class has shutdown hooks.
16:01clojure-newtechnomancy: nope
16:02clojure-newtechnomancy: finally executes it's body every time, but i need to execute body only on some interruption like exception or ctrl-c
16:02technomancyyou can catch Throwable
16:03technomancyit's probably better to copy it to a temporary location and only move it to the final location if it succeeds though
16:03technomancycatching Throwable is pretty sketchy
16:03technomancymight not be so bad if you re-throw it though; not sure
16:04gfredericksyeah I expect there are lots of reasonable cases for catching throwable, most of which involve re-throwing
16:04gfrederickse.g., rolling back a DB transaction
16:10astevewhy use recur instead of calling the function directly?
16:10tbaldridgerecur doesn't blow the stack
16:10gfredericks(inc recur)
16:10lazybot⇒ 1
16:12naegbut only on tail recursion ;)
16:12gfredericksit doesn't blow the stack no matter where you use it. It may, however, offend the compiler.
16:13tieTYT2I'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:15technomancyI think maybe no one knows what EJB is?
16:15gfredericksonly the enterprisiest of java beans
16:15tieTYT2enterprise java beans
16:16tieTYT2a place that enterprise apps write their business logic
16:20xeqiI figured people in seattle would know about those fancy coffee beans
16:21tieTYT2more complex than fancy
16:21gfredericksI need there to be a coffeeshop named "Enterprise Java Beans"
16:22tieTYT2it looks like lein-ring has an option to specify your own web.xml https://github.com/weavejester/lein-ring
16:22tieTYT2maybe that's how I have to do it
16:23jimkcarHow can I examine the fields of a deftype from the REPL?
16:23amalloyjimkcar: clojure.reflect/reflect
16:26mmitchel_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:28xeqimmitchel_: are you attempting `lein deploy clojars` ?
16:29mmitchel_eamelink: actually just "lein deploy"
16:29mmitchel_but yes, i want to deploy to clojars
16:29eamelinkScary, I'm mentioned in #clojure. But accidentally it appears :)
16:30mmitchel_xeqi: um, i just ran "lein deploy clojars" and it worked, wow I feel dumb :0
16:30TimMcI ran into that as well.
16:30jimkcaramalloy: I seem to just get class not found errors with (clojure.reflect/reflect ...)
16:31xeqimmitchel_: `lein deploy` uses the repository named "releases", which I think doesn't exist by default.
16:32xeqibut its there for shorthand if you want to add one to the project.clj
16:34jimkcaramalloy: nevermind, I got it, derp. Thanks.
16:36Raynestpope: piiiing
16:37xeqi_mmitchel_: feel free to open up an issue saying the error message there sucks
16:43mmitchel_xeqi: ha thanks :)
16:44mmitchel_xeqi: do you know if there is a way to remove libs from clojars?
16:44gdevRaynes, tpope ping timeout
16:45Rayneslol
16:45tieTYT2hi weavejester
16:47technomancyxeqi: all my beans are direct-trade
16:48technomancymmitchel_: deletion requires manual intervention
16:50TimMcmmitchel_: You must first defeat _ato in hand-to-hand combat.
16:50xeqimmitchel_: make an issue on https://github.com/ato/clojars-web/issues and I'll get to it when possible
16:51xeqior email contact@clojars.org if it is particularly secretive
16:51winkanyone using emacs and vim? any tips how stuff like copy/paste/kill lines feels less painful in emacs?
16:51Raynesmmitchel_: I will be your champion. I will take _ato on in your name.
16:57asteveI'm having a hard time understanding the use of ~ (unquote) and ~@ (unquote splice)
16:58asteve,(let [b "moop"] [b ~b])
16:58clojurebot#<IllegalStateException java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core/unquote>
16:58amalloyasteve: you cannot unquote unless you are already inside of a quoting context
16:58asteve,'(let [b "moop"] [b ~b])
16:58clojurebot(let [b "moop"] [b (clojure.core/unquote b)])
16:59amalloyspecifically, in a `(syntax-quoting ~context), since ' is a real, unescapable quote marker
16:59asteveI'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:01asteve`((apply func-n ~passed-in-value1 ~computed-value1 ~@passed-in-value2) ~@computed-value2))
17:06technomancywink: with paredit you never really think in terms of lines
17:06technomancyyou only think in terms of expressions and top-level defs
17:06dakronecemerick: are you using clojure-opennlp for your twitter corpus?
17:07cemerickdakrone: that's the theory
17:07winktechnomancy: 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:07cemerickit's running now, we'll see what comes out the other end :-)
17:09cemerickwink: paredit.vim is a thing
17:09TimMcasteve: In teh context of a `, ~ and ~@ allow you to drop in forms.
17:09TimMcOutside of that context they basically mean nothing.
17:10winkcemerick: hmm, I actually despise vim for clojure work now because of the broken (for me) syntax highlighting in vimclojure :(
17:10cemerickwink: broken, how?
17:10winkcemerick: missing closing parentheses not highlighted in any way
17:11winkmaybe I have an old version though
17:11amalloywhy would you ever have a missing closing paren?
17:11cemerickdakrone: why, is something waiting to bite me? ;-)
17:11asteveI use vim without vimclojure
17:11TimMcYou shouldn't be missing any. :-P
17:11winkamalloy: fiddling :)
17:11winkmaybe lack of paredit, yes
17:11Raynesvim-fireplace + vim-clojure-static
17:11Raynes= win
17:11amalloyfiddling badly, then. learn whatever vim's structural editing commands are
17:11dakronecemerick: not that I know of :), but I did just push 0.2.2, just wanted to know if you were using it
17:12cemerickwink: paredit, paredit :-)
17:12Raynesamalloy: Paredit works fine in vim, in fact. I'm using it right now.
17:12RaynesThe solution to every problem ever is simply paredit.
17:12TimMcparedit malkovich paredit
17:12technomancyIMO thinking about editing in terms of lines only makes sense in prose
17:12amalloyhaha
17:12winktechnomancy: worked for every other programming language for me :P
17:13cemerickRaynes: actually, a vim-expand-region properly configured for Clojure would be the final missing piece IMO
17:13technomancyevery other programming language is lame
17:13cemerickdakrone: eh, no, 0.2.0. I guess I should upgrade :-P
17:13wink:|
17:13amalloyasking 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:13Rayneswink: How is it broken?
17:13Rayneswink: And are you using vim-clojure-static?
17:13technomancyI almost added (and languages with such convoluted structure that they might as well be prose)
17:13winkRaynes: no
17:14Rayneswink: That's your first biggest problem.
17:14RaynesIf there are problems, vim-clojure-static is likely to have them fixed. Not vimclojure.
17:14astevehow does one actually install vimclojure?
17:14winkwell it's bad enough I even installed emacs
17:14winkafter 14 years
17:14Raynesasteve: One doesn't. Get vim-clojure-static and vim-fireplace.
17:14Rayneswink: Could you screenshot or something? I'm not getting it.
17:15asteveRaynes: ok, I'll look at vim-clojure-static and vim-fireplace but I'm going to ask the same question
17:15winkRaynes: well, let's imagine I have (inc 1)) - then the last closing parenthesis is bold. highlighted.
17:15cemerickdakrone: have you done much training of new models?
17:15winkRaynes: when I have (foo (inc 1) and then more code.. I don't see it
17:15dakronecemerick: some, I experimented with training models based off of java stacktraces, that was interesting :)
17:16Rayneswink: http://dl.dropbox.com/u/23745600/Screenshots/XFkm.png
17:16cemerickhah, that's funny
17:16RaynesI'm not getting that behavior.
17:16RaynesWith vim-clojure-static, at least.
17:17cemerickdakrone: 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:18dakronecemerick: 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:19dakronecemerick: sounds very sane though, and I'm definitely open to better ways of representing the data
17:25technomancyno more complaining about clojure stack traces: https://mobile.twitter.com/t_crayford/status/324992847193452544
17:26mrb_bkhello clojure
17:26TimMcThe response is pretty good too.
17:26winkRaynes: 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:26brehauttechnomancy: ◎_◎
17:27winktechnomancy: brehaut: quote is from here: http://joeyh.name/blog/entry/Template_Haskell_on_impossible_architectures/
17:27wink"PS, I hope nobody will ever find this blog post useful in their work." :D
17:30technomancyheh; nice
17:33greenyousewink: for vim, can't you tell a parenthesis wasn't closed by messed up indentation?
17:35asteveRaynes: 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:35winkgreenyouse: how would it be messed up?
17:37Raynesasteve: No.
17:38astevepathogen worked but my runtimepath method didn't; oh well, pathogen magic
17:38astevenow time to add vim-fireplace
17:39naega tool for tracing/debugging tree search algorithms out there?
17:39greenyouse:wink my .vimrc is a mess but I'll try to find the indent function I'm using :p
17:39naegalready using tools.trace but it's poor if you're like 10 steps deep with 7 branches
17:39winkhm, this paredit does not seem to work at all
17:39astevemy clojure world has completely changed with all these colors
17:40winkmaybe I have to try in a clean vim oO
17:40greenyousethis? autocmd FileType clojure setlocal tabstop=2 shiftwidth=2
17:46greenyousewink: sorry, this should change indenting http://pastebin.com/pexaWgDA
17:47winkgreenyouse: thanks, will try tomorrow.
18:08jack_rabbitping
18:10rmedlin(def ping "pong")
18:11clj_newbHi, I have a class in Java, with some static inner classes (final), can I access a random one?
18:12hyPiRionclj_newb: yup, just put a dollar between them
18:12hyPiRion,java.awt.geom.Point2D$Double ; like so
18:12clojurebotjava.awt.geom.Point2D$Double
18:12clj_newbBut can I access to a random one? without having to name then all explicitly?
18:13hyPiRionthen you'd have to use reflection, I guess
18:13hyPiRionbut sure, it's possible
18:13clj_newbI was wondering if there was some idiomatic approach
18:14clj_newbthank you hyPiRion
18:14hyPiRionIt's not exactly common to access a random static inner class, heh
18:14hyPiRionbut no problem
18:15clj_newbsure, I'm learning clojure and I was messing around with java interop
18:16dnolen_added exists? to CLJS http://github.com/clojure/clojurescript/commit/3ee148acac436dd489396fc6783ba72bbd7ff79f
18:18cemerickdakrone: sorry, was stuck on a call
18:18dakronecemerick: no worries, it's IRC
18:19cemerickdakrone: 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:19lynaghkdnolen_: thanks!
18:20dnolen_lynaghk: np
18:20dakroneoh, gotcha, I think that makes good sense
18:20cemerickIt looks like doing so might be a bit tough, just due to the black box of the chunker API...
18:20cemericknot that I've looked hard at the clojure-nlp fns
18:20dakronecemerick: they aren't the friendliest APIs
18:21amalloyclj_newb: you really mean random? as in, non-deterministic? that is pretty wild
18:21clj_newbwell, with a 'rand-nth' fashion would be enough
18:21clj_newbjust learning
18:22brehautamalloy: 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:22lynaghkcemerick, dakrone: are you guys thinking about doing machine learning on twitters using Clojure?
18:23technomancybrehaut: that's amazing
18:23cemericklynaghk: doing it live, right now, at the Tropicana!
18:23dakronelynaghk: I'd love to do some, but I haven't done anything yet
18:23amalloybrehaut: hope there weren't any Java(TM)-enabled nuclear power plants nearby
18:23brehautnot in new zealand :P
18:23technomancyamalloy: s/nearby//
18:23lynaghkcemerick, dakrone: https://github.com/lynaghk/clj-liblinear/blob/master/samples/sentiment_analysis.clj#L3
18:24cemericklynaghk: LOLOL
18:24cemerickthat's fabulous
18:24lynaghkone of my first Clojure projects was wrapping liblinear two years ago
18:24amalloyjava is no good for nuclear power plants
18:24lynaghkas you can see, I was an ass even back then =P
18:24cemericklynaghk: a few more years, you'll have that perfected to an artform!
18:25lynaghkcemerick: I try to always be learning
18:25brehautlynaghk: excellent
18:25dakroneheh
18:25cemericklynaghk: but wait, what if we're doing ML on twitters For Good Not Evil™? :-P
18:26lynaghkcemerick: 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:27lynaghkcemerick: 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:27cemerick"disappointed that my maximum attention span is 10 seconds"
18:27cemericklynaghk: sorry, was busy on twitter.
18:29jcrossley3"busy"
18:29cemericklynaghk and I really shouldn't noise up the channel trolling each other :-)
18:30brehautbut wait, isnt that the point of IRC?
18:30lynaghkbrehaut: also demanding assistance from open source folks.
18:31brehautMY THREADS ARE RACING!!! FIX IT
18:31brehaut(actually i think its process and curse you python librarys)
18:32dakronehugod: 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:35dcbAnyone 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:40naeganyone ever tried to create a tree based on the output of nested deftrace's and feed that into (inspect-tree)?
18:42ciphergothOK I'm sure I'm missing something obvious, but (find-fn {1 2} [[1 2]]) => ()
18:43ciphergoththere really must be an easy way to make a map from a list of key- value pairs!
18:43amalloyciphergoth: (into {})
18:43dnolen_ciphergoth: into
18:43dnolen_,(into {} [[1 2] [3 4]])
18:43clojurebot{1 2, 3 4}
18:44ciphergothbrill!
18:44ciphergoththank you!
19:12hugoddakrone: benchmark may be what you are looking for
19:21scottjRaynes: what's with :@attr in least? is that a valid keyword? Also why :#text instead of :text?
19:21Raynesscottj: That's what the API is returning.
19:21RaynesAnd cheshire is converting it to keywords.
19:22RaynesYou can prevent that by passing :string-keys? true in the param map.
19:22RaynesBut the special characters will still be there, just wont be keywords.
19:23scottjRaynes: ok thanks
19:25amalloyRaynes: why string-keys? as a special thing, instead of allowing access to cheshire's generalized key-fn?
19:26amalloyfor example, you could use a key-fn that strips the weirdo characters, if it turns out they don't matter
19:26Raynes*shrug*
19:26patchworkBest way to get a deep merge of two maps?
19:26RaynesSure, why not
19:27patchwork(deep-merge {:a {:b 2 :c 3}} {:a {:d 5}}) —> {:a {:b 2 :c 3 :d 5}}
19:27scottjamalloy: you'd probably want a way to add the weird characters back for write ops right?
19:27amalloyscottj: 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:30dnolengrr 1.5.0 is seriously broken w/ respect to protocol fn's w/ leading dashes in the name.
19:36hiredmanwin 20
19:46amalloydnolen: how so?
19:52dnolenamalloy: http://dev.clojure.org/jira/browse/CLJ-1202
19:54amalloywild
19:59amalloydnolen: looks like the offending code is in emit-method-builder, or possibly in the call to it in emit-protocol
20:03amalloydnolen: yeah, easy enough to fix. i'll attach a patch to your issue shortly
20:03dnolenamalloy: cool thx!
20:05Raynesamalloy: https://github.com/Raynes/least/commit/ce104388cf3f4e42575f4a2e001a89e776695534 There you go.
20:15tieTYT2i'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:22amalloydnolen: patch submitted, with a regression test
20:27dnolenamalloy: sweet
20:30thm_proverwhen reading from clojure, how do I turn off reader macros parsing?
20:31thm_prover(i.e. the thing that could cause clojure code execution / exploits)
20:32gdevalter-var-root #'*read-eval* (constantly false)
20:35ivanuse the edn reader
20:43TimMc(inc lynaghk)
20:43lazybot⇒ 2
20:43TimMclynaghk: I got out of text analytics recently. Pretty pleased with that decision.
21:01cemerickTimMc: Oh, good, that means I can bother you with stupid questions! ;-)
21:18TimMccemerick: Hmm? Is this in response to something > 1 hour ago?
21:40ttimvisheris it possible for me to make a multimethod implementation targeting a byte array?
21:40ttimvisherthe multimethod dispatch function is currently defined as `class`
21:42gfredericks,(class (make-array Byte/TYPE 54))
21:42clojurebot[B
21:42brehaut,(class (byte-array 1))
21:42clojurebot[B
21:43ttimvisherexactly
21:43ttimvisher^_^
21:44gfredericksttimvisher: (defmethod foo (class (byte-array 1)) [x] ...) works for me
21:44ttimvishergfredericks: ah, the trickiness. I love it!
21:44brehaut,(class (class (byte-array 1)))
21:44clojurebotjava.lang.Class
21:45brehautttimvisher: you are being tricked by the string representation
21:45ttimvisherexactly
21:45ttimvisherparedit wouldn't even let me enter it.
21:48clj_newb_idiotI 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:48clj_newb_idiotfor stupid reasons, I'd actually prefer the DSL to be more "assembly-ish" than "clojure-ish"
21:49brehautwhat exactly does that mean
21:50brehautyou have to abide by things the reader will let you enter, or tunnel it all through strings
21:50ttimvisherhmmm. so how then do I do this: [^(class (byte-array 1)) image]
21:50ttimvisheris there a function I can call to do the type hinting?
21:50brehautttimvisher: ^byte-array i think
21:51brehautprimatives are special cased?
21:51clj_newb_idiotbrehaut: tunneling throughs trings would pereferably be avoided
21:51brehautttimvisher: it might be ^bytes
21:51ttimvisherbrehaut: looks like it is
21:52clj_newb_idiotI'd prefer clojure code that looked like ... http://en.wikipedia.org/wiki/MIPS_architecture
21:52brehautyeah i know what mips looks like
21:52brehautbut what you are saying is 'i want the clojure lexer to be the mips lexer' and its not going to be
21:52clj_newb_idiotI agree.
21:52clj_newb_idiotI was hoping someone did some black magic with the reader macro for a similar problem
21:52brehautyou'll be able to use a macro to capture symbols
21:53clj_newb_idiotand I could just steal their framework.
21:53brehautclojure doesnt have (without great evil) user definable reader macros
21:53cemerickTimMc: not quite; re: text analytics / NLP / etc
21:54ivangetting curious about this great evil
21:54ivanhas it been done?
21:54brehautclj_newb_idiot: but you are going to have to do some sort of translation for things like memory offset syntax and labels
21:55ivanhttps://github.com/klutometis/reader-macros hmm
21:55clj_newb_idiotbrehaut: yes, there seems like there's lots of little design decisions
21:55clj_newb_idiotso I was hoping I could find someone smart and plagerize from them
21:55brehautclj_newb_idiot: you'd be better off writing a simple lexer that outputs clojure data
21:56brehautivan: ಠ_ಠ
21:58clj_newb_idiotbrehaut: 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:59brehautive not written a parser in clojure in a while
21:59brehautit used to be fnparse
21:59clj_newb_idiothttps://github.com/joshua-choi/fnparse updated 2 years ago :-)
21:59brehaut(factual's fork is probably caonical one now)
21:59clj_newb_idiotsupporting clojure 1.2
22:00danielglauser nnnnnnnnn.0
22:00danielglauser.....*1
22:00brehauthttps://github.com/factual/fnparse/
22:01metellus,(rand-nth [:cat :keyboard-cleaning])
22:01clojurebot:cat
22:02xeqiI saw https://github.com/Engelberg/instaparse on the ml recently
22:06pmonksxeql: any comments? Been meaning to look at it - was playing with Amotoen for a bit.
22:06xeqipmonks: I haven't tried it
22:07pmonksCool beans. Been a loooooong time since I've done any real parsing. I usually just regexes <dons asbestos undergarments/>
22:09jasonjck_https://github.com/cgrand looks really good
22:10jasonjck_if you're doing serious parsing, combinators parsers in my experience too slow
22:10brehauti think you mean cgrand/parsley
22:11brehautone 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:11brehautordering and search trimming is vital to making it not sluggish
22:13jasonjck_exactly
22:18brehaut"i wrote a slow program with X, therefore X is slow" bzzt
22:18brehauteven worse when you throw out a blanket X for an entire category of tool
22:19brehautclojure'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:22tieTYTi 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:23tieTYTi think it's the former, I'm not sure how to say, "install with documentation"
22:23capcrunchanyone has used clj-native lib ?
22:33TimMccemerick: 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:09tieTYThttp://stackoverflow.com/questions/16096586/with-leiningen-how-do-i-install-documentation
23:28asteve,(def make-a-list+ #(list %&))
23:28clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
23:34jack_rabbit,(def make-a-list+ #(list %&))
23:34clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
23:36Zerker,(def SANDBOX DENIED)
23:36clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
23:36Zerker,(+ 1 2 3)
23:36clojurebot6
23:37Zerker,(let (Sandbox :denied)
23:37clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
23:41tyler_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:44n_bIs there a more idiomatic way to write (if (> 1 (count col) col (first col))
23:53ambrosebsn_b: your parens don't match.
23:56ambrosebsn_b: (if (empty? col) col (first col)) ?
23:56bjeanes_Can anybody point me in the direction of sane advice for dealing with mutable java types from Clojure in a concurrent way?
23:57bjeanes_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:57bjeanes_(but is otherwise unshared)