#clojure log - Mar 20 2013

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

0:08 pocho: Say 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.

0:08 For depth 3 (apply map (fn [& b] (apply map (fn [& c] (apply map f c)) b)) a)

0:09 Is there a cool way to do this for arbitrary depth?

0:32 TimMc: amalloy, brehaut: grep -e '@@\+' -nR --include=*.clj -- repos/

0:33 Almost all pprint stuff.

0:34 clojure/src/clj/clojure/pprint/{column_writer,pprint_base,cl_format,pretty_writer}.clj and tests

0:35 ,@@#'clojure.core/*loaded-libs* <-- midje

0:35 clojurebot: #{clojure.core.protocols clojure.instant clojure.java.io clojure.repl clojure.string ...}

0:35 TimMc: I found no triple cabbages.

0:39 amalloy: TimMc: consecutive cabbages are sufficient but not really necessary

0:39 brehaut: haha midje, thats quite a line

0:42 amalloy: eg, 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)

0:43 or, realistically, @(-> (swap! m (fn [m] (...add a delay for k, or reuse existing...))) (get k))

0:51 TimMc: ,(macroexpand-1 '(->> x @@y)) hmmm

0:51 clojurebot: (clojure.core/deref (clojure.core/deref y) x)

0:51 TimMc: I wonder if you could build up a cabbage farm (that's 3 or more in a row) with clever use of threading macros.

0:52 (in a way that reduces to the kind of code you're talking about)

1:00 amalloy: TimMc: i don't follow

1:06 johnmn3: I have a function in clojurescript like this: (defn fbin [f] (let [jf (js/FileReader.)] (.readAsBinaryString fr f) (.-result fr)))

1:06 hiredman: pointed out to me a few days ago why this didn't work... because of js' asynchronous nature

1:07 you would normally call the (.-result fr) inside the file reader's 'onload' callback

1:09 and 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.

1:09 (external atom, meaning an atom outside the function)

1:12 And 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.

1:13 amalloy: johnmn3: seems like you ought to just embrace the asynchrony, and set an onload callback that continues whatever computation you were in the middle of

1:14 johnmn3: https://www.refheap.com/paste

1:14 amalloy: that's what I'm trying to do, I think. Does the code above not handle things asynchronously?

1:15 amalloy: johnmn3: you just linked to refheap's front page

1:15 johnmn3: ah

1:15 https://www.refheap.com/paste/12747

1:18 put 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

1:18 the doall there is probably not necessary

1:19 was just experimenting

1:19 Raynes: Why are you doing the _ lets for side effects? Just run them in the body of the let.

1:20 johnmn3: cause I want to capture the value from the atom afterward, then nil out the atom.. not necessary, perhaps

1:23 here's another: https://www.refheap.com/paste/12751

1:23 outside of the let... and a little cleaned up

1:29 bdash: johnmn3: 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

1:29 johnmn3: ah

1:30 yea, cause doing each step in the repl works perfectly fine.

1:30 put them in a function together.. no love

1:31 doing this works fine: https://www.refheap.com/paste/12752

1:32 bdash: johnmn3: 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

1:33 mattmoss: Is it acceptable to let the caller deref, rather than deref within the fn?

1:34 amalloy: johnmn3: it seems like you don't understand javascript's event model. your goal is fundamentally at odds with how things work

1:34 johnmn3: is 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?

1:35 amalloy: (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)

1:35 bdash: johnmn3: you can get at the value within the onload handler

1:35 johnmn3: you can pass it on to any function you'd like from there

1:36 johnmn3: bdash: I'm using an onload handler here: https://www.refheap.com/paste/12751

1:37 amalloy: johnmn3: all computation that depends on the results of this file-read must happen within that onload handler

1:37 not "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

1:38 (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)

1:39 johnmn3: and 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...

1:40 or an await function

1:40 amalloy: johnmn3: readAsBinaryString registers a callback somewhere, and then returns immediately

1:40 because javascript is single-threaded, await makes no sense. you really cannot force this asynchronous environment to act synchronous

1:41 perhaps read up on continuation-passing style in scheme, because the same techniques apply, or read some example programs in javascript

1:46 bdash: http://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

1:51 amalloy: bdash: 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

1:52 bdash: amalloy: 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 :-/

1:53 muhoo: is 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 :-/

1:53 wei_: 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.

1:53 amalloy: muhoo: mention it to alexbaranosky, and then it will probably start working

1:53 muhoo: wei_: it traverses them in order and falls through

1:54 wei_: ah, so not found is a catch-all?

1:54 muhoo: wei_: yep

1:54 amalloy: thanks, i'll march off to github

1:55 amalloy: wei_: not-found is roughly equivalent to (fn [request] {:status 404 :body "nothing here dude"})

1:56 ie, a function that ignores its input and always produces a 404 page

1:57 good content in the slides though, bdash. i like the exercises

2:10 muhoo: where are the slides for cljwest? they're usually up on github somewhere, IIRC

2:12 scottj: muhoo: https://github.com/strangeloop/clojurewest2013 nothing there yest though

2:12 muhoo: thanks

2:13 haha, last commit 18 minutes ago :-)

3:21 devn: ,"\s+|\(|\)"

3:21 clojurebot: #<RuntimeException java.lang.RuntimeException: Unsupported escape character: \s>

3:21 devn: Is that normal?

3:24 hyPiRion: devn: yes

3:24 You probably forgot the # in front

3:24 devn: hyPiRion: hmph, guess i've never run into that

3:25 hyPiRion: well, why does a string freak out over \s?

3:25 hyPiRion: ,#"\s+|\(|\)"

3:25 clojurebot: #"\s+|\(|\)"

3:25 hyPiRion: devn: because there's no escape character named \s.

3:25 You have \t, \n, \r, etc.. but no \s

3:25 devn: oh im aware

3:27 how do you get a string with \s in it, then?

3:28 hyPiRion: \\s

3:28 ,"\\s"

3:28 clojurebot: "\\s"

3:28 * devn sighs

3:28 devn: duhhh

3:28 ,(println "

3:28 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading string>

3:29 devn: ,(println "\\s")

3:29 clojurebot: \s\n

3:51 wei_: is "pop" exactly the same as "first", but with an exception if the list is empty?

3:51 sorry, "rest" not "first"

3:52 hyPiRion: hmm

3:52 ,(pop (list 1 2 3))

3:52 clojurebot: (2 3)

3:52 hyPiRion: ,(rest (list 1 2 3))

3:52 clojurebot: (2 3)

3:53 hyPiRion: ,(rest [1 2 3]))

3:53 clojurebot: (2 3)

3:53 hyPiRion: ,(pop [1 2 3]))

3:53 clojurebot: [1 2]

3:53 hyPiRion: ^

3:54 ,(rest #{1 2 3})

3:54 clojurebot: (2 3)

3:54 hyPiRion: ,(pop #{1 2 3})

3:54 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentHashSet cannot be cast to clojure.lang.IPersistentStack>

3:54 * hyPiRion shrugs.

3:59 wei_: aha, thanks.

4:46 drorbemet:

4:55 Glenjamin: does anyone know of a library that provides assertions for ring response maps?

4:56 (has-cookie response "CookieName") and so on

5:14 wei_: how do i set properties on an the html tag in hiccup? e.g. <html ng-app></html>

5:21 Glenjamin: maybe try wrapping a generic Clojure validator (e.g. http://clojurevalidations.info/) into a ring handler

5:22 Glenjamin: wei_: i'll take a look, my use-case is specifically for behaviour tests though

5:22 hyPiRion: wei_: [:a {:href "link"} "the text that's shown"]

5:22 For example.

5:23 wei_: yes, but the html function doesn't seem to work that way.

5:23 hyPiRion: oh, I see what you're saying

5:23 wei_: specifically, I want to add an attribute to the root <HTML> tag

5:24 hyPirion: trying to figure out whether your name is a Starcraft reference…

5:27 hyPiRion: wei_: 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.

5:28 *it's

5:28 Also, I thought it was a Borderlands reference, not a Starcraft reference.

5:29 wei_: there's a Hyperion in Starcraft. everyone borrows from Greek mythology I guess

5:31 ejackson: also a scifi novel...

5:31 talk about your overloaded term ;)

5:31 p_l: wei_: Greek mythology is shared cultural background of Europe

5:32 it's more than just borrowing from it, it's closer to be definitions of concepts represented by common words

5:33 hyPiRion: ejackson: And the scifi took from Keats' "Hyperion" as well

5:33 ejackson: ha! I didn't know that :)

5:33 weird book - something about a pincushion overlord

5:33 hyPiRion: ejackson: Have you read it?

5:33 ejackson: years back

5:34 noprompt: oh awesome. people are awake. :)

5:34 hyPiRion: haha @ pincushion overlord

5:34 pincushion multi-armed metal time-bending overlord

5:35 noprompt: this pattern (map #(apply fn %) coll) seems to crop up often, is there a better way?

5:35 wei_: apparently Hyperion was a Titan, the first of the gods. so you go way back, Pierre

5:36 p_l: well, one of kids of Chaos and Gaea?

5:36 wei_: nopromt: what about (map fn coll)?

5:36 ejackson: noprompt: looks fine to me

5:36 hyPiRion: noprompt: (for [c coll] (apply fn c)) ? Depends on what the apply is used for

5:36 * p_l is iffy on naming of the earliest beings of greek cosmology

5:36 noprompt: the coll contains vectors

5:37 wei_: ah i see

5:37 hyPiRion: p_l: Chronos

5:38 noprompt: hyPiRion: yeah, the other way i tried it was (for [[h t] vs] (fn h t))

5:38 p_l: hyPiRion: Chronos was the father? then Hyperion was 2nd generation

5:38 hyPiRion: noprompt: well, are the vectors of a constant size, or of a variable way?

5:38 *length

5:38 noprompt: hyPiRion: they're tuples of length 2

5:38 hyPiRion: p_l: yeah, he was a Titan

5:39 noprompt: 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)

5:39 p_l: first (origin) was Chaos and the being that became from it, Chronos was kid of that being (just not sure on naming, Gaia or similar?)

5:39 noprompt: hyPiRion: funny you should mention that. the result is wrapped in a clojure.string/join

5:40 wei_: noprompt: or, you could define the (apply fn %) as a separate function, apply-args and then (map apply-args coll)

5:40 hyPiRion: p_l: No, Erebus and Nyx were the children of Chaos

5:40 noprompt: wei_: i was thinking of (defn mapply [fn coll] ...)

5:41 hyPiRion: p_l: but then again, there isn't just one Greek mythology

5:41 p_l: hyPiRion: true, I just don't remember the naming

5:41 it's just that I remember Kronos being "second" after the beings born of Chaos

5:42 noprompt: the thing is, i feel like i've written the combination at least more than a few times in separate codebases.

5:42 i wasn't sure if there was something core that accomplishes the same thing already.

5:42 hyPiRion: ~mapply

5:42 clojurebot: You could (defn mapply [f & args] (apply f (apply concat (butlast args) (last args))))

5:43 hyPiRion: not entirely what you'd like, I think.

5:43 noprompt: hehe. maybe i'll name it map-apply then.

5:43 hyPiRion: hmm

5:44 noprompt: mapply seems strangely familiar. was that in the PAIP book?

5:44 wei_: noprompt: that works. or for extra composability, (defn make-apply-fn [fn] (partial (apply fn)) (map (make-apply-fn fn) coll)

5:45 noprompt: wei_: that's interesting.

5:45 i need to get better at making composable fns

5:46 hyPiRion: well, (partial apply fn) is way slower than #(apply fn %) sadly.

5:47 wei_: aww. I was thinking if you ever needed to you could also then (reduce (make-apply-fn fn) coll)

5:47 ejackson: as an aside, I'm making a reading list of non-fiction books about 'where we came from and what we do'

5:47 https://gist.github.com/ejackson/5203517

5:48 those are some of my favourites in no particular order

5:48 anybody want to add ?

5:48 wei_: Is that an ordered list?

5:48 ejackson: its a set :)

5:48 noprompt: would (for [x coll] (f x)) favor better than (map #(apply f %) coll)?

5:49 ejackson: noprompt: you'd still need an apply though ,right ?

5:50 noprompt: oh right. i meant (apply f x) inside the for there.

5:50 hyPiRion: well, (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)

5:51 And usually speed shouldn't be a concern

5:52 noprompt: hyPiRion: it's not. it was a question of pure curiosity.

5:53 ejackson: i liked "The Hacker Ethic"

5:53 ejackson: cool, I'm planning on putting together some list of the books liked by the Clojure crowd

5:53 sort of, defining our community history and culture

5:54 but not so obnoxious sounding

5:54 noprompt: ejackson: glancing at that reading list makes me wonder if i should return to college.

5:55 ejackson: why ?

5:55 noprompt: ejackson: oh it just got me thinking about how much i've grown as a programmer thanks to open source and having a hacker attitude.

5:55 hyPiRion: ejackson: I think this one is cool: http://www-formal.stanford.edu/jmc/robotandbaby/robotandbaby.html

5:56 It's more of the AI evolution and thoughts around it

5:56 noprompt: ejackson: the hacker ethic clears the air around the work "hacker" which even so-called "hackers" don't know the definition of.

5:56 s/work/word

5:56 ejackson: cool, cool - check out "The Brainmakers' for similar

5:56 i'm planning on putting out a tweet (US hours, of course) to try get ppl to fork, update and merge in new books

5:57 create a community list

5:57 set

5:57 :)

5:57 noprompt: i 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.

5:58 talking to the same guys that are graduating from the same program i dropped out of kind of reenforces that posture.

5:59 hehe, plus there's a lot of smart guys in this room who've said it's not really necessary.

6:00 i dunno, bit of a catch 22(?).

6:00 ejackson: but yeah, that list looks great.

6:04 so i'm working on a CSS type of thing for clojure.

6:05 would compiling separate parts of the stylesheet concurrently be overkill?

6:09 hehe, i'm guessing using clojure to write "hard core" stylesheets isn't a popular topic.

6:10 rodnaph: noprompt: what are you planning to add to the css-pre-processor party?

6:10 clgv: noprompt: take the usual route and just try if sequential compiling suffices

6:11 noprompt: rodnaph: well, i'm not really happy with what we've currently got. not saying they're bad libs or anything.

6:11 rodnaph: but i feel like the approach is off.

6:12 like gala and cssgen use [:selector :prop-1 "val" :prop-2 "val" [:nested-selector …]]

6:12 clojurebot: ,(let [testar (fn [x y] (if (= (reduce + (filter odd? (range 0 x))) y) (str y " is an")) )] (testar 10 25))

6:12 rodnaph: noprompt: 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.

6:12 noprompt: s/gala/gaka

6:12 but i've experimented with that approach and it get's ugly

6:13 both avoid using maps for declarations because in some cases order is useful

6:13 however, i think maps are fine

6:13 if order matters just use another map

6:14 [:selector {:prop "value"} {:prop-1 "value"} [:nested-selector …]]

6:14 then compile the declarations and concatenate them.

6:15 also this is something interesting i've found comes from this approach

6:15 [:sel {:font {:family "monospace" :size "16px"}}]

6:15 del { font-family: monospace; font-size: 16px }

6:16 rodnaph: i'm still experimenting, but i've attempted this 3 times and i think i'm heading in a good direction.

6:17 i've also built in output options which are missing in other libs

6:18 rodnaph: 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

6:20 rodnaph: noprompt: 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.

6:20 noprompt: rodnaph: this will generate code to spec

6:20 rodnaph: so, 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.

6:20 noprompt: rodnaph: some of the more "dangerous" stuff i'll focus on later

6:21 rodnaph: were you also suggesting comparing css and html and eliminate dead css?

6:22 rodnaph: noprompt: 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.

6:23 it 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)

6:23 noprompt: rodnaph: yeah, the big downside to that a class might be significant somewhere else like in *ahem* javascript

6:24 it's a sad fact but not everyone knows that you should just use data attributes for manipulating the dom with something like jquery

6:24 at least i've found that approach has lead to jquery code that's been far easier to maintain in the past.

6:25 rodnaph: noprompt: yah agree.

6:25 if 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.

6:25 noprompt: i completely agree though. that would be really awesome.

6:26 rodnaph: and if we're modelling everything as data in our app, then that seems more achievable.

6:26 noprompt: hehe, yep. if i had a nickel.

6:26 i did talk to one of the css spec authors at w3conf.

6:26 rodnaph: it seems to be the best place to start thinking about a solution at least.

6:26 noprompt: css needs rule scoping.

6:26 or namespacing.

6:27 he agreed, but i'm too damn lazy to join the mailing list.

6:27 the only way i know of to avoid css scoping issues with rules screwing up stuff is to use an iframe with a separate stylesheet.

6:28 and that's just diry.

6:28 or using a block level reset which compass lets you do.

6:29 but that ends up barfing more insane selector madness in to the final product for probably little gain,

6:29 the other terrible part of css imho is the syntax. it's so adhoc.

6:31 for instance. font-family: one, two, three; vs box-shadow: 0 1px black, 0 2px 3px #333;

6:31 it's insane.

6:31 like it's not clear at all when and where things need to be comma delimited, which values can be omitted etc.

6:31 hyPiRion: If syntax is the worst problem, then CSS surely is well designed.

6:32 noprompt: hyPiRion: the problem with css is the illusion that it's simple. it's not.

6:33 hyPiRion: i mean between html, css, and js. html is the only thing that's not totally broken.

6:33 hyPiRion: heh

6:36 The thing I meant was, if the syntax is the thing most people complain about, then it doesn't seem to have many problems

6:36 granted, there's only so much CSS covers.

6:37 noprompt: yeah, and it cracks me up when i talk to people about that.

6:37 they're like what?! no, css is great!

6:37 and then i'm like yeah, pass me the joint.

6:37 hyPiRion: heh

6:39 noprompt: the problem is that the people using CSS are typically *spoiler-alert* designers.

6:39 so when i bring it up i can run out of town.

6:39 s/can/get

6:41 hyPiRion: but you're right though. vim script is certainly worse.

6:43 the funniest thing about css and js is that the "best practice" is slowly shifting to "don't write them in the raw"

6:46 oh 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.

6:50 i'm thinking of using meta to deal with media queries

6:51 ^:screen [:selector {decls}], ^{:orientation :portrait} […]

6:56 supersym: cute

7:06 noprompt: hehe, *thinking* being the keyword there

7:07 but a media query is a lot like meta

7:07 it's just about rules

8:46 TimMc: I've had good results with following SMACSS rules for CSS.

8:46 I've not used it on any really big sites, but it feels scalable.

9:07 aka: yeah smacss and oocss are nice

9:07 I also think BEM is nice for scalability/maintenance

9:10 uvtc: Are there any slides available for either tbaldridge's or takeoutweight's talks? (These would be the clojure-py/llvm and clojure-scheme talks.)

9:12 Will 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?

9:18 aka: whoa, just realized how much of an acronym asshole I probably came off

9:18 pepijndevos: uvtc: found anything?

9:18 uvtc: Not yet, no.

9:19 pepijndevos: aka: what are they?

9:20 ejackson: probably be a while...

9:21 jcromartie: is there a way to fix Midje REPL output in Emacs/nREPL?

9:21 it looks awful

9:22 lots of control (colorizing?) characters leaking through

9:23 aka: pepijndevos: 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

9:23 clgv: jcromartie: I think there is some option to turn of colorizing

9:23 jcromartie: and what the heck is this

9:23 https://www.refheap.com/paste/12758

9:23 real useful there...

9:23 oops

9:24 I'm an idiot

9:24 blinded by leaky control character rage

9:24 drorbemet: Is there a clojure-refactoring lib for clojure 1.5?

9:24 jcromartie: :P

9:25 drorbemet:

9:35 Pupnik-: woah when did cloj 1.5 come out

9:36 hyPiRion: ages ago

9:37 Pupnik-: hmm i wonder why i have 1.4 then

9:37 hyPiRion: "ages", like 2 weeks or so? And 1.5.1 came out last week iirc

9:37 Pupnik-: oh

9:38 hyPiRion: lein 2.1.0's project templates comes with 1.5.1 now, upgrade with `lein upgrade 2.1.0`

9:40 Pupnik-: cheers

9:40 clgv: oh the lein 2.1 release happened^^

9:41 but just 11 hours ago ;)

9:41 hyPiRion: rejoice!

9:49 drorbemet: Does some one has some experiance with https://github.com/joodie/clojure-refactoring?

9:49 pepijndevos: lein 2.1?! cool

9:52 someone update homebrew?

10:01 clgv: pepijndevos: "lein upgrade"?

10:01 pepijndevos: clgv: yea, no… wait. I had a checkout, which said do not do that.

10:02 clgv: pepijndevos: huh what?

10:02 pepijndevos: that's the way when you install lein manually.

10:03 pepijndevos: I installed lein from source one day. it told me it can't upgrade

10:03 uvtc: lein 2.1.0 seems to start up a bit more quickly than the previous version.

10:04 So it's got *that* going for it. Which is nice.

10:05 clgv: pepijndevos: well, it works for releases I upgrade through the 2.0 previews until 2.0 release using "lein upgrade"

10:05 * pepijndevos brew installs

10:06 hyPiRion: pepijndevos: do the manual install (not source)

10:06 source is slower than the aot-compiled one

10:06 antoineB: hello, does exist a function like map, but which pass as parameter to the modifier function the previous computed element?

10:06 clgv: do you get any advantage by using brew for leiningen?

10:07 pepijndevos: convenience

10:07 clgv: antoineB: no.

10:07 pepijndevos: antoineB: (map f l (next l)) ?

10:08 clgv: pepijndevos: not the previous in the source coll but the (f prev) ;)

10:08 pepijndevos: antoineB: or something like reductions?

10:08 antoineB: i as do something like reductions

10:08 i think the scala "fold" function do what i want

10:09 hyPiRion: ,(reductions + (range 10))

10:09 clojurebot: (0 1 3 6 10 ...)

10:10 hyPiRion: reduce with history for each reduction performed

10:15 clgv: antoineB: you could also change map to pass the previous result to the next call

10:16 antoineB: (reduce #(+ %1 (mod %2 %1)) (conj '(1 2 3 4) (mod (first '(1 2 3 4)) 5)))

10:16 clgv: antoineB: I mean create your own lazy function application based on map. minimal effort^^

10:16 antoineB: it will look likre something close to that

10:28 https://www.refheap.com/paste/12761 is what i need, but i would like it lazy

10:34 clgv: i can't do it with map

10:38 clgv: antoineB: how about that? https://www.refheap.com/paste/12762

10:38 it has no special support for chunked-seqs though

10:40 the example is only for demo that it works. the same result would be possible via reductions. ##(reductions + (repeat 5 1))

10:40 lazybot: ⇒ (1 2 3 4 5)

10:41 antoineB: clgv: i will use reductions

10:42 clgv: antoineB: if it really fits, fine. :) I assume there are scenarios where map2 suits better than reductions

10:45 antoineB: i didn't know the lazy-seq construct

10:56 opa: hi, does anyone know how to configure maven to compile clojure code before compiling java code if both are used in the same project?

11:07 antoineB: how to test if something is false or nil? #(or (false? %) (nil? %))

11:08 nDuff: antoineB: just use it as a truth value.

11:08 antoineB: false or nil are the only things that behave like false.

11:08 antoineB: i know

11:08 nDuff: ...so, err, why are you trying to do this test explicitly at all?

11:09 antoineB: to pass it as function

11:09 nDuff: Don't bother with (or (false? yourthing) (nil? yourthing)), just use (not yourthing)

11:09 antoineB: ok

11:09 nDuff: If you didn't need to invert it, you could use the identity function

11:10 which has the advantage of being in the standard library (and is the idiomatic thing for the purpose).

11:10 jtoy_: 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:11 antoineB: nDuff: i was just needed "not"

11:12 jtoy_: you mean (def abc (with-open [a ...] a)) ?

11:12 nDuff: jtoy_: 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:12 jtoy_: ...but it's not clear what you meant without more explicit code.

11:14 clgv: jtoy_: it will be run everytime the namespace gets reloaded

11:19 nDuff: jtoy_: ...if you don't want it to happen on reevaluation, see defonce.

11:37 TimMc: Does proxy not allow definition of new methods?

11:39 Or more interestingly, new arities for existing methods?

11:40 nDuff: TimMc: There's a reason gen-class still exists. You could generate an interface with the new signatures, though.

11:41 TimMc: I don't actually need it; I was trying to experiment with proxy syntax without bringing in the actual superclass. :-)

11:42 ,(. (proxy [Object] [] (toString [] "foo")) (toString))

11:42 clojurebot: "foo"

11:43 TimMc: ,(. (proxy [Object] [] (toString ([] "foo") ([bar] "bar"))) (toString))

11:43 clojurebot: "foo"

11:43 TimMc: ^ so it even lets you "define" the new arity...

11:43 ,(. (proxy [Object] [] (toString ([] "foo") ([bar] "bar"))) (toString "second"))

11:43 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: toString for class sandbox.proxy$java.lang.Object$0>

11:43 drorbemet: Does anybody know an example for the fold function in Clojure 1.5?

11:45 clgv: drorbemet: (require '[clojure.core.reducers :as r]) (r/fold + (r/map inc (range 100)))

11:47 TimMc: ,*clojure-version*

11:47 clojurebot: {:major 1, :minor 5, :incremental 0, :qualifier "RC6"}

11:47 TimMc: ,(require '[clojure.core.reducers :as r])

11:47 clojurebot: #<FileNotFoundException java.io.FileNotFoundException: Could not locate clojure/core/reducers__init.class or clojure/core/reducers.clj on classpath: >

11:47 drorbemet: clgv: 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:48 clgv: drorbemet: ah so you want `reduce`

11:48 drorbemet: clgv: just a moment I put together an example

11:48 clgv: ,(reduce + (map inc (range 100)))

11:48 clojurebot: 5050

11:48 antoineB: is there a function to know the size of an object? (like sizeof in c)

11:49 clgv: antoineB: not really since it is not that easy

11:50 TimMc: antoineB: For what purpose?

11:50 antoineB: profiling in definitive, but now just for knowing

11:51 clgv: antoineB: you can use a profiler for that ;) JVisualVM, Yourkit Java Profiler ...

11:52 TimMc: There'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:52 All very different numbers.

11:52 sizeof wouldn't tell you much for profiling.

11:53 drorbemet: clgv: lets say predicate returnes true at 2 and 4 then this [1 2 3 4 5]

11:53 should result in something like this map {:2 1, :2 2, :2 3, :4 4, :4 5}

11:53 after that I whant to apply group-by ... resulting in groups for 2 and 4

11:54 TimMc: drorbemet: That's not a valid map.

11:54 drorbemet: clgv: is this a parsing problem, or pairing, or folding ...? I confuse these untill now

11:54 clgv: drorbemet: you have multiple keys with the same value which will override each other in the map

11:54 TimMc: and hwo do you know that 1 gets 2?

11:54 drorbemet: TimMc: ok right I meant a valid map

11:55 TimMc: "A valid map" doesn't tell me what it looks like.

11:55 Here's a valid map: {[] "woot"}

11:55 Presumably it is not the one you wanted. :-P

11:55 drorbemet: clgv: ah, right, so a map is not good for this

11:56 TimMc: hang on a second

11:56 TimMc: drorbemet: 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:56 clgv: drorbemet: I do not grasp your problem from the one example. maybe you can give more examples with explanation

11:56 drorbemet: clgv: ok

11:59 clgv: drorbemet: or laike TimMc said: what is the overall function/algorithm that shall be computed in terms of input and output?

12:03 TimMc: ,(->> (for [[n v] (ns-publics 'clojure.core)] [n (count (:doc (meta v)))]) (sort-by second >) (ffirst))

12:03 clojurebot: gen-class

12:03 TimMc: I guess that's no surprise.

12:05 hiredman: the java object model in a single doc string

12:05 clgv: &(doc gen-class)

12:05 lazybot: ⇒ "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:06 clgv: oh wow.^^

12:06 mikerod: Is there a way to test if a form is quoted? That works like: (quoted? 'a) => true | (quoted? "a") => false

12:07 clgv: mikerod: on macroexpansion time yes. on runtime it is either a symbol or a collection

12:08 mikerod: (defmacro check [x] (println x)) (check 'a) => "(quote a)"

12:09 drorbemet: clgv: 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:09 I want to skip all values before the first key appears.

12:09 Keys can appear multiple times and can appear in direct succession or at the very end of the sequence

12:09 my try at the moment looks like this ... if I partition that in pairs keys that appear in direct succession are glued together ...

12:09 (partition-by #(contains? #{2 5 8 7 14} %)

12:09 (drop-while #(not (contains? #{2 5 8 7 14} %)) [1 2 3 4 5 6 7 8 9 10 11 12 13 14]))

12:09 => ((2) (3 4) (5) (6) (7 8) (9 10 11 12 13) (14))

12:09 mikerod: clgv: That makes sense. Thanks.

12:12 clgv: drorbemet: is there a name for that problem?

12:15 drorbemet: clgv: 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:16 clgv: drorbemet: so you want a seq like ((key, key ...) (no-key, no-key, ...) (key, ..) (no-key, ..) ...) ?

12:19 drorbemet: clgv: yes that's the input: (no-key, key1, no-key1, no-key1, key2, no-key2, key3)

12:19 clgv: drorbemet: and what is the output supposed to look like?

12:19 drorbemet: clgv: it's like parsing, only that I have the feeling that I should need parser for that

12:20 * clgv waves white flag

12:20 drorbemet: clgv: sorry one moment the output follows

12:22 * jam256 slaps ahoops around a bit with a large trout

12:23 drorbemet: clgv: the output is a map of the keys with their values grouped together:

12:23 {:key1 [no-key1, no-key1] :key2 [no-key2] :key3}

12:27 clgv: I think I will just write a recursion myself ... just hoped that there whould be a way to combine existing functions ...

12:27 ieure: I know there's got to be an easier way to do something like (partition 2 (interleave (range) [:a :b :c]))

12:28 clgv: ieure: zipmap

12:28 S11001001: just map

12:28 clgv: oh damn right. you want no map ;)

12:28 S11001001: ,(map vector (range) [:a :b :c])

12:28 clojurebot: ([0 :a] [1 :b] [2 :c])

12:29 ieure: That looks good.

12:29 clgv: or do you really want: ##(zipmap (range) [:a :b :c])

12:29 lazybot: ⇒ {2 :c, 1 :b, 0 :a}

12:29 ieure: clgv, I want to preserve order.

12:29 silasdavis: how can I obtain {:fish "cod"} from {:fish "cod" :mammal "zebra"} ?

12:30 as in slice by keys

12:30 clgv: silasdavis: select-keys

12:30 hyPiRion: ,(map-indexed vector [:a :b :c])

12:30 clojurebot: ([0 :a] [1 :b] [2 :c])

12:30 silasdavis: sorry I should say possibly multple keys

12:30 S11001001: mmm

12:30 clgv: silasdavis: select-keys

12:31 silasdavis: clgv, thanks

12:37 can I write (map #(select-keys % [:a :b]) sequence) in a better way?

12:38 hyPiRion: (for [s sequence] (select-keys s [:a :b]))

12:38 It's not better though, just different

12:39 clgv: hyPiRion: well it avoid the anonymous function ;)

12:40 silasdavis: is there away to partially apply on second argument ? or leave open on the left or something ?

12:41 hyPiRion: (defn partial-1 [f & args] (fn [x] (apply f x args))) ?

12:42 or perhaps... (defn partial-1 [f & args] (fn [& more-args] (apply f (concat more-args args))))

12:42 silasdavis: hyPiRion, that looks like the sort of thing

12:44 then ... (map (partial-l select-keys [:a :b]) seq) right?

12:44 hyPiRion: yeah

12:44 ieure: Okay, where do I get nREPL Javadoc middleware?

12:48 clgv: ieure: erm what?

12:48 ieure: "C-c C-j nrepl-javadoc"

12:48 But when I try to use it: No Javadoc middleware available

12:49 clgv: ah emacs nrepl.el stuff... no idea..

12:50 carado: hello.

12:51 ieure: Looks like it's part of Ritz.

12:51 clgv: people are always not precise whether they mean nREPL or nREPL.el...

12:54 carado: i’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:54 i have no idea where that could come from, though :(

12:55 i 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:17 jcromartie: are people really using agents?

13:17 pjstadig: no it's just a big joke

13:17 you've been PUNK'D

13:19 we have a couple of uses of agents in our codebase

13:19 hiredman: almost entirely around hold side effects till a stm transaction completes

13:19 holding

13:20 pjstadig: i think one is for gathering stats

13:20 which is not stm related

13:20 hiredman: ah, right

13:27 ieure: technomancy, Is there some way to force `lein upgrade' or `lein install' to give me 2.1.0?

13:27 It installs 2.0.0.

13:28 babilen: ieure: "lein upgrade 2.1.0" should work

13:28 ieure: Whack

13:28 Okay

13:32 technomancy: yeah, caught that bug 5m after it went out =(

13:35 arrdem: is there a way for me to create a new Number type without modding the Clojure Core?

13:41 tomoj: arrdem: you can use proxy

13:41 S11001001: arrdem: depends on what you mean by "create a new number type"

13:42 if you mean "such that clojure.core/+ just works", no, not really

13:42 arrdem: tomoj: proxy?

13:42 S11001001: okay I was getting that sinking feeling.

13:43 llasram: Wasn't there a library which provided multimethod-based core numeric operations?

13:43 S11001001: I believe there is

13:44 arrdem: S11001001: it looks like one could implement foo.bar/+ as a superset of core/+ tho.

13:44 S11001001: arrdem: absolutely.

13:44 tomoj: hmm

13:44 https://www.refheap.com/paste/0ab90f987973ede62d7a088c5

13:45 arrdem: llasram: it's in contrib, but one exists.

13:45 tomoj: I guess this works when your + is just "convert to sane Number, then +"

13:46 llasram: Ah

13:46 tomoj: https://www.refheap.com/paste/85d48c4dfb74c78c43a5d0c8d

13:50 mikerod: Is 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:51 That cut off on my screen I had `'~(first some-form)

13:52 hyPiRion: mikerod: What would quoting it give you?

13:52 ,(identical? `'~(+ 4 5) (+ 4 5))

13:52 clojurebot: false

13:52 mikerod: It would "wrap" the results in a quote.

13:53 hyPiRion: ,`'~(+ 4 5)

13:53 clojurebot: (quote 9)

13:53 mikerod: So in that case, I want to have (quote 9) result from `'~(+ 4 5)

13:53 hyPiRion: Well, actually, that's not a quote. That's a list with the symbol quote and the integer 9.

13:53 S11001001: mikerod: as long as you accept that it may not actually emit the symbol `quote' as the first element in the future

13:53 hyPiRion: might as well do ##(list 'quote (+ 4 5))

13:53 lazybot: ⇒ (quote 9)

13:54 callenbot: it always makes me feel good when my pull request frightens people.

13:56 mikerod: hyPiRion: That does make sense to me.

13:56 hyPiRion: I feel it's more evident that it will return (quote 9) if you write it (list 'quote (+ 4 5)) rather than `'~(+ 4 5)

13:57 arrdem: ,(doc proxy)

13:57 clojurebot: "([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:57 hyPiRion: More verbose, perhaps, but then again, people prefer to use `identity`, not `#(`%%%)`

13:58 arrdem: hyPiRion: how does %%% behave? I'm aware of %1 etc and % for all args but %%% is new.

13:58 also

13:59 sritchie: technomancy, how have you liked librelist?

13:59 arrdem: (inc tomoj) ;; code talks

13:59 lazybot: ⇒ 7

14:01 mikerod: hyPiRion: I think I'd agree for that.

14:01 hyPiRion: arrdem: ##'[%%%]

14:01 lazybot: ⇒ [% % %]

14:02 hyPiRion: ,`#[`%%%]

14:02 clojurebot: #<RuntimeException java.lang.RuntimeException: Reader tag must be a symbol>

14:02 mikerod: hyPiRion: The one thing that I am seeing is that:

14:02 hyPiRion: ugh

14:02 mikerod: ,(= `'~(+ 4 5) (list 'quote (+ 4 5)))

14:02 clojurebot: true

14:02 hyPiRion: ,`#(`%%%)

14:02 clojurebot: (fn* [p1__201__203__auto__] ((quote sandbox/p1__201__202__auto__) p1__201__203__auto__ p1__201__203__auto__))

14:02 * arrdem adds macroexpand to pre-ask-#clojure-hooks

14:02 technomancy: sritchie: 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:02 mikerod: ,(= (type `'~(+ 4 5)) (type (list 'quote (+ 4 5))))

14:02 clojurebot: false

14:03 sritchie: technomancy: I was just browsing around, and it looks like there's not necessarily a way to search archives,

14:03 hyPiRion: ,(type `'~(+ 4 5))

14:03 clojurebot: clojure.lang.Cons

14:03 sritchie: though I could set that up myself by retrieving the archive

14:03 hyPiRion: oh wow, it's actually consing that.

14:03 technomancy: sritchie: I don't know if you really need a specialized search; they're just web pages

14:03 leiningen foo site:librelist.org

14:03 mikerod: Yes, I was wondering if there were any semantic implications of consing it instead of using a list.

14:04 hyPiRion: As far as I know, there shouldn't be

14:05 ,(type (list* 'quote (list (+ 4 5))))

14:05 clojurebot: clojure.lang.Cons

14:05 hyPiRion: That's probably what it is doing.

14:05 mikerod: Ah, I see.

14:05 hyPiRion: Well, there shouldn't be a semantic difference, to answer your question

14:05 mikerod: Thanks for the assistance.

14:06 hyPiRion: you're welcome

14:06 sritchie: technomancy: oh, yeah, of course

14:06 thanks dude

14:07 technomancy: sritchie: 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:09 I think they may have fixed it so that the moderation UI works in the mobile interface now

14:09 Okasu: technomancy: Dump google groups, use nntp directly.

14:10 technomancy: but 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:10 Okasu: Slrn nice client, and eternal september nice free provider.

14:10 technomancy: Okasu: tempting! not having a web UI to post is a good compromise though. =)

14:35 thm_prover: in 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:35 Thanks!

14:40 trptcolin: thm_prover: the annoying answer you probably don't want to hear is: don't perform non-returning actions at the top level

14:41 that said, you should be able to add something like :repl-options {:init-ns user :init (do-some-stuff)}

14:41 thm_prover: trptcolin: SWT requires to run in the main loop

14:41 which means SWT will take the main loop

14:41 trptcolin: then why not put it in the -main function

14:43 thm_prover: trptcolin: 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:44 trptcolin: in what context does it not get called? lein run?

14:45 thm_prover: "lein repl"

14:46 okay, "lein run" does run init/init.clj: -main

14:46 however, "lein run" does not give me a repl, and I want a repl

14:48 hyPiRion: We need a union plugin for lein.

14:48 lein union run, repl

14:49 Hmm, I wonder how that works semantically.

14:50 trptcolin: thm_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:50 thm_prover: alright, is there a way in my -main function to have something like "(.start (Thread. ... fork off a nrepl here))" ?

14:50 trptcolin: I expect the repl to run in another thread.

14:50 in fact, what commands does "lein repl" execute? I just want to execute those commands in a 2nd thread

14:51 tomoj: looks like reply.main/launch-nrepl

14:51 jtoy_: why cant I put this try around a map? (try (map #(Long. %) ["asdasd" 2]) (catch Exception _ []))

14:51 hiredman: ~map

14:51 clojurebot: map is *LAZY*

14:51 jtoy_: &(try (map #(Long. %) ["asdasd" 2]) (catch Exception _ []))

14:51 lazybot: java.lang.SecurityException: You tripped the alarm! catch is bad!

14:51 trptcolin: hiredman: whoa, that was efficient use of keystrokes

14:52 jtoy_: so is this the "right way" to do this? (try (doall(map #(Long. %) ["asdasd" 2])) (catch Exception _ []))

14:52 tomoj: wait

14:52 jtoy_: &(try (doall(map #(Long. %) ["asdasd" 2])) (catch Exception _ []))

14:52 lazybot: java.lang.SecurityException: You tripped the alarm! catch is bad!

14:52 tomoj: launch-nrepl is the client, ignore me

14:53 trptcolin: jtoy_: either that or put the try/catch in the fn you pass to map

14:53 tomoj: thm_prover: https://github.com/clojure/tools.nrepl#embedding-nrepl-starting-a-server

14:54 thm_prover: tomoj: looks like exactly what I need. Thanks!

14:54 hyPiRion: thm_prover: you can do something like :repl-options :init (doto (Thread. -main) .start) in the project map

14:54 so like. (defproject ...... :repl-options {:init (doto (Thread. -main) .start)} ... )

14:54 thm_prover: hyPiRion: SWT requires that it runs on the main thread

14:55 hyPiRion: I believe your code will run SWT's gui loop on a non-main thread

14:55 hyPiRion: thm_prover: Which thread did you want to run in the background again?

14:56 thm_prover: hyPirion: I want nrepl in background; SWT on main

14:56 hyPiRion: ooh, okay.

14:56 tomoj: thm_prover: then you can use lein repl :connect

14:56 thm_prover: hang on, let me try these various combinations and report back

15:00 pendlepa1ts: identify iw8ma3p

15:00 S11001001: pendlepa1ts: change it

15:00 pendlepa1ts: just did.

15:05 Ch3ck: hey

15:05 i wish to learn clojure i wish to know its strengths on the web

15:06 S11001001: Ch3ck: http://clojure-doc.org/

15:08 brain_shim: howdy y'all

15:08 thm_prover: is 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:08 Ch3ck: fine

15:08 what is the best text available for learning clojure

15:08 arrdem: thm_prover: for a while I had most of the eclipse codebase added to my local .m2...

15:08 thm_prover: but man was it ugly

15:08 thm_prover: 5/5 do not reccommend

15:08 thm_prover: arrdem: I would love ot hear more.

15:09 hyPiRion: Ch3ck: Do you want a book, or a webpage?

15:09 brain_shim: I'm trying to do "lein sub install" for (https://github.com/pedestal/pedestal), and I'm getting

15:09 lein-javac: system java compiler not found; Be sure to use java from a JDK

15:09 rather than a JRE by either modifying PATH or setting JAVA_CMD.

15:09 Ch3ck: book..

15:09 for a beginner

15:09 hyPiRion: brain_shim: you're using a JVM, not a JDK

15:09 Ch3ck: clear and complete..

15:09 arrdem: thm_prover: one of my many projects is semantic analysis of Java code, which involves a Java lexer/parser

15:10 thm_prover: using Eclipse meant I didn't have to roll my own

15:10 brain_shim: I ran 'sudo apt-get install openjdk-7-jdk' and it spat out a bunch of update-alternatives lines.

15:10 hyPiRion: Ch3ck: http://www.clojurebook.com/ <- This is the recommended book for people new to Clojure and lisp

15:10 brain_shim: hyPiRion: How do I switch it?

15:10 thm_prover: arrdem: oh, so you used it not for the GUI elements, but for the java parser/lexer ?

15:10 hyPiRion: brain_shim: can you show me what you get when you do `java -version`?

15:10 arrdem: thm_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:11 thm_prover: arrdem: lol, I like the name.

15:11 brain_shim: hyPiRion: 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:11 arrdem: thm_prover: the code is cuter than the name suggests I swear

15:11 thm_prover: (require 'me.arrdem.sad.grammars.bnf)

15:11 arrdem: yes, bnf is sad XP

15:11 S11001001: Sometimes 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:12 hyPiRion: brain_shim: that's weird, I'm using the same version, but for debian

15:12 arrdem: thm_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:13 thm_prover: arrdem: alright, I'll go embed an jedit instead

15:13 brain_shim: hyPiRion: Curious! I just updated it. Maybe it hasn't fully updated wherever lein detects which java yet?

15:13 thm_prover: arrdem: thanks!

15:13 arrdem: thm_prover: no problem

15:13 hyPiRion: brain_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:15 S11001001: hyPiRion: is that linked to the other tools?

15:15 hyPiRion: brain_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:15 lazybot: javac: invalid flag: -XX:+TieredCompilation while running lein sub -- https://github.com/technomancy/leiningen/issues/1082 is open

15:16 scottj: relevance people: did you guys deliberately not post an ANN on pedestal to the clojure mailinglist or did I miss it?

15:16 brain_shim: hyPiRion: 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:16 hyPiRion: brain_shim: good! Enjoy :)

15:17 S11001001: well, update-alternatives only change the `java` symlink, so no, it doesn't update javac etc

15:17 But leiningen uses java from within the JVM, so that should be an issue Lein-wise

15:17 then again, the issue I refered to earlier looks very strange for me.

15:18 shouldn't be an issue*

15:19 thm_prover: is it just me, or is the repl in clooj not working?

15:19 i.e. the output seems to just repeat the input

15:29 arrdem: wow... multimethod + was easy

15:29 tomoj, S11001001 thanks for the help

15:42 Raynes: cldwalker: ping

16:29 jcromartie: I think the nREPL workflow is getting too hairy

16:30 I think I'll just stick with lein repl and midje autotest

16:39 Raynes: Is one meant to use java.jdbc/execute! to run stuff like UPDATEs and whatnot?

17:09 arrdem: should I push the e+ e- e* and e* functions into the TolerancedNumber protocol? https://www.refheap.com/paste/12774

17:10 XPherior: Hey 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:14 amalloy: Raynes: i doubt it

17:15 Raynes: amalloy: About execute!?

17:15 Justin seemed to think otherwise.

17:15 amalloy: you probably want do-commands or do-prepared

17:22 technomancy: I use do-commands in my migrations

17:45 Raynes: So, turns out execute! is part of the new API that is currently unreleased.

17:45 Looks like it *will* be the way to do this in the next version of java.jdbc.

17:46 Too bad seancljwest wasn't around to just tell me that to begin with.

17:46 :(

17:47 TimMc: This is why I don't like docs that aren't versioned with the code.

17:48 I 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:53 technomancy: dooooooocstrings

17:53 daaaaaaaaawkstrings

17:53 TimMc: If it's not in my browser, it doesn't exist.

17:53 (Kidding. I <3 docstrings.)

17:53 * technomancy disappears in a poof of logic

17:54 TimMc: Oh, that's an idea -- a plugin or lib that generates autodoc or whatever on the fly and pops it open in your browser.

17:54 (browse-docs clojure.java.jdbc)

17:55 technomancy: M-. is hyperlinked too dude

17:58 TimMc: Not in my Emacs.

18:00 stain: now that is a good movie title

18:02 redinger: scottj: 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:26 arohner: stupid question: I have done `lein tar`. How do I run it?

18:28 joegallo: untar the result and your stuff is inside there

18:29 hyPiRion: arohner: If you want to make a standalone, do `lein uberjar` instead

18:29 then run it with `java -jar name-of-standalone.jar`

18:29 arohner: hyPiRion: thanks

18:29 technomancy: typically if you are using lein tar it's because an uberjar won't cut it

18:30 usually you'd put a bunch of bin/ scripts inside the tarball too

18:30 but yeah, if you can use an uberjar you probably should =)

18:45 ToxicFrog: amalloy: can I tell lein not to ever AOT compile things, then?

18:46 amalloy: ToxicFrog: just...don't gen-class, don't put :aot in your project.clj, and don't lein compile

18:48 hyPiRion: and no protocols either, I suppose

18:54 ToxicFrog: amalloy: why does the default core.clj :gen-class, then? Also, don't 'lein run', 'lein repl', and 'lein uberjar' implicitly compile?

18:56 amalloy: the default core.clj? are you talking about the one generated by lein new, or what?

18:56 because in any halfway-recent version of lein, that doesn't happen

19:03 technomancy: gen-class doesn't really matter; just leave out :main and :aot

19:04 ToxicFrog: the default core.clj doesn't gen-class; only app does

19:04 that's only in order to support uberjars

19:04 implicit compiles only happen if you have a :main/:aot

19:10 ToxicFrog: Aah.

19:10 And yeah, I need a new app.

19:10 (and then realized halfway through that this should actually be an app and a separate library. Oops.)

19:10 s/need/made/

20:51 antares_: Monger 1.5 RC1 is out: http://blog.clojurewerkz.org/blog/2013/03/21/monger-1-dot-5-0-rc1-is-released/

21:59 tieTYT2: i'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:59 how would you design that in clojure?

21:59 I know I could make something like a big switch, but that seems bad

22:00 something like, "if it's this url, do this, if it's that url do that, ..."

22:03 TimMc: tieTYT2: Without knowing more about your needs... this sounds like a general dispatch problem.

22:03 tieTYT2: yeah pretty much :)

22:03 how do you idiomatically solve that in clojure?

22:04 TimMc: There 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:05 tieTYT2: are you thinking a map that has functions as a key?

22:05 TimMc: domains as keys, functions as values

22:06 tieTYT2: cool that makes sense to me

22:08 TimMc: tieTYT2: 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:09 (def site-awesomeness {"wikipedia.com" 5, "shapecatcher.com" 3})

22:09 tieTYT2: and then pass the key to a function?

22:10 TimMc: (defn print-awesomeness [how-awesome] (println "This awesome:" awesome))

22:10 So then you'd do (print-awesomeness (site-awesomeness (.getHost url) 0))

22:10 tieTYT2: yeah 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:11 ok thanks for the help

22:26 what development environment do you guys use? I'm using LightTable and a repl in another window

22:28 TimMc: Emacs + 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:28 Not sure how many use Eclipse or IntelliJ.

22:28 devn: Why a separate REPL?

22:28 TimMc: devn: Because it doesn't annoy me more than Emacs configuration.

22:29 devn: hm, I guess readline and such seems wildly inneficient

22:29 to me

22:30 xeqi: TimMc: emacs + nrepl.el here

22:30 tieTYT2: i'm using a separate repl because i can't figure out how to run my program in lighttable

22:32 xeqi: ack, wrong t name.. oh weel

22:32 TimMc: devn: It's funny, because I couldn't *stand* doing my main coding without paredit...

22:33 devn: TimMc: 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:43 TimMc: I need to rework stuff.

22:44 My current config is vaguely fucked, and I'd like to unfuck it.

22:44 ...but that's a project.

23:00 tyler: what are people using for generated css?

23:00 i tried gencss but its borking on me and hasn't been updated in forever

23:01 cssgen rather

23:31 callenbot: http://pyvideo.org/category/33/pycon-us-2013 guys, why aren't Clojure videos this accessible?

23:35 rplaca: technomancy: 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:35 scottj: callenbot: different recording groups (infoq and confreaks) have different procedures, and I suspect staggared releases get more views than huge dumps

23:35 rplaca: like "/home/tom/.m2...:/home/tom/.m2..."?

23:35 TimMc: rplaca: `lein classpath`

23:36 That's the CLI invocation, at least.

23:36 rplaca: TimMc: thanks, I can probably work from there to the internal version (I need it in a plugin)

23:37 scottj: tyler: 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:37 callenbot: scottj: it still upsets me.

23:37 tyler: scottj: thnx

23:37 callenbot: scottj: it's supposed to be about the community, not a single entity

23:38 scottj: callenbot: 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:38 callenbot: how is it about a single entity?

23:39 callenbot: scottj: why can the Python community swing same day video releases, but we can't?

23:39 scottj: we have a stronger need for getting the word out than they do.

23:39 scottj: callenbot: the python community is 50 times bigger? bigger sponsors? more conferences (more competition)?

23:40 callenbot: 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:40 callenbot: scottj: in the process, screwing us working stiffs that can't go to the conference but are already plugged into the community.

23:40 or those that couldn't catch all the talks they wanted to see

23:41 scottj: callenbot: giving you almost immediate access to the slides and free access to expensive-to-produce videos is hardly screwing you

23:41 callenbot: scottj: absent the option to pay for access, yes it is.

23:42 I'd gladly pay for some $15 or $20 package for access to all the videos on the day after.

23:42 scottj: callenbot: so not offering you sex for money is considered screwing you :)

23:42 callenbot: scottj: you're the one that said they needed to make money

23:43 I'm not even given the option of just paying for the damn videos.

23:43 they act like they're the goddamn disney vault

23:43 scottj: callenbot: the videos aren't made yet. they have to be worked on.

23:43 callenbot: I don't mean right now

23:43 I mean in general

23:44 scottj: glhf

23:58 TimMc: callenbot: Even for hyperbole, comparing this to Disney is laughable. :-P

Logging service provided by n01se.net