#clojure logs

2013-03-20

00:08pochoSay I wanted to map something in a nested sequence. For example i have two 3-d seqs containing 2-d images of color triples and i want to add the color triples into a brighter image.
00:08pochoFor depth 3 (apply map (fn [& b] (apply map (fn [& c] (apply map f c)) b)) a)
00:09pochoIs there a cool way to do this for arbitrary depth?
00:32TimMcamalloy, brehaut: grep -e '@@\+' -nR --include=*.clj -- repos/
00:33TimMcAlmost all pprint stuff.
00:34TimMcclojure/src/clj/clojure/pprint/{column_writer,pprint_base,cl_format,pretty_writer}.clj and tests
00:35TimMc,@@#'clojure.core/*loaded-libs* <-- midje
00:35clojurebot#{clojure.core.protocols clojure.instant clojure.java.io clojure.repl clojure.string ...}
00:35TimMcI found no triple cabbages.
00:39amalloyTimMc: consecutive cabbages are sufficient but not really necessary
00:39brehauthaha midje, thats quite a line
00:42amalloyeg, you might have an atom wrapping a map whose values are delays. that's really the most obvious double-cabbage situation IMO, and it ends up looking like @(get @m k)
00:43amalloyor, realistically, @(-> (swap! m (fn [m] (...add a delay for k, or reuse existing...))) (get k))
00:51TimMc,(macroexpand-1 '(->> x @@y)) hmmm
00:51clojurebot(clojure.core/deref (clojure.core/deref y) x)
00:51TimMcI wonder if you could build up a cabbage farm (that's 3 or more in a row) with clever use of threading macros.
00:52TimMc(in a way that reduces to the kind of code you're talking about)
01:00amalloyTimMc: i don't follow
01:06johnmn3I have a function in clojurescript like this: (defn fbin [f] (let [jf (js/FileReader.)] (.readAsBinaryString fr f) (.-result fr)))
01:06johnmn3hiredman: pointed out to me a few days ago why this didn't work... because of js' asynchronous nature
01:07johnmn3you would normally call the (.-result fr) inside the file reader's 'onload' callback
01:09johnmn3and I ended up getting it to work with an external atom... and it seems to work in the browser... But I'd really like to get it to work within a single function. So I've been trying to figure out how to create a new atom within the let binding, do the work there, and send the result back, all in the same function.
01:09johnmn3(external atom, meaning an atom outside the function)
01:12johnmn3And I've been googling for a really long time, trying to see if there is a simple way to resolve this and I can't find anything.
01:13amalloyjohnmn3: seems like you ought to just embrace the asynchrony, and set an onload callback that continues whatever computation you were in the middle of
01:14johnmn3https://www.refheap.com/paste
01:14johnmn3amalloy: that's what I'm trying to do, I think. Does the code above not handle things asynchronously?
01:15amalloyjohnmn3: you just linked to refheap's front page
01:15johnmn3ah
01:15johnmn3https://www.refheap.com/paste/12747
01:18johnmn3put the atom in an external variable and it works, but you still can't get the function to return the _current_ result... I can only get to the result _after_ the function has ended, by deref... derefing from within the function (after the onload runs and the atom is presumably filled) still returns nothing
01:18johnmn3the doall there is probably not necessary
01:19johnmn3was just experimenting
01:19RaynesWhy are you doing the _ lets for side effects? Just run them in the body of the let.
01:20johnmn3cause I want to capture the value from the atom afterward, then nil out the atom.. not necessary, perhaps
01:23johnmn3here's another: https://www.refheap.com/paste/12751
01:23johnmn3outside of the let... and a little cleaned up
01:29bdashjohnmn3: I don't think you can do what you're after. the onload handler for your FileReader object will be called on a future iteration of the event loop, which by definition must be after your function has returned
01:29johnmn3ah
01:30johnmn3yea, cause doing each step in the repl works perfectly fine.
01:30johnmn3put them in a function together.. no love
01:31johnmn3doing this works fine: https://www.refheap.com/paste/12752
01:32bdashjohnmn3: at the repl, or in the context of a larger script? I could see the former situation working, but I would not expect the latter
01:33mattmossIs it acceptable to let the caller deref, rather than deref within the fn?
01:34amalloyjohnmn3: it seems like you don't understand javascript's event model. your goal is fundamentally at odds with how things work
01:34johnmn3is there a trick one could use to get a particular function to span an event loop iteration? with a sleep, or something? in order to get get at the value?
01:35amalloy(i don't pretend to understand javascript's event model myself, but i find that it works okay to pretend that i'm writing CPS scheme)
01:35bdashjohnmn3: you can get at the value within the onload handler
01:35bdashjohnmn3: you can pass it on to any function you'd like from there
01:36johnmn3bdash: I'm using an onload handler here: https://www.refheap.com/paste/12751
01:37amalloyjohnmn3: all computation that depends on the results of this file-read must happen within that onload handler
01:37amalloynot "after" it in source-code-order, because that is rubbish. you cannot have the current value until that onload function has been called, which is guaranteed to be sometime after the current function has returned
01:38amalloy(or, maybe not guaranteed; as i said i don't understand the event model. but it *might* be after, so you must plan for it)
01:39johnmn3and I would think that .readAsBinaryString should trigger the onload function, thus populating the atom... it sounds like this event loop thing is the crux... if I had a future or something...
01:40johnmn3or an await function
01:40amalloyjohnmn3: readAsBinaryString registers a callback somewhere, and then returns immediately
01:40amalloybecause javascript is single-threaded, await makes no sense. you really cannot force this asynchronous environment to act synchronous
01:41amalloyperhaps read up on continuation-passing style in scheme, because the same techniques apply, or read some example programs in javascript
01:46bdashhttp://yoric.github.com/Talks-MS-IEB-2013/?full#section_model has a good intro to the JavaScript execution model, and goes on to mention continuation passing style
01:51amalloybdash: who made these slides, and do they hate users? the keyboard is nice and all, but i would appreciate it if i could scroll through this with my dang scroll wheel
01:52bdashamalloy: yeah... not the greatest presentation mechanism. I was thoroughly confused at first when it loaded with black text on a black background for a minute or so before the background image loaded in :-/
01:53muhoois there a way to get slamhound to notice stuff like #'some.ring.handler/app ? it fails to add (:require some.ring.handler) and wipes it out if i add it manually :-/
01:53wei_in compojure, why does the order matter when defining routes? e.g. when I put (route/resources "/") after (route/not-found "") it does't work.
01:53amalloymuhoo: mention it to alexbaranosky, and then it will probably start working
01:53muhoowei_: it traverses them in order and falls through
01:54wei_ah, so not found is a catch-all?
01:54muhoowei_: yep
01:54muhooamalloy: thanks, i'll march off to github
01:55amalloywei_: not-found is roughly equivalent to (fn [request] {:status 404 :body "nothing here dude"})
01:56amalloyie, a function that ignores its input and always produces a 404 page
01:57amalloygood content in the slides though, bdash. i like the exercises
02:10muhoowhere are the slides for cljwest? they're usually up on github somewhere, IIRC
02:12scottjmuhoo: https://github.com/strangeloop/clojurewest2013 nothing there yest though
02:12muhoothanks
02:13muhoohaha, last commit 18 minutes ago :-)
03:21devn,"\s+|\(|\)"
03:21clojurebot#<RuntimeException java.lang.RuntimeException: Unsupported escape character: \s>
03:21devnIs that normal?
03:24hyPiRiondevn: yes
03:24hyPiRionYou probably forgot the # in front
03:24devnhyPiRion: hmph, guess i've never run into that
03:25devnhyPiRion: well, why does a string freak out over \s?
03:25hyPiRion,#"\s+|\(|\)"
03:25clojurebot#"\s+|\(|\)"
03:25hyPiRiondevn: because there's no escape character named \s.
03:25hyPiRionYou have \t, \n, \r, etc.. but no \s
03:25devnoh im aware
03:27devnhow do you get a string with \s in it, then?
03:28hyPiRion\\s
03:28hyPiRion,"\\s"
03:28clojurebot"\\s"
03:28devnduhhh
03:28devn,(println "
03:28clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading string>
03:29devn,(println "\\s")
03:29clojurebot\s\n
03:51wei_is "pop" exactly the same as "first", but with an exception if the list is empty?
03:51wei_sorry, "rest" not "first"
03:52hyPiRionhmm
03:52hyPiRion,(pop (list 1 2 3))
03:52clojurebot(2 3)
03:52hyPiRion,(rest (list 1 2 3))
03:52clojurebot(2 3)
03:53hyPiRion,(rest [1 2 3]))
03:53clojurebot(2 3)
03:53hyPiRion,(pop [1 2 3]))
03:53clojurebot[1 2]
03:53hyPiRion^
03:54hyPiRion,(rest #{1 2 3})
03:54clojurebot(2 3)
03:54hyPiRion,(pop #{1 2 3})
03:54clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentHashSet cannot be cast to clojure.lang.IPersistentStack>
03:59wei_aha, thanks.
04:46drorbemet
04:55Glenjamindoes anyone know of a library that provides assertions for ring response maps?
04:56Glenjamin(has-cookie response "CookieName") and so on
05:14wei_how do i set properties on an the html tag in hiccup? e.g. <html ng-app></html>
05:21wei_Glenjamin: maybe try wrapping a generic Clojure validator (e.g. http://clojurevalidations.info/) into a ring handler
05:22Glenjaminwei_: i'll take a look, my use-case is specifically for behaviour tests though
05:22hyPiRionwei_: [:a {:href "link"} "the text that's shown"]
05:22hyPiRionFor example.
05:23wei_yes, but the html function doesn't seem to work that way.
05:23hyPiRionoh, I see what you're saying
05:23wei_specifically, I want to add an attribute to the root <HTML> tag
05:24wei_hyPirion: trying to figure out whether your name is a Starcraft reference…
05:27hyPiRionwei_: nope. It's a mix of the trojan captain Hypiron (from the Iliad) and the god Hyperion. PiR as its standing can be read as both Pi * R, but also as Pierre.
05:28hyPiRion*it's
05:28hyPiRionAlso, I thought it was a Borderlands reference, not a Starcraft reference.
05:29wei_there's a Hyperion in Starcraft. everyone borrows from Greek mythology I guess
05:31ejacksonalso a scifi novel...
05:31ejacksontalk about your overloaded term ;)
05:31p_lwei_: Greek mythology is shared cultural background of Europe
05:32p_lit's more than just borrowing from it, it's closer to be definitions of concepts represented by common words
05:33hyPiRionejackson: And the scifi took from Keats' "Hyperion" as well
05:33ejacksonha! I didn't know that :)
05:33ejacksonweird book - something about a pincushion overlord
05:33hyPiRionejackson: Have you read it?
05:33ejacksonyears back
05:34nopromptoh awesome. people are awake. :)
05:34hyPiRionhaha @ pincushion overlord
05:34hyPiRionpincushion multi-armed metal time-bending overlord
05:35nopromptthis pattern (map #(apply fn %) coll) seems to crop up often, is there a better way?
05:35wei_apparently Hyperion was a Titan, the first of the gods. so you go way back, Pierre
05:36p_lwell, one of kids of Chaos and Gaea?
05:36wei_nopromt: what about (map fn coll)?
05:36ejacksonnoprompt: looks fine to me
05:36hyPiRionnoprompt: (for [c coll] (apply fn c)) ? Depends on what the apply is used for
05:36nopromptthe coll contains vectors
05:37wei_ah i see
05:37hyPiRionp_l: Chronos
05:38noprompthyPiRion: yeah, the other way i tried it was (for [[h t] vs] (fn h t))
05:38p_lhyPiRion: Chronos was the father? then Hyperion was 2nd generation
05:38hyPiRionnoprompt: well, are the vectors of a constant size, or of a variable way?
05:38hyPiRion*length
05:38noprompthyPiRion: they're tuples of length 2
05:38hyPiRionp_l: yeah, he was a Titan
05:39hyPiRionnoprompt: then it's best to do what you mentioned. Avoid apply if you can, use reduce if that's a better fit (except when working with string concatenation)
05:39p_lfirst (origin) was Chaos and the being that became from it, Chronos was kid of that being (just not sure on naming, Gaia or similar?)
05:39noprompthyPiRion: funny you should mention that. the result is wrapped in a clojure.string/join
05:40wei_noprompt: or, you could define the (apply fn %) as a separate function, apply-args and then (map apply-args coll)
05:40hyPiRionp_l: No, Erebus and Nyx were the children of Chaos
05:40nopromptwei_: i was thinking of (defn mapply [fn coll] ...)
05:41hyPiRionp_l: but then again, there isn't just one Greek mythology
05:41p_lhyPiRion: true, I just don't remember the naming
05:41p_lit's just that I remember Kronos being "second" after the beings born of Chaos
05:42nopromptthe thing is, i feel like i've written the combination at least more than a few times in separate codebases.
05:42noprompti wasn't sure if there was something core that accomplishes the same thing already.
05:42hyPiRion~mapply
05:42clojurebotYou could (defn mapply [f & args] (apply f (apply concat (butlast args) (last args))))
05:43hyPiRionnot entirely what you'd like, I think.
05:43noprompthehe. maybe i'll name it map-apply then.
05:43hyPiRionhmm
05:44nopromptmapply seems strangely familiar. was that in the PAIP book?
05:44wei_noprompt: that works. or for extra composability, (defn make-apply-fn [fn] (partial (apply fn)) (map (make-apply-fn fn) coll)
05:45nopromptwei_: that's interesting.
05:45noprompti need to get better at making composable fns
05:46hyPiRionwell, (partial apply fn) is way slower than #(apply fn %) sadly.
05:47wei_aww. I was thinking if you ever needed to you could also then (reduce (make-apply-fn fn) coll)
05:47ejacksonas an aside, I'm making a reading list of non-fiction books about 'where we came from and what we do'
05:47ejacksonhttps://gist.github.com/ejackson/5203517
05:48ejacksonthose are some of my favourites in no particular order
05:48ejacksonanybody want to add ?
05:48wei_Is that an ordered list?
05:48ejacksonits a set :)
05:48nopromptwould (for [x coll] (f x)) favor better than (map #(apply f %) coll)?
05:49ejacksonnoprompt: you'd still need an apply though ,right ?
05:50nopromptoh right. i meant (apply f x) inside the for there.
05:50hyPiRionwell, (for [[x y] coll] (f x y)) is even better speed-wise. Though if that's not a concern, then (for [x coll] (apply f x)) is about the same as (map #(apply f %) coll)
05:51hyPiRionAnd usually speed shouldn't be a concern
05:52noprompthyPiRion: it's not. it was a question of pure curiosity.
05:53nopromptejackson: i liked "The Hacker Ethic"
05:53ejacksoncool, I'm planning on putting together some list of the books liked by the Clojure crowd
05:53ejacksonsort of, defining our community history and culture
05:54ejacksonbut not so obnoxious sounding
05:54nopromptejackson: glancing at that reading list makes me wonder if i should return to college.
05:55ejacksonwhy ?
05:55nopromptejackson: oh it just got me thinking about how much i've grown as a programmer thanks to open source and having a hacker attitude.
05:55hyPiRionejackson: I think this one is cool: http://www-formal.stanford.edu/jmc/robotandbaby/robotandbaby.html
05:56hyPiRionIt's more of the AI evolution and thoughts around it
05:56nopromptejackson: the hacker ethic clears the air around the work "hacker" which even so-called "hackers" don't know the definition of.
05:56noprompts/work/word
05:56ejacksoncool, cool - check out "The Brainmakers' for similar
05:56ejacksoni'm planning on putting out a tweet (US hours, of course) to try get ppl to fork, update and merge in new books
05:57ejacksoncreate a community list
05:57ejacksonset
05:57ejackson:)
05:57noprompti guess the thing about college, is that if i go back i'm not sure i'll gain more intellectually than i will lose financially.
05:58noprompttalking to the same guys that are graduating from the same program i dropped out of kind of reenforces that posture.
05:59noprompthehe, plus there's a lot of smart guys in this room who've said it's not really necessary.
06:00noprompti dunno, bit of a catch 22(?).
06:00nopromptejackson: but yeah, that list looks great.
06:04nopromptso i'm working on a CSS type of thing for clojure.
06:05nopromptwould compiling separate parts of the stylesheet concurrently be overkill?
06:09noprompthehe, i'm guessing using clojure to write "hard core" stylesheets isn't a popular topic.
06:10rodnaphnoprompt: what are you planning to add to the css-pre-processor party?
06:10clgvnoprompt: take the usual route and just try if sequential compiling suffices
06:11nopromptrodnaph: well, i'm not really happy with what we've currently got. not saying they're bad libs or anything.
06:11nopromptrodnaph: but i feel like the approach is off.
06:12nopromptlike gala and cssgen use [:selector :prop-1 "val" :prop-2 "val" [:nested-selector …]]
06:12clojurebot,(let [testar (fn [x y] (if (= (reduce + (filter odd? (range 0 x))) y) (str y " is an")) )] (testar 10 25))
06:12rodnaphnoprompt: i'd love to see someone explore the essential untestable brokenness of CSS using clojure, possibly tying enlive together with a CSS thing to make it all more verifiable.
06:12noprompts/gala/gaka
06:12nopromptbut i've experimented with that approach and it get's ugly
06:13nopromptboth avoid using maps for declarations because in some cases order is useful
06:13noprompthowever, i think maps are fine
06:13nopromptif order matters just use another map
06:14noprompt[:selector {:prop "value"} {:prop-1 "value"} [:nested-selector …]]
06:14nopromptthen compile the declarations and concatenate them.
06:15nopromptalso this is something interesting i've found comes from this approach
06:15noprompt[:sel {:font {:family "monospace" :size "16px"}}]
06:15nopromptdel { font-family: monospace; font-size: 16px }
06:16nopromptrodnaph: i'm still experimenting, but i've attempted this 3 times and i think i'm heading in a good direction.
06:17noprompti've also built in output options which are missing in other libs
06:18nopromptrodnaph: i talked with chris eppstein of compass fame at w3conf and he suggested using JNI and sassc to help all the folks in the java world
06:20rodnaphnoprompt: the problem i see with all those tools that compile "something hopefully better" to CSS... is that they have to generate CSS. which is utterly unverifiable.
06:20nopromptrodnaph: this will generate code to spec
06:20rodnaphso, they can be nice, and can remove duplication, and make things easier to read, but we're still in the problem of not being able to maintain it.
06:20nopromptrodnaph: some of the more "dangerous" stuff i'll focus on later
06:21nopromptrodnaph: were you also suggesting comparing css and html and eliminate dead css?
06:22rodnaphnoprompt: yes. but not just remove dead CSS, having a way to verify what CSS affects what. i know with dynamic content this is difficult, but atleast having an idea might help.
06:23rodnaphit would be nice if CSS was tied to the HTML in some way (i know the point is that they are separate, but that doesn't mean they can't be analysed together)
06:23nopromptrodnaph: yeah, the big downside to that a class might be significant somewhere else like in *ahem* javascript
06:24nopromptit's a sad fact but not everyone knows that you should just use data attributes for manipulating the dom with something like jquery
06:24nopromptat least i've found that approach has lead to jquery code that's been far easier to maintain in the past.
06:25rodnaphnoprompt: yah agree.
06:25rodnaphif we can remove the "ok i need to add a CSS rule, but i've no idea what this might affect so i'll just try and stick it in at the end" - i'd be mucho less afraid day-to-day.
06:25noprompti completely agree though. that would be really awesome.
06:26rodnaphand if we're modelling everything as data in our app, then that seems more achievable.
06:26noprompthehe, yep. if i had a nickel.
06:26noprompti did talk to one of the css spec authors at w3conf.
06:26rodnaphit seems to be the best place to start thinking about a solution at least.
06:26nopromptcss needs rule scoping.
06:26nopromptor namespacing.
06:27noprompthe agreed, but i'm too damn lazy to join the mailing list.
06:27nopromptthe only way i know of to avoid css scoping issues with rules screwing up stuff is to use an iframe with a separate stylesheet.
06:28nopromptand that's just diry.
06:28nopromptor using a block level reset which compass lets you do.
06:29nopromptbut that ends up barfing more insane selector madness in to the final product for probably little gain,
06:29nopromptthe other terrible part of css imho is the syntax. it's so adhoc.
06:31nopromptfor instance. font-family: one, two, three; vs box-shadow: 0 1px black, 0 2px 3px #333;
06:31nopromptit's insane.
06:31nopromptlike it's not clear at all when and where things need to be comma delimited, which values can be omitted etc.
06:31hyPiRionIf syntax is the worst problem, then CSS surely is well designed.
06:32noprompthyPiRion: the problem with css is the illusion that it's simple. it's not.
06:33noprompthyPiRion: i mean between html, css, and js. html is the only thing that's not totally broken.
06:33hyPiRionheh
06:36hyPiRionThe thing I meant was, if the syntax is the thing most people complain about, then it doesn't seem to have many problems
06:36hyPiRiongranted, there's only so much CSS covers.
06:37nopromptyeah, and it cracks me up when i talk to people about that.
06:37nopromptthey're like what?! no, css is great!
06:37nopromptand then i'm like yeah, pass me the joint.
06:37hyPiRionheh
06:39nopromptthe problem is that the people using CSS are typically *spoiler-alert* designers.
06:39nopromptso when i bring it up i can run out of town.
06:39noprompts/can/get
06:41noprompthyPiRion: but you're right though. vim script is certainly worse.
06:43nopromptthe funniest thing about css and js is that the "best practice" is slowly shifting to "don't write them in the raw"
06:46nopromptoh and if you don't think css syntax is adhoc. just look at media queries. they're full random syntax you don't see anywhere else in the language.
06:50noprompti'm thinking of using meta to deal with media queries
06:51noprompt^:screen [:selector {decls}], ^{:orientation :portrait} […]
06:56supersymcute
07:06noprompthehe, *thinking* being the keyword there
07:07nopromptbut a media query is a lot like meta
07:07nopromptit's just about rules
08:46TimMcI've had good results with following SMACSS rules for CSS.
08:46TimMcI've not used it on any really big sites, but it feels scalable.
09:07akayeah smacss and oocss are nice
09:07akaI also think BEM is nice for scalability/maintenance
09:10uvtcAre there any slides available for either tbaldridge's or takeoutweight's talks? (These would be the clojure-py/llvm and clojure-scheme talks.)
09:12uvtcWill videos of the talks end up on http://www.youtube.com/user/ClojureTV ? Or, is there somewhere else to find vids of Clojure/West talks?
09:18akawhoa, just realized how much of an acronym asshole I probably came off
09:18pepijndevosuvtc: found anything?
09:18uvtcNot yet, no.
09:19pepijndevosaka: what are they?
09:20ejacksonprobably be a while...
09:21jcromartieis there a way to fix Midje REPL output in Emacs/nREPL?
09:21jcromartieit looks awful
09:22jcromartielots of control (colorizing?) characters leaking through
09:23akapepijndevos: SMACSS/OOCSS are techniques to organize your CSS/HTML to make them more maintanable and BEM is a methodology that is centered around a very specific naming convention for html elements and the css classes that effect them
09:23clgvjcromartie: I think there is some option to turn of colorizing
09:23jcromartieand what the heck is this
09:23jcromartiehttps://www.refheap.com/paste/12758
09:23jcromartiereal useful there...
09:23jcromartieoops
09:24jcromartieI'm an idiot
09:24jcromartieblinded by leaky control character rage
09:24drorbemetIs there a clojure-refactoring lib for clojure 1.5?
09:24jcromartie:P
09:25drorbemet
09:35Pupnik-woah when did cloj 1.5 come out
09:36hyPiRionages ago
09:37Pupnik-hmm i wonder why i have 1.4 then
09:37hyPiRion"ages", like 2 weeks or so? And 1.5.1 came out last week iirc
09:37Pupnik-oh
09:38hyPiRionlein 2.1.0's project templates comes with 1.5.1 now, upgrade with `lein upgrade 2.1.0`
09:40Pupnik-cheers
09:40clgvoh the lein 2.1 release happened^^
09:41clgvbut just 11 hours ago ;)
09:41hyPiRionrejoice!
09:49drorbemetDoes some one has some experiance with https://github.com/joodie/clojure-refactoring?
09:49pepijndevoslein 2.1?! cool
09:52pepijndevossomeone update homebrew?
10:01clgv pepijndevos: "lein upgrade"?
10:01pepijndevosclgv: yea, no… wait. I had a checkout, which said do not do that.
10:02clgvpepijndevos: huh what?
10:02clgvpepijndevos: that's the way when you install lein manually.
10:03pepijndevosI installed lein from source one day. it told me it can't upgrade
10:03uvtclein 2.1.0 seems to start up a bit more quickly than the previous version.
10:04uvtcSo it's got *that* going for it. Which is nice.
10:05clgvpepijndevos: well, it works for releases I upgrade through the 2.0 previews until 2.0 release using "lein upgrade"
10:06hyPiRionpepijndevos: do the manual install (not source)
10:06hyPiRionsource is slower than the aot-compiled one
10:06antoineBhello, does exist a function like map, but which pass as parameter to the modifier function the previous computed element?
10:06clgvdo you get any advantage by using brew for leiningen?
10:07pepijndevosconvenience
10:07clgvantoineB: no.
10:07pepijndevosantoineB: (map f l (next l)) ?
10:08clgvpepijndevos: not the previous in the source coll but the (f prev) ;)
10:08pepijndevosantoineB: or something like reductions?
10:08antoineBi as do something like reductions
10:08antoineBi think the scala "fold" function do what i want
10:09hyPiRion,(reductions + (range 10))
10:09clojurebot(0 1 3 6 10 ...)
10:10hyPiRionreduce with history for each reduction performed
10:15clgvantoineB: you could also change map to pass the previous result to the next call
10:16antoineB(reduce #(+ %1 (mod %2 %1)) (conj '(1 2 3 4) (mod (first '(1 2 3 4)) 5)))
10:16clgvantoineB: I mean create your own lazy function application based on map. minimal effort^^
10:16antoineBit will look likre something close to that
10:28antoineBhttps://www.refheap.com/paste/12761 is what i need, but i would like it lazy
10:34antoineBclgv: i can't do it with map
10:38clgvantoineB: how about that? https://www.refheap.com/paste/12762
10:38clgvit has no special support for chunked-seqs though
10:40clgvthe example is only for demo that it works. the same result would be possible via reductions. ##(reductions + (repeat 5 1))
10:40lazybot⇒ (1 2 3 4 5)
10:41antoineBclgv: i will use reductions
10:42clgvantoineB: if it really fits, fine. :) I assume there are scenarios where map2 suits better than reductions
10:45antoineBi didn't know the lazy-seq construct
10:56opahi, does anyone know how to configure maven to compile clojure code before compiling java code if both are used in the same project?
11:07antoineBhow to test if something is false or nil? #(or (false? %) (nil? %))
11:08nDuffantoineB: just use it as a truth value.
11:08nDuffantoineB: false or nil are the only things that behave like false.
11:08antoineBi know
11:08nDuff...so, err, why are you trying to do this test explicitly at all?
11:09antoineBto pass it as function
11:09nDuffDon't bother with (or (false? yourthing) (nil? yourthing)), just use (not yourthing)
11:09antoineBok
11:09nDuffIf you didn't need to invert it, you could use the identity function
11:10nDuffwhich has the advantage of being in the standard library (and is the idiomatic thing for the purpose).
11:10jtoy_if I have a method defined with (def with-open .... returned process_file) is that run only once or is the contents of the file processed everytime?
11:11antoineBnDuff: i was just needed "not"
11:12antoineBjtoy_: you mean (def abc (with-open [a ...] a)) ?
11:12nDuffjtoy_: If you're creating and setting a var with def, whatever function you run to get that value happens only at assignment time, not when the var is dereferenced.
11:12nDuffjtoy_: ...but it's not clear what you meant without more explicit code.
11:14clgvjtoy_: it will be run everytime the namespace gets reloaded
11:19nDuffjtoy_: ...if you don't want it to happen on reevaluation, see defonce.
11:37TimMcDoes proxy not allow definition of new methods?
11:39TimMcOr more interestingly, new arities for existing methods?
11:40nDuffTimMc: There's a reason gen-class still exists. You could generate an interface with the new signatures, though.
11:41TimMcI don't actually need it; I was trying to experiment with proxy syntax without bringing in the actual superclass. :-)
11:42TimMc,(. (proxy [Object] [] (toString [] "foo")) (toString))
11:42clojurebot"foo"
11:43TimMc,(. (proxy [Object] [] (toString ([] "foo") ([bar] "bar"))) (toString))
11:43clojurebot"foo"
11:43TimMc^ so it even lets you "define" the new arity...
11:43TimMc,(. (proxy [Object] [] (toString ([] "foo") ([bar] "bar"))) (toString "second"))
11:43clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: toString for class sandbox.proxy$java.lang.Object$0>
11:43drorbemetDoes anybody know an example for the fold function in Clojure 1.5?
11:45clgvdrorbemet: (require '[clojure.core.reducers :as r]) (r/fold + (r/map inc (range 100)))
11:47TimMc,*clojure-version*
11:47clojurebot{:major 1, :minor 5, :incremental 0, :qualifier "RC6"}
11:47TimMc,(require '[clojure.core.reducers :as r])
11:47clojurebot#<FileNotFoundException java.io.FileNotFoundException: Could not locate clojure/core/reducers__init.class or clojure/core/reducers.clj on classpath: >
11:47drorbemetclgv: thanks, I don't need parallel at the moment though, I just need to thread a value to the next application of a predicate function
11:48clgvdrorbemet: ah so you want `reduce`
11:48drorbemetclgv: just a moment I put together an example
11:48clgv,(reduce + (map inc (range 100)))
11:48clojurebot5050
11:48antoineBis there a function to know the size of an object? (like sizeof in c)
11:49clgvantoineB: not really since it is not that easy
11:50TimMcantoineB: For what purpose?
11:50antoineBprofiling in definitive, but now just for knowing
11:51clgvantoineB: you can use a profiler for that ;) JVisualVM, Yourkit Java Profiler ...
11:52TimMcThere's the size of the object itself, there's the space that could be reclaimed by GC if it were deleted, and there's the space consumed by the graph starting with the object as a root.
11:52TimMcAll very different numbers.
11:52TimMcsizeof wouldn't tell you much for profiling.
11:53drorbemetclgv: lets say predicate returnes true at 2 and 4 then this [1 2 3 4 5]
11:53drorbemetshould result in something like this map {:2 1, :2 2, :2 3, :4 4, :4 5}
11:53drorbemetafter that I whant to apply group-by ... resulting in groups for 2 and 4
11:54TimMcdrorbemet: That's not a valid map.
11:54drorbemetclgv: is this a parsing problem, or pairing, or folding ...? I confuse these untill now
11:54clgvdrorbemet: you have multiple keys with the same value which will override each other in the map
11:54TimMcand hwo do you know that 1 gets 2?
11:54drorbemetTimMc: ok right I meant a valid map
11:55TimMc"A valid map" doesn't tell me what it looks like.
11:55TimMcHere's a valid map: {[] "woot"}
11:55TimMcPresumably it is not the one you wanted. :-P
11:55drorbemetclgv: ah, right, so a map is not good for this
11:56drorbemetTimMc: hang on a second
11:56TimMcdrorbemet: Instead of focusing on whether or not a map is called for in an intermediate step, you should provide an example of the final output.
11:56clgvdrorbemet: I do not grasp your problem from the one example. maybe you can give more examples with explanation
11:56drorbemetclgv: ok
11:59clgvdrorbemet: or laike TimMc said: what is the overall function/algorithm that shall be computed in terms of input and output?
12:03TimMc,(->> (for [[n v] (ns-publics 'clojure.core)] [n (count (:doc (meta v)))]) (sort-by second >) (ffirst))
12:03clojurebotgen-class
12:03TimMcI guess that's no surprise.
12:05hiredmanthe java object model in a single doc string
12:05clgv&(doc gen-class)
12:05lazybot⇒ "Macro ([& options]); When compiling, generates compiled bytecode for a class with the given package-qualified :name (which, as all names in these parameters, can be a string or symbol), and writes the .class file to the *compile-path* directory. When not compi... https://www.refheap.com/paste/12764
12:06clgvoh wow.^^
12:06mikerodIs there a way to test if a form is quoted? That works like: (quoted? 'a) => true | (quoted? "a") => false
12:07clgvmikerod: on macroexpansion time yes. on runtime it is either a symbol or a collection
12:08clgvmikerod: (defmacro check [x] (println x)) (check 'a) => "(quote a)"
12:09drorbemetclgv: ok, I try to explain in words ... I have a sequence of values (strings), some of them are keys to their successors, untill an other key follows
12:09drorbemetI want to skip all values before the first key appears.
12:09drorbemetKeys can appear multiple times and can appear in direct succession or at the very end of the sequence
12:09drorbemetmy try at the moment looks like this ... if I partition that in pairs keys that appear in direct succession are glued together ...
12:09drorbemet(partition-by #(contains? #{2 5 8 7 14} %)
12:09drorbemet(drop-while #(not (contains? #{2 5 8 7 14} %)) [1 2 3 4 5 6 7 8 9 10 11 12 13 14]))
12:09drorbemet=> ((2) (3 4) (5) (6) (7 8) (9 10 11 12 13) (14))
12:09mikerodclgv: That makes sense. Thanks.
12:12clgvdrorbemet: is there a name for that problem?
12:15drorbemetclgv: Not realy, I am reading a webpage with enlive ... ending up with a sequence that I can not divide by keys attachet to the data.
12:16clgvdrorbemet: so you want a seq like ((key, key ...) (no-key, no-key, ...) (key, ..) (no-key, ..) ...) ?
12:19drorbemetclgv: yes that's the input: (no-key, key1, no-key1, no-key1, key2, no-key2, key3)
12:19clgvdrorbemet: and what is the output supposed to look like?
12:19drorbemetclgv: it's like parsing, only that I have the feeling that I should need parser for that
12:20drorbemetclgv: sorry one moment the output follows
12:23drorbemetclgv: the output is a map of the keys with their values grouped together:
12:23drorbemet{:key1 [no-key1, no-key1] :key2 [no-key2] :key3}
12:27drorbemetclgv: I think I will just write a recursion myself ... just hoped that there whould be a way to combine existing functions ...
12:27ieureI know there's got to be an easier way to do something like (partition 2 (interleave (range) [:a :b :c]))
12:28clgv ieure: zipmap
12:28S11001001just map
12:28clgvoh damn right. you want no map ;)
12:28S11001001,(map vector (range) [:a :b :c])
12:28clojurebot([0 :a] [1 :b] [2 :c])
12:29ieureThat looks good.
12:29clgvor do you really want: ##(zipmap (range) [:a :b :c])
12:29lazybot⇒ {2 :c, 1 :b, 0 :a}
12:29ieureclgv, I want to preserve order.
12:29silasdavishow can I obtain {:fish "cod"} from {:fish "cod" :mammal "zebra"} ?
12:30silasdavisas in slice by keys
12:30clgvsilasdavis: select-keys
12:30hyPiRion,(map-indexed vector [:a :b :c])
12:30clojurebot([0 :a] [1 :b] [2 :c])
12:30silasdavissorry I should say possibly multple keys
12:30S11001001mmm
12:30clgvsilasdavis: select-keys
12:31silasdavisclgv, thanks
12:37silasdaviscan I write (map #(select-keys % [:a :b]) sequence) in a better way?
12:38hyPiRion(for [s sequence] (select-keys s [:a :b]))
12:38hyPiRionIt's not better though, just different
12:39clgvhyPiRion: well it avoid the anonymous function ;)
12:40silasdavisis there away to partially apply on second argument ? or leave open on the left or something ?
12:41hyPiRion(defn partial-1 [f & args] (fn [x] (apply f x args))) ?
12:42hyPiRionor perhaps... (defn partial-1 [f & args] (fn [& more-args] (apply f (concat more-args args))))
12:42silasdavishyPiRion, that looks like the sort of thing
12:44silasdavisthen ... (map (partial-l select-keys [:a :b]) seq) right?
12:44hyPiRionyeah
12:44ieureOkay, where do I get nREPL Javadoc middleware?
12:48clgvieure: erm what?
12:48ieure"C-c C-j nrepl-javadoc"
12:48ieureBut when I try to use it: No Javadoc middleware available
12:49clgvah emacs nrepl.el stuff... no idea..
12:50caradohello.
12:51ieureLooks like it's part of Ritz.
12:51clgvpeople are always not precise whether they mean nREPL or nREPL.el...
12:54caradoi’m trying to make a clojure web applet ( http://paste.awesom.eu/mf0 ) but by firefox freezes with these errors in the terminal : http://paste.awesom.eu/O5D
12:54caradoi have no idea where that could come from, though :(
12:55caradoi followed the method on http://en.wikibooks.org/wiki/Clojure_Programming/Examples/Creating_an_Applet with and without signing clojure.jar , and i have the same problem in both cases
13:17jcromartieare people really using agents?
13:17pjstadigno it's just a big joke
13:17pjstadigyou've been PUNK'D
13:19pjstadigwe have a couple of uses of agents in our codebase
13:19hiredmanalmost entirely around hold side effects till a stm transaction completes
13:19hiredmanholding
13:20pjstadigi think one is for gathering stats
13:20pjstadigwhich is not stm related
13:20hiredmanah, right
13:27ieuretechnomancy, Is there some way to force `lein upgrade' or `lein install' to give me 2.1.0?
13:27ieureIt installs 2.0.0.
13:28babilenieure: "lein upgrade 2.1.0" should work
13:28ieureWhack
13:28ieureOkay
13:32technomancyyeah, caught that bug 5m after it went out =(
13:35arrdemis there a way for me to create a new Number type without modding the Clojure Core?
13:41tomojarrdem: you can use proxy
13:41S11001001arrdem: depends on what you mean by "create a new number type"
13:42S11001001if you mean "such that clojure.core/+ just works", no, not really
13:42arrdemtomoj: proxy?
13:42arrdemS11001001: okay I was getting that sinking feeling.
13:43llasramWasn't there a library which provided multimethod-based core numeric operations?
13:43S11001001I believe there is
13:44arrdemS11001001: it looks like one could implement foo.bar/+ as a superset of core/+ tho.
13:44S11001001arrdem: absolutely.
13:44tomojhmm
13:44tomojhttps://www.refheap.com/paste/0ab90f987973ede62d7a088c5
13:45arrdemllasram: it's in contrib, but one exists.
13:45tomojI guess this works when your + is just "convert to sane Number, then +"
13:46llasramAh
13:46tomojhttps://www.refheap.com/paste/85d48c4dfb74c78c43a5d0c8d
13:50mikerodIs it considered "bad form" to use the syntax quote when not inside of a macro? For instance, if I want to evaluate something and then "quote" it e.g. `'~(first some-form)
13:51mikerodThat cut off on my screen I had `'~(first some-form)
13:52hyPiRionmikerod: What would quoting it give you?
13:52hyPiRion,(identical? `'~(+ 4 5) (+ 4 5))
13:52clojurebotfalse
13:52mikerodIt would "wrap" the results in a quote.
13:53hyPiRion,`'~(+ 4 5)
13:53clojurebot(quote 9)
13:53mikerodSo in that case, I want to have (quote 9) result from `'~(+ 4 5)
13:53hyPiRionWell, actually, that's not a quote. That's a list with the symbol quote and the integer 9.
13:53S11001001mikerod: as long as you accept that it may not actually emit the symbol `quote' as the first element in the future
13:53hyPiRionmight as well do ##(list 'quote (+ 4 5))
13:53lazybot⇒ (quote 9)
13:54callenbotit always makes me feel good when my pull request frightens people.
13:56mikerodhyPiRion: That does make sense to me.
13:56hyPiRionI feel it's more evident that it will return (quote 9) if you write it (list 'quote (+ 4 5)) rather than `'~(+ 4 5)
13:57arrdem,(doc proxy)
13:57clojurebot"([class-and-interfaces args & fs]); class-and-interfaces - a vector of class names args - a (possibly empty) vector of arguments to the superclass constructor. f => (name [params*] body) or (name ([params*] body) ([params+] body) ...) Expands to code which creates a instance of a proxy class that implements the named class/interface(s) by calling the supplied fns. A single class, if provided, mus...
13:57hyPiRionMore verbose, perhaps, but then again, people prefer to use `identity`, not `#(`%%%)`
13:58arrdemhyPiRion: how does %%% behave? I'm aware of %1 etc and % for all args but %%% is new.
13:58arrdemalso
13:59sritchietechnomancy, how have you liked librelist?
13:59arrdem(inc tomoj) ;; code talks
13:59lazybot⇒ 7
14:01mikerodhyPiRion: I think I'd agree for that.
14:01hyPiRionarrdem: ##'[%%%]
14:01lazybot⇒ [% % %]
14:02hyPiRion,`#[`%%%]
14:02clojurebot#<RuntimeException java.lang.RuntimeException: Reader tag must be a symbol>
14:02mikerodhyPiRion: The one thing that I am seeing is that:
14:02hyPiRionugh
14:02mikerod,(= `'~(+ 4 5) (list 'quote (+ 4 5)))
14:02clojurebottrue
14:02hyPiRion,`#(`%%%)
14:02clojurebot(fn* [p1__201__203__auto__] ((quote sandbox/p1__201__202__auto__) p1__201__203__auto__ p1__201__203__auto__))
14:02technomancysritchie: it's better than google groups for sure. two annoyances: it takes a while before messages are visible in the web interface, and it's unclear how new users join; you can't add your own explanation/welcome message on the archives page.
14:02mikerod,(= (type `'~(+ 4 5)) (type (list 'quote (+ 4 5))))
14:02clojurebotfalse
14:03sritchietechnomancy: I was just browsing around, and it looks like there's not necessarily a way to search archives,
14:03hyPiRion,(type `'~(+ 4 5))
14:03clojurebotclojure.lang.Cons
14:03sritchiethough I could set that up myself by retrieving the archive
14:03hyPiRionoh wow, it's actually consing that.
14:03technomancysritchie: I don't know if you really need a specialized search; they're just web pages
14:03technomancyleiningen foo site:librelist.org
14:03mikerodYes, I was wondering if there were any semantic implications of consing it instead of using a list.
14:04hyPiRionAs far as I know, there shouldn't be
14:05hyPiRion,(type (list* 'quote (list (+ 4 5))))
14:05clojurebotclojure.lang.Cons
14:05hyPiRionThat's probably what it is doing.
14:05mikerodAh, I see.
14:05hyPiRionWell, there shouldn't be a semantic difference, to answer your question
14:05mikerodThanks for the assistance.
14:06hyPiRionyou're welcome
14:06sritchietechnomancy: oh, yeah, of course
14:06sritchiethanks dude
14:07technomancysritchie: apart from the hashbang nonsense in google groups, the really annoying moderation UI was driving me nuts; spam hasn't been an issue with librelist yet
14:09technomancyI think they may have fixed it so that the moderation UI works in the mobile interface now
14:09Okasutechnomancy: Dump google groups, use nntp directly.
14:10technomancybut a while back if you turned off the mobile UI on your mobile device and visited the moderation page it would force you back into the mobile UI, in which the moderation page wasn't implemented
14:10OkasuSlrn nice client, and eternal september nice free provider.
14:10technomancyOkasu: tempting! not having a web UI to post is a good compromise though. =)
14:35thm_proverin my project.clj, I have ":main" referring to a namespace that does NOT return (i.e. it ends up running a SWT) loop. This apparently prevents the nREPL from running. How do I avoid this? I.e. I woudl like "lein repl" to (1) start up SWT on the main thread, and run the SWT gui thread on the main thread, yet (2) also run nREPL in the console.
14:35thm_proverThanks!
14:40trptcolinthm_prover: the annoying answer you probably don't want to hear is: don't perform non-returning actions at the top level
14:41trptcolinthat said, you should be able to add something like :repl-options {:init-ns user :init (do-some-stuff)}
14:41thm_provertrptcolin: SWT requires to run in the main loop
14:41thm_proverwhich means SWT will take the main loop
14:41trptcolinthen why not put it in the -main function
14:43thm_provertrptcolin: I am probably doing something wrong, but "src/init/init.clj 's -main" function is not called even when I have ":main init.init" in my project.clj file
14:44trptcolinin what context does it not get called? lein run?
14:45thm_prover"lein repl"
14:46thm_proverokay, "lein run" does run init/init.clj: -main
14:46thm_proverhowever, "lein run" does not give me a repl, and I want a repl
14:48hyPiRionWe need a union plugin for lein.
14:48hyPiRionlein union run, repl
14:49hyPiRionHmm, I wonder how that works semantically.
14:50trptcolinthm_prover: so maybe i'm unclear. how do you expect to be able to interact with the repl if something else is required to be running on the main thread?
14:50thm_proveralright, is there a way in my -main function to have something like "(.start (Thread. ... fork off a nrepl here))" ?
14:50thm_provertrptcolin: I expect the repl to run in another thread.
14:50thm_proverin fact, what commands does "lein repl" execute? I just want to execute those commands in a 2nd thread
14:51tomojlooks like reply.main/launch-nrepl
14:51jtoy_why cant I put this try around a map? (try (map #(Long. %) ["asdasd" 2]) (catch Exception _ []))
14:51hiredman~map
14:51clojurebotmap is *LAZY*
14:51jtoy_&(try (map #(Long. %) ["asdasd" 2]) (catch Exception _ []))
14:51lazybotjava.lang.SecurityException: You tripped the alarm! catch is bad!
14:51trptcolinhiredman: whoa, that was efficient use of keystrokes
14:52jtoy_so is this the "right way" to do this? (try (doall(map #(Long. %) ["asdasd" 2])) (catch Exception _ []))
14:52tomojwait
14:52jtoy_&(try (doall(map #(Long. %) ["asdasd" 2])) (catch Exception _ []))
14:52lazybotjava.lang.SecurityException: You tripped the alarm! catch is bad!
14:52tomojlaunch-nrepl is the client, ignore me
14:53trptcolinjtoy_: either that or put the try/catch in the fn you pass to map
14:53tomojthm_prover: https://github.com/clojure/tools.nrepl#embedding-nrepl-starting-a-server
14:54thm_provertomoj: looks like exactly what I need. Thanks!
14:54hyPiRionthm_prover: you can do something like :repl-options :init (doto (Thread. -main) .start) in the project map
14:54hyPiRionso like. (defproject ...... :repl-options {:init (doto (Thread. -main) .start)} ... )
14:54thm_proverhyPiRion: SWT requires that it runs on the main thread
14:55thm_proverhyPiRion: I believe your code will run SWT's gui loop on a non-main thread
14:55hyPiRionthm_prover: Which thread did you want to run in the background again?
14:56thm_proverhyPirion: I want nrepl in background; SWT on main
14:56hyPiRionooh, okay.
14:56tomojthm_prover: then you can use lein repl :connect
14:56thm_proverhang on, let me try these various combinations and report back
15:00pendlepa1tsidentify iw8ma3p
15:00S11001001pendlepa1ts: change it
15:00pendlepa1tsjust did.
15:05Ch3ckhey
15:05Ch3cki wish to learn clojure i wish to know its strengths on the web
15:06S11001001Ch3ck: http://clojure-doc.org/
15:08brain_shimhowdy y'all
15:08thm_proveris there a way to run eclipse _under_ clojure? I.e. I want more than just access to the SWT elements. I want access to all of eclipse from clojure.
15:08Ch3ckfine
15:08Ch3ckwhat is the best text available for learning clojure
15:08arrdemthm_prover: for a while I had most of the eclipse codebase added to my local .m2...
15:08arrdemthm_prover: but man was it ugly
15:08arrdemthm_prover: 5/5 do not reccommend
15:08thm_proverarrdem: I would love ot hear more.
15:09hyPiRionCh3ck: Do you want a book, or a webpage?
15:09brain_shimI'm trying to do "lein sub install" for (https://github.com/pedestal/pedestal), and I'm getting
15:09brain_shimlein-javac: system java compiler not found; Be sure to use java from a JDK
15:09brain_shimrather than a JRE by either modifying PATH or setting JAVA_CMD.
15:09Ch3ckbook..
15:09Ch3ckfor a beginner
15:09hyPiRionbrain_shim: you're using a JVM, not a JDK
15:09Ch3ckclear and complete..
15:09arrdemthm_prover: one of my many projects is semantic analysis of Java code, which involves a Java lexer/parser
15:10arrdemthm_prover: using Eclipse meant I didn't have to roll my own
15:10brain_shimI ran 'sudo apt-get install openjdk-7-jdk' and it spat out a bunch of update-alternatives lines.
15:10hyPiRionCh3ck: http://www.clojurebook.com/ <- This is the recommended book for people new to Clojure and lisp
15:10brain_shimhyPiRion: How do I switch it?
15:10thm_proverarrdem: oh, so you used it not for the GUI elements, but for the java parser/lexer ?
15:10hyPiRionbrain_shim: can you show me what you get when you do `java -version`?
15:10arrdemthm_prover: yeah. it was so bad that I built https://github.com/arrdem/sad yesterday so that rolling my own would be less painful.
15:11thm_proverarrdem: lol, I like the name.
15:11brain_shimhyPiRion: java version "1.6.0_27" OpenJDK Runtime Environment (IcedTea6 1.12.3) (6b27-1.12.3-0ubuntu1~12.04.1) OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
15:11arrdemthm_prover: the code is cuter than the name suggests I swear
15:11thm_prover(require 'me.arrdem.sad.grammars.bnf)
15:11arrdemyes, bnf is sad XP
15:11S11001001Sometimes I'm casually interested in some programming topic outside my usual interests, and buy a book on it. But then I find that the mere purchase has satisfied my casual desire to learn even a bit about that thing.
15:12hyPiRionbrain_shim: that's weird, I'm using the same version, but for debian
15:12arrdemthm_prover: anyway the Eclipse jar base is a mess... what I was doing was using a script to merge all the jars into one gigajar and then imprting it to maven
15:13thm_proverarrdem: alright, I'll go embed an jedit instead
15:13brain_shimhyPiRion: Curious! I just updated it. Maybe it hasn't fully updated wherever lein detects which java yet?
15:13thm_proverarrdem: thanks!
15:13arrdemthm_prover: no problem
15:13hyPiRionbrain_shim: however, for moving over to java 7, you can use `sudo update-alternatives --config java` to pick the java version you want to use
15:15S11001001hyPiRion: is that linked to the other tools?
15:15hyPiRionbrain_shim: But well, if that doesn't work, have a look at technomancy/leiningen#1082 - Seems like leiningen and pedestal don't dance salsa together yet
15:15lazybotjavac: invalid flag: -XX:+TieredCompilation while running lein sub -- https://github.com/technomancy/leiningen/issues/1082 is open
15:16scottjrelevance people: did you guys deliberately not post an ANN on pedestal to the clojure mailinglist or did I miss it?
15:16brain_shimhyPiRion: Awesome! I chose the 2nd option (I was still on jre-6) and then I ran 'lein sub install' and it worked! Thanks a bunch!
15:16hyPiRionbrain_shim: good! Enjoy :)
15:17hyPiRionS11001001: well, update-alternatives only change the `java` symlink, so no, it doesn't update javac etc
15:17hyPiRionBut leiningen uses java from within the JVM, so that should be an issue Lein-wise
15:17hyPiRionthen again, the issue I refered to earlier looks very strange for me.
15:18hyPiRionshouldn't be an issue*
15:19thm_proveris it just me, or is the repl in clooj not working?
15:19thm_proveri.e. the output seems to just repeat the input
15:29arrdemwow... multimethod + was easy
15:29arrdemtomoj, S11001001 thanks for the help
15:42Raynescldwalker: ping
16:29jcromartieI think the nREPL workflow is getting too hairy
16:30jcromartieI think I'll just stick with lein repl and midje autotest
16:39RaynesIs one meant to use java.jdbc/execute! to run stuff like UPDATEs and whatnot?
17:09arrdemshould I push the e+ e- e* and e* functions into the TolerancedNumber protocol? https://www.refheap.com/paste/12774
17:10XPheriorHey guys. I'm using clojure.tools.logging. Whenever I make a call to info, debug, etc, it returns nil no matter what properties file I use. Is there a way to diagnose if anything is messed up with the configuration?
17:14amalloyRaynes: i doubt it
17:15Raynesamalloy: About execute!?
17:15RaynesJustin seemed to think otherwise.
17:15amalloyyou probably want do-commands or do-prepared
17:22technomancyI use do-commands in my migrations
17:45RaynesSo, turns out execute! is part of the new API that is currently unreleased.
17:45RaynesLooks like it *will* be the way to do this in the next version of java.jdbc.
17:46RaynesToo bad seancljwest wasn't around to just tell me that to begin with.
17:46Raynes:(
17:47TimMcThis is why I don't like docs that aren't versioned with the code.
17:48TimMcI haven't looked really hard, but it's completely not obvious to me where I'd find the generated docs for the release of c.j.jdbc that I'm using.
17:53technomancydooooooocstrings
17:53technomancydaaaaaaaaawkstrings
17:53TimMcIf it's not in my browser, it doesn't exist.
17:53TimMc(Kidding. I <3 docstrings.)
17:54TimMcOh, that's an idea -- a plugin or lib that generates autodoc or whatever on the fly and pops it open in your browser.
17:54TimMc(browse-docs clojure.java.jdbc)
17:55technomancyM-. is hyperlinked too dude
17:58TimMcNot in my Emacs.
18:00stainnow that is a good movie title
18:02redingerscottj: We have not yet posted anything. We have been highly focused on getting the message out for Clojure/West, which has kept us pretty busy up to now.
18:26arohnerstupid question: I have done `lein tar`. How do I run it?
18:28joegallountar the result and your stuff is inside there
18:29hyPiRionarohner: If you want to make a standalone, do `lein uberjar` instead
18:29hyPiRionthen run it with `java -jar name-of-standalone.jar`
18:29arohnerhyPiRion: thanks
18:29technomancytypically if you are using lein tar it's because an uberjar won't cut it
18:30technomancyusually you'd put a bunch of bin/ scripts inside the tarball too
18:30technomancybut yeah, if you can use an uberjar you probably should =)
18:45ToxicFrogamalloy: can I tell lein not to ever AOT compile things, then?
18:46amalloyToxicFrog: just...don't gen-class, don't put :aot in your project.clj, and don't lein compile
18:48hyPiRionand no protocols either, I suppose
18:54ToxicFrogamalloy: why does the default core.clj :gen-class, then? Also, don't 'lein run', 'lein repl', and 'lein uberjar' implicitly compile?
18:56amalloythe default core.clj? are you talking about the one generated by lein new, or what?
18:56amalloybecause in any halfway-recent version of lein, that doesn't happen
19:03technomancygen-class doesn't really matter; just leave out :main and :aot
19:04technomancyToxicFrog: the default core.clj doesn't gen-class; only app does
19:04technomancythat's only in order to support uberjars
19:04technomancyimplicit compiles only happen if you have a :main/:aot
19:10ToxicFrogAah.
19:10ToxicFrogAnd yeah, I need a new app.
19:10ToxicFrog(and then realized halfway through that this should actually be an app and a separate library. Oops.)
19:10ToxicFrogs/need/made/
20:51antares_Monger 1.5 RC1 is out: http://blog.clojurewerkz.org/blog/2013/03/21/monger-1-dot-5-0-rc1-is-released/
21:59tieTYT2i'm new to FP and I have a design question. I'm writing a program that takes a url as input and depending on that url (ie: the domain), does different but similar things. If this were OO, I'd create a Site interface and the impls would do different things depending on the url input
21:59tieTYT2how would you design that in clojure?
21:59tieTYT2I know I could make something like a big switch, but that seems bad
22:00tieTYT2something like, "if it's this url, do this, if it's that url do that, ..."
22:03TimMctieTYT2: Without knowing more about your needs... this sounds like a general dispatch problem.
22:03tieTYT2yeah pretty much :)
22:03tieTYT2how do you idiomatically solve that in clojure?
22:04TimMcThere are a number of approaches, depending on how dynamic the data is and how compelx the dispatch is -- lookup in a map, multimethods, cond statements, case statements, core.match (which is dubiously maintained, I think...)
22:05tieTYT2are you thinking a map that has functions as a key?
22:05TimMcdomains as keys, functions as values
22:06tieTYT2cool that makes sense to me
22:08TimMctieTYT2: If you can parameterize the differences between how you handle different domains, you can have just one function and put the parameters as values in the map.
22:09TimMc(def site-awesomeness {"wikipedia.com" 5, "shapecatcher.com" 3})
22:09tieTYT2and then pass the key to a function?
22:10TimMc(defn print-awesomeness [how-awesome] (println "This awesome:" awesome))
22:10TimMcSo then you'd do (print-awesomeness (site-awesomeness (.getHost url) 0))
22:10tieTYT2yeah I think i'm going to go w/ the first suggestion, because at first thought, I think i want different enough logic for each domain
22:11tieTYT2ok thanks for the help
22:26tieTYT2what development environment do you guys use? I'm using LightTable and a repl in another window
22:28TimMcEmacs + lein repl, here. A lot of folks use SLIME to put the REPL inside Emacs. There are also a goodly number of vim users, and I think some using Sublime Text.
22:28TimMcNot sure how many use Eclipse or IntelliJ.
22:28devnWhy a separate REPL?
22:28TimMcdevn: Because it doesn't annoy me more than Emacs configuration.
22:29devnhm, I guess readline and such seems wildly inneficient
22:29devnto me
22:30xeqiTimMc: emacs + nrepl.el here
22:30tieTYT2i'm using a separate repl because i can't figure out how to run my program in lighttable
22:32xeqiack, wrong t name.. oh weel
22:32TimMcdevn: It's funny, because I couldn't *stand* doing my main coding without paredit...
22:33devnTimMc: Honestly, if you're using Emacs I don't know why you wouldn't just install nrepl and roll out. It's really simple. No config necessary.
22:43TimMcI need to rework stuff.
22:44TimMcMy current config is vaguely fucked, and I'd like to unfuck it.
22:44TimMc...but that's a project.
23:00tylerwhat are people using for generated css?
23:00tyleri tried gencss but its borking on me and hasn't been updated in forever
23:01tylercssgen rather
23:31callenbothttp://pyvideo.org/category/33/pycon-us-2013 guys, why aren't Clojure videos this accessible?
23:35rplacatechnomancy: is there a function in leiningen that will take a project map and return the classpath construct implied by the deps (either as a string or list)?
23:35scottjcallenbot: different recording groups (infoq and confreaks) have different procedures, and I suspect staggared releases get more views than huge dumps
23:35rplacalike "/home/tom/.m2...:/home/tom/.m2..."?
23:35TimMcrplaca: `lein classpath`
23:36TimMcThat's the CLI invocation, at least.
23:36rplacaTimMc: thanks, I can probably work from there to the internal version (I need it in a plugin)
23:37scottjtyler: I haven't done much css lately, but I used to use gaka and was happy with it (though I was happy with cssgen too)
23:37callenbotscottj: it still upsets me.
23:37tylerscottj: thnx
23:37callenbotscottj: it's supposed to be about the community, not a single entity
23:38scottjcallenbot: they want too encourage people to pay and go to the conference too, something they suspect will be less likely with same day video releases (I suspect)
23:38scottjcallenbot: how is it about a single entity?
23:39callenbotscottj: why can the Python community swing same day video releases, but we can't?
23:39callenbotscottj: we have a stronger need for getting the word out than they do.
23:39scottjcallenbot: the python community is 50 times bigger? bigger sponsors? more conferences (more competition)?
23:40scottjcallenbot: releasing videos over the course of the year like infoq does get shte word out better imo than releasing 50 videos in one that day most people don't have time to watch and will forget about.
23:40callenbotscottj: in the process, screwing us working stiffs that can't go to the conference but are already plugged into the community.
23:40callenbotor those that couldn't catch all the talks they wanted to see
23:41scottjcallenbot: giving you almost immediate access to the slides and free access to expensive-to-produce videos is hardly screwing you
23:41callenbotscottj: absent the option to pay for access, yes it is.
23:42callenbotI'd gladly pay for some $15 or $20 package for access to all the videos on the day after.
23:42scottjcallenbot: so not offering you sex for money is considered screwing you :)
23:42callenbotscottj: you're the one that said they needed to make money
23:43callenbotI'm not even given the option of just paying for the damn videos.
23:43callenbotthey act like they're the goddamn disney vault
23:43scottjcallenbot: the videos aren't made yet. they have to be worked on.
23:43callenbotI don't mean right now
23:43callenbotI mean in general
23:44scottjglhf
23:58TimMccallenbot: Even for hyperbole, comparing this to Disney is laughable. :-P