#clojure log - Nov 28 2013

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

0:00 bbloom: ignoring readline support, debugging features, etc, a repl can do 3 IO things: read form, print text, and print values

0:00 i'm only interested in print

0:00 (println ...) is like emitting text

0:01 in theory i could have (emit :content-type "plain/text" ...)

0:01 or emit-jpg or whatever

0:01 technomancy: right

0:01 justin_smith: what about prn / print / display

0:01 technomancy: so nrepl handlers can already emit response maps of arbitrary contents

0:01 bbloom: sure

0:02 anyway, i need this long weekend badly b/c my brain is fried, so i'm mostly just wasting both of our time here. sorry. in anycase, i'd propose for eval/print sort of things a two-function API:

0:03 (f (g "image/jpeg" ...))

0:03 where g wraps some thing in a magic type that middleware knows to render with that mimetype

0:03 and f takes a pre-wrapped thing and emits it like printed text would be emitted

0:04 anything more sophisticated than that won't give me the control i want to trust the thing & belongs out of the core of it :-P

0:04 if that makes anysense

0:04 technomancy: aha; gotcha, to bridge the gap between eval land and the nrepl tooling which knows about the transport/communication

0:04 that makes sense, but it's a totally different use case from what I've been considering so far

0:04 I'll give it some thought

0:05 bbloom: it's acceptable for g-wrapped things to be printed special if returned from an eval

0:05 but ONLY g-wrapped things... again from core

0:05 if somebody wants to install some insane thing that does arbitrary fucking with their return values fine

0:05 but not me :-P

0:06 i want to opt-in to "ok fine, you can display THIS particular jpeg as a jpeg, instead of the standard toString"

0:06 technomancy: that would be analogous to an HTML-generating function attaching some kind of hinting to its response to tell the ring handler to add some kind of caching directive to the headers or something

0:06 bbloom: yeah, but i don't want that

0:06 no metadata

0:06 no fancy tricks w/ different data types

0:06 just a single quoting construct

0:07 (deftype NReplContent [mime-type x])

0:07 technomancy: hiredman suggested sending tagged literals all the way back to the client, but we currently don't require clients to implement a reader, so that's a lot to ask

0:07 bbloom: that's it

0:07 er i guess

0:07 technomancy: yeah, makes sense

0:07 bbloom: (deftype Content [mime-type bytes])

0:07 and you'll probably already need some system for mime-type => serialization-function

0:08 i just want explicit representation

0:08 at least absent some much more sophisticated system a la mathematica's "forms" that you'll never be able to build nor standardized

0:09 don't get cute & i'll love this feature :-P

0:09 technomancy: heh nice

0:09 bbloom: thanks for putting up with my incoherent rant that took a while to find it's point. i'm going to bed now.

0:09 technomancy: well I did get to meet tpope at the conj and he said he'd take a look

0:09 cheers

0:09 justin_smith: so we currently have print-dup and print-method that return strings with different rules for constructing them - what about a third method that returned an arbitrary tagged rich type? then we can use some extension of the same logic / rules that currently decide between print-dup and print-method

0:10 s/method/multi

0:11 technomancy: seems eminently reasonable

0:12 I kinda feel like getting the client/server bits nailed down first since everything else rests on top of that

0:12 but if you want to take a swing at it =)

0:12 justin_smith: hah

0:12 I'll consider it

0:12 technomancy: starting to think there's enough meat here for a clojurewest talk

0:13 bitemyapp: oh man, I should go to clojurewest since I failed to go to the conj.

0:14 technomancy: come see me speak! (maybe)

0:14 justin_smith: I failed to come to the last c/w and it was in my own damn city

0:14 I have no excuse this year

0:15 bitemyapp: justin_smith: pretty sure c/w is in my city this year.

0:15 s'posed to be SF innit?

0:19 justin_smith: clojurewest.org still mentions the portland event

0:19 I really don't know

0:24 arrdem: bitemyapp: gaming PC get

0:28 technomancy: justin_smith: they said at the conj it would be SF =(

0:29 justin_smith: you consider that sad news?

0:32 Raynes: PARSE ERROR

0:34 jared314: Raynes: that is quite an entrance. I'll have to use that some time

0:34 akurilin: Howdy. Have people heard much of Clojuratica in the past few years? Is the project dead?

0:34 technomancy: justin_smith: well if it has to be in california, SF is fine

0:34 but portland is the best place in the world for conferences

0:35 justin_smith: agreed, I like being able to walk to conferences

0:35 and sleep at home

0:35 Raynes: technomancy: Are you a Portlandia fan?

0:35 technomancy: Raynes: I haven't seen the show

0:35 Raynes: o_o

0:35 technomancy: it's just ... a cool city

0:35 justin_smith: they actually filmed one of the portlandia sketches in my office

0:35 technomancy: seattle's kid brother

0:35 justin_smith: the one with "pitchfork kids"

0:36 technomancy: unrelated note: I heard BSD described as "the Canada of Linux" the other day and it was perfect; the best thing I heard all week.

0:37 Raynes: I don't really watch anything but doctor who

0:37 justin_smith: http://www.youtube.com/watch?v=6eOnnIi6O5E

0:38 err... that didn't show the part in my office actually

0:39 bitemyapp: arrdem: WHOA

0:39 arrdem: up for some practice/2s?

0:40 arrdem: http://i.imgur.com/DWnJplv.gif

0:40 arrdem: bitemyapp: already playing br0

0:40 bitemyapp: arrdem: goddammit, catch you next game then.

0:44 noprompt: ah, the Emacs spiral.

0:44 justin_smith: noprompt: it is literally endless

0:44 noprompt: technomancy: i uninstalled esk. the learning process begins.

0:44 bitemyapp: noprompt: esk?

0:45 arrdem: emacs starter kit

0:45 noprompt: bitemyapp: emacs starter kit.

0:45 bitemyapp: noprompt: oh good.

0:46 noprompt: i wanted to try out cider but i didn't know how to remove the old nrepl dependencies apparently because i was getting strange errors.

0:46 so i decided to nuke everything in elpa.

0:47 now i need helpa. lolpa.

0:48 one thing i miss is the switch-to-buffer behavior.

0:48 technomancy: noprompt: start here https://github.com/technomancy/better-defaults

0:48 bitemyapp: I wouldn't advocate the use of cider specifically...

0:48 technomancy: this is like the bare minimum to keep you sane

0:48 justin_smith: yeah, that should get you back iswitchb, if that is what you miss

0:48 noprompt: bitemyapp: does it suck?

0:48 arrdem: it works...

0:48 but isn't quite stable

0:49 supposeldy

0:49 I have't had problems with it yet

0:49 bitemyapp: noprompt: it's unstable. use nrepl for now.

0:49 justin_smith: noprompt: for switch to buffer behavior do you mean the completions visible with C-x b?

0:49 bitemyapp: noprompt: look at my dotfiles repo if you need ideas for what to add.

0:49 justin_smith: that is iswitchb

0:49 technomancy: I finally upgraded to cider, but only so I could add features to it

0:49 bitemyapp: justin_smith: iswitchb is heavenly.

0:49 can't live without it.

0:49 noprompt: technomancy: bingo.

0:49 technomancy: justin_smith: he's talking about ido

0:49 justin_smith: ahh

0:49 technomancy: which is a superset of iswitchb technically

0:49 justin_smith: well ido is just iswitchb on find file

0:50 and a few other things

0:50 yeah

0:50 he mentioned switching buffers, I was looking for the most conservative match :)

0:58 noprompt: one thing i'd really like is a smart tab and for emacs to not autobreak long lines for me.

0:58 *two things

0:58 justin_smith: what is a smart tab?

0:59 noprompt: justin_smith: one that autocompletes when it can or otherwise "insert fucking spaces."

0:59 justin_smith: also, M-x toggle-truncate-lines

0:59 noprompt: that is alt-tab by default

0:59 or m-/ for more heuristic guessing

0:59 noprompt: justin_smith: that's not the answer. the answer i'm looking for is how to turn that shit off.

1:00 justin_smith: toggle is what I said

1:00 a toggle

1:00 * technomancy is really not a fan of overloading the tab key to mean two completely unrelated things

1:00 noprompt: justin_smith: oh oh, wait no that's not what i was talking about. what you're talking about is fine.

1:01 what i'm talking about is when i type a long line and hit enter, emacs tries to get all fancy and break the line at x number of characters etc.

1:01 justin_smith: you mean it is actually making new lines, not just wrapping?

1:01 noprompt: for docstrings and comments this is desirable.

1:01 justin_smith: yes, that.

1:01 justin_smith: noprompt: I think that is part of paredit, it is called electric-return iirc

1:02 noprompt: justin_smith: js2-mode and html-mode both do this and it drives me nuts.

1:03 technomancy: i hear ya.

1:04 justin_smith: the problem is window managers all decided to steal the alt-tab combo

1:04 noprompt: for all i know the solution could be (setq jiggle-pop-bibble nil) but i have no way of knowing what i'm looking for.

1:04 justin_smith: noprompt: maybe it is auto-fill-mode you need to turn off

1:05 it is not a default, so it will be somewhere in your config explicitly

1:05 fill or electric will likely be somewhere in the name

1:05 noprompt: justin_smith: thankyou. this is a good start.

1:06 justin_smith: see if M-: (auto-fill-mode 0)

1:06 turns off the bad behavior

1:06 if so, put that in your .emacs, or delete the thing that turns auto fill on

1:07 noprompt: well, i'll be.

1:09 justin_smith: you sir are today's winner.

1:09 justin_smith: was it auto-fill?

1:09 noprompt: looks like it was.

1:10 justin_smith: I had discounted the possibility at first, because I have only ever turned that on for plain text

1:10 I figured it was for paragraph formatting

1:14 noprompt: it's nice for comments. if i could turn that on soley for breaking long lines in comments that'd be a win.

1:14 personally, i think it's kind of annoying when someone writes a 200 character long comment.

1:14 justin_smith: M-q fills the block your cursor is inside

1:14 clojurebot: Ok.

1:14 justin_smith: does what you want inside comments

1:15 technomancy: noprompt: there's a way to turn it on in comments only iirc

1:15 noprompt: technomancy: i'll google it.

1:15 justin_smith: fyi, i use evil-mode.

1:15 justin_smith: I don't mind having to occassionally hit m-q inside a commnt block, as luddite as that sounds

1:15 oh, so you don't get the normal shortcuts

1:16 the command is called fill-paragraph

1:16 noprompt: justin_smith: no. for example M-x is done with keychord as m+x

1:16 err sorry ,+x

1:17 justin_smith: if you do M-x describe-function fill-paragraph it will tell you any keybinding you have for it

1:17 or +x or whatever

1:17 noprompt: ah good deal

1:17 justin_smith: yeah, describe-function, apropos, describe-key

1:17 all your friends as a learner

1:18 oh, and apropos-documentation

1:18 apropos-variable is good too

1:19 noprompt: nice.

1:22 just realized i've been programming with Andale Mono for over a month.

1:23 justin_smith: at first I thought that was a disease

1:23 a relation of the regular mononucleosis

1:23 aka mono

1:24 emaphis: I thought it was a brand of cheese.

1:24 majyk: OMG that's funny!

1:24 justin_smith: clearly it is a contageous variety of cheese, spread by kissing

1:24 emaphis: Ewww!

1:25 `cbp: it means go monkey! in spanish

1:26 justin_smith: not to be confused with andale arriba

1:27 which is a monospace programming typeface designed for usage by spanish speaking mice

1:27 emaphis: lol

2:10 d11wtq: Is there any sort of convention in Clojure to group the defn-'s at the top or bottom of the namespace?

2:13 andyf: d11wtq: You mean specifically the defn's for functions that you want to be private? I have not seen any pattern there -- what I have usually seen is that defn-'s go wherever the author would put them if they were regular defn's.

2:14 d11wtq: Putting them all at the bottom would be inconvenient, since they could not be called by public functions in the namespace unless you declare'd them earlier.

2:15 d11wtq: andyf: yeah, for non-public defn-'s. Good point about the need to declare them!

2:15 In other languages I'd tend to keep the "private" stuff in the least visible place, at the bottom of the file.

2:16 andyf: d11wtq: You can do that if you prefer, as long as you declare what is needed, e.g. at the top.

2:16 hiredman: I would recommend against making anything private at all

2:16 d11wtq: andyf: yeah, thanks. I'll go with the flow and stick with convention!

2:17 hiredman: I generally agree with that, although sometimes it's just useful to guide people who are reading the code so they know what's intended to be used and what's likely to change.

2:20 hiredman: private things have only ever been a thorn in my side, mocking me in an opensource project where I can see the source, see what I need, and I could just use it and it would be fine, but someone decided to make it private

2:21 d11wtq: can't disagree with that :)

2:22 bitemyapp: private vars should've never been added to the language.

2:22 they lead to either #' or dependency vendoring.

2:22 Sucks.

2:22 arrdem: bitemyapp: I almost forgot, happy thanksgiving!

2:22 (same goes for the rest of yall)

2:22 bitemyapp: arrdem: Happy thanksgiving to you too!

2:23 arrdem: 'night

2:23 bitemyapp: g'night

2:23 ddellacosta: what am I forgetting to do such that my new extern, defined in a file with other externs which are already working, isn't getting picked up? I've cleaned my clojurescript and re-compiled...confused.

2:23 'night arrdem, happy thanksgiving!

2:23 * ddellacosta sad he is not in the U.S. this week. *sniff*

2:23 bitemyapp: ddellacosta: I mean, it's not like all of us benefit from Thanksgiving beyond having a day off work.

2:23 I'm just going to drinking tea and coding tomorrow.

2:23 going to be*

2:24 ddellacosta: bitemyapp: yeah, I'm not even taking a day off. Although can't blame my bosses, I'm sure they would have given it to me if I'd asked. I just don't have any reason to do so.

2:24 bitemyapp: ddellacosta: what's the biggest holiday of the year in Japan?

2:25 ddellacosta: anyone have any tips for getting externs picked up? I feel like I'm forgetting something obvious, since it is such a simple thing.

2:25 bitemyapp: hmm, probably either Obon or the New Year

2:25 bitemyapp: I guess New Year's day is probably the biggest one.

2:26 bitemyapp: ddellacosta: is it in your :provides vector?

2:27 ddellacosta: bitemyapp: haha, what is that? I don't have that but other externs are definitely picked up.

2:28 bitemyapp: oh, I thought maybe you had to re-expose it like you setup the namespaces for javascript modules.

2:28 I don't do much, if any, CLJS I'm afraid. Sorry!

2:28 ddellacosta: bitemyapp: no worries! Thanks for giving it a shot. Anything is helpful at this point.

2:38 rurumate: is it correct that clojure cannot auto-determine order of compilation when using using a gen-classed class within in the same project?

2:38 what I do is, I determine order of compilation manually using :aot in project.clj but that is tedious

2:39 bitemyapp: that is tedious.

2:39 rurumate: so I do :aot [ns.that.generates.javaclass ns.that.uses.generated.javaclass] in that order

2:41 bitemyapp: rurumate: :aot :all dinna work?

2:41 rurumate: no

2:41 bitemyapp: nuts.

2:41 rurumate: lemme try again though..

2:42 bitemyapp: rurumate: yeah I think you just have to specify the AOT order. Sorry :(

2:43 rurumate: bitemyapp: yes it fails with :aot, pity

2:43 with :aot :all I mean

2:43 bitemyapp: you'll just have to be specific for now I guess.

2:43 rurumate: it seems like something the compiler might learn some day

2:44 bitemyapp: well you could hack it up, it'd just be a bad idea.

2:44 rurumate: also auto-resolving circular dependencies between namespaces would be a nice feature

2:44 bitemyapp: maybe a pre-task that overrides/provides the AOT vector based on inference.

2:44 I don't think allowing circular dependencies is a good idea anyway.

2:44 rurumate: why not?

2:44 bitemyapp: you can and should break stuff like that out into a tree.

2:45 / DAG

3:07 ddellacosta: bitemyapp: the answer to my problem before was, btw, that I was not including the JavaScript I had written the extern for in my HTML. /facepalm

3:07 bitemyapp: ddellacosta: welp.

3:07 ddellacosta: thanks for sharing the original problem.

3:07 * bitemyapp chucks it into the dataset.

3:08 bitemyapp: ddellacosta: I should celebrate thanksgiving by launching a wiki.

3:08 ddellacosta: bitemyapp: there ya go. :-) You can set it up so Clojurebot will give it as the answer to any questions that have been asked before...

3:08 bitemyapp: seriously though, we do need some kind of FAQ for Clojure

3:08 Clojure/Script

3:19 bitemyapp: krisajenkins: US Fact: On my last visit, I *could not* buy a tuna sandwich. Kept getting chicken. In the end, I had to pronounce tuna with a silent 'ch'.

4:32 ered: https://news.ycombinator.com/item?id=6812499

4:32 did you guys see this on HN today?

4:34 bitemyapp: ered: of course, I was trolling Church on Twitter.

4:34 ered: hah, fair enough

4:35 bitemyapp: ered: I was correcting the mutable "placeness" description of core.async

4:39 technomancy: I found something really cool.

5:04 d11wtq: How does one find things that used to be in contrib? I'm looking for where clojure.contrib.mock would live today.

5:05 xeqi: ~contrib

5:05 clojurebot: Monolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/community/Where+Did+Clojure.Contrib+Go

5:07 d11wtq: I've seen that page, but clojure.contrib.mock is nowhere to be seen.

5:08 I might actually want something else. I basically want to be able to say: if foo/some-func is invoked with args [x y z] then return 42.

5:08 For stubbing out a network-calling function in tests.

5:08 With midje.

5:11 I'll just go with robert.hooke and do it by hand for now.

5:11 noprompt: bitemyapp: check out this wank book http://www.math.mcgill.ca/triples/Barr-Wells-ctcs.pdf

5:12 Category Theory for Computer Scientists!

5:12 my only hope is that it doesn't suck as had as Logic and Discreet Matematics For Computer Scientists.

5:13 which by the way, if you want to learn about logic or math, go get fucking logic or math book for god's sake.

5:14 one for mathemeticians.

5:15 * noprompt puts the mic down.

5:15 * noprompt leaves the comedy club.

5:19 robewald: hi, is there a function to compare a nested datastructure for submaps? The easy case for testing submaps is (= sub (select-keys super (keys sub))). But that doesn't work for nested maps.

5:19 jballanc: d11wtq: does "provided" not work for you?

5:22 d11wtq: jballanc: I'm not sure what that is. Third day learning clojure :)

5:22 noprompt: robewald: can you provide a bit more context?

5:23 d11wtq: jballanc: Oh, I just found it in the midje wiki.

5:23 jballanc: yeah, the wiki is a good resource...take some time to digest it all :)

5:23 noprompt: d11wtq: welcome to clojure!

5:25 d11wtq: noprompt: thanks. Liking it so far. Having done (guile) scheme and CLISP, Clojure is elegant.

5:25 robewald: noprompt: well. I have a vector of maps containg other vectors of maps. But in the "super" map there are more keys than I am interested in. So for testing I want to have a predicate that checks whether the stucture of the vectors is equal but ignores the keys of the various maps that are not present in the "sub" map. If that makes the problem clear at all... I could go recursively through all the vectors checking map? and go from

5:25 there. It is just a bunch of work that might be in a library.

5:27 d11wtq: Reader macros would be nice, although the things I'd want to implement in Common Lisp are already implemented in Clojure anyway (e.g. decent regex syntax).

5:28 noprompt: robewald: so you have something like [{? []} {? []}]?

5:28 [{? [{?? }]} ..]

5:28 bitemyapp: (inc robert.hooke)

5:28 lazybot: ⇒ 1

5:30 robewald: I guess. What i want is (= [{:a "f"} {:b "b"}] [{:a "f" :c "c"} {:b "b"}]) => true

5:30 where [{:a "f"} {:b "b"}] is the "sub"map

5:31 and the whole thing recursively nested :)

5:31 jballanc: robewald: recursion is your friend, I think...something like:

5:31 ,(letfn [(comp-map [ma mb] (reduce (fn [a [k v]] (and a (if (and (map? v) (map? (mb k))) (comp-map v (mb k)) (= v (mb k))))) true ma))] (comp-map {:a {:b 2 :c 3}} {:a {:b 2 :c 3}}))

5:31 clojurebot: true

5:32 jballanc: :)

5:32 noprompt: ,(doc comp-map)

5:32 clojurebot: It's greek to me.

5:33 robewald: I know. I was wondering whether there is a library function for that. Because I think this stuff is really basic.

5:33 noprompt: oh whoops, letfn.

5:35 jballanc: a bit easier to read: https://gist.github.com/jballanc/7690023

5:35 robewald: ,(letfn [(comp-map [ma mb] (reduce (fn [a [k v]] (and a (if (and

5:35 (map? v) (map? (mb k))) (comp-map v (mb k)) (= v (mb k))))) true

5:35 ma))] (comp-map [{:b 2 :c 3} {:b 2}]))

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

5:35 jballanc: robewald: basic, but there are a million *small* variations on semantics that means it's probably just easier to implement yourself

5:36 noprompt: so basically you just want to know if there are some key-value pairs in the vector of maps that are equal?

5:37 robewald: jballanc: I guess.

5:38 jballanc: for example, my solution only handles maps nested in maps

5:38 but you said you want maps nested in vectors nested in maps...so you'll have to alter what I wrote

5:38 robewald: noprompt: yes, and the keys that are not in the "sub"map I don't care about.

5:38 jballanc: (an exercise left for the reader ;-) )

5:39 robewald: jballanc: yes I know. And it is a bit of work because AFAIK you cannot just override the map comparison and everything else is as before. You have to handle all the cases again.

5:40 noprompt: robewald: sounds like you could use sets then if i'm not misunderstanding the problem.

5:41 jballanc: yup...depending on the number of cases you want to handle, you might consider using cond(p) and/or case

5:41 noprompt: ,(set {:b "b" :c "f"})

5:41 clojurebot: #{[:b "b"] [:c "f"]}

5:41 robewald: noprompt: i cannot, because I care about the values associated with the keys being equal.

5:41 oh

5:41 noprompt: robewald: intersection

5:42 robewald: right

5:42 didn't think of it like that.

5:42 that might work

5:42 thanks

5:42 noprompt: robewald: defintely explore the clojure.set ns if you haven't already. it's certainly powerful.

5:43 bitemyapp: http://clojurewiki.com/

5:43 noprompt: bitemyapp: nice work!

5:43 robewald: I have, but I didn't consider the *entries* as sets, only the keys...

5:44 bitemyapp: noprompt: it's git based, if I add a git user for somebody, they can push changes from their text editor!

5:44 Apage43: hot diggity haskell

5:44 bitemyapp: Apage43: sssshhhhhh

5:45 robewald: jballanc: I wonder whether there are easier ways in clojure to add these small variations.

5:45 noprompt: robewald: the way i tend to think of hash-maps is a set of key-value pairs.

5:46 Apage43: i've used pandoc a good bit, its handy to know that's in there

5:47 noprompt: robewald: that being said, one way to see which key value pairs are equal between two hash-maps would be to use `set` on each of the maps and perform an intersection.

5:48 bitemyapp: that sounds pretty rad.

5:48 robewald: noprompt: not quite (clojure.set/union (set {:a "a" :b "b"}) (set {:a "b"}))

5:48 ,(clojure.set/union (set {:a "a" :b "b"}) (set

5:48 {:a "b"}))

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

5:48 robewald: I don't know how to use clojurebot

5:49 ,(clojure.set/union (set {:a "a" :b "b"}) (set {:a "b"}))

5:49 clojurebot: #<ClassNotFoundException java.lang.ClassNotFoundException: clojure.set>

5:49 robewald: anyway that evals to #{[:b "b"] [:a "a"] [:a "b"]}

5:49 Apage43: oh neat, same guy as pandoc

5:49 robewald: which is not a hashmap

5:49 noprompt: robewald: why are you using union?

5:51 robewald: noprompt: just to illustrate that you may create a set of map-entries that are not a map. That is why i don't think of hashmaps as a set of entries.

5:51 But your point is valid for this problem and I will try

5:52 noprompt: ,(s/intersection (set {:a "b" :b "f"}) (set {:a "c" :b "f"}))

5:52 clojurebot: #<CompilerException java.lang.RuntimeException: No such namespace: s, compiling:(NO_SOURCE_PATH:0:0)>

5:52 noprompt: (clojure.set/intersection (set {:a "b" :b "f"}) (set {:a "c" :b "f"}))

5:52 ,(clojure.set/intersection (set {:a "b" :b "f"}) (set {:a "c" :b "f"}))

5:52 clojurebot: #<ClassNotFoundException java.lang.ClassNotFoundException: clojure.set>

5:52 noprompt: :|

5:52 whatever anyway that should respond with: #{[:b "f"]}

5:53 robewald: right

5:53 actually I would need to test for subset?

5:54 noprompt: (reduce set/intersection (map set [{:a "b" :b "f"} {:a "c" :b "f"}]))

5:55 bitemyapp: noprompt: haha, pro.

5:55 (inc noprompt)

5:55 lazybot: ⇒ 1

5:55 bitemyapp: I was wondering to myself if there wasn't a better way.

5:56 Apage43: I actually got really lucky, only searched for Haskell-based wikis after I failed to get MediaWiki running.

5:56 Apage43: uninstalled apache, php, mysql, and mediawiki, got gitit running in a jiffy. Turned out to be more of what I wanted anyway :)

5:57 poppingtonic: hi

5:58 noprompt: poppingtonic: hi

5:58 * noprompt waves from a boat.

5:58 * poppingtonic waves from the side of a building

5:59 poppingtonic: noprompt: does anyone here work with Weka? I'm wondering how to connect the library with my leiningen project.

5:59 Apage43: yeah it looks like a nice thing

5:59 mediawiki is a bit of a pain, but just about any significantly large php thing is

5:59 noprompt: poppingtonic: as if i'm the president of #clojure. flattering.

5:59 poppingtonic: hihi

6:00 * noprompt knows people want to laugh.

6:01 noprompt: poppingtonic: in all seriousness, my guess is there probably are. ML, not SML, is popular topic in the clojure world or so it would seem.

6:02 poppingtonic: I guess I should just stick around until the hive wakes up, then :)

6:02 bitemyapp: Apage43: the way Apache and PHP are crammed up each others asses drives me nuts.

6:02 Apage43: I'd rather just fire up a server bound to localhost and proxy the fucker with nginx.

6:02 poppingtonic: I'm only awake because 1. I'm crazy 2. I'm getting a wiki rolling

6:02 Apage43: but but LAMP stack man

6:02 so 2003

6:03 i'm awake because someone decided it was poignant movie night

6:04 noprompt: poppingtonic: americans will be busy with thanksgiving and black friday for the next two days; it's not certain what the #clojure channel will look like.

6:06 you know come to think of it, i don't recall seeing any portrayals of white men breaking bread with the former natives of this country the past few thanksgivings.

6:06 poppingtonic: noprompt: ah, yeah. Food comas and everything. I'm happy for them, the turkey-eaters.

6:07 bitemyapp: I'm not eating turkey :(

6:07 noprompt: bitemyapp: i'm up because i'm on a really fucked up sleep cycle.

6:07 bitemyapp: noprompt: me too!

6:07 I decided to make it constructive :)

6:08 poppingtonic: noprompt, bitemyapp So am I. It's 14:10 and I just woke up, slept at 6AM.

6:08 bitemyapp: 0311 in our realm.

6:09 yeah I'm satisfied, I'm going to start reading and prepping for sleep now.

6:09 noprompt: write something in the wiki! :)

6:09 noprompt: god i love 24hr time. thank you so much rational people.

6:09 bitemyapp: i know, i'll post a George Carlin quote!

6:10 j/k

6:10 poppingtonic: I'm pretty sure there's a movie in there somewhere, that someone's just afraid of making. Better call Tarantino!

6:11 noprompt: poppingtonic: he's the last person to call.

6:11 seriously if i had an actual list of people i would call in the event i needed to call someone from a list, his name would be at the bottom.

6:12 poppingtonic: that bad, huh?

6:13 noprompt: i'll call myley cyrus before i call tarantino.

6:13 then i'll put them on three way.

6:13 and hang up.

6:14 poppingtonic: teach your machines that.

6:14 sm0ke: noprompt: leave mylry cyrus ALONE!!

6:14 bitemyapp: sm0ke: sshhh with the pop culture plz

6:17 noprompt: bitemyapp: you know how i said i wrote that app that lets me browse ~/.m2?

6:17 well, i just realized there's probably some code in there i could pull out into a lein plugin if it doesn't already exist.

6:19 lein describe (or something like that) - Display information about a project's dependencies.

6:19 ie. display dependency description's, git info etc.

6:19 bitemyapp: noprompt: hrm, not a bad idea.

6:19 noprompt: does something like that exist?

6:20 cause all that meta is sitting in the pom.xml files generally.

6:21 bitemyapp: how can i publish something to the wiki? (serious)

6:21 bitemyapp: noprompt: create an account yo

6:21 noprompt: top right

6:22 noprompt: bitemyapp: if i get one spam email, you're done. :P

6:22 * bitemyapp rolls eyes

6:23 yedi: do i need to wrap these while loops in go blocks? https://gist.github.com/yedi/c7f54429df6dc39bb5fc#file-gistfile1-txt-L6

6:23 bitemyapp: Aha, three users now :)

6:23 noprompt: bitemyapp: is the css open source?

6:23 bitemyapp: yippee.

6:23 yedi: i'm dealing with an issue where my channels are getting closed and im not sure why

6:23 bitemyapp: noprompt: uhm, it's an unmodified gitit install right now. there's a custom.css file that I haven't changed.

6:23 noprompt: the only thing I've changed is swapping out the logo.png

6:24 noprompt: yedi: hmmm

6:28 yedi: well one thing i think you can do is change [socket (<! (ws/connect ...)) ... to just [socket (ws/connect ...) ... and move the let above the first (go

6:28 bitemyapp: the wiki is now being backed up as well.

6:29 noprompt: it looks like you want to execute code in the go block whenever the connection arrives.

6:29 so my assumption is that socket is bound to a channel right?

6:32 yedi: i'm guess it's because of the (<! (ws/connect ...)) part.

6:33 sm0ke: hey guys, is there anyway lein repl can detect my changes in a namespace and load entire file automatically?

6:34 i would be running lein repl from a project

6:34 noprompt: yedi: maybe what you wanna do is (let [{:keys [in out]} (<! socket)] and use alt! on in/clicks

6:37 yedi: ill try it

6:38 sm0ke: it would be better if it only reloads changed forms but anything will do

6:38 does this happens automatically for emacs users using cider?

6:40 noprompt: yedi: i'm taking a shot in the dark here. :-) does the channel returned by ws/connect close! after it receives the connection?

6:40 or rather once the connection event takes place?

6:41 yedi: https://github.com/loganlinn/cljs-websockets-async/blob/master/src/cljs_websockets_async/core.cljs

6:42 noprompt: i'm guessing it might and that {:in (chan) :out (chan)} are open. but if (<! socket) is closed the whole go block will park.

6:42 yeah, it looks like they're closing that channel once the connection is established. https://github.com/loganlinn/cljs-websockets-async/blob/master/src/cljs_websockets_async/core.cljs#L22

6:43 poppingtonic: noprompt: what about one where you find out the latest version of a leiningen project? like `lein project latest`? Rather than searching clojars all the time...

6:43 noprompt: poppingtonic: i think lein anchient does that.

6:43 poppingtonic: which is what I usually do

6:44 noprompt: poppingtonic: but the meta data about dependencies can be useful.

6:44 CookedGryphon: and i made an emacs plugin which will automatically type out the dependency vector with the latest version in your buffer

6:44 and offers you the option of adding it to your running repl

6:44 (uses lein-ancient in the background)

6:44 noprompt: i'm thinking of situations where someone is new to a code base and wants to know what dependecies are used for.

6:44 poppingtonic: CookedGryphon: nrepl.el or cider?

6:45 noprompt: that way they can get an idea at a glance w/o having to google/search github.

6:45 poppingtonic: noprompt: aren't they handled automatically when one runs lein deps?

6:45 CookedGryphon: I'm still nrepl, I've been meaning to update it to cider, but wasn't sure how many people were on it already

6:45 i'm using emacs live which is still on nrepl

6:45 poppingtonic: so am I...

6:45 noprompt: most of the libs pulled down from clojars have a lot of that information sitting in the pom.xml file.

6:46 poppingtonic: CookedGryphon: strange choice, considering your language choice...

6:46 CookedGryphon: poppingtonic: ?? what do you mean?

6:47 yedi: noprompt: why would the entire go block part just because socket is closed? the init fn only takes! from socket once

6:48 noprompt: poppingtonic: here's what i'm saying. suppose i clone some project and there's a dependency on [jayq "x.x.x"]. when i run lein describe-dependencies i should see something like: jayq - A jQuery wrapper for ClojureScript. (https://github.com/ibdknox/jayq)

6:48 poppingtonic: Clojure has maybe .2% of all programmers hooked, yet you're worried about cider not having that many users among clojurists. If I had to guess, it's probably just inertia.

6:49 noprompt: ok that's awesome. want!

6:49 CookedGryphon: ^^

6:50 CookedGryphon: noprompt: If that's stuff that's in the pom, you could probably extend lein-ancient to do that

6:50 which would work on maven and friends too

6:52 noprompt_: well erc decided to take a dump.

6:52 poppingtonic: did you get my description?

6:54 poppingtonic: noprompt:yeah you were very clear. I think it does fill a need.

6:54 cYmen_: I just read this ( https://www.refheap.com/2464e1cf9678fe26ea275322e ) somewhere. Could somebody interpret what the author might be trying to say for me?

6:54 noprompt: poppingtonic: the information would be pretty printed, etc.

6:55 justin_smith: poppingtonic: emacs has poor dependency isolation, compiled elisp gets used in the compilation of another lib that depends on it, and you get weird bugs eventually with major lib changes that require rebuilding all your packages. So I am waiting until cider is 100% verified production ready, and then dumping all my clojure related packages and rebuilding with a cider stack. I am probably not the only one.

6:55 noprompt: is there something better than erc for emacs?

6:56 justin_smith: noprompt: not in my experience. what extensions do you have turned on? my setup seems pretty stable

6:57 noprompt: justin_smith: no extensions. but it seems to lock up and crash. could be something else.

6:57 justin_smith: I mean what erc extensions

6:57 noprompt: justin_smith: none extensions.

6:57 justin_smith: just the default out of the box erc.

6:57 justin_smith: what about optional behaviors turned on?

6:57 oh, ok

6:59 noprompt: it's probably just bad luck.

6:59 justin_smith: what are the symptoms?

7:00 bitemyapp: justin_smith: hey, look: http://clojurewiki.com/

7:01 justin_smith: who is hosting it?

7:01 bitemyapp: justin_smith: moi

7:01 justin_smith: cool

7:01 bitemyapp: justin_smith: finally got my fucking wiki.

7:02 noprompt: justin_smith: i'm not sure. at first blush i might say evil-mode and accidentally prefixing an insert with 99 by mistake. however, the second time it locked up right after i ran erc and logged in. :(

7:02 bitemyapp: this should be ported to that http://www.clojure-toolbox.com/

7:03 bitemyapp: noprompt: psh, on it: http://clojurewiki.com/Libraries

7:03 noprompt: bitemyapp: that'd be the idea. ;)

7:04 bitemyapp: oh nice. did you write a script to parse/dump the markdown?

7:04 bitemyapp: noprompt: no, this is by hand yo.

7:04 noprompt: http://clojurewiki.com/_activity diary of a madman

7:05 noprompt: bitemyapp: boo! you had a chance to use ruby + nokogiri and blew it.

7:05 bitemyapp: like I want to use Ruby.

7:06 noprompt: bitemyapp: true. doesn't enlive do something like that. let you query html and get data out of nodes?

7:07 bitemyapp: yeh

7:07 justin_smith: enlive has saved my ass when clients want certain data included as a "feed" from another page, but we need to inject styling or truncate some content

7:08 bitemyapp: noprompt: I'm doing it by hand partly because I explicitly want to remove some content from clojure-toolbox.

7:08 justin_smith: another page I do not control, that is

7:08 bitemyapp: there are some libraries that are abandoned/broken or just plain bad.

7:08 noprompt: bitemyapp: i'll remove CSSGen and Gaka for you. :P

7:08 * justin_smith goes and starts working on the "opinionated loudmouths" section of the wiki.

7:09 bitemyapp: justin_smith: I'm not even sure what that would entail.

7:09 justin_smith: I kid because I love

7:09 * sm0ke finds https://github.com/weavejester/ns-tracker on interwebz

7:10 noprompt: actually, i'm not trying to be a douce here but cssgen hasn't been touched in two years and one of Gaka's last commit messages is "Update to clojure 1.4.0"

7:10 ben_m: Anyone know why nREPL quits after I close Quil sketches?

7:11 bitemyapp: sm0ke: already in the wiki now.

7:11 CookedGryphon: :on-close :dispose

7:11 sm0ke: bitemyapp: what wiki?

7:11 bitemyapp: noprompt: k, I'll kill 'em.

7:11 CookedGryphon: ben_m: the default behaviour on closing a jframe is system.exit

7:11 justin_smith: noprompt: sometimes something is simple enough that it is just done, that doesn't make it stop being useful

7:11 now if they have multiple unaddressed issues on their repo on the other hand

7:12 sm0ke: i also found https://github.com/paraseba/lein-reload, but it doesnt seems to be working

7:12 noprompt: justin_smith: this is certainly true.

7:12 bitemyapp: justin_smith: I'm willing to believe that, but people should just be directed to Garden.

7:12 if I want to emphasize a particular library, I'll put a "Recommended" next to it in future.

7:13 noprompt: justin_smith: garden does have open issues, some of which are not really issues, other's like this one: https://github.com/noprompt/garden/issues/23 are pretty much a crap shoot.

7:13 CookedGryphon: ben_m: at least that's a thing I remember being an issue, can't remember the exact details now I've said it

7:14 noprompt: the issues on garden right now are mainly feature oriented.

7:14 ben_m: CookedGryphon, yeah that makes sense, it doesn't work though and on-close isn't an option if I (doc sketch)

7:14 CookedGryphon: ben_m: and you're using defsketch and not putting it in something else?

7:14 justin_smith: well garden hasn't seen a change in master in two years from what I see

7:15 noprompt: say wut?

7:15 justin_smith: err

7:15 wait, don't mind me

7:15 need my coffee

7:15 I was looking at cssgen

7:15 noprompt: justin_smith: the version was bumped 9 days ago. haha!

7:15 ben_m: CookedGryphon, I was using sketch instead of defsketch. Works now :D

7:15 CookedGryphon: ben_m: oh, odd, were you making your own frame?

7:16 noprompt: lol

7:16 CookedGryphon: ben_m: I would recommend finding out what was wrong and going back to sketch, defsketch is bad for many reasons

7:16 noprompt: justin_smith: everyone has those moments. :)

7:16 ben_m: No, just using sketch, I assumed it was just defsketch without giving it a name.

7:16 justin_smith: it would be cool if the list of libs mentioned the time since last activity on github

7:16 CookedGryphon: including things like opening windows when you're trying to package a jar or run tests!

7:16 noprompt: justin_smith: i thought you just said that wasn't technically relevant.

7:17 justin_smith: noprompt: I was devil's advocating

7:17 not sure how I feel :)

7:17 noprompt: justin_smith: oh, hoho, i see! :P

7:17 justin_smith: or maybe more thinking out loud

7:17 socratic method to find the truth!

7:17 CookedGryphon: ben_m: it's quite easy to stick the sketch in a swing window yourself, maybe using seesaw

7:17 noprompt: justin_smith: although i dislike the metric, i tend to agree it can be useful at times.

7:17 CookedGryphon: ben_m: then if you wanted to add other ui too...

7:18 ben_m: ah, so the difference is, defsketch actually does defapplet under the hood

7:18 ben_m: Which seems to be the same thing

7:18 CookedGryphon: in fact it seems to be an exact alias

7:18 justin_smith: now a reddit style karma system for libs

7:18 ben_m: Yeah.

7:18 I'm currently investigating source too.

7:18 justin_smith: where each user could upvote / downvote a lib

7:18 noprompt: oh gawd.

7:19 CookedGryphon: ben_m: the :target option might be interesting to you too

7:19 :frame :perm-frame or :none

7:19 justin_smith: but then of course we would see "karma whore" libs, that include kitten pics and in jokes to get pushed to the top

7:19 CookedGryphon: I use none when embedding some graphics in another bigger ui

7:19 ben_m: I'm just calling functions from nrepl

7:20 Still very much in the exploring phase

7:22 sm0ke: aha finally found https://github.com/pyronicide/lein-autoreload

7:22 noprompt: bitemyapp: "there is no substitute for using criterium in benchmarking. Proper."

7:22 rkz: can anyone spot the problem with my 'throttle' function here? http://cljsfiddle.net/fiddle/r4vi.cljsfiddle123

7:22 maybe i'm misunderstanding core.async

7:22 i'm trying to throttle mouse events

7:23 CookedGryphon: rkz: why do you have a sliding buffer?

7:23 of 1...

7:23 isn't that just the same as not having a buffer?

7:23 bitemyapp: noprompt: yes.

7:24 noprompt: nothing there is untrue.

7:24 noprompt: I need to sleep, plz add things

7:24 rkz: CookedGryphon: I don't want it to block

7:24 CookedGryphon: it won't... that's the point of core.async

7:24 rkz: CookedGryphon: just throw away all events between 1st one and recieved while blocking for timeout

7:24 inside the go block it will

7:25 i dont want to recieve 1 mouse event every 5 seconds

7:25 i want to recieve 1 mouse event ignore all of them for 5 seconds and recieve the next one

7:29 bitemyapp: I'm off to sleep 5realz now. Goodnight all.

7:29 noprompt: bitemyapp: night buddy.

7:30 sm0ke: is robert.hooke available for every lein plugin?

7:32 noprompt: rkz: wait (>! to-throttle)?

7:33 CookedGryphon: rkz: you could share a timeout...

7:34 rkz: noprompt: bloking put onto a sliding-buffer channel of size 1, then blocking read from timeout channel of msesc

7:34 (>! to-throttle) shouldn't block and immediately wait on the timeout

7:34 noprompt: rkz: yeah but you're not putting anything on the channel.

7:35 rkz: i see

7:35 yeah

7:35 im just returning (chan) basically

7:35 whoops

7:35 yedi: what happens when you put! to a closed channel?

7:36 noprompt: yedi: http://clojure.github.io/core.async/#clojure.core.async/put!

7:36 "Will throw if closed."

7:36 yedi: is there a way to check if a channel is closed

7:37 noprompt: yedi: you know i was wondering the same thing the other day.

7:37 drguildo: is anybody here using nrepl.el on windows?

7:38 yedi: i guess i'll just have to wrap my puts in try/catches

7:38 rkz: noprompt: i think this fixes what you're pointing out http://cljsfiddle.net/fiddle/r4vi.cljsfiddle123

7:38 noprompt: rkz: fyi https://github.com/swannodette/swannodette.github.com/blob/master/code/blog/src/blog/utils/reactive.cljs#L239-L277

7:41 ben_m: CookedGryphon, if you're curious still, closing the sketch is actually fine, pressing Escape is what causes nREPL to close.

7:42 I guess that might be some hardcoded part of processing or something like that.

7:42 drguildo: if not, what's the most popular clojure development environment on windows because i've found a problem with nrepl.el that's kind of a deal breaker

7:44 noprompt: drguildo: doesn't counterclockwise work on windows?

7:45 drguildo: https://code.google.com/p/counterclockwise/

7:45 drguildo: noprompt, as far as i know. i really need a good development environment, especially for something like clojure with it's simple syntax and type system.

7:46 erm, i don't mean it has a simple type system, just that with something like scala the type system helps you more by default

7:47 noprompt: drguildo: most of the folks here use Emacs. but you might wanna look at counterclockwise. also i think SublimeText now has some good plugins to get a repl etc rolling. LightTable should also work.

7:49 drguildo: oh. i'm not sure about that. clojure's a dynamic language (aka unityped).

7:50 drguildo: how much help an IDE will be able to give you about the correctness of your program is really hard to say. there's core.typed for static type checking though but that's outside of the scope of what you're asking for i think.

7:52 drguildo: well i was thinking more along the lines of manipulating s-expressions

7:52 i'm a beginner and my brain isn't good at parsing them yet

7:52 so i need all the help i can get from my tools

7:53 noprompt: drguildo: Emacs' paredit excels at that. i believe similar facilities are available for LightTable and SublimeText.

7:54 drguildo: i'm having trouble with emacs + nrepl.el, it seems windows cannot kill child processes automatically so each time i nrepl-quit i'm left with an orphaned jvm instance

7:54 noprompt: drguildo: you might also want to look into something like rainbow-delimiters or rainbow-parentheses which will highlight matching delimiters using alternating colors depending on nesting.

7:54 drguildo: lighttable has a problem with recursion causing it to bug out sometimes which makes it unresponsive. not the program itself but the magic instarepl stuff.

7:54 noprompt: drguildo: you may want to try simply running lein repl somewhere and then connecting to it from emacs vs using something like nrepl-jack-in.

7:55 drguildo: so that's a no go as well

7:55 noprompt: drguildo: yes, i've seen that happen.

7:55 drguildo: hrmm yeah, maybe.

7:55 noprompt: drguildo: typically that's how i do it. i seldom use nrepl-jack-in unless i'm being supremely lazy.

7:55 drguildo: i'm already using rainbow-delimiters, it's great.

7:56 noprompt: drguildo: paredit-mode is probably the next thing you'll want to look in to.

7:57 drguildo: if you're fluent with paredit-mode and have you're nrepl working properly, you're pretty much set. everything else is icing on the cake. :)

7:58 drguildo: i hope that's helpful to you.

7:59 drguildo: i suppose if all else failed you could run a linux VM. :P

8:03 justin_smith: drguildo: you can run (System/exit 0) in a repl to kill its vm

8:05 drguildo: noprompt, thanks

8:06 noprompt: drguildo: sure thing.

8:06 holy cow it's 0509.

8:06 well that's my cue to sleep.

8:06 drguildo: apparently windows has no way of automatically killing a parent processes children

8:07 which is what's causing the orphaned java.exe

8:07 there must be a way around it though

8:08 surely windows isn't that shit... right?

8:11 justin_smith: drguildo: as long as your agents are shut down, System/exit will shut down the vm

8:12 though I guess it would be annoying to have to remember to do that before exiting the editor

8:13 (and this is where as an emacs user with 32 gigs of ram I think "exit the editor, when does anyone ever do that?")

8:13 drguildo: i have the mentality where if there's a problem like this it really bugs me and i feel compelled to find a "proper" solution to it

8:13 i have 16gb so memory isn't an issue either

8:14 justin_smith: if you want "proper" behavior, it is odd that you would use Windows

8:14 Windows has some great things, propriety isn't one of them

8:14 rkz: surprised I havent heard of this before though, must be plenty of people using windows

8:14 doing clojure

8:14 drguildo: i came to the conclusion a long time ago that there are no good operating systems, unix, linux and windows are all bad in their own special ways

8:14 justin_smith: I think a plurality are osx or linux users

8:15 wait, you've used a proper unix? I didn't think anyone used a licensed unix any more on a desktop

8:15 drguildo: but i don't want to argue about operating systems

8:16 i've used freebsd and openbsd

8:16 i used linux exclusively for years

8:16 justin_smith: those aren't unix any more than linux is

8:16 none are licensed as unix

8:17 drguildo: why does being licensed matter?

8:17 justin_smith: that's what makes something a unix

8:17 drguildo: if you say so

8:17 justin_smith: unix is a trademark

8:17 it's a certification

8:18 if you are going to differentiate unix vs. linux, bsd is not in the unix category

8:18 drguildo: if you say so

8:19 justin_smith: http://en.wikipedia.org/wiki/Unix#Branding

8:19 *bsd and linux are legally not allowed to use the unix name

8:19 it is a trademark and a certification

8:20 drguildo: cool

8:24 dsrx: i think people tend to not differntiate *BSD and UNIX so much because the BSDs are direct descendents of AT&T UNIX

8:28 justin_smith: anyway, I should apologize, the whole unix pedantery is irrelevant here

8:28 as is my opinion of anything about windows being "proper"

8:29 I think the proper thing is if a program starts a jvm that you wouldn't use after its exit, it should safely shutdown said vm

8:30 drguildo: are you seeing this phenomenon with emacs / nrepl on windows?

8:30 drguildo: yeah

8:32 justin_smith: if there is an nrepl.el command that shuts down all jacked-in repls, you could add that to kill-emacs-hook

8:32 any function added to kill-emacs-hook will get run if emacs is exited in a normal way

8:33 drguildo: the problem is nrepl.el spawns a java.exe process which has a java.exe child but when the parent is killed it doesn't kill the child

8:33 either explicitly or automatically (windows doesn't kill children when the parent is killed)

8:33 i don't know why java.exe even has the child to begin with but i'd like to

8:33 justin_smith: OK, so what we need is a command that sends a message to each open repl owned by emacs, and tells it to exit

8:34 sounds like something that could be done in four or five lines of elisp, if it is not in nrepl already

8:35 the tricky thing I guess is the owned by emacs vs. connected to and should stay running distinction

8:35 drguildo: https://github.com/clojure-emacs/cider/issues/390

8:35 justin_smith: for example I use emacs to host a repl inside a server - just because I quit emacs does not mean I want that server to shut down

8:35 s/host/connect-to

8:36 OK, that's helpful

8:36 (that link)

8:37 I think an elisp command that sends (System/exit 0) to be evaluated by a child repl would fix that issue

8:37 heh, and now I see you say the same thing there

8:38 drguildo: :-)

8:39 the problem is ultimately with windows but the chances of getting that fixed are practically 0

8:39 justin_smith: right

8:39 thus my snark about propriety and windows :)

8:40 drguildo: but maybe there could be some kind of workaround implemented in emacs's delete-process

8:40 but i don't know enough about windows system programming to have any ideas

8:40 justin_smith: but the point of the jvm is to smooth over such things, so why not rely on the jvm (by telling it nicely to exit) rather than the os (by depending on shutdown behaviors specific to sane operating systems)

8:40 drguildo: i've looked around and there are no obvious/easy ways of find a processes children

8:40 true

8:41 WWWest1: hi all

8:41 justin_smith: I mean if everyone had a sane OS, we wouldn't need the jvm now would we

8:41 drguildo: it could also be seen as a problem in java.exe because it should really be killing it's child when it gets the signal to exit

8:41 dsrx: does the jvm run on templeos?

8:42 justin_smith: LOLOL

8:42 WWWest1: is there something special to do to get :advanced compilation working when targeting node?

8:42 justin_smith: dsrx: speaking of sane os's

8:42 WWWest1: my project compiles but dies with has no method 'zb' when I run it

8:42 drguildo: templeos has ascended beyond the need for virtual machines

8:43 makkalot: hi, is someone using austin, ?

8:43 WWWest1: do the modules I use through node/require need to be declared as extern libs or something?

8:45 justin_smith: woah, cleaning up browser windows I see that OSX paid for unix certification

8:46 drguildo: is templeos a unix?

8:46 francis_wolke: It's rather annoying that all library sources are stored in .jar files, as this prevents me from r-grepping the libraries that I use - is there an solution to this I'm simply oblivious to? There __are__ solutions, ( http://stackoverflow.com/questions/1342894/find-a-class-somewhere-inside-dozens-of-jar-files ) but I'm asking anyway because it seems likely that someone has had this issue before and solved it.

8:47 justin_smith: francis_wolke: if you know which ones you want to search, jars are zip files

8:47 clojurebot: It's greek to me.

8:47 justin_smith: you can unzip them

8:49 you could do something like: for i in $(lein classpath | grep jar); do mkdir $(basename $i .jar); cd $(basename $i .jar); unizp $i; done

8:49 that is not complete, but close to what would do it

8:52 francis_wolke: justin_smith: Adknowledged.

8:54 justin_smith: I just experimented with emacs archive mode - it lets you open and edit jars without extracting them, but does not allow search rgrep style

8:54 francis_wolke: agreed that this is an annoying issue btw

8:54 francis_wolke: justin_smith: Yep. I walked down that path too.

8:54 justin_smith: Elisp hacking time I suppose. *sigh*

8:54 justin_smith: definitely an option :)

8:55 M-x jar-occur

8:55 would be sweet

9:04 CookedGryphon: Or, get cloc 0.1.0 and do lein cloc

9:05 my colleague wrote it, it scans all the jars on your classpath and source folder, running codox over them building documentation for every namespace sorted by library

9:05 and indexing them to be lucene searchable

9:05 justin_smith: CookedGryphon: if people use doc strings, that seems like it would work

9:05 henryw374: codeq could help here. u need a script to pull all src of all deps into a codeq instance - which i dont have btw. then query away

9:05 CookedGryphon: indeed, which they should. It searches on the function name too

9:06 justin_smith: CookedGryphon: I have coworkers who see doc strings as irrelevant decoration, so the only way to figure the namespace out is to read the whole god damned source file

9:07 grumble grumble

9:07 CookedGryphon: justin_smith: marginalia might be better for you then

9:07 justin_smith: yeah

9:07 or hs-mode in emacs

9:07 which comes out to the same thing if you don't have doc strings :)

9:08 now I am dreaming of a variant of hs that hides everything but the doc string...

9:08 that would be sweet

9:09 CookedGryphon: focus-mode - you can only see the source of one thing at a time

9:09 if you find yourself needing to look at two, you haven't named/documented it sufficiently

9:09 fix that then continue

9:09 justin_smith: that is how I use hideshow basically

9:10 collapse all, expand one at a time

9:10 but my main collaborator has an "abstract all the things" philosophy, such that his code is not readable that way

9:11 common conversation him: "why use flet, and not just put it in its own defn?" me: "why make a top level defn that will only be used in one place?"

9:12 I am more likely to repeat small things, he is more likely to have definition-spaghetti

9:13 CookedGryphon: it's not spaghetti if it does one well defined small thing and doesn't have tendrils

9:13 justin_smith: CookedGryphon: spaghetti as in you cannot figure out what this thing is doing without recursively following 5 or more definitions spread throughout the file

9:13 each one is small

9:14 CookedGryphon: so that's badly named

9:14 justin_smith: and too abstract to have an intuitively meaningful name

9:14 CookedGryphon: yeah, you need to be able to name it

9:14 justin_smith: right, they are weird hard to name things he is abstracting out

9:15 https://github.com/caribou/caribou-core/blob/master/src/caribou/model.clj#L111

9:15 for example

9:16 screen after screen of weird little definitions

9:16 CookedGryphon: i don't even understand the docstring on the top level function there though :P

9:16 but yeah i see your point

9:17 if you're having to do lots of funny little custom transformations like that... it makes me wonder whether the underlying data structure is actually to blame

9:17 justin_smith: and notice that splinter-order is only ever called once in the entire codebase!

9:17 why even make that a function :(

9:17 CookedGryphon: (disclaimer, that opinion is entirely based on these few lines)

9:18 justin_smith: it's more like he has a write-only brain for algorithms sometimes

9:18 don't get me wrong, he is brilliant, and it is solely thanks to him that caribou does what it does so well - but working on his code can be maddening

9:18 OK, done griping about my best friend now :)

9:20 CookedGryphon: actually the data structures are pretty straightforward, though the impedence mismatch between sql and clojure maps can be a bit sticky sometimes

9:38 for a while I used sets as a shorthand for testing for any of multiple equalities (set membership)

9:38 (defn is [& things] (let [preds (map #(fn [x] (= x %)) things)] (apply some-fn preds)))

9:38 compared to the equivalent set used as a predicat, the average time is 1.48 microseconds

9:38 as opposed to 100 nanoseconds

9:39 which is how many orders of magnitude? wow

9:40 err wait

9:41 I got the order of micro and nano mixed up

9:41 * justin_smith facepalms

9:48 xeqi: dnolen: does form-seq (really form-seq*) cause a rebinding everytime a value is realized from the resulting lazy-seq?

9:48 I thought it did, but perhaps I missunderstand lazy-seq recursion w/ dynamic vars

9:55 nonuby: compojure depends on clojure 1.3.0 https://github.com/weavejester/compojure/blob/master/project.clj so what happens when i bring compojure into my new project that is according to my project.clj on 1.5.1?

9:57 CookedGryphon: nonuby: I *believe* it'll default to the latest version and assume back compatibility. Which in this case is a correct assumption, so you'll be fine

9:57 justin_smith: nonuby: it should still work, you may want to use an :exclusions clause in your dependencies so that you don't accidentally get the wrong clojure version

9:57 with a recent library, I actually left out the clojure dependency, because I assume nobody using it would not be using clojure

9:58 I wonder if that is bad form

9:58 CookedGryphon: justin_smith: if nothing else it documents which version you had in mind when you wrote it. I would say it was bad form

9:58 clojure is a funny one though, because it is really very stable and back compatible

9:58 nonuby: clj-http lists in dev dependencies rather than deps

10:00 justin_smith: CookedGryphon: the library is miniscule, it is really just a dependency injection of avout as a state coordinator into a caribou app (replacing an atom caribou used with an avout distributed atom)

10:01 my reason for doing this is so often I have gotten a wrong clojure version (or wrong foo version) indirectly through some random lib

10:01 CookedGryphon: tell you what we need... immutable libraries

10:02 and when you compile code, it closes over the versions of the libraries you use

10:02 then instead of jars, have some git-like construct

10:02 justin_smith: not really compatible with the clojure classloader

10:02 CookedGryphon: to give you immutable library versions

10:02 dnolen: xeqi: it does because it calls re-form, which will rebind

10:02 xeqi: lazy sequences and binding do not compose

10:02 xeqi: you always have to capture before you start

10:02 justin_smith: CookedGryphon: unless we had a new ns with every library version

10:02 dnolen: s/re-form/read-form

10:03 xeqi: dnolen: I meant on current master

10:03 dnolen: xeqi: the behavior is correct and master and incorrect in your patch

10:03 s/and/in

10:05 CookedGryphon: justin_smith: not necessarily... the build/packaging tool could manage that

10:05 dnolen: xeqi: oops actually, master is wrong too :)

10:06 xeqi: actually it's not ... *cljs-ns* and *alias-map* is correct because those might change during reading

10:06 justin_smith: CookedGryphon: so how is it handled when two versions of clojure are relied on?

10:06 dnolen: xeqi: I mean master is right for those

10:07 xeqi: and data-readers is also right - because we need to bind that based on what it was when we started

10:07 xeqi: so yeah master is correct here

10:07 xeqi: dnolen: heh, I'm good with the changes proposed (as mentioned in my latest comment). Just was really curious about behaviour difference

10:08 dnolen: xeqi: so what was the dec thing in compiler.clj all about?

10:08 gotta run, bbiab

10:16 ohcibi: hi, is there an equivalent for this: http://clojuredocs.org/clojure_core/clojure.core/vector for sequences? i found sequence but it just takes a coll as single argument and turns it into a seq..

10:16 `cbp: ohcibi: no, you construct seqs "by hand"

10:17 Assuming that's what you meant by sequences

10:17 sequences are actually a superset that includes vectors, lists, seqs, etc

10:18 ohcibi: `cbp: yes but I need a function like vector that takes many arguments and creates a sequence from it to pass to map, so I wonder why there is no function like vector

10:18 justin_smith: seq does not create a sequence, it creates a "cursor" on a sequence

10:18 the overhead is pretty low, it is a convenience so you can check the first / rest etc. and iterate on it

10:19 ohcibi: map turns an argument into a sequence

10:19 clgv: o:O

10:19 o_O

10:19 justin_smith: ohcibi: the input to map can be any collection that can be treated as a sequence

10:20 ohcibi: justin_smith: i need a function that takes many arguments and returns a sequence from them...

10:20 like vector does

10:20 justin_smith: vector is a sequential

10:20 sequence is not a type

10:20 clgv: ohcibi: why not use vector?

10:20 justin_smith: it describes many types

10:20 you could use vector, list, hell if you don't care about the order you could use set

10:21 *hash-set

10:22 or if you prefer you could use a java array or List

10:22 map will iterate over any of them by using a seq

10:23 TEttinger: a function that takes many arguments and creates a sequence from it to pass to map: ##((fn [& args] (map inc args)) 1 2 3 4 5)

10:23 lazybot: ⇒ (2 3 4 5 6)

10:23 justin_smith: that's another way to do it, sure :)

10:23 ohcibi: ah... indeed I confused "sequence" with list

10:23 TEttinger: I just meant the many args thing

10:23 justin_smith: ((fn [& args] args) 1 2 3 4 5)

10:23 ,((fn [& args] args) 1 2 3 4 5)

10:23 clojurebot: (1 2 3 4 5)

10:24 clgv: ohcibi: if the current answers dont suffice for you just provide concrete examples for the input and output

10:24 ohcibi: clgv: no no, its just that I confused sequence with list, so there was no way to give proper answers 8-)

10:24 TEttinger: I wonder...

10:25 justin_smith: ,(class ((fn [& args] args) 1 2 3 4 5))

10:25 clojurebot: clojure.lang.ArraySeq

10:25 justin_smith: ,(class (list 1 2 3 4 5))

10:25 clojurebot: clojure.lang.PersistentList

10:26 justin_smith: ,(class (reduce conj () [1 2 3 4 5]))

10:26 clojurebot: clojure.lang.PersistentList

10:26 TEttinger: ,(map first (java.util.TreeMap. (sorted-map :a 1 :b 2)))

10:26 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.util.TreeMap$Entry>

10:26 xeqi: dnolen: (dec column) was meant to be a seperate patch. yet another instance of 0 vs 1 indexing difference between tools.reader and sourcemaps

10:26 TEttinger: so it can map over java types cool

10:27 justin_smith: ,(map identity (java.util.TreeMap. (sorted-map :a 1 :b 2)))

10:27 clojurebot: (#<Entry :a=1> #<Entry :b=2>)

10:28 justin_smith: ,(map identity "hello")

10:28 clojurebot: (\h \e \l \l \o)

10:28 justin_smith: :)

10:29 though map on a string is usually a pretty bad idea

10:29 it totally works

10:29 TEttinger: it is totally not a bad idea if you need character manipulating

10:29 it just uh... shouldn't be needed...

10:30 justin_smith: depends on if you care about memory usage / execution time

10:30 sticking string ops on strings makes a big difference

10:30 TEttinger: lazy seqs vs. strings though...?

10:31 justin_smith: (says the guy who made the mistake of ubiquitously using seq ops on strings in a webapp and felt the pain)

10:31 TEttinger: heh.

10:32 justin_smith: a sequence from a string, compared to a string, will likely use at least 4 times the space, not to mention the difference in search and alteration time

10:32 4 times the size is hazy and from memory.. let me see if I can get more accurate

10:35 ,[Character/SIZE (count (.getBytes "a"))]

10:35 clojurebot: [16 1]

10:35 TEttinger: ,[(count (.getBytes "a")) (count (.getBytes \a))]

10:35 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: getBytes for class java.lang.Character>

10:36 justin_smith: so a primitive character is 2 times the size

10:36 \a is not a collection

10:36 looking for the size of the class

10:36 TEttinger: also an array might be different?

10:36 justin_smith: which is different from char

10:36 yes, array vs. seq

10:36 because an array is unboxed

10:37 so if you used a char-array, that would be smaller than a seq of character objects by a significant margin

10:37 and both are larger than a string of equivalent contents

10:37 and then you have the optimized string ops, as compared to the ops on collections that are more general and have to be more cautious

10:42 TEttinger: comparison of seq vs. string ops http://sprunge.us/TTNK

10:42 a simple one, but informative

10:43 TEttinger: woah!

10:44 justin_smith: yeah, the differnce is pretty big. Though to be fair, you would only construct that seq once and convert the seq back to string in actual practice, you would need a more realistic example for that

10:45 TEttinger: I do wonder if it would make sense to use java strings as a basis for specialized data. I'm almost certain my crappy game's map could be represented with unicode...

10:45 justin_smith: or you could use an array if it is a performance bottleneck

10:45 I guess with string you get the advantage it is still immutible

10:45 TEttinger: I am. but it uses a ton of memory now

10:46 justin_smith: an array of what type?

10:46 TEttinger: ,(count (.getBytes "╬"))

10:46 clojurebot: 3

10:47 justin_smith: also, you could consider a sparse map

10:47 `cbp: I always used .toCharArray for codejam stuff :-)

10:47 lnostdal: SegFaultAX: from the chat yesterday (if you recall) this was the problem for me: https://github.com/clojure-emacs/cider/issues/408#issuecomment-29471701

10:47 TEttinger: I actually kinda did a sparse map in C# for some of this

10:47 then later rewrote in clojure

10:48 justin_smith: TEttinger: for example I have been playing with quad trees for representing some rectangle packing stuff, and the advantage of only needing storage for occupied space is nice

10:48 also makes iterating easier

10:49 I guess in 3d they ubiquitously use octrees

10:49 same concept

10:49 TEttinger: I think now I'm using ^doubles arrays. not sure if that boxes or not?

10:50 justin_smith: ^doubles should be unboxed

10:50 you could use jvisualvm and compare the memory used by the object to the count to know for sure :)

10:50 jvisualvm is really helpful for investigating this stuff

10:50 clgv: TEttinger: the values in the ^doubles array are primitiv

10:50 justin_smith: alongside criterium

10:51 clgv: TEttinger: there is also `vector-of` for primitives

10:52 TEttinger: I have never been able to figure out visualvm

10:53 `cbp: you can also compile to .class then decompile into java with something like jd-gui :)

10:53 TEttinger: then probably it has something to do with either logic code (which uses large vectors for each creature), or more likely the rendering is poorly done

10:54 justin_smith: the difference in storage space used between a sequence of char and a string is 3/2 + (housekeeping data of sequence)/8

10:54 3/2*length that is

10:54 `cbp: that's the only sure way i know to check for boxing

10:54 justin_smith: also, TIL each bool is 8 bytes in size minimum, even when optimized

10:55 TEttinger: 8 BYTES?

10:55 for 64-bit stuff?

10:55 justin_smith: "a normal object requires 8 bytes of "housekeeping" space;"

10:55 clgv: `cbp: Luyten is much better than jd-gui (and the jd-gui website is down, isnt it?)

10:55 justin_smith: unboxed 8 bits, sorry

10:55 oh, so my math above is way off

10:56 9/2*count + seq-stuff/8

10:56 for sequence of char vs. string

10:56 `cbp: clgv: it seems up for me: http://jd.benow.ca/

10:56 clgv: Ive never used luyten though

10:56 clgv: oh on a new URL?

10:57 justin_smith: TEttinger so the minimum size of a bool is 8 bits, 9 bytes if it is a standalone boxed bool

10:57 crazy

10:57 clgv: `cbp: Luyten is a small frontend for procyon which had much ebtter results on the class files I got from clojure

10:58 `cbp: i'll check it out

10:58 clgv: `cbp: I upgraded it to use the latest version of procyon overhere: https://github.com/guv/Luyten/releases

10:58 justin_smith: TEttinger: which is a good argument for using bytes as bit-vectors

10:58 clgv: `cbp: the original developer seems not very reactive

10:59 `cbp: :P

10:59 clgv: oh jd-gui has no 0.3,6 release for linux?

10:59 justin_smith: clgv: so is that the decompiler you would recommend?

11:00 clgv: justin_smith: you mean procyon via Luyten GUI?

11:00 ea-: newbie question here.. if I have a string, and a vector, how can I prepend the string into the vector?

11:00 justin_smith: I recently got the "clojure high performance programming" book and it recommended jd-gui

11:00 clgv: yeah

11:01 `cbp: that book sounds interesting :)

11:01 ea-: right now im doing (into [mystring] myvector) and it's adding each character from the string into the vector as an element

11:01 clgv: justin_smith: it managed to decompile class files where jd-gui/jd-core failed (showed only bytecode)

11:01 * `cbp googles

11:01 Profpatsch: I’m trying to configure ac-nrepl. It works for the REPL, is there a way to couple it into my clojure-mode buffer?

11:01 arcatan: justin_smith: what's this book?

11:01 ea-: also tried (conj myvector mystring) and it still adds each character fmor the string into the vector

11:01 justin_smith: ,(apply vector "your string" [1 2 3]) ; ea-:

11:01 clojurebot: ["your string" 1 2 3]

11:02 clgv: justin_smith: I think you should install both and on failure check if the other one manages decompilation of the class file

11:02 arcatan: ah, found it

11:02 justin_smith: ea-: if you don't mind the string being at the end instead, you can use conj, and that is much more efficient

11:02 clgv: cool, sounds like a plan

11:02 ,(conj [1 2 3] "your string") ; ea-:

11:02 clojurebot: [1 2 3 "your string"]

11:03 justin_smith: ea-: or use a list and conj, that will put it on the front

11:03 ,(conj (list 1 2 3) "your string")

11:03 clojurebot: ("your string" 1 2 3)

11:03 ea-: hmm.. still seem to be getting the same issue

11:03 justin_smith: arcatan: shantanu kumar, clojure high performance programming

11:04 it's good, though slim

11:04 not much filler though

11:04 ea-: (csv/write-csv *out* (apply vector [url (re-seq re-expn line)]))

11:04 justin_smith: http://www.packtpub.com/clojure-high-performance-programming/book

11:04 ea-: what issue

11:04 ea-: seems to add each character of the "url" into the vector instead of the whole string.

11:04 justin_smith: ea-: the order of the args is wrong

11:05 ea-: basically just trying to prepend the vector returned by re-seq with the string "url"

11:05 justin_smith: you are putting the vector into the string

11:05 ea-: oh, damn!

11:05 haha

11:05 justin_smith: ea-: sorry, missed where you described that above

11:05 ,[(into "hello" [:a :b :c]) (into [:a :b :c] "hello")]

11:05 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IPersistentCollection>

11:05 justin_smith: err

11:06 ea-: no, I was right the first time

11:06 use conj

11:06 into treats the string as a collection

11:06 ea-: ok let me try into

11:07 justin_smith: ,(into [:a :b :c] ["hello"])

11:07 clojurebot: [:a :b :c "hello"]

11:07 justin_smith: that is one way to do it

11:07 but really you could just conj

11:07 ,(conj [:a :b :c] "hello")

11:07 clojurebot: [:a :b :c "hello"]

11:07 ea-: i must be missing something reallty obvious

11:07 (csv/write-csv *out* (conj (re-seq re-expn line) url))

11:07 that still adds each character of the string URL inrto the vector

11:08 justin_smith: re-seq returns a lazyseq not a vector

11:09 ea-: hmm

11:09 justin_smith: ,(conj (re-seq #"[^ ]+" "this is a test") "hello")

11:09 clojurebot: ("hello" "this" "is" "a" "test")

11:09 justin_smith: what else are you doing to url - maybe something else is turning it into a seq before that

11:09 gtrak: dnolen: managed to make ISeq first/rest work with array-copy, inefficient, but works.

11:09 justin_smith: if so, (apply str url)

11:10 ,(apply str [\a \b \c])

11:10 clojurebot: "abc"

11:10 ea-: https://gist.github.com/earle/0a5266fd0ebb4db5cc43

11:10 Bronsa: xeqi: any issue working with the source-logging reader?

11:11 justin_smith: ea-: yeah, don't use apply vector

11:11 ea-: i have some futures that are grabbing some urls and tokenizing an access log. .trying to prepend the url to the csv returned frmo re-seq

11:11 justin_smith: ea-: use conj

11:11 ea-: yeah im using conj, and its tokenizing the string into characters in the vector

11:12 justin_smith: ea-: that gist is using apply vector

11:12 `cbp: can you paste what you're actually using? :P

11:13 ea-: https://gist.github.com/earle/0a5266fd0ebb4db5cc43

11:13 sorry hadnt updated the gist ;)

11:13 `cbp: the arguments to conj are in reverse order

11:14 oh nevermind me

11:14 justin_smith: `cbp: I was gonna say :)

11:14 ea-: my first real clojure program.. figures i get the futures right, but cant figure out how to put a string into the vector ;)

11:15 justin_smith: ea-: how sure are you that the code in that gist is running when you get a request?

11:15 ea-: its running, its writing everything to stdout

11:16 justin_smith: and it is definitely running that version and not an old definition?

11:16 ea-: yeagh

11:16 `cbp: I imagine write-csv takes a sequence of [column-names & rows] so i guess you're telling the csv that column-names is the url so it takes each char as a column

11:18 or i may be completely wrong, ea- which library are you using

11:19 ea-: im using https://github.com/clojure/data.csv

11:19 if i take out the conj and url, and just write the csv, it works fine

11:20 justin_smith: ea-: I just commented something you can try on that gist

11:20 ea-: trying to prepend the url into it is adding each character of the url instead of the string

11:20 justin_smith: to see what conj is returning

11:20 conj really does not work that way, something else is going on

11:21 the doto form returns what conj would have returned, while also printing

11:22 wait, I fucked that up, one sec

11:23 ea-: updated

11:24 ea-: ok..

11:25 yeah this makes sense.. i changed it to println, and it works:

11:25 (println (conj (re-seq re-expn line) url))

11:25 justin_smith: err

11:25 ea-: (http://notebook.cowgar.com/access.log [1.202.218.8 - - [03/Jun/2012:13:51:44 -0400] "GET /robots.txt HTTP/1.0" 404 1.202.218.8 - - 03/Jun/2012:13:51:44 -0400 "GET /robots.txt HTTP/1.0" 404])

11:25 justin_smith: right, so conj is doing the right thing

11:25 ea-: not really

11:25 its not adding to the vector.. it returned a new sequence with the url then the vector in it

11:26 justin_smith: OH

11:26 shit

11:26 line is not a string, it is a collection?

11:26 wait, no

11:27 ea-: its the result of spit-lines

11:27 which should be a string right?

11:27 AimHere: It's a collection of strings

11:27 Probably a vector

11:27 `cbp: i dont see how it can work at all haha since write-csv needs a vector of vectors and youre passing it a seq of strings as far as i can tell

11:28 ea-: https://gist.github.com/earle/0a5266fd0ebb4db5cc43

11:28 is where im at.. im just using println right now

11:29 `cbp: can you use prn insteand of println

11:29 justin_smith: what is re-expn

11:29 I think re-seq re-expn is not returning the data structure you expect

11:29 does it have any grouping in it?

11:30 ea-: updated the gist with the whole thing.. re-seq is returnignt he vector

11:31 this app is: 1) read urls for access logs from a file 2) grab urls 3) parse into csv prepending with the url of where it came frmo

11:31 and re-seq seems to be dong just fine.. i just cant figure out how to prepend the vector retruned by re-seq with the url

11:32 justin_smith: ea-> when you have multiple groups like that, re-seq returns a nested structure

11:32 ,(conj (re-seq #".*(s).*" "this is a test") "hello")

11:32 clojurebot: ("hello" ["this is a test" "s"])

11:32 justin_smith: that is your problem

11:32 ea-: re-seq is returning one vector not nested, its fine

11:32 justin_smith: you need to massage the output of re-seq

11:32 no it is not

11:33 ea-: oh, yeah you're right

11:33 hmm

11:33 justin_smith: ,(re-seq #".*(s).*" "this is a test")

11:33 clojurebot: (["this is a test" "s"])

11:33 justin_smith: nested structure

11:33 if you conj to that, the conjed thing will be in the outer group, but not the inner

11:33 ea-: ok i just need to change my regex then

11:33 justin_smith: so the problem is you did not know the data structure re-seq was returning

11:33 conj was behaving properly

11:33 ea-: yup, ok thanks.. so now i just need to fix hte regex

11:34 ok this makes me feel better i was really confused ;)

11:34 justin_smith: glad we sorted it out, I was confused for a moment too, and I should know better

11:35 ea-: yeah.. thanks.. happen to have a good regex for parsing an apache log?

11:35 justin_smith: I bet org.apache.something has a log file parser class you can use :)

11:39 http://stackoverflow.com/questions/6623974/parsing-log4j-layouts-from-log-files

11:40 if you know apache's patternlayout config, you can use that to generate your parser

11:40 bonus, if the config changes your parsing still works :)

11:57 francis_wolke: justin_smith: https://gist.github.com/francis-/7694998

11:57 justin_smith: francis_wolke: so you went for the for loop method, nice

11:58 another option could be decompressing to /tmp

11:59 but then you would need to manipulate the search path or make a symlink I guess

11:59 francis_wolke: justin_smith: Yup.

12:02 justin_smith: the for loop on lein classpath method would have the "advantage" of unpacking all your recursive deps

12:03 before an rgrep

12:03 maybe that should be a separate function, if it should even exist :)

12:03 check for project.clj, query for unpack all deps into a subdir before rgrep

12:07 francis_wolke: justin_smith: In that case you have to deal with other people, submit a pull request - ect. ect. Personally, I don't feel like doing all that. 10 minutes is about my maximum amount of time I'm willing to invest. Please don't let my negativity prevent you from creating the solution though.

12:07 justin_smith: why? you can just write a function that calls rgrep

12:07 but sure

12:24 francis_wolke: justin_smith: I had to kill emacs, and don't have our previous conversation. Iirc you wanted to tie into lein. I'm not familiar with what lein offers in terms of running functions on startup. Also, if at all possible, I'd prefer to do things from emacs, that way if at some point in the future I'd like to change something, it's a M-. or two away.

12:24 Emacs has more staying power that either the JVM or clojure. I'd prefer to invest in it, and it's model rather than a particular build tool.

12:24 justin_smith: francis_wolke: I was just suggesting running lein classpath from the shell

12:25 I almost have the script working actually, I will share when done

12:26 http://sprunge.us/LAhN

12:26 run it from the top level of the project

12:26 puts everything under alldeps

12:26 just run it before doing the rgrep

12:27 I think the only non-standard command in there is basename

12:27 it could be replaced with anything that takes a file and generates a good directory name out of the full path

12:27 but I recommend having basename if you ever use the shell

12:28 francis_wolke: justin_smith: Cool. But what happens when you dynamically pull in a dep with pomogranate?

12:28 justin_smith: then you can fix the script

12:28 or do your version of the rgrep from the location that has the lib's jar

12:28 francis_wolke: justin_smith: Exactly

12:29 justin_smith: the advantage here is you can semi-instantly have all jars declared in project.clj open for investigation and recursive search

12:30 and in one tidy place so you can remove them again

12:30 *all jars required via declarations in project.clj, including nested dependencies

12:39 poppingtonic: hi

12:40 is there anyone who can guide me on how to connect Weka to my leiningen project?

12:40 justin_smith: poppingtonic: have you found the maven repo and required it in your project.clj?

12:41 poppingtonic: justin_smith: yes.

12:41 Is that all there is?

12:41 justin_smith: well that is the first step

12:41 I would have explained how to do it if you had not done it yet

12:42 I'd say find a simple example / tutorial that gets close to what you want to try, and translate from java to clojure jvm interop

12:42 poppingtonic: justin_smith: ah, cool. I've downloaded v3.7.10, and extracted it. Where do I put weka.jar?

12:42 justin_smith: wait

12:42 I said require it in your project.clj

12:43 lein will just find it and hand it to you

12:44 hyPiRion: poppingtonic: could you provide us with the URL to the WEKA maven repo?

12:44 justin_smith: so you want something like [nz.ac.waikato.cms.weka/weka-stable "3.6.6"] in the project.clj dependencies vector

12:44 hyPiRion: I think it is this: http://mvnrepository.com/artifact/nz.ac.waikato.cms.weka/weka-stable/3.6.6

12:44 poppingtonic: yeah, sec

12:45 hyPiRion: justin_smith: yeah, except he has 3.7.10

12:45 ohcibi: ok, I learned that a vector is a sequence, but why does (seq? [1]) return false?

12:45 poppingtonic: otoh, justin_smith jsut gave it...

12:45 *just

12:46 justin_smith: ohcibi: it is sequential, but does not implement the ISeq protocol

12:46 hyPiRion: ohcibi: a vector is seqable/sequential, not a seq itself. It just means it can be converted to a seq

12:46 ohcibi: ah

12:46 so what I want is sequential?

12:47 seangrove: Hrm, what's a good strategy for generating api-keys?

12:47 Incremental integer ids?

12:47 hyPiRion: ohcibi: I would guess so, yes

12:47 justin_smith: ,(doc sequential?) ; ohcibi

12:47 clojurebot: "([coll]); Returns true if coll implements Sequential"

12:47 hyPiRion: ,(sequential? [1])

12:47 clojurebot: true

12:48 CookedGryphon: seangrove: java.util.UUID/randomUUID perhaps?

12:48 hyPiRion: seangrove: Wouldn't random UUIDs suffice?

12:48 poppingtonic: i see...

12:48 seangrove: CookedGryphon hyPiRion: That was going to be my serious suggestion. So that's not a known bad-idea?

12:49 CookedGryphon: seangrove: not as far as I know, I've used it for just that purpose in a production system, less chance of screwing it up and getting a collision than incremental IDs

12:49 justin_smith: poppingtonic: if the version they have on the standard maven is not recent/ good enough, there are ways to do a local install

12:49 poppingtonic: but everything just works better if you rely on the archives that exist

12:50 poppingtonic: justin_smith: `lein deps` didn't complain about unavailability or anything...

12:50 justin_smith: oh OK

12:51 hyPiRion: seangrove: it's incredibly unlikely to get a collision, so unless you process incredible amounts of data AND need to be 120% sure there aren't any collisions, it should be okay

12:51 seangrove: CookedGryphon: Heh, the incremental ids was not meant in any seriousness, of course :)

12:51 justin_smith: if you have the artifact, then you can import it in a repl and start experimenting

12:51 seangrove: hyPiRion: Cool cool.

12:51 poppingtonic: So I'm just writing a quick repl form to test everything

12:51 CookedGryphon: seangrove: oh yeah, I was thinking user names, heh, yeah it would be monumentally bad as an api key :P

12:52 hyPiRion: afaik it's way more likely to get SHA collisions in your git repo

12:52 um wait, I think I take that back.

12:52 justin_smith: poppingtonic: yeah, I would suggest opening a repl, importing the class, and trying to follow a simple tutorial

12:52 turning their code into clojure w/ interop

12:53 poppingtonic: justin_smith: Eric Rochester's data analysis cookbook should be useful for that...

13:35 xeqi: Bronsa: only issue with hooking the source reader up was the one you helped with about cljs bootstrapping

13:35 its unfortunate that metadata can't go on java objects / primitives though

13:36 took me a moment to realize why reading "3" didn't give back any info

13:38 Bronsa: xeqi: yeah, that's unfortunate but there's nothing I can do about that

13:41 xeqi: its a minor inconvience atm, and a work around is possible. It might be a bit uglier for making sourcemaps have more detailed info, but agreed nothing can be done about it at the tools.reader level

13:43 tangrammer: Hi folks!, any advise about refactor clojure (so far only i'm searching for rename vars) in emacs[-live]

13:44 I'm trying to use https://github.com/joodie/clojure-refactoring but no success

13:44 justin_smith: m-x query-replace-regexp

13:44 or just m-x query-replace

13:44 also m-x rgrep

13:44 tangrammer: that only works with slime, it appears

13:44 slime is out of date

13:45 arrdem: ooh yeah

13:45 tangrammer: justin_smith: thanks Justin, i'm using nrepl

13:45 upwardindex: I'm using enfocus.core/html but it seems that it remove capital letters in my attribute names. Anyone has had the problem?

13:45 scottj: tangrammer: clojure-refactoring hasn't worked well, even with slime, since clojure 1.1 or maybe 1.2

13:46 tangrammer: scottj: i dont know the cause, but i was trying without success

13:47 scottj: thanks, i'll try justin_smith trick

13:47 justin_smith: tangrammer: I am sure query-replace-regexp and rgrep are a poor substitute for true refactor tooling, but I don't really know what one expects from that, never having felt a need for it myself

13:47 beyond rgrepping for the names and adjusting with a query-replace-regexp

13:48 tangrammer: justin_smith: me neither, but i'm trying to understand the bmaddy 4clojure problem solution

13:48 (fn [c]

13:48 (let [f (fn [[b & c :as a] [y & z :as x]]

13:48 (if (= a x)

13:48 false

13:48 (if (= b y)

13:48 (recur c z)

13:48 (or (= c x)

13:48 (= a z)

13:49 (= c z)))))

13:49 p (fn p [c]

13:49 (if (= (count c) 1)

13:49 (list c)

13:49 (for [h c

13:49 t (p (disj (set c) h))

13:49 :let [s (cons h t)]]

13:49 s)))]

13:49 (reduce #(or % %2)

13:49 (map (fn [i]

13:49 (every? true? (map (fn [[x y]]

13:49 (f (seq x) (seq y)))

13:49 (partition 2 1 i))))

13:49 (p c)))))

13:49 sorry!

13:49 i didn't know how to paste that

13:49 justin_smith: refheap in the future

13:49 ~refheap

13:49 clojurebot: refheap is http://gist.github.com/

13:49 amalloy: tangrammer: refheap.com

13:49 hyPiRion: clojurebot: forget refheap

13:49 clojurebot: Huh?

13:50 hyPiRion: meh

13:50 justin_smith: tangrammer: yeah, for something like that query-replace will help make it more readable

13:50 amalloy: hyPiRion: you'll never get that one to work

13:50 tangrammer: justin_smith: the code golf!

13:50 amalloy: it's inferred via refheap is paste, paste is gist, gist is gist.github.com, or some similar madness

13:50 hyPiRion: oh, wonderful

13:51 amalloy: clojurebot: forget refheap |is| paste

13:51 clojurebot: I forgot that refheap is paste

13:51 justin_smith: tangrammer: m-x query-replace c <return> input-collection <return>

13:51 for example

13:51 amalloy: ~refheap

13:51 clojurebot: refheap is gist.github.com

13:51 amalloy: ugh

13:51 `cbp: :)

13:51 justin_smith: ~gist

13:51 clojurebot: gist is http://gist.github.com/

13:52 hyPiRion: clojurebot: forget gist |is| http://gist.github.com/

13:52 justin_smith: ~paste

13:52 clojurebot: I forgot that gist is http://gist.github.com/

13:52 paste is not gist.github.com

13:52 tangrammer: justin_smith: it seems perfect for that!

13:52 hyPiRion: ~refheap

13:52 clojurebot: https://www.refheap.com/

13:52 hyPiRion: oh hey

13:53 amalloy: hyPiRion: i don't know which of us fixed him; i was PMing while you were doing it for all to see. but it does look fixed

13:53 justin_smith: tangrammer: also if you have a region, or are narrowed, it will only try to operate within that constraint

13:53 Raynes: lol

13:53 mimieux: blist

13:53 hyPiRion: amalloy: Well, we'll see how long it will last

13:53 Raynes: It's because someone changed 'gist' to be refheap at some point.

13:53 Someone decided to seek revenge, clearly. :P

13:54 justin_smith: ~paste

13:54 clojurebot: paste is not gist.github.com

13:54 hyPiRion: clojurebot: gist is <reply>http://gist.github.com/

13:54 clojurebot: Ok.

13:54 hyPiRion: ~gist

13:54 clojurebot: http://gist.github.com/

13:54 hyPiRion: ~refheap

13:54 clojurebot: https://www.refheap.com/

13:54 hyPiRion: okay, done spamming

13:54 justin_smith: ~eatpaste

13:54 clojurebot: Titim gan éirí ort.

13:55 justin_smith: tangrammer: also paredit helps with refactoring clojure, because for example C-k kills to end of line, then keeps killing until the last fragment killed is balanced

13:56 so you can easily move blocks around

13:57 wuschel: Hi folks.

13:58 hyPiRion: hi there

13:58 tangrammer: justin_smith: yes, i'm a bit familiar with paraedit, i started to use it from the first time I used clojure on emacs because I was used to use eclipse IDE

13:58 wuschel: How hard is the transition from scheme to clojure if one is absolutely not into Java? Does it make sense to get a take on clojure-lang, or should I wait a bit and see how alternatives (e.g. Julia-lang) might turn out?

13:59 I am using LightTable right now - but the Java package, building, deploying system really scare me, even when I use leiningne.

13:59 justin_smith: wuschel: I find the dep management in clojure better than my scheme experiences

13:59 the ease of having specific per project versions

13:59 (of various deps)

14:00 wuschel: ^^ True. Saw the in project.clj

14:00 tat

14:00 h

14:00 (damn)

14:00 justin_smith: so I can have a project where I try clojure 1.6, and that does not interfere with my clojure 1.5 projects

14:01 wuschel: Sounds good. I guess I still have little knowledge where those dependencies get downloaded, where clojure is stored, etc.

14:01 Also, how hard is it to include a java package? Say, I want to play with the chemistry development kit (http://cdk.sourceforge.net/).

14:01 What would be the key steps?

14:01 justin_smith: find out the artifact name and version

14:02 seangrove: wuschel: I avoided clj-jvm for a long time because of my dislike for the java ecosystem and did everything in cljs

14:02 justin_smith: put them in project.clj

14:02 restart

14:02 done

14:02 arrdem: the hell... are we standardizing on gists rather than refheaps now?

14:02 wei__: for people using migratus: how do you debug a migration error? the stacktrace for java.sql.BatchUpdateException is pretty useless

14:02 seangrove: I wouldn't recommend it, but it's possible. And once you've got your head around lein, it's really quite nice in hiding almost anything to do with Java

14:02 amalloy: justin_smith: C-k's paredit-behavior is nice, but you can move blocks around just fine (and more carefully) with the default C-M-k

14:02 wei__: my migration runs in plain sql but fails using migratus

14:02 hyPiRion: wuschel: lein places every dependency in the ~/.m2 directory for development, and if you want to uberjar the thing, everything is packaged in the standalone jar file

14:02 justin_smith: wuschel: to try a different version of the lib, just change the version in the dep

14:03 seangrove: wei__: Are you able to catch the exception and call .getNextMessage on it?

14:03 wei__: ah, so that's what it means. trying that now

14:03 seangrove: Let me see what the exact call is...

14:03 wuschel: hyPiRion / justin_smith: I should have a closer look on that one. Thank you. I am on Win64, but I guess it should be the same concept there.

14:04 hyPiRion: wuschel: yeah, in a .m2 folder in your home directory

14:04 seangrove: wei__: This is my migration library https://www.refheap.com/e6d0b7c7e09f6271d228891f5

14:04 justin_smith: wuschel: yeah, may not be .m2, but will be in $HOME - that exists under win right?

14:04 wuschel: It is just that the thought of that giant , unknown Java blob scares me a bit (; Not that the blob would not be powerful.

14:04 justin_smith: yep.

14:04 justin_smith: wuschel: I just wrote a shell script today to open up all my deps so I could recursively seasrch them

14:05 hyPiRion: wuschel: There is a pain point if you want to use a java project, which is not in a maven/clojure repository. That's by design, but it is possible to bypass that through some lein plugin (which afaik is not hard to use)

14:05 justin_smith: wuschel: http://sprunge.us/LAhN

14:05 wuschel: justin_smith: Thanks!

14:05 hyPiRion: Ok, I guess I will read into that. Cheers!

14:06 Leiningen all the way, then.

14:06 hyPiRion: apart from that, Leiningen should make stuff easy, although I understand the concern of "I don't understand this"

14:06 justin_smith: wuschel: the things that still bug me about clojure are the preference of gigo over early reporting of errors, and the long start up time, otherwise as a former lisper / schemer / ocaml user it is awesome

14:06 hyPiRion: It's a legitimate concern, and it should be documented what Leiningen does behind the covers

14:07 wuschel: I agree 100%. The startup time sucks, and then as I said: without knowing Java it feels a bit like running in the dark.

14:07 seangrove: The small pool of lispers is pretty interesting

14:07 hammerandtongs: http://techbehindtech.com/2010/12/11/leiningen-adding-git-submodule-to-leiningen-project/ # was about to ask if there was some way to do this

14:07 wei__: seangrove: thanks for the insight and code. out of curiosity what does v0/migrate! look like-- are you using plain SQL migrations or some DSL?

14:07 seangrove: I see a lot of people from my chicken scheme and CL days in the clojure community from time to time

14:08 amalloy: hyPiRion: isn't there a good blog post that goes into a lot of detail about the things lein has to do?

14:08 seangrove: wei__: https://www.refheap.com/8d3a7c485cde7e370225d687f

14:08 wuschel: Chicken scheme is great. My favourite so far.

14:08 amalloy: http://www.flyingmachinestudios.com/programming/how-clojure-babies-are-made-what-leiningen-is/ is what i'm thinking of

14:08 wuschel: If only the concurrency would be better.

14:08 amalloy: quite long, but covers a lot

14:09 justin_smith: if you are looking for good concurrency, clojure is the right place

14:09 wuschel: Thanks for the links (:

14:09 * wuschel agrees.

14:09 hyPiRion: amalloy: I think there was some guy who explained task through task

14:09 wuschel: I currently having one eye on Clojure, the other on Julia (;

14:10 seangrove: Yeah, I don't mean to say that the universal migration is every-other-lisp -> clojure, just that there seems to be a fairly small community of lisp people, and they all kind of wander around inside the same lake

14:11 amalloy: per task? man, i don't want to know that level of detail

14:11 hyPiRion: amalloy: Well, many people have been burnt by the dependency resolution for example

14:13 not saying that a detailed explanation on how `lein repl` is necessary, just some of the magic parts

14:22 amalloy: "if version ranges are present, lein asks maven to find you a compromise version that nobody will be happy with" belongs in any article about dependency resolution

14:32 Profpatsch: I’m trying to configure ac-nrepl. It works in the REPL, but can I also use it in my clojure-mode buffer.

14:33 yedi: while using paredit: i have a form but now i wanna wrap the form in say a str call (+ 1 2) => (str (+ 1 2)), what's the best/quickest way to go about it?

14:34 what ive been doing is highlighting the entire form with C-space and then typing open paren

14:34 justin_smith: Profpatsch: do you have global-auto-complete-mode turned on?

14:34 yedi: was wondering if there was something quicker

14:34 justin_smith: yedi: cursor before form: ( + C-<right-arrow>

14:35 err ( str C-<right-arrow>

14:35 that is

14:35 control right-arrow slurps the thing to the right

14:35 control left-arrow spits out the rightmost thing

14:36 yedi: oh tiiightt

14:36 hm, i have to disable the mac keyboard shortcuts for control-rightarrow though

14:36 justin_smith: there are other bindings

14:37 scottj: (+ 1 2|) C-u M-( str

14:37 justin_smith: C ) is the other option

14:37 scottj: s/C-u/C-M-u

14:38 justin_smith: also, everything is much easier if you periodically figure out what your most frequent commands are, and find shorter / simpler keybindings for them

14:39 Control-c + char (for any single char on your keyboard) is specifically designed to only be bound by users for their personal favorite commands

14:40 so your first 26 most favorite commands should be very easy to access

14:41 yedi: ooh C-( and C-) works pretty well

14:41 justin_smith: yeah, but it's too bad about the chorded control / shift

14:42 s_kilk: hi all. I've just hit an odd issue with selmer, the 'with' tag doesn't seem to work properly: "Unrecognized tag found {% endwith %} on..." . the relevant code snippet is here: https://gist.github.com/ShaneKilkelly/7697218

14:42 any ideas?

14:43 scottj: justin_smith: if you make your shifts double as parens, then for me it's just control + shift, not control + shift + paren

14:43 justin_smith: scottj: shifts double as parens?

14:44 yedi: justin_smith and scottj: so many thanks

14:44 scottj: justin_smith: you can make shift keys behave as parens when not used as a modifier

14:44 yedi: that just changed the gam efor me

14:44 scottj: justin_smith: steve losh cadet keyboard blog article

14:44 justin_smith: scottj: woah, cool

14:44 yedi: now i just need to step up my repl-fu

14:45 scottj: justin_smith: I use xcape in linux. shifts are parens, caps lock is control and escape

14:45 amalloy: scottj: fascinating. you just made me find out what C-u M-( does, even if it was an accident

14:45 justin_smith: I will look into that shift-paren thing

14:46 Bronsa: (

14:47 gf3: Guys, what's a cool hack-day idea I can work on?

14:47 /cc bitemyapp

14:48 amalloy: justin_smith, scottj: i think swapping number keys with symbols (ie, implicitly pressing shift when on the top row) is a nice alternative change to the shift-as-paren thing

14:49 justin_smith: hmm, one day hack... - a template that takes all your clojurescript and bundles it with the version of the csound synthesis language that runs inside chrome

14:49 (they ported the code to nacl)

14:49 http://vlazzarini.github.io/

14:50 amalloy: i don't quite get how shift-as-paren works - i know i often press shift and then decide i didn't want to shift anything after all. having that turned into a paren sounds like quite a pain

14:50 justin_smith: gf3 allows controlling a synthesizer in the browser via html5

14:50 gf3: justin_smith: o0o0o neat

14:50 justin_smith: so yeah, hack some clojurescript onto it :)

14:51 Profpatsch: justin_smith: Yep, indeed.

14:52 justin_smith: I have global-auto-complete enabled.

14:53 justin_smith: Does it work with you?

14:53 justin_smith: Profpatsch: try running ac-nrepl-setup

14:53 Profpatsch: affirmative

14:55 gf3: you can do real time livecoding synthesis like in overtone (though of course nobody has written the pretty clojure dsl for it yet), but the engine is your browser, so you can serve it up for others to use

15:28 Profpatsch: justin_smith: I get “Namespace not found.“

15:29 justin_smith: require the ns you are in in the repl

15:29 or load the file

15:29 then you will start to get hints for it

15:29 Profpatsch: Hm.

15:29 justin_smith: that message means it is communicating with the repl, but the repl does not know yet about the function you are typing

15:30 try constructing a call to a function in clojure.core, you should see ac do its thing

15:32 Profpatsch: Will do, thanks.

15:37 allsystemsarego: hi all, what do I need to add to my project dependencies in order to be able to use the keyword "defrel" in core.logic?

15:37 seangrove: Hrm, was ring.middleware.stacktrace moved somewhere? I don't seem to be able to require it

15:38 justin_smith: allsystemsarego: if you have core.logic, you just need to refer to defrel

15:38 allsystemsarego: though using require with an alias is better

15:38 allsystemsarego: justin_smith, I get an error when attempting to use defrel

15:38 justin_smith: (ns your-ns (:require [clojure.core.logic :as logic])) (logic/defrel ...)

15:38 allsystemsarego: oh

15:39 let me try that

15:39 Profpatsch: justing_smith: It seams to work in clojure files. Do you use it with Clojurescript?

15:40 justin_smith: Profpatsch: nope, have not tried it in clojurescript

15:40 Profpatsch: Ok, I guess there’s more to that.

15:40 justin_smith: it could be it doesn't know how to properly load or resolve the cljs namespaces

15:40 Profpatsch: But it works now.

15:40 justin_smith: cool, glad you got it sorted out

15:42 seangrove: you could unzip your ring jar and see if it is anywhere in the ring/middleware/ directory

15:42 or just open it if your editor supports that

15:42 seangrove: justin_smith: Sorry, it was just that I hadn't included ring/ring-devel in my deps list

15:42 err, in my project.clj

15:42 justin_smith: seangrove: oh, cool

15:43 seangrove: regarding finding things in your deps I wrote this today https://gist.github.com/noisesmith/7697007

15:43 so that I could rgrep in my project dependencies

15:43 will I trade disk usage for transperency? today I will

15:44 seangrove: Oh, interesting

15:44 Yeah, with emacs' find-grep-dired worked with jars transparently

15:44 Opening and editing clojure jars like any other file? Awesome.

15:44 justin_smith: wait, find-grep-dired works with jars?

15:45 seangrove: No, I *wish* it did

15:45 Emacs can just open them and edit them fine, if only it could f-g-d them as well

15:45 justin_smith: ahh, yeah, I couldn't find the functionality, thus this hack, after which I can run m-x rgrep and find things to my bliss

15:47 I will love it until the first time I check in all the sources to all my deps to git

15:47 then I will hate it

15:49 seangrove: amend it to add to .gitignore ;)

15:49 justin_smith: heh, true

15:50 si14: I just keep getting "REPL server launch timed out" in my project. Is there any common way to debug huge (around a minute) REPL startup time?

15:51 justin_smith: si14: try starting a repl from the terminal

15:51 si14: justin_smith: I'm already doing this

15:51 justin_smith: ahh, ok

15:51 si14: can I see your project.clj?

15:52 si14: justin_smith: PMed it to you

15:52 justin_smith: it's a bit messy :)

15:52 justin_smith: looking now, thanks

15:53 si14: I suspect that prismatic schema can be at fault

15:53 justin_smith: hmm, maybe try removing the nrepl-middleware entries?

15:53 temporarily of course

15:54 si14: at least in my experience I've found that in *some* (didn't really find why or when exactly) cases heavy class-based hinting can cause huge loading/compilation times.

15:54 justin_smith: trying this.

15:55 justin_smith: also you could try ammending -main to start an nrepl server; then doing lein uberjar followed by java -jar (your jar)

15:55 if that works then it is definitely the compilation lag

15:56 also, if that is the case you could also try lein compile for the aot

15:57 since you do specify that

15:57 also it could be that just leaving out the aot would reduce the bootup time

15:58 si14: justin_smith: removing lein middlewares had no affect. Moreover, CPU is at 100% during loading, so I suspect it's compilation

15:58 the question is why compilation take sooo long?

15:59 justin_smith: because you have a pile of deps that godzilla would find threatening in size

15:59 :)

15:59 si14: I've tried to omit AOT in dev profile (line 69), doesn't help much

16:00 justin_smith: I thought it's quite idiomatic for Clojure projects :)

16:00 yedi: so simple yet brilliant: http://feedproxy.google.com/~r/KrisJenkinsBlog/~3/6qkWJ-mWM40/clojure-less-than-greater-than-tip.html

16:01 justin_smith: if only I'd seen that article 15 years ago when I was first learning common lisp

16:05 seangrove: Uhg... well, might be time to finish off the google apps integration.... need to make sure I have plenty of alcohol for afterwards, though.

16:06 First step: "Pay a small fee using Google Wallet if it's the first time you are publishing an app on the store"

16:06 Lovely.

16:07 Guessing ~$100...

16:07 hyPiRion: guessing 2 cents

16:08 mr_rm: &(clojure.data.json/read-str "{\"name\":\"Bob\"}")

16:08 lazybot: ⇒ {"name" "Bob"}

16:09 mr_rm: &(clojure.data.json/read-str "{\"name\":\"Bob\"}" {:key-fn keyword})

16:09 lazybot: java.lang.IllegalArgumentException: No value supplied for key: {:key-fn #<core$keyword clojure.core$keyword@5d8bde>}

16:09 bagl: Anyone using Emacs' midje-mode? I can run in repl midje test just fine, I can use midje-mode commands for showing/hidding facts, but I cannot check them (C-c .). It just prints "Mark set" in statusbar... Any ideas?

16:09 justin_smith: &(clojure.data.json/read-str "{\"name\":\"Bob\"}" :key-fn keyword)

16:09 lazybot: ⇒ {:name "Bob"}

16:09 mr_rm: justin_smith: doh!

16:09 justin_smith: i could swear the doc said to pass it as a map

16:09 Bronsa: eeew keyword args

16:10 mr_rm: nope, i was wrong

16:10 just says to pass the pairs

16:10 thanks, justin_smith

16:10 justin_smith: np

16:11 in general, if your maps are well constructed and you see "no value supplied for key" you called a function that expects an &keys

16:13 mr_rm: justin_smith: makes sense

16:14 tommo__: can some1 explain the meaning of the [[]] in a function such as this: (fn [[a b]] [b (+ a b)])?

16:15 justin_smith: tommo__: destructuring

16:15 ,((fn [[a b]] (+ a b)) [1 2])

16:15 clojurebot: 3

16:15 justin_smith: tommo__: it mirrors the structure inside a collection

16:15 so you can concisely access the contents

16:15 tommo__: also works for maps

16:16 ,((fn [{a :a b :b}] (+ a b)) {:a 1 :b 8})

16:16 clojurebot: 9

16:16 tommo__: ah i see, ty

16:17 justin_smith: I like it because there is less noise in the function body that way, so fewer places bugs can hide

16:24 patrkris: hi folks. is the prim-seq function shown in the following URL built in to ClojureScript?

16:24 https://github.com/swannodette/swannodette.github.com/blob/master/code/blog/src/blog/utils/dom.cljs#L39

16:26 seangrove: patrkris: Yes

16:26 justin_smith: patricko1: https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L716

16:26 that is where it is defined

16:27 patrkris: ah ok

16:27 seangrove: (inc justin_smith) ; Even though I got there first.

16:27 lazybot: ⇒ 13

16:27 justin_smith: heh

16:28 sadly, most of the question askers here don't even know how to inc somebody

16:28 seangrove: I think technomancy is by far the channel leader

16:28 patrkris: (inc justin_smith)

16:28 lazybot: ⇒ 14

16:28 justin_smith: $karma technomancy

16:28 lazybot: technomancy has karma 86.

16:29 justin_smith: $karma seangrove

16:29 lazybot: seangrove has karma -2.

16:29 justin_smith: you must have gotten so much it rolled over

16:29 seangrove: Haha, I'm bringing down the channel average here

16:30 $karma bitemyapp

16:30 lazybot: bitemyapp has karma 14.

16:30 seangrove: -.-

16:30 justin_smith: $karma lazybot

16:30 lazybot: lazybot has karma 20.

16:30 patrkris: I guess there is no separate documentation site for ClojureScript's API?

16:30 justin_smith: $karma clojurebot

16:30 lazybot: clojurebot has karma 33.

16:31 seangrove: patrkris: No, but that's a good idea

16:33 Maybe clojuredocs, but with "This function is available in : clojureclr, clj-jvm, cljs", etc.

16:33 patrkris: yeah

16:34 who, except for David Nolen, would ever have known about prim-seq? ;-)

16:34 justin_smith: people who read the source for fun

16:34 patrkris: but i could've just grep'ed clojurescript.git

16:34 * seangrove raises his hand too

16:34 seangrove: But I learned it from dnolen

16:35 patrkris: yes... I guess there's nothing inherently wrong with having to read the source code :)

16:36 seangrove: patrkris: How did you find you needed it?

16:36 patrkris: but I'm on my iPad and too lazy ;-)

16:36 s_kilk: hi all. im getting a strange error with the selmer html rendering library. I'm using the 'with' tag, but the page is blowing up on the corresponding 'endwith' tag. error: "Unrecognized tag found: {% endwith %}"

16:36 si14: justin_smith: thank you!

16:36 patrkris: just reading through David's blog about core.async and UI's

16:36 justin_smith: si14: what worked?

16:37 si14: justin_smith: nothing. just wanted to thank you for help :)

16:37 justin_smith: so its still broken?

16:38 yedi: (inc justin_smith)

16:38 lazybot: ⇒ 15

16:40 tommo__: which clojure book do you guys reccomend

16:41 Pupnik: clojure programming

16:41 seangrove: I've never found much use from programming language-specific books

16:42 yedi: ugh, everytime i visit prismatic i lose hours of valuable time

16:42 seangrove: OL, L.I.S.P., LoL, etc. all were more interesting for general concepts, and then blog posts, example projects, and source code for language-specific implementation details

16:42 tommo__: me neither, im a java dev by trade but i want to go into clojure with a fresh mind

16:43 seangrove: yedi: Is it that good? I've never used it.

16:45 yedi: seangrove: yea, i'm a big procrastinate by reading kinda guy and i have to make sure to never visit prismatic if i have shit i wanna get done

16:46 si14: justin_smith: it's still slow. It works, but REPL starts before timeout in 1/2-1/3 of my attempts.

16:46 yedi: i actually visit hn way more regularly cuz i know there'll only be a tiny # of articles i care about on the front page

16:48 seangrove: yedi: Hrm, that's pretty interesting.

16:48 As the accuracy of prismatic(s) improve, they cross a threshold and become damaging...

16:51 algernon: prismatic is bad. it makes it far too easy to sit at the computer for half a day, and not see anything less than very interesting.

16:52 seangrove: algernon: Well, we knew this day would come.

16:52 * seangrove couldn't resist.

16:53 algernon: see you in a week! ;)

16:55 ohcibi: is there a built in faculty function?

17:00 bitemyapp: seangrove: http://clojurewiki.com/

17:00 technomancy: http://clojurewiki.com/

17:00 gf3: what's up?

17:01 gf3: let me know if you still need a hack-day idea :)

17:03 seangrove: bitemyapp: Looks like it could be good. It'd be nice if wikis could have structured data/models though

17:03 A standardish-schema for functions in this case

17:03 bitemyapp: seangrove: yes, it would. Bonus is that it's git-backed, so if somebody really hates websites I can give them a git account.

17:04 seangrove: Instead of just making a new document, you'd make a new document/fn-def, put in the structured data, and you'd be able to link to it just like another doc

17:06 bitemyapp: Looks like a decent start. Are you thinking about this superseding clojuredocs for function doc string, examples, clojure versions, and platforms?

17:06 bitemyapp: seangrove: I'm agnostic to the idea.

17:07 I'm happy if it does, fine if something else does a better job. API documentation isn't a core strength of wikis, this is more for folklore, informal knowledge, speculation, discussion, gathering, categorization, etc.

17:07 but if the wiki becomes the home for that, so be it.

17:07 arrdem: bitemyapp: what is this?

17:07 bitemyapp: arrdem: a wiki for Clojure users!

17:07 seangrove: bitemyapp: That sounds like a good middleground for me.

17:07 bitemyapp: seangrove: in some places, I link out to ClojureWerkz's tutorials because their work is peerless in the subject described.

17:07 in others, I simply write out the material.

17:08 seangrove: Yeah, I went through a bit and saw that

17:09 justin_smith: bitemyapp: I hacked together a script for when you just wish you could grep -r (or m-x rgrep) through all your dependencies https://gist.github.com/noisesmith/7697007

17:10 bitemyapp: justin_smith: that's quite handy, thank you!

17:10 I need to automate the backups for the wiki...

17:11 justin_smith: is git tag enough, or would you clone it too?

17:11 bitemyapp: justin_smith: when I run it, I get "unzip: cannot find or open" and then a dump of my directories/.m2

17:11 arrdem: bitemyapp: if you copied this from the clojure toolbox then the parsers article needs fixing

17:11 bitemyapp: justin_smith: I rsync the whole dir.

17:12 arrdem: it's not copy-paste and it's not complete.

17:12 justin_smith: bitemyapp: prereqs are the unzip command, and the basename command

17:12 bitemyapp: justin_smith: I have both.

17:12 justin_smith: odd

17:12 mind sharing the output of lein classpath?

17:13 that is how it is generating the list

17:13 bitemyapp: justin_smith: https://www.refheap.com/21337

17:14 justin_smith: cool, can I see the lein classpath output it generates that from?

17:14 oh

17:15 somewhere \n turned into n

17:15 that is what it is doing

17:15 in the sed, the s/:/\n/g is acting like s/:/n/g

17:16 maybe it is an osx sed incompatibility

17:16 bitemyapp: that's a common issue.

17:16 sadface :(

17:17 justin_smith: I've fixed sed unportability before

17:18 mind telling me the variation of 'lein classpath | sed -e "s/:/\n/g"' that outputs one thing per line?

17:18 since my osx box is at work

17:19 bitemyapp: justin_smith: looks like one big blog.

17:19 blob&

17:19 blob*

17:19 /Users/callen/code/bulwark/testn/Users/callen/code/bulwark/srcn/Users/callen/code/bulwark/dev-resourcesn/Users/callen/code/bulwark/resourcesn/Users/callen/code/bulwark/target/classesn/Users/callen/.m2 etc etc

17:19 justin_smith: yeah, that \n needs to be something else

17:19 but I am not sure what

17:20 bitemyapp: lein classpath | tr : '\n'

17:21 does that do it?

17:22 bitemyapp: justin_smith: that works perfectly.

17:22 justin_smith: this would appear to be a lesson in using the simplest tool possible.

17:22 justin_smith: awesome, gist updated

17:22 yeah, I so rarely need to use tr, but lesson learned!

17:25 bitemyapp: justin_smith: ding http://clojurewiki.com/expand-deps

17:25 ~clojurewiki is http://clojurewiki.com/

17:25 clojurebot: Ok.

17:25 bitemyapp: ~wiki

17:25 clojurebot: wiki is http://en.wikibooks.org/wiki/Clojure_Programming

17:25 bitemyapp: ~wiki is also http://clojurewiki.com/

17:25 clojurebot: Ack. Ack.

17:25 bitemyapp: ~wiki

17:25 clojurebot: wiki is clojurewiki

17:25 bitemyapp: hrm.

17:28 allsystemsarego: Is (require 'pldb) the correct way to import the pldb dependency at the repl?

17:28 justin_smith: allsystemsarego: it probably has a project name

17:29 allsystemsarego: the one on github?

17:29 justin_smith: try pldb.logic

17:29 allsystemsarego: threatgrid?

17:29 ok

17:29 justin_smith: pldb is the name of a project, the ns is called logic

17:29 (require 'pldb.logic)

17:30 allsystemsarego: I tried it, and it says No such var: l/contains-lvar?

17:30 justin_smith: if you look at their source they refer to clojure.core.logic as l

17:30 it could be you have the wrong version of clojure.core.logic for pldb

17:31 allsystemsarego: ok

17:31 justin_smith: pldb depends on version 0.8.3

17:31 do you require some other version in your project.clj?

17:31 allsystemsarego: 0.8.5

17:31 so yeah

17:32 justin_smith: try downgrading temporarirly

17:32 allsystemsarego: I'll go back to my project.clj

17:32 justin_smith: it could be clojure.core.logic dropped or renamed the function pldb needs

17:32 allsystemsarego: ok, thanks

17:33 justin_smith: also pldb is so small, updating it to a newer core.logic may actually be pretty easy

17:33 if you feel ambitious

17:33 allsystemsarego: that's for when I'm more comfortable with clojure

17:36 jouiswalker: is there a way to prevent refreshing the page from resending post data?

17:36 i'm using compojure, but it isn't obvious to me

17:37 justin_smith: allsystemsarego: https://github.com/clojure/core.logic/commit/1375f34ef42ee6b288ccb110b5c8c4aeb87a39a9#diff-30dcdb8bdb2cc62ab14e86f0d21703d7 they merged in pldb

17:37 it is part of core.logic now

17:37 bitemyapp: I feel like I have marbles in my mouth when I write on Twitter.

17:37 is there a Twitter++ where I get 280 characters?

17:37 indigo: bitemyapp: There's your next project!

17:37 ;P

17:37 seangrove: A working UI is a beautiful thing.

17:38 allsystemsarego: justin_smith, thanks

17:38 seangrove: The implementation is slowly catching up as well.

17:38 bitemyapp: indigo: http://clojurewiki.com/ signup and add things please :)

17:38 justin_smith: jouiswalker: you can dynamically create a "request key" each time you render and send the page

17:38 bitemyapp: seangrove: I actually didn't add carica on purpose, if you can believe it :P

17:38 justin_smith: jouiswalker: and not do anything if it comes in with a request-key you have not issued, or already served

17:39 indigo: A Clojure wiki written in Haskell, eh

17:39 justin_smith: it would be a hidden numeric parameter or random string in the form body

17:39 seangrove: bitemyapp: Well, are you going for an exhautive resource, an opinionated one, or an exhaustive resource with opinionated commentary?

17:40 bitemyapp: Also, ridiculous feature request, but allowing read/write access to it from the channel via a clojurewiki bot would be wonderful

17:40 justin_smith: jouiswalker: on further consideration, don't use a number for the request key, use a uuid

17:40 jouiswalker: justin_smith: i'll give this a try.

17:40 justin_smith: thanks!

17:41 justin_smith: np

17:41 seangrove: But you probably need more structure than a wiki easily provides to do it properly

17:41 JaredR: sup, justin_smith ?

17:41 bitemyapp: seangrove: neat idea.

17:41 justin_smith: JaredR: Sup

17:41 bitemyapp: seangrove: I'm not opinionated about the form the wiki takes. If people add stuff I left out, I won't remove, just add commentary.

17:43 seangrove: bitemyapp: I suppose ideally it would have 1.) structural data that 2.) can be edited and expanded as in any wiki and 3.) accessed via an api and finally a 4.) RapGenious overlay to allow meta-conversations to happen cleanly and clearly.

17:44 And a unicorn, while I'm dreaming.

17:44 bitemyapp: seangrove: a rapgenius-esque open source wiki is something I've wanted for awhile.

17:45 seangrove: the wiki is HApps (Haskell) based and backed by git, it's not out of the question.

17:47 justin_smith: what is rapgenius' backend? google is failing me

17:47 seangrove: Rails

17:47 bitemyapp: justin_smith: a poorly maintained Rails application on Heroku

17:47 justin_smith: ahh ok

17:47 seangrove: Tom is a crazy skilled coder though.

17:47 bitemyapp: dev-ops and coding aren't skills that always intersect.

17:50 seangrove: I noted that environ was recommended and demonstrated a pattern here: http://clojurewiki.com/Configuring%20Clojure%20Applications

17:53 arrdem: oh cool clojure-doc got a new theme since last I looked...

17:53 indigo: Hm, I should expand the Clojure with vim page

17:53 Because vim is awesome

18:03 freshhawk: if I have: (def x 'toUpperCase) and I want to use that java method ... (. "foobar" x) isn't going to work

18:03 how does one call java methods dynamically with the '.' special form?

18:04 or without the '.' special form, but I'm not very good with the java interop

18:10 justin_smith: freshhawk: you can use a macro, or use reflection

18:10 ,(doc .)

18:10 clojurebot: Excuse me?

18:11 justin_smith: ,(clojure.repl/doc .)

18:11 clojurebot: Pardon?

18:11 justin_smith: hmm

18:11 he appears not to like that call, but it works in a repl

18:11 freshhawk: . needs to have its arguments resolved at compile time

18:12 as far as methods are concerned at least

18:12 adhollander: seangrove: if you want to see a wiki platform with structured data, take a look at Semantic MediaWiki. Granted, it inherits all the cruftiness of Mediawiki...

18:12 cored: hello

18:13 I'm reading Functional Programming for object oriented programmers, and found out an exercise which I have to implement the second function here is my implementation of that particular function (def second (fn [list] (nth list 1))) and here is the solution from the author (def second (fn [list] (first (rest list))))

18:14 it's seems to me that my implementation is clear, but the author took another approach, is there some sort of best way to implement that or something?

18:14 freshhawk: justin_smith, it will have to be reflection. So the method objects return from reflection are what I will be using?

18:15 justin_smith: https://groups.google.com/forum/#!topic/clojure/YJNRnGXLr2I here's a thread on the clojure ml that is apropos

18:15 you really won't know any method names until runtime?

18:16 because otherwise you can do (def as-string #(.toString %)) and pass in as-string as a function to call

18:16 for example

18:17 freshhawk: justin_smith, it's a big ugly soap based api so I unfortunately don't

18:17 justin_smith: gotcha

18:17 eval is another option

18:17 freshhawk: true

18:17 justin_smith: which is effectively another compile time in the middle of runtime :)

18:18 bitemyapp: now to play holiday restaurant roulette

18:19 freshhawk: justin_smith, this thread is gold. thanks very much!

18:21 bitemyapp: justin_smith: added that to the wiki.

18:21 http://clojurewiki.com/FAQ

18:22 justin_smith: awesome

18:24 si14: awesome. my friend's lein can't even start.

18:25 just timeout every time.

18:25 justin_smith: si14: still?

18:25 si14: justin_smith: yeah

18:25 justin_smith: did you try running lein compile first

18:26 so the aot stuff would be out of the way

18:26 or can it not even do the compile task?

18:28 si14: justin_smith: yes. doesn't help much

18:31 meanwhile, SpaceX started countdown again.

18:31 grim_radical: 9 minutes!

18:32 si14: I was impressed by today's shutdown instead of miserable explosion on launchpad.

18:33 I mean, a lot of rockets just exploded without this sort of self-contro

18:33 *control

18:40 justin_smith: si14: I just thought of one more thing you could try, the standard voodoo option if things are acting weird

18:40 lein clean

18:40 can't hurt

18:43 si14: justin_smith: it started at 10th or something attempt, but I'll try lein clean on the next restart, thank you :)

18:43 justin_smith: are there any other symptoms? running out of memory maybe?

18:45 si14: justin_smith: no, just very slow startup

18:46 I'll run a profiler eventually.

18:46 ...and SpaceX aborted today's launch.

18:47 :(

18:47 johnjelinek: hihi all

18:47 JaredR: stupid question... is there an editor for Clojure that has autocomplete and such?

18:47 johnjelinek: how's it goin'?

18:47 JaredR: Emacs

18:47 JaredR: *sigh* I was afraid you were gonna say that...

18:47 VI GODDAMNIT ;)

18:48 Licenser: isn't Lighttable doing that?

18:48 johnjelinek: lololol

18:48 JaredR: I just downloaded lighttable... it doesn't seem to have autocomplete, insert, etc.

18:48 johnjelinek: JaredR: what's wrong with Emacs? you can use Emacs in evil-mode to get your vim bindings working

18:49 JaredR: I have memory issues and having to refer to documentation every 10 seconds is exhausting, so I tend to rely on code insight and autocomplete to help me with my productivity

18:49 johnjelinek: JaredR: I'm in the same boat

18:49 but I just taught myself emacs today for clojure

18:49 JaredR: yeah?

18:49 LOL OK

18:50 johnjelinek: yea

18:50 JaredR: well, I'm on OSX so using emacs isn't the end of the world... *coughVIisbettercough*

18:50 johnjelinek: lol

18:50 ditto and ditto

18:51 I am having a problem though with running unit tests in emacs

18:51 anyone available to help out?

18:52 I created a brand new lein project

18:52 when I compile the default test it shows "#'command-line-args.core-test/a-test"

18:53 which I imagine is correct

18:53 JaredR: seancorfield: you there somewhere?

18:53 johnjelinek: but when I run the tests, I get a compile error

18:53 clojure.lang.Compiler$CompilerException: java.lang.ClassNotFoundException: clojure.test.mode, compiling:(/private/var/folders/rh/wxb4f7d50151_tzpn2z_whdh0000gp/T/form-init5102129192986648799.clj:1:1) at clojure.lang.Compiler.analyze (Compiler.java:6380) ....

18:54 $ lein --version

18:54 Leiningen 2.3.4 on Java 1.7.0_45 Java HotSpot(TM) 64-Bit Server VM

18:54 any thoughts how to troubleshoot?

18:56 fixed it!

18:56 wewt!

18:56 I had to do cider-jack-in after opening a project file

18:56 not before

19:03 JaredR: johnjelinek: awesome! love it when something works out!

19:15 justin_smith: johnjelinek: it decides what project to launch based on what file / directory you have open

19:16 johnjelinek: I've got a new question, I'm trying to change the namespace of the REPL buffer to the one of the file I'm in

19:16 justin_smith: so you otherwise get a default setup, that is not connected to your project

19:16 johnjelinek: so I try C-c M-n

19:16 but it says "Symbol's function definition is void: cider-repl-set-ns"

19:16 justin_smith: johnjelinek: sounds like your cider is not up to date, or cider is not ready for prime time

19:16 could even be both :)

19:16 nrepl still works

19:16 johnjelinek: how do I check my cider version?

19:17 justin_smith: M-x package-list-packages

19:17 it will also let you update the list, and check to update packages that have new versions from that screen

19:19 johnjelinek: justin_smith: I have 0.3.1 installed

19:21 how could I do it in the nrepl?

19:21 justin_smith: there is an older nrepl.el package

19:21 that cider is replacing

19:21 johnjelinek: ooh, I see

19:21 justin_smith: but it seems cider may have incomplete coverage right now

19:21 johnjelinek: it should have this functionality though

19:22 justin_smith: part of the change is just that clojure nrepl / emacs nrepl.el was confusing people

19:22 johnjelinek: http://clojure-doc.org/articles/tutorials/emacs.html indicates cider should work fine

19:22 justin_smith: either your cider is out of date, or they are wrong

19:23 you can switch the ns in the repl using in-ns

19:23 johnjelinek: 0.3.1 is latest

19:23 justin_smith: so they are wrong

19:23 johnjelinek: couldn't it be something else with my setup that could be borking it?

19:23 justin_smith: seriously doubt it

19:23 it is trying to call a function that does not exist

19:24 that is pretty cut and dried

19:24 in the repl buffer: (in-ns 'my.namespace)

19:24 that is all you need to do

19:24 it's not complicated, you don't need the editor to do it for you

19:25 personally I don't even use in-ns

19:25 in the repl I run (require '[my.ns :as n])

19:25 then I call (n/whatever)

19:25 johnjelinek: ok, I'll try that

19:25 justin_smith: you may need to ammend that to (require '[my.ns :as n] :reload) if you save changes

19:27 notice that the content on that clojure-doc page is listed for 2012

19:27 johnjelinek: cool, it worked

19:27 justin_smith: it was just a search and replace of nrepl / cider

19:27 and the docs are not accurate yet, clearly

19:27 johnjelinek: lol, if it's 2012, you'd think cider would only get better from then

19:27 justin_smith: cider did not exist in 2012

19:27 so I'm saying the docs are not yet correct for cider

19:28 they switched some strings in the docs, without checking if those commands actually work with cider, I bet

19:29 johnjelinek: ahh, ok

19:29 gotcha

19:33 justin_smith: added an issue to the guide: https://github.com/clojuredocs/guides/issues/149 thanks :)

19:42 justin_smith: np

19:54 dabd: stole 2 functions from onlisp: https://gist.github.com/dabd/7700137 please comment on style or better ways to define them. ty

20:02 justin_smith: ,(reduce identity nil nil) ; dabd

20:02 clojurebot: nil

20:02 justin_smith: you don't need to test (seq coll)

20:02 reduce handles empty inputs just fine

20:03 though where you want to return [nil nil] you could use or

20:03 dabd: ,(reduce #(if (f %1 %2) %1 %2) nil)

20:03 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: f in this context, compiling:(NO_SOURCE_PATH:0:0)>

20:04 dabd: ,(reduce #(if (> %1 %2) %1 %2) nil)

20:04 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox$eval89$fn>

20:04 justin_smith: you need the init val

20:05 dabd: can you post youre definition pls?

20:05 your*

20:05 justin_smith: dabd: working on it

20:07 dabd: https://gist.github.com/noisesmith/7700208

20:07 first one updated, and works

20:08 for nil or valid inputs

20:11 both updated and working

20:12 oops, one bug in the latter

20:12 dabd: the most fn may raise an exception depends on how the function f handles a nil value

20:12 justin_smith: yeah, that is the bug

20:12 fixing

20:14 dabd: (f h) -> (when-not (nil? h) (f h)) seems to work

20:14 justin_smith: I was looking for something more concise

20:15 coventry: (doc fnil)

20:15 clojurebot: "([f x] [f x y] [f x y z]); Takes a function f, and returns a function that calls f, replacing a nil first argument to f with the supplied value x. Higher arity versions can replace arguments in the second and third positions (y, z). Note that the function f can take any number of arguments, not just the one(s) being nil-patched."

20:15 justin_smith: because otherwise the if seq coll version makes sense

20:15 coventry: Doesn't quite work.

20:15 justin_smith: coventry: we don't know a-priori what arg to give f

20:15 right, I tried that :)

20:18 https://gist.github.com/noisesmith/7700208

20:18 it's a judgement call whether my version of the second is better

20:18 I am pretty sure my version of the first is

20:18 that if could be an and

20:18 that may help clarity wise

20:19 dabd: ends up being almost as verbose as the when-not nil? version

20:19 justin_smith: right

20:22 I'd say use the destructuring so you don't have to call first / rest, but leave the check on seq coll

20:22 for the second one

20:23 dabd: ok thanks

20:23 justin_smith: https://gist.github.com/noisesmith/7700208 updated

20:24 (I also changed alignment of the last two args of reduce, because I think the extra line is worth the clarity)

20:57 coventry: Just had a programming interview where the problem was to implement a robot moving on an integer grid. Wrote it in nice functional style, so it hurt a little when the interviewer wanted me to make it throw an exception when it hit an obstacle. :-)

20:58 justin_smith: hah

20:58 robots hitting obstacles? how totally out of the ordinary, better throw an exception!

21:01 emaphis: I take exception to hitting obstacles.

21:05 dsrx: move :: Location -> Either Collision Location

21:05 bleh add a direction in there somewhere too

21:07 emaphis: Depends on how much beer I've had.

21:08 dsrx: hmm, so it's a function of BAC too ;D

21:08 I met a guy at thanksgiving dinner named "T. Scala"

21:08 made me wonder if he had a cousin "L. Clojure"

21:09 emaphis: :-)

21:09 justin_smith: Q. PHP never gets invited anywhere

21:10 (it's a vietnamese name)

21:11 hyPiRion: You'd be surprised when you hear about Haskell Curry then.

21:53 `cbp: bitemyapp: The heckle thing kinda works now lol. It feels kinda silly though

21:54 bitemyapp: `cbp: why?

21:54 `cbp: do you need the ability to ignore namespaces or what?

21:54 `cbp: no, i don't know it just does :D

21:54 Just need to revert clojure.test now to show successes instead of failures

21:55 and uh test selectors too i guess

21:55 oh and mutate more stuff

21:56 bitemyapp: heh

21:56 `cbp: sounds fun :)

21:57 `cbp: bitemyapp: https://www.refheap.com/21341 :P

21:57 that -231 is randomized stuff

22:02 bitemyapp: `cbp: oh no, you should just change functions to throw an exception

22:02 `cbp: much more reliable that way, and you can use the exception class to determine if it was caused by eris.

22:02 (ErisException. "Are you testing this function?")

22:02 `cbp: well i didnt think of that :)

22:02 but randomizing stuff is more fun

22:03 bitemyapp: `cbp: you really shouldn't randomize outputs

22:04 `cbp: seriously, it'll miss stuff and be harder to understand

22:04 `cbp: better to just use an exception class.

22:04 `cbp: aw

22:07 coventry: The trouble is, you can only randomize one element at a time to effectively test coverage. So you probably do need to do it a higher granularity for it to be efficient.

22:11 `cbp: I think i had it all wrong

22:11 oh well time to rewrite

22:12 logic_prog: are there protocols for (1) map, (2) atom ? In particular, I'd like to implement my own datat structures that can be used in place of standard maps/atoms

22:12 coventry: `cbp: You might want to take a look at ztellman's sleight. It's useful for this kind of thing.

22:13 llasram: logic_prog: For JVM Clojure most of that pre-dates protocols, but there are interfaces, and you can define types implementing those interfaces

22:14 logic_prog: llasram: and if I do so, I can then use assoc/get/update aswell as @/swap! on them ?

22:14 bitemyapp: coventry: that may not be a good fit.

22:14 logic_prog: llasram: if so, if ther sample code I can look at?

22:14 llasram: logic_prog: Not `swap!`, but yes to the rest

22:15 coventry: bitemyapp: Actually, yeah, if he wants to break things at the function level. I was thinking that looking at what he has on github now.

22:16 llasram: logic_prog: Someone had a macro which simplified implementing a map-like thing... Who/where it was eludes me at the moment

22:16 bitemyapp: coventry: would not robert.hooke or alter-var-root suffice?

22:16 (fn [] (throw (MyException. "blah")))

22:16 coventry: bitemyapp: Yeah, for breaking things at the function level.

22:16 bitemyapp: well that's all that matters.

22:17 llasram: logic_prog: For references, `@` is just IDeref and optionally IPending

22:17 justin_smith: I just answered a stack overflow question about a library I work on. It is a weird feeling.

22:17 logic_prog: llasram: noted

22:17 coventry: It seems rather inadequate, actually. You don't learn which forms within each function are being exercised by your tests, that way. But it's the only way for a strategy like heckle to run in reasonable time.

22:17 logic_prog: llasram: if you don't mind explaining; why is swap! different from @ ?

22:18 llasram: logic_prog: Because `swap!` is just for atoms and is explicitly defined as such. Check out the source

22:19 logic_prog: llasram: how shold I be searching the code? https://github.com/clojure/clojure/search?q=defn+swap%21&ref=cmdform is rather useless

22:19 so I must be doing something wrong

22:20 justin_smith: logic_prog: (clojure.repl/source swap!)

22:21 logic_prog: justin_smith: let me try that

22:21 bitemyapp: coventry: functions alone would be a substantial improvement. branches/forms could follow later *after* something working is released.

22:22 logic_prog: justin_smith: worked; thanks!

22:22 coventry: I just don't understand what this strategy gets you over something like cloverage, which actually will look at coverage at the level of forms.

22:22 bitemyapp: coventry: http://clojurewiki.com/ a wiki page a day keeps the bitemyapp away.

22:22 coventry: how can cloverage understand which branches get exercised?

22:22 `cbp: ooh a wiki!

22:22 bitemyapp: `cbp: yeah I finally launched one.

22:23 `cbp: make an account and write stuff :D

22:23 coventry: bitemyapp: Tracing instrumentation. https://github.com/lshift/cloverage/blob/master/cloverage/src/cloverage/instrument.clj

22:29 And, if the sadomasochism of heckle's marketing is appealing, cloverage is actually way more invasive and controlling. :-)

22:30 "I'm going to watch your every thought." :-)

22:43 bitemyapp: coventry: is lshift or Jacek the official version of cloverage?

22:47 coventry: this does seem nice.

23:02 concur: hey

23:03 is there any way to paint an array as pixels in seesaw?

23:09 glosoli: hmm what would you suggest for database migration?

23:11 bitemyapp: glosoli: http://clojurewiki.com/Libraries#database-migrations

23:16 justin_smith: what is the predicate to check if you can use a thing as the first arg to get?

23:17 for some reason I expected associative? to exist

23:17 never mind, it does

23:17 bitemyapp: justin_smith: had me proper baffled for a moment there.

23:17 justin_smith: not nearly as confused as I was, I am sure

23:18 almost done with a lein plugin that encrypts / decrypts edn data

23:18 probably mostly useful for config

23:18 also regular functions to suck that data into your config, of course

23:19 no more unencrypted passwords in git, yay

23:21 bitemyapp: justin_smith: that's a good idea.

23:22 justin_smith: I've been wanting it for a while, the holdup was making it convenient to use

23:22 because if it is annoying it may as well not be there because people won't use it proplerly

23:23 so I have lein crypt show - outputs creds (looks for passwords in command line, then env, then a dotfile in home dir, then fallback to project.clj

23:23 )

23:23 lein crypt store

23:23 cemerick: justin_smith: FWIW, get accepts a lot more than things that are associative

23:23 justin_smith: and lein crypt update (which acts like swap

23:24 cemerick: OK, associative is what I wanted actually :) thanks

23:24 cemerick: associative? indicates that `assoc` will work, if that's what you care about

23:24 ah, cool

23:25 justin_smith: err s/project.clj/project as merged and passed in by lein

23:25 so it would more likely be in the profiles.clj of course

23:40 https://clojars.org/noisesmith/cryptlj https://github.com/noisesmith/cryptlj

23:40 I still need to update the readme for the lein tasks

23:43 bitemyapp: justin_smith: I avoid having secure information in my git repos by simply using environment variables, by the by.

23:43 justin_smith: you guys have a penchant for finding excuses to write code, it seems.

23:43 justin_smith: makes sense, but with our workflow we have multiple developers running the server

23:44 bitemyapp: I'm not sure what that means or what importance it has.

23:44 justin_smith: easier to just hand them something that works than set them up with a bunch of scripts

23:44 bitemyapp: justin_smith: when I handed off the clojure app I deployed to my coworkers for them to tweak and re-deploy, it too, just worked.

23:45 justin_smith: scenario: we have multiple configs (development / staging etc.), someone else who isn't on the project full time needs to switch configs

23:46 it's best if they can just provide an environment name and everything else works

23:46 do I had them a script with all the credentials for all the environments in it?

23:46 that's where this comes in

23:46 bitemyapp: in my case, there are simply secured env provider scripts

23:46 which I can use without writing any code...

23:46 you just source them before running the app.

23:46 generally not even that is needed.

23:47 justin_smith: so if someone new joins the project, you give them a copy of the script?

23:47 the script is in the repo?

23:47 bitemyapp: no and no

23:47 justin_smith: do they run the server on their own machine?

23:48 bitemyapp: they don't run the staging or production environments on their computers

23:48 when they're developing, they use the default config (overriding as they desire) and run things like the database locally

23:48 when they need to see if it works, they run the staging deploy script

23:49 if it works in staging, that is.

23:49 justin_smith: right

23:49 bitemyapp: they can run the test suite and poke at anything they want with the default local dev environ.

23:50 also nrepl servers are embedded in the app by default, so they can nrepl into staging or prod if they have ssh access.

23:51 justin_smith: we tend to have a schema and content that is changing rapidly as we develop - especially in early stages - so dev works out better with a shared db

23:51 and with a cdn

23:51 soon likely also zookeeper

23:52 also api keys

23:52 (client's social network credentials for example is a common one)

23:52 it is advantageous to provide all that transperently, and keep it all up to date, without credentials in git

23:53 of course during dev it is not the client's social key - it is some test key for that app

23:53 bitemyapp: I don't really mind leaving test stuff in the repo at all.

23:56 justin_smith: this method is an experiment (not tried in production yet), but what I am aiming for is reducing the incedental complexity of some app behaviors coming from the code, some from config files on the server / dev box, some coming from the environment - wanting a streamlining so that I can as much as possible push the config to one place and know it gets where it is needed

Logging service provided by n01se.net