#clojure log - Apr 19 2013

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

0:57 nonuby: is there a function that returns true/false is item is either a list or vector or something iterable

0:58 seq? return false on []

1:01 technomancy: try coll?

2:32 tieTYT: I wrote a cond with a bunch of conditions and each test uses the same argument. Is there any way to write that in a more concise way?

2:33 ucb: tieTYT: perhaps condp?

2:33 ,(doc condp)

2:33 clojurebot: "([pred expr & clauses]); Takes a binary predicate, an expression, and a set of clauses. Each clause can take the form of either: test-expr result-expr test-expr :>> result-fn Note :>> is an ordinary keyword. For each clause, (pred test-expr expr) is evaluated. If it returns logical true, the clause is a match. If a binary clause matches, the result-expr is returned, if a ternary clause matches, i...

2:35 tieTYT: how could I do that? Each test is either: (.contains "some string" src) or a regex match like (.regex-matches #"some regex" src)

2:35 ucb: oh, I see

2:35 tieTYT: if all the tests were one or the other, condp seems like a fit, but not when it's a mixture

2:35 ucb: you're trying to get rid of all the instances of src, right?

2:36 tieTYT: yep

2:36 ucb: a side point, .regex-matches can be replaced by re-matches

2:36 (I believe)

2:36 tieTYT: yeah that's not a real method, i do use re-matches

2:36 ucb: oh, right :)

2:37 I'm thinking whether you could have a pred that used apply or ->>

2:37 so that you could write your conditions like (re-matches #"regex")

2:37 or (contains "string")


2:38 tieTYT: the thing is, sometimes if the test passes I return true, sometimes I return false

2:38 hah

2:38 I could use a macro for this right? one without generated symbols

2:39 I believe that's called unhygenic, I'm not sure though

2:39 ucb: hum, perhaps

2:40 the alternative to cond is to have a list of these things and then drop-while falsey

2:40 I think that's some?

2:40 ,(doc some?)

2:40 clojurebot: Huh?

2:40 ucb: ,(doc some)

2:40 clojurebot: "([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"

2:41 tieTYT: hm maybe

2:41 ucb: something like: (some (fn [f] (f s)) [(partial re-matches #"regex") (partial str-contains "string")...])

2:41 tieTYT: maybe I could and/or two condps together

2:41 ucb: thing is, you wouldn't know which one matched :/

2:42 tieTYT: i don't need to know, it returns a bool

2:42 ok thanks for the help, ttyl

2:42 ucb: enjoy

2:45 rhg135: Hi

2:45 deadlockx2: why so many people here...?

2:45 rhg135: Yup

2:45 deadlockx2: noone cares about clojure

2:45 rhg135: Get him!

2:46 deadlockx2: and taht proves my point... ppl in this channel for no reason...

2:46 rhg135: Poor deadlockx2

2:47 deadlockx2: ur alone in this matter rhg135

2:48 rhg135: I'll tell rich when I see him lol

2:48 deadlockx2: tell everyone... obviously, your dare turned out to backfire :P

2:48 rhg135: Know who he is?

2:49 deadlockx2: nopz

2:49 mthvedt: don't feed the trolls

2:49 rhg135: The creator

2:49 Raynes: I don't Rich would care about this at all.

2:50 rhg135: I'm stuck with him anyway

2:50 deadlockx2: lol

2:50 rhg135: Ik

2:51 noprompt: he's joking right

2:51 s/right/right?

2:51 rhg135: No

2:51 noprompt: oh that's a roflcopter...

2:51 rhg135: He's said it twice

2:52 deadlockx2: the twiceys rule :o

2:52 anything you say twice.. you mean it

2:53 rhg135: Yup

2:53 noprompt: works for me!

2:53 deadlockx2: lol

2:54 Raynes: Ohai noprompt.

2:54 noprompt: wuzzup.

2:55 boy lemme tell you about eating your own dog food...

2:55 Raynes: I don't have any dog food.

2:55 rhg135: +deadlockx2> if (sleep musthappen) (do (skipit)) else (do(irc))

2:55 <+deadlockx2> or some bs like that

2:55 <@rhg135> Bad

2:55 <+deadlockx2> yeah.. its cuz noone cares about clojure

2:55 <@rhg135> Go on #clojure and say that lol

2:55 <+deadlockx2> will do

2:55 Raynes: I don't have any food at all, in fact.

2:55 noprompt: yeah don't eat dog food.

2:55 Raynes: It's okay if you don't like Clojure, guys.

2:56 We're all fine with it.

2:56 noprompt: yeah, like, i don't really care for ruby.

2:56 but if you care for it, then, like, well that's ok with me.

2:56 rhg135: The sad part is he likes java and oop

2:56 Raynes: You can, in fact, say you hate it without causing us any pain and suffering. We would however appreciate it if you don't bother us with it for the rest of the night.

2:57 That's okay too.

2:57 Not everybody likes our koolaid.

2:57 deadlockx2: theres koolaid involved?

2:57 noprompt: indeed, that would be ammenable.

2:57 deadlockx2: ok ok i retire my comments... i want some

2:57 Raynes: I have some koolaid right here.

2:57 deadlockx2: is it purple koolaid?

2:57 Raynes: Cherry red.

2:57 I don't like grape.

2:58 deadlockx2: that works too :D

2:58 lol

2:58 noprompt: does this happen often?

2:58 Raynes: noprompt: I've been using Vim all day.

2:58 noprompt: Raynes: for realz?

2:59 Raynes: Yeah. I think I just get bored with editors.

3:00 noprompt: i dunno man. i mean i think there's really only two out there you could possibly use.

3:00 Raynes: noprompt: The cool thing is that by using evil-mode I can more or less switch between editors and not give any shits at all.

3:01 noprompt: Raynes: that's certainly true, but i have found it frustrating that i can emulate some things with evil.

3:01 for instance, i can't have a normal-state binding like ,el and have it do something.

3:01 it seems limited to only two key strokes at this point.

3:02 in vim i have normal mode maps like ,rbt for ToggleRainbowParens.

3:02 vim is really great for that sort of thing.

3:04 but yeah i hear you.

3:05 right now i'm trying to port my vim colorscheme to emacs.

3:05 Raynes: tomorrow night <3

3:05 Works everywhere.

3:05 Even refheap.

3:05 noprompt: yeah, it's definitely a nice theme.

3:06 a really cool colorscheme for Vim is Galaxy.

3:06 https://github.com/Rykka/galaxy.vim

3:06 Raynes: MY EYES


3:06 noprompt: it's actually a weird scheme. in that it has it's own color theming tool built in.

3:07 the defaults look pretty bad but it has a few different settings for some really nice dark themes.

3:08 Raynes: Holy shit.

3:08 Today is Friday?

3:08 Where did this week go?

3:08 I need to stop taking sleeping pills.

3:08 I thought maybe Wednesday.

3:09 jasonjckn: Raynes: melatonin?

3:09 Raynes: diphenhydramine

3:09 noprompt: Raynes: so were you doing clojure in vim?

3:10 Raynes: I'm doing it right now in fact.

3:10 noprompt: are you using fireplace or vimclojure?

3:10 Raynes: Fireplace.

3:10 tpope is a boss.

3:10 noprompt: indeed.

3:10 Raynes: noprompt: https://www.refheap.com/paste/0eeb2ab595cdeb786ac91eefb You missed this while you disappeared.

3:10 * noprompt hat-tip to tpope

3:10 jasonjckn: You know that emacs run vim right?

3:11 it's called viper-mode :-P

3:11 Raynes: It's called evil-mode.

3:11 noprompt: jassonjckn: sike, it's called evil-mode

3:11 jasonjckn: lol

3:11 noprompt: boom!

3:11 jasonjckn: i tried it once, didn't like it either

3:11 noprompt: :)

3:11 Raynes: viper-mode is the completely ancient version.

3:11 I use Emacs.

3:11 But today I used Vim.

3:11 noprompt: yah, viper's the pits bro.

3:11 Raynes: I mean.

3:11 I use both guys.

3:11 jasonjckn: me too

3:11 noprompt: me three.

3:11 Raynes: I'm ambieditorxious.

3:11 jasonjckn: my brain can switch easily between vim and emacs

3:11 i'm that smart

3:12 noprompt: my brain cannot handle the default emacs keybindings.

3:12 it's like when i tried to pick up dvorak.

3:12 that was painful.

3:12 and i went back to qwerty.

3:12 jasonjckn: have you tried default emacs AND dvorak, it's even more fun

3:12 noprompt: but i doubt there's an evil mode for dvorak.

3:12 jasonjckn: so you're asking me to commit suicide? is that it?

3:13 :P

3:13 Raynes: My boss uses a modified colemak on a kinesis advantage keyboard.

3:13 Good luck beating that.

3:13 jasonjckn: I'm asking you to suck it up princess

3:13 Crtl + X is painful, but then you realize you're alive

3:13 noprompt: i really want one of these http://www.datahand.com/

3:13 well i have capslock bound to both ctrl and esc.

3:14 esc on tap and ctrl on hold. so it's not so bad.

3:14 jasonjckn: Raynes: if it didn't take so long to change keyboard layouts i'd do that

3:14 Raynes: but i learned dvorak when I was a teen

3:15 noprompt: wow colemak.


3:15 jasonjckn: noprompt: have you talked to anyone that uses datahand?

3:15 Zerker: As a teen, I'm trying to learn steno :P

3:15 jasonjckn: noprompt: looks interesting

3:16 Raynes: noprompt: You should go to the Fall Out Boy conference with me in September.

3:16 conference? Wtf.

3:16 Concert.

3:16 noprompt: LMFAO!!!

3:16 fall out boy conference.

3:16 Raynes: That's for the hardcore fans. I just want the concert.

3:16 Unfortunately it is in Anaheim and I don't have any way to get there.

3:17 jasonjckn: Zerker: that keyboard layout is just non-sense

3:17 noprompt: i dunno man, i think i'd have to have a few before i went. that's really out of my element.

3:17 Raynes: Baha

3:17 noprompt: http://www.youtube.com/watch?v=5hDZbroaQDc

3:18 noprompt: i had a roomate back in the day who was really in to those guys.

3:18 Zerker: It's based on pressing several keys at once to get less frequent ones, and typing syllables at a time

3:19 noprompt: Zerker: which layou is that?

3:19 Raynes: I like this new album. I only liked a few of their older songs, noprompt. I like them mostly because they discovered Panic! At The Disco which is one of my favorite bands

3:19 Zerker: Stenotype xD

3:19 noprompt: s/(ou)/\1t

3:19 Zerker: S/\1/&/

3:20 noprompt: it's funny you bring that up Zerker. i saw a commercial on television the other day about court room reporters and it got me thinking about that.

3:21 Raynes: noprompt: How do you feel about Imagine Dragons?

3:21 noprompt: so you can really hook a stenotype up and go for it?

3:21 Zerker: Yup, currently machines/software cost thousands of dollars, both are being open-sourced though

3:22 noprompt: Raynes: i have no idea. most of what i listen to is 60's/70's. occasionally i'll listen to some newer stuff though.

3:22 Zerker: that it is - so - awesome.

3:23 Raynes: noprompt: http://www.youtube.com/watch?v=sENM2wA_FTg

3:23 noprompt: Zerker: so you have one of those machines?

3:23 lol. there isn't a depeche mode for emacs?

3:24 Zerker: I have a gaming keyboard(nkro kinda necessary) with lasercut keys stuck on top of it, first iteration of "open-sourcing the hardware" ^-^

3:26 noprompt: Raynes: hmm... not really my taste. most of the stuff now-a-days more or less sounds the same. but i wouldn't knock someome if they liked it.

3:26 Zerker: I'm at ~10WPM at the moment, but that's because I've been helping write code a lot more than actually drilling

3:27 gunface: hi guys, is there a pdf version of the whole clojure official documentation somewhere, I tried but couldn't find :(

3:27 caulagi: Is noir the recommended way to develop web applications in Clojure?

3:28 noprompt: gunface: the internet is your pdf version.

3:28 :)

3:28 lol but i do kinda like Dragon Force, Raynes. as cheesey as they are.

3:29 something about wizards and fighthing for glory somehow connects me deeply to what i do as a programmer. :)

3:29 gunface: ahh ok, I thought i might find something to use offline

3:29 besides the doc function

3:29 ok

3:29 noprompt: gunface: why not pick up one of the good clojure books as a pdf?

3:30 gunface: remember you also have clojure.repl/doc and clojure.repl/source at your disposal.

3:30 ,(doc map)

3:30 clojurebot: "([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & ...]); Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments."

3:30 noprompt: ,(source clojure.string/join)

3:30 clojurebot: Source not found\n

3:30 gunface: no I have all of them but they don't go full fledged in the library functions

3:31 noprompt: gunface: you mean as far as examples?

3:31 gunface: yeah and full coverage of functions too

3:31 ok repl will work for me

3:32 noprompt: well you can also try clojure-doc.org or clojuredocs.org

3:33 gunface: yeah noprompt will do :)

3:33 antares_: caulagi: look into Compojure or Luminus. Noir is no longer maintained.

3:33 noprompt: gunface: try not to pick everything up all at once. you can get a lot done with map, reduce, seq, into, etc.

3:33 caulagi: there's also pedestal too.

3:34 still not sure what the consensus is on that, however.

3:34 gunface: yeah getting a hang of map,reduce,filter stuff

3:34 noprompt: gunface: also it's good to recognize when fn's like comp and partial will suit you.

3:35 for instance (partial apply some-fn) can be very concise and powerful.

3:35 tgoossens: i never actually used comp before i think

3:35 ,(doc comp)

3:35 clojurebot: "([] [f] [f g] [f g h] [f1 f2 f3 & fs]); Takes a set of functions and returns a fn that is the composition of those fns. The returned fn takes a variable number of args, applies the rightmost of fns to the args, the next fn (right-to-left) to the result, etc."

3:35 noprompt: f circl g FTW

3:35 ;)

3:36 gunface: comp,partial,seq,into I haven't used looking them up

3:36 noprompt: comp is just function composition

3:36 gunface: as of now doing 4clojure questions :)

3:37 noprompt: ,(map (comp inc inc) (range 3))

3:37 clojurebot: (2 3 4)

3:37 gunface: the small sokutions of others hurt like a bitch though :P

3:38 noprompt: i've never done any of those.

3:39 gunface: they seem good, the elementary ones are well, elementary but the later questions are good and have a code-golf thing in that so yeah a lot of map, reduce and functional stuff

3:39 caulagi: antares_:, noprompt: I will look at Luminus and pedestal, thanks

3:39 noprompt: btw Raynes, if you use the vim-clojure-static files it has awesome regexp highlighting ;)

3:39 Raynes: I do.

3:40 ejackson: Raynes got married ?

3:40 noprompt: Raynes: we didn't fuck around https://github.com/guns/vim-clojure-static/blob/master/syntax/clojure.vim#L78-L113

3:40 * Raynes pukes

3:40 Raynes: Don't link me to viml man.

3:41 noprompt: https://github.com/guns/vim-clojure-static/blob/master/clj/test/syntax_test.clj

3:41 that guy guns was pretty cool though coming up with a way to test the syntax files though.

3:41 pretty clever.

3:41 viml is nasty though...

3:43 my guess is that doing syntax highlighting in emacs is much better.

3:44 *my guess*

3:48 Raynes: noprompt: https://github.com/tpope/vim-fireplace/commit/77444275fda8e20ac2b92541398543fdd0fa2614 This is sad.

3:48 I had to manually revert that .format() change to get it working.

3:48 caulagi: noprompt: does pedestal have templating? I.e. HTML is separate from Clojure?

3:50 Raynes: I hope not.

3:50 There are lots of good libraries for doing that.

3:50 I'd hope that pedestal is flexible enough to let you use any of them.

3:50 noprompt: man that's a bummer.

3:50 Raynes: See: laser, enlive, hiccup, clabango

3:50 noprompt: you know i should give fireplace another chance.

3:50 Raynes: stencil

3:51 noprompt: caulagi: yeah i dunno about html templating. with what's available, as Raynes just mentioned, it seems like a step backward.

3:52 caulagi: the consensus seems to be geared toward composing your application from the pieces you want to use. not an all inclusive monolithic framework.

3:53 btw laser is an awesome name and uses zippers which are way out rad stuff. :)

3:53 caulagi: noprompt: sure. But I don't want my Clojure code to generate HTML. I am just starting Clojure but it is much easier for me when the HTML is separate

3:54 so what should I use?

3:54 Ember-: enlive maybe

3:54 or well, you're just starting clojure...

3:54 could be kinda a big leap then

3:54 noprompt: caulagi: if you're just starting clojure then definitely do hiccup anyway.

3:54 Raynes: I prefer laser myself.

3:54 <_<

3:54 >_>

3:54 Ember-: it's purely functional, needs a bit of mind twisting to get around (enlive that is)

3:54 noprompt: :)

3:54 * Raynes whistles nonchalantly.

3:54 Ember-: Raynes: I wonder why ;)

3:55 noprompt: caulagi: you can put your hiccup templates in a separate namespace.

3:55 caulagi: noprompt: by template, I mean a HTML file

3:56 noprompt: yes i understand that. i'm suggesting this as a thought expirement.

3:56 Raynes: Clabango is probably most approachable option. I think the consensus is that laser and enlive are the coolest solutions.

3:56 caulagi: Raynes: Let me look at laser and enlive

3:56 * noprompt gets ready for a bbq

3:56 Raynes: They're also coincidentally the hardest to understand solutions.

3:57 Ember-: for a guy coming from oop world

3:57 * noprompt preps the brain

3:57 Raynes: I have a guide, but Enlive has jack squat to help you understand how it works.

3:57 Ember-: not for a guy coming from the functional world

3:57 Raynes: Not that I'm promising miracles with my guide.

3:57 * noprompt concurs

3:57 Ember-: an yeah, enlive is indeed lacking in documentation

3:57 +d

3:57 Raynes: Ember-: Really? I started programming with Haskell and I couldn't figure Enlive out for a very long time.

3:57 Glenjamin: are there guidelines for handling error states in laser/enlive world - wouldn't you have to display all the errors on the page, and then have clojure turn them off?

3:57 Ember-: Raynes: :)

3:58 Raynes: Glenjamin: Or just conditionally display them.

3:58 Glenjamin: but then where do you put them?

3:58 Raynes: You probably can't do that easily in Enlive, but you can in Laser.

3:58 Look at refheap.

3:58 Glenjamin: isn't the idea that a pure frontend person could build the templates, and then laser magically makes them dynamic?

3:58 Raynes: Glenjamin: https://github.com/Raynes/refheap/blob/master/src/refheap/views/paste.clj#L31

3:59 caulagi: Raynes: I still think Laser uses Clojure to generate HTML. Is that correct?

3:59 Raynes: caulagi: No.

3:59 It takes HTML and then transforms that HTML and spits it back out.

3:59 I mean, there is only so much you can do.

3:59 antares_: Laser uses the power of unicorns. You can't expect less from Raynes.

3:59 Raynes: If you want a dynamic website, you have to let your code touch your html.

3:59 Hi antares_

3:59 :D

4:00 Glenjamin: say for example i wanted to put inline errors next to form fields, i'd have to build my html as if everything had gone wrong, and then have laser hide them?

4:00 noprompt: Raynes: you know, after looking at enlive and laser i've wondered about CSS a bit more.

4:01 of course CSS comes with a whole wonderful treasure trove of horse crap to deal with....

4:01 html is the only part of the front-end webstack that isn't totally fucked.

4:02 Glenjamin: actually https://github.com/Raynes/refheap/blob/master/src/refheap/views/paste.clj#L64 is a good example - this bit of content creation is hidden from the template author

4:04 Raynes: Glenjamin: There are really two options. You can either conditionally generate that HTML in your Clojure and put it in there, or you can put all of the cases in your HTML and then conditionally remove the pieces you don't need in the transformation.

4:04 noprompt: Raynes: are you guys hand authoring all the css?

4:04 Raynes: noprompt: Yes.

4:05 caulagi: Raynes: what are the other pieces needed with laser?

4:05 * noprompt is amazed

4:05 Glenjamin: mm, i suppose the question i'm really asking is: is the goal to allow pure-frontend people to write the templates

4:05 noprompt: as opposed to with a pre-processor?

4:05 Raynes: Glenjamin: Yes.

4:05 noprompt: Glenjamin: yah

4:05 Raynes: caulagi: I mean remove the unnecessary pieces of HTML with the laser transformation.

4:06 caulagi: Raynes: I got that. I meant, what other libraries should I use? laser is only the html part, right? What about routing and stuff

4:06 Raynes: compojure is a good option

4:07 You should look at luminus. It'd help you get up and running pretty quickly.

4:07 noprompt: compojure's the bomb.

4:07 Raynes: $google luminus web

4:07 lazybot: [Luminus - A Clojure Web Framework] http://www.luminusweb.net/

4:07 Glenjamin: so you'd either have a bunch of stuff to conditionally remove, or some stuff frontend guys can't change - I wonder if something funky could be done with clojurescript to provide state previews

4:07 Raynes: Glenjamin: Yes. You'd have this problem in any templating solution though.

4:08 Glenjamin: I mean, there is a third option. You can have it as a separate template.

4:08 But template files with 1 line in them?

4:08 BLEH

4:08 Glenjamin: yeah, but normally you'd throw logic into the template, so at least they can edit stuff - even if logic in templates is awful

4:08 it's the balance between offline-preview and actually working online i guess

4:09 anyway, i plan to have a proper go with laser once i've got my unstyled working beta deployed :)

4:11 noprompt: Raynes: would you be open to garden stylesheets once it's out of alpha?

4:11 Raynes: noprompt: I don't really like doing that sort of thing in Clojure.


4:12 Apparently my disdain for that is irrational.

4:12 callen was complaining about duplication in my css file.

4:12 noprompt: well there's always sass + compass, but that can get slow.

4:12 Raynes: noprompt: I'd be open to it under the condition that it generate to a file and not just serve random magic.

4:12 As in, generate to a file on startup.

4:13 And that you add it in and not me. :P

4:13 Glenjamin: noprompt: do you have some notes for benefits over sass?

4:13 noprompt: Raynes: yeah that's how i do it now.

4:13 Glenjamin: or is it just speed?

4:13 Raynes: Glenjamin: Benefits? You do it in Clojure dude.

4:13 noprompt: Glenjamin: the benefits, imho, are not just speed.

4:13 Raynes: That's the benefit.

4:14 Glenjamin: all css pre-processors are basically functional/declarative

4:14 noprompt: the main benefit is consistency, which css lacks.

4:14 and thus, sass lacks.

4:14 or whatever preprocessor out there you use lacks.

4:15 Glenjamin: interesting, so you actually abstract away from raw CSS syntax?

4:15 instead of being a superset

4:15 noprompt: to a degree yes. but i'm still working on it.

4:15 it's got a decent base at the moment.

4:15 and clear semantics.

4:16 Glenjamin: i suspect the issue will be, how well does it fit the existing mental model people have of how css works

4:16 noprompt: i've been working with CSS for almost 10 years now.

4:16 Glenjamin: the current generation of pre-processors all lightly wrap CSS, i suspect thats because people don't want to learn something completely different

4:17 noprompt: i'd say if you know it well enough, a mild shift in thinking is appropriate.

4:17 as with lisp you have to slightly shift your thinking.

4:17 Glenjamin: my current stance is that CSS is excellent for text formatting, awful for layout - and I'm interested to see if a tool can somehow fix that :p

4:18 noprompt: it's actually not that bad.

4:18 today i wrote a functional grid system.

4:19 Glenjamin: i'm certainly intrigued

4:19 noprompt: so you provide the grid settings and you get back a grid function (a map) for which you can use to do layou

4:19 ie. [:section.main (grid :container)]

4:20 [:.row (grid :row)]

4:20 Glenjamin: presumably you have to retain calling order, rather than being declarative?

4:20 noprompt: what do you mean?

4:21 by calling order? (a little tired)

4:21 Glenjamin: one of the things that bugs me about sass is if i define media queries next to the elements they apply to, it's not smart enough to group them all together by breakpoint

4:21 noprompt: oh righ.

4:21 *right

4:21 Glenjamin: so they get scattered across the generated file, duplicating the breakpoint definition

4:21 noprompt: well that's one of the thigns i'm thinking about.

4:22 so my thinking is that when you compile the stylesheet it clearly separates "normal" rules and groups media queries as you would expect.

4:22 normal rules take precedence of course.

4:22 Glenjamin: mm, seems sensible

4:22 noprompt: in the future i want to be able to mark rules like this.

4:23 ^:screen [:div.row ...]

4:23 Glenjamin: referencing other element's properties might be cool, not sure if needing that is a good thing though

4:23 noprompt: and then compile @media screen { div.row { ...

4:23 well why would you?

4:23 you don't need to because you're using clojure.

4:24 just call a function or use a def in some place

4:24 Glenjamin: [:div.main {:width (- 100 (ref :div.sidebar :width))}]

4:24 noprompt: ah i see.

4:24 hmm... i need to think about that one.

4:24 Glenjamin: unsure if thats useful when you have grids

4:24 noprompt: because you could say (def sidebar-width (px whatever))

4:25 and then [:div.main {:width (px- sidebar-width 100)}]

4:25 garden units automatically convert (when possible)

4:26 but still i think that's an interesting thought.

4:27 one thing i'm kinda debating right now, and Glenjamin_ let me know your thoughts here, is a lone :& selector.

4:27 it'd basically be like a mixing but w/o bs defmixin etc.

4:28 *mixin

4:29 Raynes: lemme tell you about the worst thing that ever happened in my recent life.

4:30 Raynes: Exciting.

4:30 noprompt: the company i worked for blocked the IRC ports...

4:30 Raynes: Oh my goodness.

4:30 noprompt: yeah and what's worse is that i'd have to use some shitty irc client in the browser.

4:31 needless to say i've vanished from irc during the day.

4:31 and it's been oh so sad.

4:31 oh and they blocked most of the chat protocols too.

4:31 Raynes: I could fix that for you if you wanted to break company rules.

4:31 If they really just block IRC ports.

4:31 noprompt: i'm all ears.

4:31 Raynes: I have a bouncer that runs on port 7776.

4:32 If they don't block that then I can give you an account on it and you can connect via it.

4:32 noprompt: they really did, and they blocked the ssl ports as well.

4:32 yeah it's blocked...

4:32 Raynes: 7776?

4:32 Wow.

4:32 noprompt: they've only left open the standard ports needed for existence like 22.

4:32 Raynes: Quit your job, man.

4:33 noprompt: if you know a place where i can go, please let me know.

4:33 i had to write a huge letter asking for the port to be reopened AT MY DESK.

4:33 Raynes: If we blocked IRC ports at work I'd actually get work done.

4:33 * Raynes shudders at the thought.

4:34 noprompt: dude, i work for a newspaper company that can't get their shit together.

4:34 iamdrw: howdy everybody, quick question — what is the idiomatic way of converting json to clojure map from clojurescript? as I understand clojure.data.json doesn't work there

4:34 Raynes: This channel is publicly logged btw, noprompt.

4:34 noprompt: point being?

4:35 ;)

4:35 Raynes: Your company hatred is now google searchable. :p

4:35 noprompt: that's ok. they don't understand the internets. :P

4:35 Raynes: Heh

4:35 noprompt: and for the record, i don't actually hate the company.

4:36 i work with great people. it's just that they have some weird approaches to solving problems.

4:37 iamdrw: not sure. i guess i'd do (.toJSON (clj->js map))

4:37 or whatever the method is in javascript to convert an object to json.

4:43 iamdrw: I want to convert json to hash map, there is a js->cli, but it's not actualy what I want

4:44 like (json/read-str "{\"a\":1,\"b\":2}"

4:44 :key-fn keyword)

4:44 from clojure.data.json

4:45 but I can't use it from clojure script :(

4:46 noprompt: right. hmm. but i thought javascript had a json parser.

4:46 as in from a string.

4:47 sorry it's been a little bit since i messed with cljs, or even js.

4:47 https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/parse

4:48 iamdrw: no parsing json is not a problem, but that gives me a js object

4:48 and I want that js object to be converted to clojure map

4:48 mpenet: (js->clj x)

4:48 noprompt: and (js->clj obj) doesn't work?

4:49 iamdrw: it works, but I want to have keys be a keywords instead of strings

4:49 and I don't wan't to do conversion two times

4:50 noprompt: in that case you may have to.

4:51 but it makes sense to have them be strings. since this is valid json {"first name": "bob"}

4:51 iamdrw: maybe I'll stick with that

4:52 because parsing whole object is a bit slow for big objects

4:52 abp: Hell-o

4:52 noprompt: yeah, but you'd still have the same issue in raw js to btw.

4:52 obj["first name"]

4:53 but most of the js engines are pretty fast. you'd have to have a really large js obj for it to be slow.

4:54 have you tried to mimic clojure.data.json?

4:54 with stuff like :key-fn?

4:54 iamdrw: the problem is that I don't have a clojure server, yet

4:55 it's a pure clojurescript app

4:56 noprompt: have you used vagrant before?

4:56 you could try it out on a fake server and get a feel for it.

4:57 sometimes you have to do things twice. if there's a performance bottleneck then you worry.

4:58 just brainstorming here.

4:58 mpenet: iamdrw: you can have the keys as keywords if you use (js->clj x :keywordize-keys)

4:59 iamdrw: (js->clj x :keywordize-keys true)

5:01 noprompt: ah, good to know. wasn't aware of that.

5:01 mpenet: but what about when the keys contain spaces?

5:01 or worse symbols like @ or %

5:01 mpenet: ,(keyword "foo bar")

5:01 iamdrw: the json doesn't contain spaces

5:01 clojurebot: :foo bar

5:01 mpenet: you need to be careful

5:02 noprompt: ,(keyword "e@mail")

5:02 clojurebot: :e@mail

5:02 noprompt: whoa.

5:03 oh, i'm thinking of symbols as being problematic.

5:03 iamdrw: @mpenet — that's exactly what I want

5:03 mpenet: noprompt: they arent I think, you have an example in mind?

5:04 noprompt: well i'm not completely sure but i know having the % and @ characters and even the : character in symbols can cause the clojure reader to complain

5:05 iamdrw: @noprompt in general it's a problem, but in my case I have json of defined structure returned by api

5:06 noprompt: hmm... well maybe not. i think that was a 1.4.0 problem

5:06 seems to work fine in 1.5.0+

5:06 Zerker: ,(keyword ":::")

5:06 clojurebot: ::::

5:07 noprompt: ,:::

5:07 clojurebot: #<RuntimeException java.lang.RuntimeException: Invalid token: :::>

5:07 noprompt: ,:::

5:07 ,:::

5:07 ,:::

5:07 ,:::

5:07 clojurebot: #<RuntimeException java.lang.RuntimeException: Invalid token: :::>

5:07 #<RuntimeException java.lang.RuntimeException: Invalid token: :::>

5:07 #<RuntimeException java.lang.RuntimeException: Invalid token: :::>

5:07 noprompt: ,:::

5:07 clojurebot: #<RuntimeException java.lang.RuntimeException: Invalid token: :::>

5:07 #<RuntimeException java.lang.RuntimeException: Invalid token: :::>

5:07 noprompt: ,:::

5:07 clojurebot: #<RuntimeException java.lang.RuntimeException: Invalid token: :::>

5:07 Zerker: ,(:::)

5:07 clojurebot: #<RuntimeException java.lang.RuntimeException: Invalid token: :::>

5:07 noprompt: ,:::

5:07 clojurebot: #<RuntimeException java.lang.RuntimeException: Invalid token: :::>

5:08 noprompt: ,:::

5:08 clojurebot: #<RuntimeException java.lang.RuntimeException: Invalid token: :::>

5:08 noprompt: sorry

5:08 Zerker: ,(::)

5:08 clojurebot: #<RuntimeException java.lang.RuntimeException: Invalid token: ::>

5:08 noprompt: holy crap, i'm really sorry

5:08 Zerker: ,'(::)

5:08 clojurebot: #<RuntimeException java.lang.RuntimeException: Invalid token: ::>

5:08 noprompt: evil-mode fail.......

5:08 Zerker: ,(list (keyword ":"))

5:08 clojurebot: (::)

5:09 noprompt: reminds me of ruby

5:09 where you can do stuff like "::".to_symbol but not ::

5:10 Zerker: ,(eval '(list ::))

5:10 clojurebot: #<RuntimeException java.lang.RuntimeException: Invalid token: ::>

5:10 noprompt: ok i think i'm gonna turn off evil-mode in erc

5:10 Zerker: ,(quote (keyword ":"))

5:10 clojurebot: (keyword ":")

5:11 Zerker: ,(eval (cons 'quote (keyword ":"))

5:11 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

5:12 Zerker: Zerker: (eval (cons 'quote (keyword ":"))

5:12 noprompt: well that one actually makes sense

5:12 Zerker: ,(eval (cons 'quote (keyword ":")))

5:12 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

5:12 Zerker: '(eval 1)

5:13 ,(eval 1)

5:13 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

5:13 noprompt: oh man, i think i broke it.

5:13 (dec noprompt)

5:13 lazybot: You can't adjust your own karma.

5:13 * noprompt is embarrised

5:13 Zerker: ,(cons (keyword ":") (keyword "::"))

5:13 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword>

5:14 noprompt: when i tried (eval (cons 'quote (keyword ":")))

5:14 i got: IllegalArgumentException Don't know how to create ISeq from: clojure.lang.Keyword clojure.lang.RT.seqFrom (RT.java:505)


5:14 Zerker: ,(cons (keyword ":") '())

5:14 clojurebot: (::)

5:14 noprompt: weird

5:15 Zerker: I think evals are just prohibited, same as defs

5:18 noprompt: makes sense.

5:24 weavejester: why is html a macro in hiccup?

5:24 Raynes: noprompt: Optimization purposes mostly, IIRC.

5:24 noprompt: It generates as much of your HTML at compile-time as possible.

5:26 noprompt: interesting. that makes sense. i switched garden.core/css to a function today because i wasn't sure if i needed ito be a macro at this point.

5:26 i'm not that advanced yet.

5:27 i'm still trying to comprehend much of the hiccup source.

5:32 well i'm out for the night.

5:32 Raynes: Night

5:32 noprompt: :)

5:32 laters.

5:50 ordnungswidrig: re

5:52 abp: Any suggestions on how to store a ring app's configuration? I've got different environments like dev, test, staging, live. So I'm leaning towards having dev as a map of the basic configuration, merging in specific settings per environment. What environment the app is started in would be determined via an environment variable. (No set variable raises an error)

5:52 weavejester: abp: I tend to use environ

5:57 abp: weavejester: Yea, already seen environ. That seems more basic than what I need. Probably combined with carica I could do everything I think off.

5:57 weavejester: Also, your clojure-toolbox is missing a config section. ;)

5:59 Raynes: Oh, I guess...

5:59 weavejester: https://github.com/Raynes/leasdt

5:59 Er.

5:59 weavejester: https://github.com/Raynes/least

5:59 Highly doubt you have a category for that one.

5:59 But there it is nonetheless.

6:00 abp: Raynes: Web API Clients, your tentacles are in there. :P

6:00 Raynes: orly

6:00 Well, that works then.

6:17 $lfmassoc RaynesFM

6:17 lazybot: Associated your username.

6:17 Raynes: $last

6:17 lazybot: RaynesFM is listening to: Fall Out Boy - The Phoenix [Save Rock And Roll]

6:17 * Raynes wipes his brow.

6:18 Raynes: Welp, that was about 4 hours of work.

6:18 It's 3:17AM. I can't believe I stayed up this late working on that.

6:18 I have to go to work in the morning.

6:18 clgv: Raynes: that's called passion ;)

6:18 Raynes: It's called stupidity.

6:18 I just traded my well being tomorrow for a moment of pleasure tonight. :P

6:18 clgv: Thats what the unpassionate say ;)

6:19 Raynes: Sad part is that at least 2 of those 4 hours was fighting with vim-fireplace (found a couple of bugs).

6:19 clgv: that sucks

6:22 Raynes: Well. I'm going to sleep. Hard.

6:22 Goodnight #clojure.

6:27 filippobo: hi there

6:27 I have a seq of sets like: (def in '(#{1 6} #{3 4} #{2 5}))

6:28 how can I get something like (def out '(1 6 3 4 2 5)) ?

6:29 clgv: good night raynes

6:29 ,(reduce into [] '(#{1 6} #{3 4} #{2 5}))

6:29 clojurebot: [1 6 3 4 2 ...]

6:30 filippobo: into is the key!

6:30 clgv: no guarantees on order though

6:30 hyPiRion: yeah

6:30 filippobo: thanks clgv ;-)

6:31 ok... the sets are actually ordered-set

6:31 hyPiRion: ,(= (set (range -20 20)) (set (range 19 -21 -1)))

6:31 clojurebot: true

6:31 clgv: well, then you have a guarantee ;)

6:31 filippobo: sorted-set

6:31 hyPiRion: ,(= (seq (set (range -20 20))) (seq (set (range 19 -21 -1))))

6:31 clojurebot: false

6:44 clgv: ,(= (seq (sorted-set (range -20 20))) (seq (sorted-set (range 19 -21 -1))))

6:44 clojurebot: false

6:45 hyPiRion: ,(= (sorted-set (range -20 20)) (sorted-set (range 19 -21 -1)))

6:45 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to java.lang.Comparable>

6:45 hyPiRion: aha!

6:46 ,(= (apply sorted-set (range -20 20)) (apply sorted-set (range 19 -21 -1)))

6:46 clojurebot: true

6:48 clgv: ah damn. there was an asymmetrie...

6:48 * clgv hates those

6:49 hyPiRion: well

6:49 set != hash-set

6:57 ambrosebs: hyPiRion: whats the difference?

7:01 hyPiRion: ,(set (range 5))

7:01 clojurebot: #{0 1 2 3 4}

7:02 hyPiRion: ,(hash-set (range 5))

7:02 clojurebot: #{(0 1 2 3 4)}

7:02 hyPiRion: ambrosebs: I was talking about the functions, not the specific classes :)

7:02 ambrosebs: Got it :)

7:15 samrat: Raynes: I'm getting a "Invalid method signature supplied" error in least while trying the `write` example in the readme

7:26 naeg: what's the reader sugar behind #"regex"?

7:27 hyPiRion: naeg: what do you ask?

7:28 ,#"\d+"

7:28 clojurebot: #"\d+"

7:28 naeg: hyPiRion: actually I want to make a regex out of a normal string

7:28 hyPiRion: ,(re-find "1234 12421" #"\d+")

7:28 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to java.util.regex.Pattern>

7:28 hyPiRion: whoops.

7:28 naeg: oh, in that case you should probably use Pattern.

7:29 naeg: hyPiRion: btw, I found out what was wrong with my alpha-beta algorithm

7:30 hyPiRion: ,(java.util.regex.Pattern/compile "\\d+") ;; from string

7:30 clojurebot: #"\d+"

7:30 hyPiRion: oh?

7:30 naeg: (take-while cond (reductions ...)) doesn't work since

7:30 ,(last (take-while #(< % 100) [20 40 100 30]))

7:30 clojurebot: 40

7:30 naeg: won't return the 100, which I actually wanted

7:30 had to use reduce/reduced now

7:31 hyPiRion: oh

7:32 Zerker: ,(first (take-while #(>= % 100) [20 40 100 30]))

7:32 clojurebot: nil

7:33 Zerker: ,(doc take-until)

7:33 clojurebot: Cool story bro.

7:33 hyPiRion: heheh

7:33 drop-while

7:34 ,(drop-while #(< % 100) [20 40 100 30])

7:34 clojurebot: (100 30)

7:34 Zerker: naeg: ^?

7:34 naeg: Zerker: but can't use drop-while either, since that will realize the calls returned by (reductions ...)

7:35 were I put numbers in that example, there are actually function calls which where not realized yet, and should not be realized more than needed

7:35 Zerker: drop-while isn't lazy?

7:36 naeg: it is, but still the 30 is realized when you do

7:36 ,(first (drop-while #(< % 100) [20 40 100 30]))

7:36 clojurebot: 100

7:36 naeg: ...I think

7:36 checking...

7:38 hyPiRion: Zerker: it's the common issue

7:38 ,(take 1 (map #(do (pr \.) 0) (range)))

7:38 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox$eval35$fn>

7:38 hyPiRion: ,(take 1 (map #(do (pr \.) %) (range)))

7:38 clojurebot: (\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.0)

7:38 hyPiRion: it's semilazy

7:40 naeg: ,(drop-while #(< % 100) (reductions #(do (println %) (inc %2)) [98 99 100 101]))

7:40 clojurebot: (98\n100\n100 101\n101 102)

7:40 naeg: see, the call with 101 as arg is realized too

8:49 gdev: good morning fellow clojurist for whom the hour is indeed morning, else good afternoon or evening

8:56 , ((comparator >) 1/3 0.3333333333333333)

8:56 clojurebot: 0

8:56 gdev: , ((comparator >) 1/3 0.333333333333333)

8:56 clojurebot: -1

8:57 namespace: (Please note, I have no way of evaluating the strength of this code, so I'm assuming it's bad.)

8:57 http://pastebin.com/WQPsDwJj

8:58 I'm trying to print every line that ends with a question mark, and then print every line before it until one starts with an upper case letter.

8:59 The error message I get is "ClassCastException java.lang.Long cannot be cast to clojure.lang.IFn " which I read means I can't cast a long to a function.

9:00 dnolen: namespace: it means you're trying to invoke a number as a function

9:00 ,(1 'foo)

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

9:00 namespace: Right.

9:00 I don't see where I'm doing that.

9:05 dnolen: namespace: might be easier to see what's going if you provided the inputs you're using

9:06 namespace: That's the problem.

9:06 They're probably under copyright.

9:06 -_-

9:06 dnolen: namespace: I'm sure you can come up w/ sample inputs that don't infringe

9:06 namespace: Okay.

9:08 clgv: namespace: you should definitely lean about "let"

9:08 *learn

9:08 namespace: clgv: Noted.

9:09 clgv: there are far too many repetitions in your code snippet

9:09 namespace: I know about it, but don't know how it would help here.

9:09 clgv: namespace: better code is easier to understand by other

9:09 namespace: I'm sure when you point it out I'll go "Oh, I see, I'm dumb.".

9:10 dnolen: namespace: you have a lot of code duplication, (first ln) (last ln)

9:10 namespace: https://gist.github.com/swannodette/5420253

9:11 namespace: So that's how I'm supposed to indent it.

9:12 dnolen: namespace: update to remove all repeated (get vec f). that's how I would indent it anyways.

9:12 clgv: (get vec f) should also be calculated only once ^^

9:12 namespace: http://pastebin.com/5Bndgr0x Sample input

9:13 dnolen: namespace: but what parameter is that, your function takes two arguments

9:14 namespace: vec

9:14 dnolen: namespace: and what is the first argument?

9:14 namespace: can't test your fn w/o know both

9:14 knowing

9:14 namespace: Right.

9:14 (0 1)

9:16 dnolen: namespace: do you mean '(0 1) ?

9:16 namespace: So it should print everything except "And in other news..."

9:16 Maybe.

9:17 noncom: so i'm like trying to include a simple jar (not anywhere on clojars or sonatype but local) into a lein project

9:17 dnolen: namespace: yes or no? if you're inputing (0 1) that's the source of your error right there.

9:17 ,(0 1)

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

9:17 namespace: I don't know.

9:18 noncom: and in lein deps it says that it cannot get it since there is a typo in :dependencies or network issue

9:18 namespace: And thinking about it, yes.

9:18 dnolen: namespace: well I can't help you if you don't know :)

9:18 namespace: It's definitely the problem.

9:18 Thank you.

9:18 noncom: i followed this guide : http://www.pgrs.net/2011/10/30/using-local-jars-with-leiningen/

9:18 dnolen: namespace: you're also going to get null pointer exceptions in your code

9:18 namespace: ((print x) (questions (cons (inc l) l) vec))

9:19 print returns nil

9:19 namespace: Oh.

9:19 dnolen: and then you try to invoke it

9:19 you probably want:

9:19 (do (print x) (questions (cons (inc l) l) vec))

9:19 namespace: Yes, yes I do.

9:21 Notes for the future: 1. Look up how to indent. 2. Use let to shorten things I do more than once. 3. Use do. 4. Provide input along with the function. Did I get everything?

9:23 dnolen: namespace: the purpose of the ln parameter seems a bit convoluted. I'd look into eliminating it

9:23 namespace: Oh right.

9:23 I took that as a given.

9:25 dnolen: namespace: also on large enough inputs your program will probably stackoverflow. it appears it will do that anyway as I don't see a terminal condition and every branch recursively calls questions again.

9:26 namespace: The terminal condition is "the program crashes". It's standalone.

9:27 noncom: so anyone knows how to link not maven-enabled jars to a lein project?

9:27 joegallo: noncom: mvn install them

9:29 FAQ #4 https://github.com/technomancy/leiningen/blob/master/doc/FAQ.md

9:32 clgv: noncom:better do not - it is easy to add them to clojars. I have done that twice

9:36 noncom: mvn install or lein install gives errors... andidk how to push to clojars since it is a java lib

9:37 if you point to an instruction, i think it will help

9:37 clgv: noncom: just write a minimal pom and "scp" the jar with he pom to clojars

9:37 noncom: i did this: "mvn install:install-file -Dfile=jaad-0.8.3.jar -DartifactId=jaad -Dversion=0.8.3 -DgroupId=jaad -Dpackaging=jar -DlocalRepositoryPath=maven_repository" and maven created a pom

9:38 so there is one. does it have to be in the same folder as the jar?

9:39 joegallo: yes

9:39 it's doesn't just know where random jar files are on your machine

9:40 clgv: noncom: just do "scp jaad.pom jaad-0.8.3.jar clojars@clojars.org" provided you have an account at clojars and your user accoutns public ssh key is registered there

9:40 noncom: well it created the folder structure itself so i presumed it knew where all things are

9:40 clgv: noncom: https://github.com/ato/clojars-web/wiki/Pushing#ssh

9:41 oops pom.xml it is ;)

9:41 noncom: joegallo: whatever i do, even putting both the jar and the pom into the same dir, now, mvn install yields this: [ERROR] The goal you specified requires a project to execute but there is no POM in this directory

9:42 clgv: i'll try that! first i have to register on clojars and get the ssh though )))

9:42 i'm rather new to clojure so nothing is ready yet

9:43 clgv: noncom: are you on a linux machine?

9:44 noncom: clgv: nope) it'swin7

9:44 here is the pom that it generated: http://pastebin.com/UJBvRTBn, the library is named minim-2.1.0.jar

9:44 theyre in the same folder...

9:45 ehh... intended to be simple, but still lots of convolute things

9:45 maybe there is some definite instruction on that.. there should be some standard way of deadling with this, no?

9:47 i'll also try the ssh way now, i know how to make it work on windows, i did it before

9:48 clgv: :)

9:48 noncom: but why so hard...

9:48 joegallo: because you're doing something out of the ordinary

9:49 noncom: sure, i trust you, but i can't believe that using arbitrary java jars in my project on java machine is not ordinary :D

9:50 joegallo: you're right, i tell lies to newbies on the internet just for fun

9:50 noncom: :DDD

9:52 joegallo: https://gist.github.com/anonymous/aa0556dd7dbacd1e0a7e/raw/76ed293ad6b658cff154878e813d7c2d763895d2/gistfile1.txt

9:52 i dunno what to tell ya, buddy, it works fine here

9:59 noncom: joegallo: ok i did that the last time and it created the pom. now i did it again with your command (like removing .0 in the version which is like insignificant)... and the report is the same as yours - all success, but lein deps gives errors. here is the pastebin with the lein error and my project.clj file: http://pastebin.com/D7Jytnjx

10:02 namespace: Another stupid question: Is there a lib I need to load at runtime to get the clojure interop?

10:02 clgv: noncom: if you install it only locally I hope you have only one development machine and it's a private project ;)

10:03 borkdude: namespace interop from java or what?

10:23 noncom: TimMc: yeah, agree. just have to accustomize myself with the system. see i'm coming from a stone age when jars were plugged-in manually. hey i used sbt for scala but there are not problems like that..

10:23 internet repository i consider a major good since it helps centralization and is a result of evolution

10:25 TimMc: More importantly, it helps with repeatability.

10:25 ~repeatability

10:25 clojurebot: repeatability is crucial for builds, see https://github.com/technomancy/leiningen/wiki/Repeatability

10:27 noncom: ooh!)

10:27 mefesto: is there a definitive index of ClojureScript libraries?

10:50 in clojurescript, is there a built-in function for converting a NodeList to a seq or vector?

10:53 gdev: is there a schedule for the google hangout sessions? I always see those posted after they're over.

11:00 dnolen: mefesto: no but you can easily extend NodeList to ISeq, ILookup etc yourself.

11:00 ppppaul: when would i use reverse over rseq?

11:00 mefesto: dnolen: ok thanks

11:01 noncom: what is the idiomatic way in clojure to name variables whose names collide with standard ones. like i have a fn argument named "name"

11:02 dnolen: ppppaul: reverse calls rseq

11:02 mpenet: noncom: in most case I wouldn't bother, unless you need clj.core/name in your fn

11:08 ppppaul: on clojuredocs the source says otherwise

11:08 maybe this has changed past 1.3

11:08 noncom_: mpenet: yeah, i mostly don't but this is the case.. so ok, i just make some prefix i think

11:13 tmciver: noncom_: the way to exclude a name is like this: http://clojuredocs.org/clojure_core/1.2.0/clojure.core/refer-clojure

11:14 noncom_: yeah...

11:20 naeg: how to [0 1 2 3] => [[0 1] [2 3]]?

11:20 it's so simple, but can't remember...

11:20 ucb: ,(doc partition)

11:20 clojurebot: "([n coll] [n step coll] [n step pad coll]); Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap. If a pad collection is supplied, use its elements as necessary to complete last partition upto n items. In case there are not enough padding elements, return a partition with less than n items."

11:20 ucb: naeg: ^^^

11:20 naeg: ucb: thanks! I remember now...

11:29 AndChat718256: ,(doc seq)

11:29 clojurebot: "([coll]); Returns a seq on the collection. If the collection is empty, returns nil. (seq nil) returns nil. seq also works on Strings, native Java arrays (of reference types) and any objects that implement Iterable."

11:33 joegallo: ucb: ##(seq (apply hash-map [0 1 2 3])) ; the subtle bugs this would result in would so amazingly devious

11:33 lazybot: ⇒ ([0 1] [2 3])

11:34 ucb: heh - nice joegallo

11:34 joegallo: we really need an evil bot to answer questions with misleading code that happens to work for their simple answer

11:34 ucb: isn't there a findfn thing that'll do something like that already?

11:34 joegallo: well, it give non-evil answers, too

11:35 ucb: yeah

11:38 TimMc: joegallo: ##(trampoline + 2 3)

11:38 lazybot: ⇒ 5

12:04 technomancy: joegallo: lazybot answers a bunch of questions in the negative; that could be considered evil

12:11 gunface: Is there anyway to connect privately to the clojurebot so that everyone doesn't see my error messages? :P

12:11 gdev: yeah, hit ctrl+alt + t, type lein repl, hit enter

12:11 hiredman: it's called "a repl" you can even run it on your computer

12:13 tpope: Raynes: pong (already rolled back the problematic commit)

12:14 * clgv slaps the bad guys :P

12:21 TimMc: gunface: Private-message it.

12:22 But yes, `lein repl` also works surprisingly well as a repl. :-P

12:22 technomancy: eh; it's all right I guess

12:24 rkh: Hehehe.

12:24 gunface: Yeah but I am on my android far away from lein :P

12:24 gdev: theres an android repl app

12:25 gunface: There is :O

12:25 gdev: https://play.google.com/store/apps/details?id=com.sattvik.clojure_repl&hl=en

12:27 Daniel Solano Gomez also did a talk about getting clojure on android which is on youtube

12:29 gunface: gdev you just made my commutes so much more fun :)

12:29 Thanks a lot

12:29 And yeah will check that talk

12:31 luxbock: I'm learning Clojure (and programming in general) by creating an application for analyzing poker hands

12:32 atm I'm working on interpreting handranges (for example: AK, ATs would be a range that includes all combinations of Ace King, and Ace Ten suited)

12:32 here are the full list of hand range macros I have in mind: https://www.refheap.com/paste/13773

12:33 ToBeReplaced: i just did my first clojars release! https://github.com/ToBeReplaced/jdbc-format ... high-fives?

12:33 luxbock: so these are all strings that then get translated to the proper card data type representation (they are just vectors)

12:34 I figured that before I jump to the task at hand, I should ask here about what's the best way to go about implementing it

12:34 should I just use regex or are there alternatives to that?

12:35 nz: luxbock: last night I saw a presentation on how to do poker hand detection using core.logic https://github.com/PasiHeikkinen/poker

12:35 luxbock: oh cool

12:35 nz: luxbock: which is not the way to go if you need any kind of speed

12:36 TimMc: ToBeReplaced: Sweet! Did you sign it?

12:37 luxbock: yeah speed is definitely an issue further down the road

12:38 nz: luxbock: some links: http://spaz.ca/poker/ http://poker.cs.ualberta.ca/

12:39 luxbock: yep, I've read their stuff before

12:40 though now my focus is more on how to learn how to program and less on how to play poker :)

12:40 ToBeReplaced: TimMc: no i didn't; can you link me somewhere to learn about that?

12:43 rboyd: luxbock: so this is for classifying holdem starting hands/hole cards?

12:43 luxbock: yep

12:43 rboyd: luxbock: there's https://github.com/jamesmacaulay/poker-hands for ranking 5 card hands. also a pr in there from me on finding the best 5 of 7

12:43 not exactly what you're trying to do but maybe useful later

12:45 luxbock: thanks

12:45 TimMc: ToBeReplaced: `lein help gpg`, or https://github.com/technomancy/leiningen/blob/stable/doc/GPG.md

12:45 Basically, create a GPG keypair and use lein deploy. (This is all lein 2.)

12:46 Once everything is set up it is easy-peasy.

12:47 ToBeReplaced: i guess it auto-signs on lein deploy clojars?

12:49 is there a way to sign a version already uploaded?

12:49 xeqi: ToBeReplaced: yep, trying to make it easy

12:49 and no, but would you really want to sign a jar that was on the internet

12:50 ToBeReplaced: good point

12:50 xeqi: though atm you do have to assume we're not messing with the jars to use the ecosystem :p

12:51 TimMc: ToBeReplaced: The easiest thing to do is make another commit bumping the version number at the patch level ("bugfix: jar was not signed") and then lein deploy that.

12:51 ToBeReplaced: where can you see whether or not something was signed? i had filled out my ssh public key prior to deploy

12:52 TimMc: xeqi: I can see a potential problem here for people who are doing their first signing.

12:52 xeqi: there is a .asc file in the repo, I really should add some sorta flair to the artifact page for signed / releases repo stuff

12:53 TimMc: Try to deploy; signing fails; can't re-deploy over artifact; bump the version; try to deploy the new version; signing fails for another and exciting reason...

12:54 xeqi: TimMc: the signing happens before the push to the server

12:54 all the server does is save the files, all the logic is client side

12:54 technomancy: TimMc: you don't have to bump the version number ATM

12:54 we're just discussing making that change; hasn't happened yet

12:55 you can just redeploy currently

12:59 ToBeReplaced: hm... so i definitely didn't add a gpg key before deploying... but it is showing up as signed with lein deps :verify; if i filled out ssh public key, does that count as a signature?

13:00 xeqi: ToBeReplaced: no, that just lets you deploy wit hssh, which used to be the normal way to do it

13:00 technomancy: ToBeReplaced: whether it's signed is different from whether clojars can verify the signature server-side

13:00 ToBeReplaced: for Clojars to verify, it needs your gpg key to be added to your profile

13:00 but it will happily serve a signature you deploy without verifying it

13:00 xeqi: it appears that you did sign it https://clojars.org/repo/jdbc-format/jdbc-format/0.1.0/

13:03 ToBeReplaced: so i assume that since i already had a gpg pair, lein deploy clojars signed the jar... then when i added my pub key to my clojars profile, it was able to verify?

13:04 TimMc: technomancy: But once overwriting is prevented, this could become an issue.

13:05 technomancy: indeed

13:05 TimMc: I guess if you can prevent the deploy if signing fails, it's all good.

13:07 ToBeReplaced: is there a thread where i can read about the decision for clojars to use gpg?

13:08 augustl: anyone got some favorite clojure swag webshops? :)

13:09 technomancy: ToBeReplaced: all the infrastructure around Maven assumes GPG, and it has hands-down the best tooling for this kind of thing

13:10 ToBeReplaced: do you mean GPG vs another signing mechanism, or do you mean the decision to encourage signing in general?

13:10 ToBeReplaced: both? i'm not sure what i'm asking... i don't know what factors come into play

13:11 i'm just kinda surprised by me having signed something without knowing it

13:14 technomancy: it didn't prompt you for your passphrase?

13:14 but yeah, I think the output could be clearer

13:15 TimMc: ToBeReplaced: I didn't like it using my regular GPG key for software signing, so I added a key selection patch. It was a bit startling.

13:15 ToBeReplaced: technomancy: it did, you're right

13:16 technomancy: it could definitely be clearer about why it's asking

13:17 ToBeReplaced: you know, i think i was just confused; it all seems to make sense now

13:18 technomancy: there's kind of a lot going on

13:19 I wonder if we could de-emphasise the SSH pubkey section of the profile

13:19 billy_bodacious: im using lein ring uberjar but it throws a classnotfound exception regarding a require in a ns, where as lein uberjar works fine, anyone have a clue as to why

13:19 ToBeReplaced: i got confused because of the combination of ssh and gpg

13:19 technomancy: ToBeReplaced: SSH is legacy

13:20 weavejester: billy_bodacious: lein uberjar doesn't necessarily compile anything, but lein ring uberjar currently works using an AOT-compiled servlet class

13:20 ToBeReplaced: i probably glossed over the gpg thinking it was ssh -- is there any reason to keep an ssh pub key in my clojars profile now?

13:20 since no scp etc.

13:20 weavejester: Really it should probably use a static java class that calls the Clojure code, but I haven't got around to writing that

13:20 TimMc: lein 1

13:20 billy_bodacious: weavejester: so how do i start to fix this?

13:22 weavejester: i can run lein repl and require it.. it even works fine with lein ring server

13:22 tieTYT2: hi weavejester: maybe you can help me with my issue: http://stackoverflow.com/questions/16094439/is-it-possible-to-build-a-ring-webapp-in-an-already-existing-javaee-project

13:22 technomancy: ToBeReplaced: we don't want to remove scp for people who are currently using it

13:23 weavejester: billy_bodacious: I'd have to see the full error

13:23 technomancy: ToBeReplaced: but we could move it to an "advanced" section or something

13:24 weavejester: tieTYT2: No idea I'm afraid. I know servlets pretty well, but little beyond that in the Java web development stack.

13:24 tieTYT2: aw :( ok

13:26 since I can't use compojure at work, I'm thinking of cheating and making a library called clojersey that converts compojure-like code into jersey resources

13:26 billy_bodacious: weavejester: http://pastebin.com/NBees1gW

13:28 weavejester: billy_bodacious: Hm, doesn't really have much useful information there… Have you tried a "lein clean"? Perhaps there's some old servlet class file screwing things up.

13:28 xeqi: technomancy: agreed re: demphasizing ssh key. want to make an issue?

13:28 billy_bodacious: weavejester: yes i have

13:30 weavejester: billy_bodacious: Hum, no idea what the issue is. It's strange that the NPE is triggered by the compiler… What does your project file look like?

13:32 billy_bodacious: weavejester: http://pastebin.com/Lemfxzqv

13:32 weavejester: billy_bodacious: There's no lein-ring plugin in that project file...

13:32 billy_bodacious: its in my global profile

13:33 does it need to be in the project file?

13:33 weavejester: billy_bodacious: Well, it's possible to put it in the global profile, but it doesn't make much sense to do so

13:34 billy_bodacious: Presumably you've also put the lein-ring configuration for your project in your global profile as well?

13:34 billy_bodacious: weavejester: no additional configuration in there

13:35 weavejester: billy_bodacious: So where's your :ring {:handler my.app.blah/handler} ?

13:35 billy_bodacious: oh the last line got cutoff in the past

13:35 it's: :ring {:handler overdue-invoices.core/handler})

13:36 i added ring to the plugins but still got the same error

13:37 weavejester: billy_bodacious: You could try adding lein-ring to the project.clj file. I can't think why that would make a difference, but it's worth reducing the number of unusual elements.

13:37 billy_bodacious: What version are you using? 0.8.3?

13:38 billy_bodacious: weavejester: yea

13:38 weavejester: Try removing it from your global profile and putting it in your project.clj.

13:39 billy_bodacious: just a second

13:40 same error

13:41 just doing lein compile overdue-invoices.core gives the same error, so i guess its not related to the ring plugin

13:41 weavejester: billy_bodacious: Ahh, that would explain things.

13:42 Well, at least why lein-ring can't compile it

13:52 gdev: ToBeReplaced:) I'm working on a small clojure project that hits a relational database so I'll try out your jdbc-format library.

14:00 technomancy: xeqi: ah, you created it; thanks

14:03 ToBeReplaced: gdev: that would be cool! i'd appreciate the feedback

14:03 clojure-new: hello

14:03 ,(pmap (fn [_] (println "Downloading ")) (range 3))

14:03 clojurebot: #<SecurityException java.lang.SecurityException: no threads please>

14:03 clojure-new: &(pmap (fn [_] (println "Downloading ")) (range 3))

14:03 lazybot: java.lang.SecurityException: You tripped the alarm! pmap is bad!

14:04 billy_bodacious: weavejester: i think i have fixed it, but now uberwar just seems to hang forver, it almost looks like its running my project..

14:04 rasmusto: lazybot: pmap isn't necessarily bad always

14:04 clojure-new: anyway, why does println in pman doesn't insert newlines like it does without pmap?

14:04 weavejester: billy_bodacious: One of your source files probably blocks when it's evaluated.

14:05 billy_bodacious: When Clojure compiles things, it evaluates the whole namespace

14:05 clojure-new: it inserts it in random way.

14:05 for example

14:05 (pmap (fn [_] (println "a")) (range 3)) => aaa\n\n\n

14:05 or

14:05 (pmap (fn [_] (println "a")) (range 3)) => aa\na\n\n

14:06 how can i print something inside pmap?

14:06 Glenjamin: you probably need a thread-safe output stream of some sort

14:06 why do you need to print in a pmap?

14:07 weavejester: clojure-new: pmap runs things from multiple threads. When multiple threads are writing to stdout, they can overlap.

14:07 clojure-new: weavejester: oh, i see, thanks.

14:07 Glenjamin: just info messages about how well my functions are doing their job.

14:08 jjido: trying to understand how it works maybe

14:08 clojure-new: is there any thread safe println in clojure?

14:08 weavejester: Not to my knowledge. Nor in Java. It's not something that people typically need.

14:09 Glenjamin: logging frameworks usually would be

14:09 jjido: logging

14:09 weavejester: Oh, that's true

14:09 Glenjamin: http://stackoverflow.com/questions/565893/best-practices-for-java-logging-from-multiple-threads

14:10 clojure-new: Glenjamin: thanks@

14:10 !

14:11 amalloy: haha guys, andy's tickets-needing-work email introduced me to a neat bug:

14:11 &[do 1 2 3 4]

14:11 lazybot: ⇒ 4

14:11 Glenjamin: i'm not very familiar with the clojure logging options, but that page describes the general idea

14:12 technomancy: whoa

14:12 Glenjamin: thats weird o.O

14:12 i guess that's only with do?

14:12 technomancy: oh!

14:12 because of the gilardi scenario workaround

14:12 that's bonkers; I love it

14:12 amalloy: technomancy: what workaround?

14:13 technomancy: amalloy: the reason (do (require 'clojure.set) clojure.set/join) doesn't asplode

14:13 do is special-cased by eval to split it apart and doseq over evaling each part individually

14:17 jjido: is this only in eval scenario ?

14:17 technomancy: jjido: yeah

14:18 also only works with top-level do

14:26 TimMc: technomancy: But it doesn't need to work with sets and vectors, right?

14:26 technomancy: TimMc: yeah, looks like that's accidental

14:27 TimMc: &#{(println "of") do (do :z/h283r (println "order")) (do :b121 (println "out"))} ;; amalloy

14:27 lazybot: ⇒ out of order nil

14:27 TimMc: (keywords are there to make the hashes order properly)

14:28 technomancy: hah; nicely done

14:33 TimMc: &(let [_ :_] #{[-1] [[1]] do}) ;; and you're right, it's onlt at the top level

14:33 lazybot: java.lang.RuntimeException: Unable to resolve symbol: do in this context

14:33 TimMc: &'(let [_ :_] #{[-1] [[1]] do})

14:33 lazybot: ⇒ (let [_ :_] #{do [-1] [[1]]})

14:34 Raynes: tpope: Pingsies.

14:36 TimMc: Wow, the Conj is going to be in DC!

14:36 Freaking finally.

14:37 Raynes: DC scares me.

14:37 I don't like things that are both not a country and not a US state at the same time.

14:37 TimMc: Like Puerto Rico?

14:37 mynomoto: what's the best way to setup autotests in clojure? I'm using inotify with 'lein test' but it's slow.

14:37 * Raynes shudders

14:37 TimMc: How about Antarctica?

14:38 mefesto: lol

14:38 what a funny discussion to drop in on

14:39 technomancy: mynomoto: most people do it from within the editor/ide

14:39 in emacs you can hook up an after-save-hook

14:40 mynomoto: technomancy: but the hook will call 'lein test'?

14:41 technomancy: mynomoto: no, you'd trigger it over nrepl

14:41 so it doesn't have to start a new JVM

14:41 mynomoto: the biggest problem is there's no way to reliably tell given a changed file which tests need to run

14:42 (which is not in any way specific to clojure)

14:42 mynomoto: technomancy: but it reloads every file to rerun the tests?

14:44 technomancy: mynomoto: it's up to you; you can write the hook however you like

14:45 typically you'd try to determine a test namespace; load it with :reload-all, and run its tests

14:46 wjlroe: If a library depends on an old clojure in its project.clj, and you depend on it - do you have to specify a exclusion for that dep in your project so as to use the version of clojure you want?

14:47 mynomoto: technomancy: thanks, I will try that.

14:54 technomancy: wjlroe: unless a dependency defines a version range you will be fine

14:54 wjlroe: if you're having trouble figuring out what's going on, the lein-pedantic plugin is helpful there

14:55 wjlroe: technomancy: oh ok brilliant. It just so happens I'm using quickbeam in something

14:55 technomancy: wjlroe: oh dear... that was a rather hurried hack =)

14:55 don't set your expectations too high

14:56 wjlroe: technomancy: it seems to be the only clojure lib for accessing git though - but it's simple enough to extend it to support more of JGit, my needs are modest anyway, just want listing branches/tags and reading files in different branches like that

14:57 technomancy: there's another one IIRC

14:57 which has had more than 2 hours of work put into it =)

14:57 but happy to take pull requests if you'd like to extend it further

14:58 wjlroe: the problem of googling for "clojure git" is that the results are utterly meaningless :)

15:00 oh ok just found https://github.com/clj-jgit/clj-jgit

15:05 jweiss: i have a forward declaration in my namespace. trying to compile it fails (as expected), but (require 'my-ns) works, even on a fresh repl

15:05 oh wait, i get it

15:05 it bails out of the forward decl the first time but the 2nd time it exists

15:06 no.. wait, it still couldn't evaluate the thing that it is missing

15:06 SegFaultAX: This is way offtopic, but I have to share it: http://boingboing.net/2013/04/18/what-happens-when-you-wring-ou.html

15:07 jweiss: how is it nrepl-compiling fails but require works

15:07 it partially loaded it the first time so require thinks nothing more needs to be done?

15:11 ppppaul: i love memoize

15:14 tpope: Raynes: sup

15:16 gdev: Raynes:) Reply from tpope: bytes=32 time=3 hours TTL=4ever

15:18 tpope: I am replying to his ping from less than an hour ago

15:18 but thanks peanut gallery

15:25 gdev: tpope:) it was just a joke, no need to go and insult the whole gallery like that

15:35 antares_: Welle 1.5 is released: http://blog.clojurewerkz.org/blog/2013/04/19/welle-1-dot-5-0-is-released/

15:46 mefesto: clojurescript is so cool :)

15:47 do most people stick with the gclosure libs or use jquery and other things with cljs?

15:48 obviously you could do either but im just wanted to get a feel for what the pros are doing

15:48 mpenet: mefesto: a bit of both, some use angular too, there is no rule really

15:48 closure is easy to reach, there is that.

15:48 mefesto: mpenet: any best practices emerging yet that you know of?

15:49 mpenet: I don't think so.

15:49 there are some "neutral" libs that are good in any context I think, such as hiccup like templating and stuff like that

15:50 but this is very subjective, some prefer other ways

15:59 mynomoto: Someone know why this does't work? (clojure.java.shell/sh "inotifywait -qq -r -e modify,moved_to,create src test")

15:59 tgoossens: I don't know how rich hickey manages it but for a month now i've been experimenting with static methods all in my project (annoying a lot of people of my team). And by now i get the feeling that after all it is still a bad idea to use static methods frequently

15:59 asteve: (map symbol ["?value_id" "?value_ts" "?timestamp"]); I need the result to ?value_id ?value_ts ?timestamp

15:59 but map symbol … returns a list with the symbols

16:01 lynaghk: mynomoto: you need to pass each argument as a separate string: (clojure.java.shell/sh "inotifywait" "-qq" "-r" ...)

16:02 mynomoto: lynaghk: Ok, thank you. I will try.

16:03 weavejester: Does anyone happen to know if a "unchecked" macro exists that substitutes forms like (+ 1 1) for (unchecked-add 1 1)?

16:04 mynomoto: lynaghk: It works. Do you know why can't be just a string?

16:05 asteve: how can I, given a vector, return each element separated by a space but not in a list or vector?

16:05 ["a" "b" "c"] becomes a b c

16:05 lynaghk: mynomoto: because you are passing a bunch of different arguments to a command. Typically your shell (i.e., bash) will split everything up for you automatically, but in this case you're not going through bash so you need to split the args apart yourself

16:06 mynomoto: that's my understanding, anyway. I'm not a big unix hacker =)

16:06 joegallo: asteve: in a string? or in a code form?

16:06 asteve: code form

16:06 in this case a b c are symbols

16:06 joegallo: ~@

16:06 clojurebot: @ is what

16:06 joegallo: heh

16:07 asteve: joegallo: that is only if they're quoted?

16:07 TimMc: clojurebot: forget what |is| @

16:07 clojurebot: I forgot that what is @

16:07 TimMc: ~@

16:07 clojurebot: @ is like the macro version of apply

16:07 joegallo: neat

16:07 * TimMc shrugs

16:07 joegallo: asteve: i don't understand the question

16:08 you can magic up a list of things, manipulate the crap out of them, and then ~@ them in

16:08 if you're not in a quoted context, then i'm afraid i don't understand what you're doing at all -- perhaps a gist or something might help

16:08 asteve: joegallo: are you familiar with cascalog?

16:09 joegallo: no, i'm not

16:09 weavejester: Hm, actually unchecked math doesn't seem to have a huge speedup. I won't bother with it until I really need it.

16:09 mynomoto: lynaghk: I'm not either, just curious. Thanks.

16:10 TimMc: asteve: Are you writing a macro?

16:10 asteve: I have a vector containing strings that I need to convert to symbols and then splice them into a function; (func-name [] (call-other-func "something here") (mapv symbol ["?a" "?b" "?c"]))

16:10 TimMc: I know of it but not well enough to use it

16:11 TimMc: "splice them into a function" sounds like syntax generation (macros)

16:13 llasram: asteve: I use Cascalog frequently. What's your goal in Cascalog terms?

16:13 joegallo: ,(apply + [1 2 3])

16:13 clojurebot: 6

16:13 joegallo: (+ 1 2 3)

16:13 clojurebot: *suffusion of yellow*

16:13 joegallo: ,(+ 1 2 3)

16:13 clojurebot: 6

16:13 joegallo: if it's just a function, then why can't you use apply?

16:14 llasram: asteve: There's also #cascalog, although in my experience it is infrequently populated

16:14 asteve: llasram: heh, to understand how a project that is written in a very poor manner is currently working; it's very simple, I want to read in 3 fields from a file and spit them out into another file but use the proper aggr queries

16:14 llasram: Speaking of...

16:14 asteve: llasram: I've been asking in there and that brought me here to solve the vector -> splice problem

16:14 which may be the completely wrong way to do everything

16:16 lynaghk: mynomoto: no worries

16:16 llasram: asteve: Yeah, I'm afraid I'm not quite following. You have a text file input, and you want to parse three fields out of it, to then deal with as their query variables w/in a query?

16:16 asteve: llasram: here's the pastie http://pastie.org/7665272

16:17 I believe the reason it does not work is because (map symbol ["?blah..) is returning (?value_id ?value_ts…) not ?value_id ?value_ts

16:18 llasram: Well, no

16:18 So, there's two things going on

16:19 It's kind of confusing, but in places where you need to use generated field names, you use strings, not Clojure symbols

16:19 So you could do e.g.: (let [outfields ["?a" "?b"]] (<- outfields <rest of query>))

16:20 The bigger issue: why do you need generated field names?

16:20 SegFaultAX: What does <- do?

16:20 asteve: create a cascalog query

16:20 llasram: SegFaultAX: It's part of the Cascalog API. It generates a query

16:20 SegFaultAX: Ah.

16:21 asteve: llasram: I need generated field names because the actual code builds these dynamically and mk-values-view is a macro

16:23 llasram: asteve: Well. Two approaches. (a) You don't actually need a macro, because you can programatically construct almost any query just using what Cascalog provides. For this approach, You solve your "I need `?a ?b`, not `(?a ?b)`" problem by using a sequence of strings to *replace* the field list, not *inside* the field list

16:24 asteve: (b) If you really need a macro, it sounds like you want quote-splice: ~@

16:24 TimMc: splicing-unquote

16:24 llasram: ,(let [x '[a b c]] `(example ~@x))

16:25 clojurebot: (sandbox/example a b c)

16:25 llasram: TimMc: Right

16:25 What he said, name-wise

16:25 gfredericks: ,'~@foo

16:25 clojurebot: (clojure.core/unquote-splicing foo)

16:25 TimMc: ,'~@_

16:25 clojurebot: (clojure.core/unquote-splicing _)

16:25 * gfredericks wins

16:25 asteve: well the good news is ~@ does not fix the source tap error

16:25 TimMc: :-(

16:25 asteve: so that means the problem is somewhere else

16:25 llasram: asteve: Wait

16:26 asteve: So, you're trying to pass `mk-values-view` directly to `?-`, but in your pastie, that's a function, not a query

16:32 jweiss: i am getting 'cant recur from non tail position' on line 15, but i can't figure out how it is NOT in the tail position. https://www.refheap.com/paste/13778

16:33 dnolen__: jweiss: you put a recur in a doseq

16:33 llasram: jweiss: Check what `doseq` expands to. Probably wouldn't do what you wanted, even if it complied

16:34 jweiss: ah yes, the doseq still has to be evaluated even though it returns nil

16:34 asteve: llasram: http://pastie.org/7666703 am I doing something stupid here?

16:35 jweiss: ok... so what am i missing here, i want to do tail recursion and i am keeping track of the stack myself so that should be possible

16:37 llasram: asteve: Your macro is splicing the `outargs` symbols into the body of the query, where the Cascalog `<-` macro expects sequences

16:37 asteve: Sorry, not the `outargs` splicing -- the second use

16:37 asteve: llasram: the strange thing is that `(<- [~@outargs] was taken directly from the working code

16:38 llasram: Yeah, that part is "fine"

16:38 asteve: right, ok :)

16:38 llasram: But I will reiterate -- there's probably no reason to use a macro here

16:39 asteve: you are most certainly right, I really need to understand the running code before I recreate it

16:39 llasram: gotcha

16:39 amalloy: jweiss: not related to your question, but the if on line 13 will always be truthy

16:39 Raynes: tpope: Ohai.

16:40 tpope: I was going to ask if there is a way to change how fireplace invokes lein but then I realized I was dumb and that it doesn't.

16:40 jweiss: amalloy: yeah i noticed that, should be (seq fields-to-create) right

16:41 let's see i guess i have to pass a list of entites to create instead of just one

16:41 Raynes: tpope: Other thing was I just wanted to say grrrrr about https://github.com/tpope/vim-fireplace/issues/48#issuecomment-16643219, though I'm sure you've already seen it and are entirely baffled.

16:43 tpope: Raynes: vim can be ... unpredictable when it comes to redrawing the screen

16:43 Raynes: Heh

16:43 tpope: Raynes: but the location list shouldn't be auto-opening anymore

16:43 Raynes: As of when? I have the latest.

16:44 asteve: llasram: ok, this is enough for the week; thank you for your help

16:44 llasram: asteve: np. good luck sorting it out

16:44 tpope: well I'll be

16:45 maybe I forgot to push or something

16:46 but that was well before the rename

17:03 stuartsierra: Is Nicolo Mometto here?

17:03 * Nicola Mometto

17:07 Bronsa: hello?

17:08 Bronsa: stuartsierra: yes?

17:08 stuartsierra: Hi

17:08 Bronsa: hi =)

17:09 stuartsierra: Bronsa: I'm working on Clojure Hudson releases.

17:09 Bronsa: yeah, I saw that on github

17:09 stuartsierra: You were trying to release tools.reader 0.7.4 earlier right?

17:10 Bronsa: last I tried was a few days

17:10 ago*

17:10 but yeah

17:10 stuartsierra: I've nearly got Hudson reconfigured. With your permission, I'd like to use tools.reader as my test case.

17:10 Bronsa: sure.

17:10 stuartsierra: OK.

17:11 I'll push some minor updates to the pom.xml file, then edit the Hudson config & try to release it.

17:11 Bronsa: right, do whatever you need

17:11 Raynes: tpope: Looks like it fixed my issue as well.

17:11 tpope: perfect

17:12 Raynes: tpope: Is there a leader command or something for :%Eval?

17:12 I hate having to define those things. I never know what to use. Always stepping on something's toes. :p

17:12 tpope: Raynes: no, but cpr does (require ... :reload)

17:12 Raynes: Oh, I see.

17:14 tpope: Is the namespace the same as the file I'm in?

17:14 tpope: Raynes: it looks for a ns declaration

17:14 Raynes: Man, that's a terrible nickname, namespace. You're going to get soooooooooooo many spurious pings.

17:15 stuartsierra: Bronsa: Here it goes...

17:15 Raynes: tpope: This is all very amazing, what you've done here. It's like you have a perversely vast knowledge of viml that borders on mental illness or something.

17:15 TimMc: (Raynes org.timmc.thing (:require [clojure.string :as str]))

17:15 oh, sorry about that

17:15 It's my new Clojure variant.

17:16 tpope: no bordering about it

17:17 hyPiRion: TimMc: What kind of class is Raynes?

17:17 Bronsa: stuartsierra: damn :/

17:17 hyPiRion: Or was the outher paren a non-language paren?

17:18 stuartsierra: Bronsa: The weird part is, it worked.

17:18 Bronsa: mh.

17:18 stuartsierra: There's just some failure in parsing the response from Nexus.

17:18 Bronsa: oh.

17:19 stuartsierra: I'm going to try upgrading the plugin.

17:19 Bronsa: stuartsierra: that might be a problem though, since clojure-build didn't bump pom.xml & git tag'ed

17:19 stuartsierra: yeah

17:20 So now we have a release of tools.reader 0.7.4 in a repository but no tag in Git.

17:20 I can log in to the Hudson server and fix this manually.

17:22 Raynes: tpope: God, Tim. "I wish I had Clojure interaction in Vim. Oh, there's something by Tim Pope. Hmm, sure wish I had git integ… oh, Tim. Well, I could use some markdown highl OH COME ON."

17:23 technomancy: Raynes: that's why they let him wear the big hat

17:23 amalloy: quick, Raynes, ask for a pony

17:23 Raynes: That sure is a good looking hat.

17:25 tpope: Raynes: that's not entirely unlike my interior monologue

17:26 Raynes: Staging individual hunks confuses me though.

17:26 tpope: it's a bit awkward

17:26 I still do git add -p a lot

17:26 Raynes: tpope: In Emacs's magit, I can stage a specific region (highlighted with my mouse).

17:27 With this I can only stage the entire hunks.

17:27 As far as I can discern anyways.

17:27 tpope: Raynes: after highlighting you can do :diffput

17:27 technomancy: Raynes: there's a darcs mode that lets you edit in the status buffer so you can stage stuff that's never actually existed on disk

17:27 it's kinda bonkers

17:27 Raynes: tpope: Really? I thought I tried that.

17:27 technomancy: actually I think gitsum does that too

17:27 tpope: you can do that with fugitive too

17:27 edit the stage directly

17:27 Raynes: I can edit the stage?

17:27 See, it'd help if I understood how git works.

17:27 Bronsa: stuartsierra: thanks

17:27 stuartsierra: Bronsa: OK, I've manually pushed the tags and master branch to tools.reader.

17:28 Bronsa: heh.

17:28 tpope: Raynes: yeah, if you switch to the diff buffer, you can edit it

17:28 and writing it writes to the index

17:28 stuartsierra: Now back to work on making this work.

17:28 technomancy: brings me back: http://chneukirchen.org/blog/archive/2008/02/introducing-gitsum.html

17:29 Raynes: tpope: So :Gdiff and then edit the one on the left?

17:29 tpope: yep

17:29 Raynes: Nice.

17:29 tpope: or just :Gsplit or whatever if you don't want that painful diff highlighting

17:29 * Raynes gives tpope a nice big vimhug.

17:31 amalloy: technomancy: bonkers? it's not terribly hard to stage stuff that never existed on disk, using just the git command-line

17:32 technomancy: amalloy: bonkers that the tool goes out of its way to support it

17:32 amalloy: it's useful! manually editing hunks is handy

17:33 * technomancy backs away slowly

17:42 Raynes: technomancy: amalloy has taken git commit trees and turned them into art. He has broken it down to a science. We sometimes print his network graphs and display them on the wall.

17:42 amalloy: cool, another item for my collection of Things That Never Happened

17:44 weavejester: Are we talking more sophisticated than "git add -p"?

17:45 Because that's about as magical as I get :)

17:46 amalloy: weavejester: well, i was talking about selecting the 'e' option for a hunk with git-add -p

17:46 Raynes: weavejester: He can rebase a tree onto mars without killing it.

17:46 They're planning to let him terraform it with this method.

17:46 amalloy: hahaha

17:47 technomancy: rebase onto the two trees of valinor

17:48 Raynes: Whoosh.

17:49 I can't talk to technomancy for longer than 3 references or I start to feel inadequate.

17:49 amalloy: but Raynes, with http://xkcd.com/903/ you can sound just as smart as he does

17:49 technomancy: onto the white tree of Gondor?

17:50 Glenjamin: 'e' in git-add -p is mental

17:50 Raynes: Well, I've seen the Lord of the Rings movies.

17:50 I couldn't get past the first chapter of the first book in that series.

17:50 Felt like reading the bible.

17:50 Derander_: rebase on to the world tree.

17:50 technomancy: did you start with the Silmarillion?

17:51 Raynes: Lord of the Rings novels.

17:51 amalloy: Raynes: i found the hobbit a lot more approachable than the LotR series proper

17:51 Derander_: the Silmarillion is literally the bible

17:51 Raynes: I was thinking of reading that at some point.

17:51 technomancy: Raynes: you can cheat with https://en.wikipedia.org/wiki/Nightfall_in_Middle-Earth

17:51 (which is absolutely amazing btw)

17:51 hyPiRion: Raynes: Silmarillion is the only book I've stopped reading because it was too dense

17:51 callen: Raynes: the LOTR books are boring.

17:51 Raynes: the Hobbit is okay.

17:51 Raynes: callen: That's what I gathered from the first LOTR book.

17:52 I *wanted* to like it because I liked the movie.

17:52 Glenjamin: there was a really interesting article on Christopher Tolkien recently

17:52 Raynes: But I would fall asleep if I tried to read it.

17:52 * Derander_ stopped reading The Mysts of Avalon

17:52 hyPiRion: Raynes: Great, now you know what to do when you can't get to sleep

17:52 technomancy: Nightfall on Middle Earth is like a tl;dr for people who couldn't even sit through the films.

17:52 Glenjamin: http://badassdigest.com/2013/01/09/why-jrr-tolkiens-son-hates-what-peter-jackson-has-done/

17:53 Tolkien's son has spent his life trying to guess what his dad would have written, and then writing that

17:54 callen: Glenjamin: Christopher is just mad that he's not a real writer like his father or someone capable of propagating his father's work to millions like Jackson :P

17:54 technomancy: callen: wait, isn't that Brian Herbert?

17:54 callen: technomancy: no that's the case there too, but it wasn't really his writing.

17:55 technomancy: Herbert was working with KA I thought.

17:55 tieTYT2: has anyone ever used the clojure-maven plugin? I'm getting this error: Exception in thread "main" java.io.FileNotFoundException: Could not locate foo/poc__init.class or foo/poc.clj on classpath: What is causing this? It's obviously finding something or else it wouldn't have reported this path in the exception

17:55 callen: technomancy: also the writing in the Brian novels was killing me, but I wanted to know more so badly I stomached it.

17:55 noprompt: john lennon's son has the same problem.

17:55 Glenjamin: bah, just read the FAQ and discovered i've been pronoucing leiningen all wrong

17:55 Raynes: No, nobody in the history of Clojure has ever used the clojure-maven plugin.

17:55 technomancy: callen: I had to take a break from Dune for like seven years before I could go back to the original and actually enjoy it

17:56 tieTYT2: Raynes: :P Do you know what i'm getting that exception?

17:56 Glenjamin: you have a require, but not a file

17:56 tieTYT2: i don't have a require

17:56 i only have one file called poc.clj

17:57 here are its contents: (ns foo.poc) (defn f [x] (println fn))

17:57 Glenjamin: well something is trying to require foo.poc

17:57 callen: technomancy: I've been thinking about rereading the original but after like 10,000 pages of Dune I don't think my soul can take it.

17:57 Glenjamin: is it in a folder called foo?

17:57 tieTYT2: yes

17:57 callen: technomancy: also have you seen clojure-control?

17:57 Glenjamin: then i've reached my limit of helpfullness in this case i'm afraid

17:57 callen: technomancy: I've been tinkering with it. Neat stuff. Handy for provisioning machines.

17:57 technomancy: callen: I don't believe I have

17:58 tieTYT2: :T thanks anyway

17:58 Glenjamin: tieTYT2: try lein classpath

17:58 and see if foo/poc.clj is valid in any of the paths listed

17:58 if not, thats the problem

17:58 callen: technomancy: well. take a look. I'd love to hear what somebody else that does dev-ops has to say.

17:59 tieTYT2: ohh there's a compile error

17:59 i should have said: (defn f [x] (println f))

17:59 but I said (defn f [x] (println fn))

17:59 technomancy: callen: I don't really do dev-ops actually

17:59 callen: technomancy: really?

17:59 technomancy: well take a look anyway. '(please)

17:59 technomancy: callen: syme is about the extent of how I provision machines

18:00 Glenjamin: is the current leiningen profile available to the running process?

18:01 eg. when I do with-profile production, how do I check that in my app?

18:01 amalloy: Glenjamin: no

18:03 TimMc: hyPiRion: No, he's a compiler special.

18:04 technomancy: Glenjamin: typically you'd place a key in the environment or on the classpath

18:04 using environ or carica

18:04 Glenjamin: ah ok, so PROD=1 lein with-profile production ...

18:04 technomancy: Glenjamin: no, environ lets you put env vars in your profile

18:05 Glenjamin: aha, i see

18:05 right, makes sense now

18:05 cheers

18:06 hyPiRion: TimMc: ah I see

18:18 papachan: is there a library in clojure to parse json files?

18:19 dakrone: papachan: there are two, https://github.com/dakrone/cheshire and https://github.com/clojure/data.json

18:20 papachan: dakrone: oh thank you.

18:23 amalloy: just two!?

18:24 there are like ninety

18:24 but i don't think anyone uses clj-json anymore

18:38 tieTYT2: is there a way to define annotations on a gen-class?

18:39 this says no, but it was answered in 2011: http://stackoverflow.com/questions/7703467/attaching-metadata-to-a-clojure-gen-class

18:39 hiredman: the one answer is really horrible

18:40 like "I don't know clojure and I will cobble together something by cutting and pasting in to the browser's input box" bad

18:41 (ns genclass.example (:gen-class ^{:doc "example class"})) is just not valid in anyway

18:41 tieTYT2: ok well can you help me?

18:41 hiredman: so certainly not a test case for gen-class supporting annotations

18:41 tieTYT2: i might ask the question again just so the answer is more up to date

18:42 hiredman: that answer is not out of date

18:42 it is just flat out complete nonsense

18:42 "not even wrong"

18:43 https://groups.google.com/forum/?fromgroups=#!topic/clojure/3q17KuyGsic has some example code annotating a gen-classed class

18:44 tieTYT2: thank you

18:44 hiredman: but that mailing list post is out of date, you can now also annotate constructors

18:44 amalloy: aw, hiredman, that answer isn't *wrong*. he says a number of true things, of the form: "i don't know how to answer your question, but here is some code that doesn't compile"

18:45 hiredman: (I think I wrote that patch)

18:45 amalloy: right, not even wrong

18:46 tieTYT2: oh waht I was asking about is annotations on the class it generates, not the methods

18:46 is that possible?

18:47 cemerick: are people using .edn for explicit data files these days?

18:48 hiredman: tieTYT2: doesn't look like it

18:48 tieTYT2: hiredman: what about this: https://github.com/clojure/clojure/blob/master/test/clojure/test_clojure/genclass/examples.clj

18:48 is that what the clojure.test_clojure.genclass.examples.ExampleAnnotationClass is doing?

18:48 hiredman: cemerick: I recently changed a data file in our codebase to .edn because we have a test that complains .clj files have lines over 80 characters

18:49 cemerick: hiredman: yeah, similar reason for my asking

18:49 Raynes: cemerick: You can use .titties. Clojure doesn't care.

18:50 cemerick: I know, just wondering if it's breached into "common practice" for some definition.

18:50 hiredman: tieTYT2: that does look like it, I dunno, try it, I was skimming the gen-class source so maybe I missed it

18:50 cemerick: Raynes: .titties?!

18:50 Man, a few weeks in LA, and it's all downhill :-P

18:51 Raynes: Two and a half months, man.

18:51 gdev: some guy is going to be googling for titties in a week and this log is going to show up in his search results and blow his mind

18:51 amalloy: we haven't seen him for days, cemerick. he's just been "working" on his laptop from a strip club

18:52 tieTYT2: hiredman: eyah it works, nice

18:54 cemerick: amalloy: that's what I figure

18:54 Raynes: Sorry, wasn't tracking your calendar closely

18:55 Raynes: cemerick, amalloy: The twist is that the strip club is the office and amalloy is the one stripping.

18:55 amalloy: wat

18:55 cemerick: whoa

18:55 Now I need to drink.

18:56 filippobo: Hey guys, s it possible to create a "assoc-in!"

18:56 namespace: How do I print a range of characters from a string?

18:56 filippobo: ?

18:56 namespace: Like say I had the string "Hello" being able to print characters 1 through 3

18:57 filippobo: range by index?

18:57 namespace: (Keeping in mind that strings are zero indexed.)

18:57 Bronsa: use subs and then println

18:58 namespace: Sub?

18:58 callen: filippobo: sure why not

18:58 Bronsa: ,(subs "hello" 1 4)

18:58 clojurebot: "ell"

18:58 namespace: callen: Thank you.

18:59 SexyTattoos96: im looking for someone to help me with my website

18:59 gdev: ,(.substrnig "hello" 0 4)

18:59 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: substrnig for class java.lang.String>

19:00 gdev: ,(.substring "hello" 0 4)

19:00 clojurebot: "hell"

19:01 filippobo: callen: I tried adapting the implementation of assoc-in using assoc! https://github.com/clojure/clojure/blob/c6756a8bab137128c8119add29a25b0a88509900/src/clj/clojure/core.clj#L5565

19:01 callen: filippobo: why?

19:01 filippobo: but I get Exception in thread "main" java.lang.ClassCastException: clojure.lang.PersistentVector$TransientVector cannot be cast to clojure.lang.IPersistentCollection

19:01 because there is no assoc-in! :-)

19:17 Foxboron: Helluw. So i am messing with lein-daemon, it dosnt start and i get a Nullpointer exception in the log file. Anyone able to help?

19:30 amalloy: ~helpme

19:30 clojurebot: A bug report (or other request for help) has three parts: What you did; what you expected to happen; what happened instead. If any of those three are missing, it's awfully hard to help you.

20:07 tieTYT2: oh i figured out that filenotfound issue I had before

20:07 stupid intellij creates dashes as dashes in filenames

20:17 is there a way to define a gen-class' methods step by step or outside of the gen-class call?

20:17 i can't figure out a way to do that

20:19 what I want to do is have a compojure-like api that generates a java jersey class. But I can't figure out how to make (GET "mypath") create a method named -mypath and a method signature named "mypath" inside the gen-class from one call

20:20 namespace: Okay, I get an unbounded function error with this code for fpunct.

20:20 http://pastebin.com/Wfk6wWcM

20:21 Sample input:

20:21 http://pastebin.com/gTbm49yj

21:05 mynomoto: namespace: what's the error message?

21:14 namespace: mynomoto: IllegalStateException Attempting to call unbound fn: #'user/fpunct

21:19 mynomoto: namespace: is that when you try to call the funcion?

21:19 namespace: Yes.

21:19 In any context.

21:22 mynomoto: namespace: example of call please.

21:39 n_b: How bad would having a git submodule in your lein checkouts folder be on a scale of "really" to "not even once"?

21:41 namespace: mynomoto: (fpunct "Hello my name is bob, how are you? In other news I finished the program. This is a filler statement between the next question! I'm the next question?" 0 1)

21:42 It's really not a big deal anymore, I ended up doing it in python.

22:08 technomancy: n_b: if you adjust your expectations it could be somewhat reasonable

22:20 rasmusto: tpope: There are probably all sorts of problems with this: https://gist.github.com/rasmusto/5424432 but it seems to let me :Gedit some old rev and cpp functions. It probably breaks on windows and if filenames change around in git history

22:58 amalloy: namespace: i think the only time you can get that exception is some kind of java-interop scenario, where you're using a java "main" program to call into your clojure function without first require'ing the file it's defined in

23:41 robear1: i have a clojurescript question. it relates to the js->clj function. if i don't pass :keywordize-keys true as an option, the function works fine. if i add that option, i get an error - clojure.lang is undefined - var map__10179__10181 = cljs.core.seq_QMARK_.call(null, map__10179__10180) ? clojure.lang.PersistentHashMap.create.call(null, cljs.core.seq.call(null, map__10179__10180)) : map__10179__10180;

23:41 any idea where i should look to figure out what is going on?

23:48 tieTYT: in a precondition, what's the most concise way to check that an argument is not null?

23:50 i think this works: {:pre [(x)]}

23:51 capcrunch: tieTYT what that does means ?

23:51 tieTYT: oops, I mean this: {:pre [x]}

Logging service provided by n01se.net