#clojure log - Nov 03 2013

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

0:14 dav: do people think this macro would be useful or is there a better way to implement this idiom? http://paste.debian.net/63619/

0:16 jasonjck_: dav: no need for a macro (if-let [[f & rst] (seq s) then else)

0:18 dav: jasonjck_: thanks a lot that's exactly what I wanted :)

0:19 jasonjck_: for some reason one rarely sees this on 4clojure or even in the source of standard fuctions..

0:19 jasonjck_: it's called destructuring syntax

0:50 dav: What about this? Would anyone find this useful? => (defn rcomp [& fs] (fn [x] (reduce #(%2 %1) x fs)))

0:50 it reads left to right (like the threading macros) but it's composing functions of 1 arg instead.

0:54 jared314: dav: it looks like comp but reversed

0:58 dav: hence the name rcomp ;-)

1:00 abaranosky: hmmm... anyone know the best way to fetch an XLSX file via HTTP?

1:00 clj-http, my goto tool, doesn't understand the content-type

1:01 I'm getting back a String as the :body. Maybe the idea is I need to convert it to bytes, and read those bytes as the XLSX?

1:03 bitemyapp: abaranosky: I use http-kit's client when I want something a bit "dumber"

1:03 clj-http attempts too much magic for me sometimes.

1:04 abaranosky: bitemyapp: checking it out, thx

1:05 bitemyapp: abaranosky: has the bonus property of being async.

1:05 abaranosky: yeah, we use it at work for some stuff

1:07 bitemyapp: `cbp: okay, what happened?

1:07 `cbp: there's a bunch of stuff broken all over the place in the connections branch that wasn't before ?_?

1:09 `cbp: ah wait, my fault, think I see it now. Sorry!@

1:12 abaranosky: bitemyapp: nice, that seems to worked much better for me thx

1:13 I'm trying to use https://github.com/cgrand/spreadmap to read th XSLX, but it is throwing exceptions left and right

1:13 srruby: I want to have my json output pretty printed in a manner that produces valid json. In node I use JSON.stringify. What is the equivalent in clojure or Java

1:19 bitemyapp: srruby: cheshire

1:19 srruby: + pprint

1:20 abaranosky: srruby: you want to print as CLojure data?

1:20 srruby: I want the pretty printed output to be valid JSON

1:20 json data

1:32 SegFaultAX: srruby: cheshire has a pretty printing mode.

1:32 bitemyapp: srruby: supplicate at the altar of the smiling kitty.

1:33 BAMbanda: https://github.com/magomimmo/modern-cljs/blob/master/doc/tutorial-04.md

1:33 when do we use ".-" or just "."

1:33 what's the difference

1:36 SegFaultAX: BAMbanda: Depends on the usage of the symbol prefixed by ./.-

1:37 muhoo: . is function. .- is field

1:37 SegFaultAX: Well, that's not complete I think.

1:37 . is an application. .- is a field access (which could return a function object)

1:38 A function application, to be precise.

1:38 BAMbanda: can you specify what you mean by field?

1:38 muhoo: (.someMethod foo) vs (.-field foo) is what i've seen in cljs

1:39 BAMbanda: i notice .- is used for events?

1:39 as well as to see whenter getElementById was a valid method of the document object

1:39 the example in /home/shai/Documents/modern_javascript_scripts/ch02/login.html

1:39 shows .- for a method as well...

1:40 unless thats a typo?

1:40 SegFaultAX: BAMbanda: That's not a function application

1:40 It's a field access.

1:40 BAMbanda: is a field a term used in clj? I've never heard of it before

1:40 SegFaultAX: So consider an object like: { foo: 1, bar: function() { ... } }

1:40 BAMbanda: ohhhh, like a key

1:40 SegFaultAX: You can apply our objects bar method like this (.bar obj)

1:41 But you can get the function object itself like this: (.-bar obj)

1:41 BAMbanda: SegFaultAx, ohhhh getting the object, not calling it

1:41 SegFaultAX: (.foo obj) clearly makes no sense, since it's just a simple scalar value.

1:41 muhoo: i think (.someMethod foo) compiles to foo.someMethod() in js or java, but (.-field foo) compiles to foo.field without the ()

1:42 BAMbanda: now that definitely makes sense

1:42 thanks fro the clarification

1:42 SegFaultAX: muhoo: Yup, and that difference matters precisely in the above case where I may want to get the function object, and not /apply/ the function.

1:42 BAMbanda: Good luck!

1:43 BAMbanda: SegFaultAX, thanks!

1:43 the clojure community rocks, I guess the best way to show appreciation is to develop modules/libraries along the road to keep it alive!

1:06 if I typed something into the brepl and its not responding, how can I cancel that command without exiting the whole repl?

1:06 i have it wrapped with rlwrap

1:07 dav: is there a performance difference between ((comp h g f) x) and (->> x f g h) ?

1:07 BAMbanda: dav, the last one looks cooler

1:08 dav: BAMbanda: the last one requires that the running variable be the last argument..

1:08 andyfingerhut: dav: best way to find out is to measure it. criterium is a good way to help you do benchmarks, averaging run times over many runs after warming up the JVM's JIT

1:09 dav: https://github.com/hugoduncan/criterium

1:10 dav: andyfingerhut: ok, thx.

1:10 andyfingerhut: dav: That was the long way of saying "I don't really know off hand" :-)

1:11 SegFaultAX: I don't actually know, but if I took a blind guess I'd say the macro is faster.

1:11 dav: andyfingerhut: ;-)

1:11 SegFaultAX: yes I'd assume it lines more and has fewer function calls..

1:11 SegFaultAX: dav: Right, and fewer intermediate classes.

1:11 dav: s/lines/inlines/

1:11 SegFaultAX: Just a guess, though.

1:11 andyfingerhut: dav: My personal guess is that the 2nd would be faster, since it is just syntactic sugar for (h (g (f x))), whereas first one creates and calls a new function.

1:12 dav: k, we're all on the same page.

1:12 SegFaultAX: Precisely

1:12 bitemyapp: but, it doesn't matter.

1:12 comp is more generally useful for composing HOFs.

1:12 the performance difference is trivial.

1:13 dav: what's a HOF?

1:13 SegFaultAX: Higher order function

1:13 andyfingerhut: Yes, unless you are in the most critical inner loop of your code and it needs to be faster, I doubt it makes enough of a difference to worry about.

1:13 SegFaultAX: Generally, a function that receives a function as an argument, or returns one as a result (or some combination thereof)

1:13 seangrove: ~hof?

1:13 clojurebot: Titim gan éirí ort.

1:13 seangrove: ~hof

1:13 clojurebot: Huh?

1:13 seangrove: hof?

1:14 Damnit.

1:14 dav: SegFaultAX: hmmm... I find that odd but I'll take your word for it.

1:14 bitemyapp: ~hof is a higher order function - typically, a function that receives a function as an argument, or returns one as a result

1:14 clojurebot: Ik begrijp

1:14 bitemyapp: ~hof

1:14 clojurebot: hof is a higher order function - typically, a function that receives a function as an argument, or returns one as a result

1:14 SegFaultAX: dav: Why do you find that odd?

1:15 dav: SegFaultAX: in haskell composition isn't used more often for hofs than for regular functions..

1:15 abaranosky: I too would expect ->> to be faster -- but criterium is the way to know for real

1:15 dav: SegFaultAX: comp is itself a hof, but other than that, I don't see the link.

1:15 bitemyapp: guesses are fine, measurements are better.

1:16 SegFaultAX: dav: Oh, you're responding to bitemyapp's comment?

1:16 bitemyapp: seemingly. I don't really know why.

1:16 SegFaultAX: Well comp isn't particularly /more/ useful for combining hofs, no.

1:16 dav: SegFaultAX: yes, sorry, should have been addressed to bitemyapp

1:18 SegFaultAX: dav: Haskell has slightly cleaner syntax for composition and application via . and $, which combined with automatic currying makes for clean and terse expressions, similar to -> and ->> in Clojure.

1:18 dav: So hmmm.. http://paste.debian.net/63631/ works fine as the solution to http://www.4clojure.com/problem/150 locally, but times out then the website tries to check it..

1:20 SegFaultAX: dav: Yea that one is tricky. I suggest finding an implementation that avoids all forms of guess-and-check.

1:22 dav: SegFaultAX: ah I gess it times out on the later cases. The little green lights wouldn't even come on on the early checks so I assumed there was something wrong. I guess my code is just slow..

1:26 SegFaultAX: dav: My first solutions were all numerical in nature as well. Eventually I chose to produce an iterated function that used simple string manipulations to find the next palindrome.

1:31 dav: SegFaultAX: yes I can see that now, thanks.

1:33 SegFaultAX: Man I dropped in rank a lot since the last time I looked. I used to be in the high 60s and now I'm 83. :(

1:33 dav: I'm 459 :/

2:09 bitemyapp: dav: pffft, I'm 1872. You have nothing to complain about.

2:16 TEttinger: gah even with the string hint this is killing me

2:16 it works in the repl but not on 4clojure (same problem)

2:17 ok it is timing out on later ones in the repl :|

2:18 SegFaultAX: TEttinger: I worked on that one for at least an hour.

2:19 TEttinger: ouch

2:19 SegFaultAX: I was really determined to solve it numerically.

2:27 shriphani: hello. In the latest snapshot of incanter, I get this mental error: Caused by: java.lang.ClassNotFoundException: clojure.set , how is this possible ?

2:39 bitemyapp: Agents are magical when you need them.

2:40 I need a macro for (pst (agent-error ...)) though.

3:08 abaranosky: bitemyapp: Fabric looks really simple and nice. I'm going to look at it more, but looks less shitty than Chef and Rex :)

3:17 bitemyapp: abaranosky: I just got some work done on Revise, considering open-sourcing those fabric recipes.

3:52 shriphani: hello does anyone here have any experience with incanter matrices ?

3:53 I am trying to save a matrix using the default save method but it fails: https://www.refheap.com/20427

3:56 bitemyapp: abaranosky: https://github.com/bitemyapp/fabric_recipes

4:22 terom: shriphani: looks like a bug. Incanter started using Clatrix from version 1.5.0 and there has been a similar issue with view function which was fixed: https://github.com/liebke/incanter/issues/168

4:22 shriphani: I suggest you file an issue

4:22 shriphani: wow.

4:22 is there anything I can do before the fix is pushed ?

4:22 I will file an issue obv.

4:25 terom: shriphani: I think there are some io functions also on incanter.io namespace but they might be limited to reading/writing datasets (and not matrices) only. I'm not so familiar with Incanter, I've mostly only used the charting facility

4:26 shriphani: I think the fix is straightforward. so I guess I could work with the snapshot

4:27 terom: Yeah. One option is to use version 1.4.1 although it is quite old now.

4:29 shriphani: I am not doing anything more complicated than SVDs

4:29 and I assuming that wasn't broken in 1.4.1

4:29 but yea this needs fixing

4:36 terom, btw it still fails in 1.4.1

4:36 this time it complains about incanter.Marix

4:36 terom: oh, damn :/

4:37 shriphani: is this io stuff not tested ?

5:18 dav: what do you guys think of this threading macro? http://paste.debian.net/63651/

5:19 it doesn't rely on the variable having to be the first or last arg

5:27 and I replaced the last line by ([x i form & more] `(let [v# (->>> ~x ~i ~form)] (->>> ~x v# ~@more)))) to avoid having the form evaluated multiple times if it appears more than once in the expression.

5:31 lol the as-> macro is exactly that

5:31 great

7:36 luxbock: with core.matrix, what is the difference between using (matrix (array v)) and just (matrix v)?

7:39 it looks like I'm not missing anything by dropping the array call in the middle

8:42 cYmen: I solved the first 5 project euler problems in clojure. Would be great is somebody could take a look at my solution and give some comments about unclojurianisms and such. Anybody willing to give me a few hints? It's only about 70 lines...

8:57 joegallo: cYmen: paste a link to a pastbin

8:57 pastebin, even ;)

8:57 like refheap or gist.github.com or whatever

9:10 cYmen: http://pastebin.com/8i97abM6

9:11 joegallo: considered being a chicken for a moment and sending it to you in a query :)

9:34 llasram: cYmen: Instead of `condp =` for numbers, you could just use `case`

9:35 cYmen: You define an `any` function, but the only place you use it, you'd be better-served w/ the core `not-any?` function

9:36 (not (any (map #(divisible? n %) ...))) => (not-any #(divisible? n %) ...)

9:36 s,not-any,not-any?,

9:37 This is something people have differing opinions on, but `partial` lets you write things like `#(divisible? n %)` as instead `(partial divisible? n)`

9:37 It arguable makes intent clearer

9:37 arguably even

9:37 `cbp: theres no any fn :-D

9:37 some maybe

9:38 llasram: Yeah, `some` is the equivalent

9:39 IMHO the one token saved by `(any ...)` vs `(some identity ...)` isn't worth introducing a new function

9:40 Anyway, that's all the Clojure-wise specific comments I can summon easily. Keep it up :-)

9:42 cYmen: So basically, use partial if all you do is fill in some params because it is more obvious. Seems like good advice.

9:42 I didn't know there was a "not any" that's why I wrote "any". :)

9:43 I basically just type the function I want into google and in that case it gave me (some identity ...)

9:43 But yeah I could probably just write that instead.

9:44 Well, thanks for looking at it!

9:55 zilti: For defmethod/defmulti, is there a "run-time macro" working in the background?

9:56 llasram: zilti: Not following your question. Clarify?

9:57 zilti: llasram: It seems like I can't give a multimethod an object without print-dup defined as argument, just as is the case when trying to unquote such an object inside a macro

10:00 llasram: Do you mean as a dispatch value? I'm not seeing that -- I'm able to use any arbitrary value

10:00 zilti: llasram: Hmm there seem to be some other weird things happening here at me. I'll tinker around a bit longer

10:22 muhoo: dav: wat is ->>> ? i've only seen ->> and ->

10:22 ,(doc ->>>)

10:22 clojurebot: excusez-moi

10:23 dav: ,(doc as->)

10:23 clojurebot: "([expr name & forms]); Binds name to expr, evaluates the first form in the lexical context of that binding, then binds name to that result, repeating for each successive form, returning the result of the last form."

10:23 dav: I basically wrote as-> not knowing it already existed and called it ->>> -- it's just as->

10:23 muhoo: oh

10:24 zilti: llasram: I've isolated the error, but I don't know what I have to change so every variant works as the last one does? https://www.refheap.com/20430

10:24 muhoo: there's also -<> in swiss-arrows, which i like better than as->

10:25 zilti: As a Swiss, I still haven't figured out why they're called "Swiss arrows"

10:26 llasram: For the same reason the Pope has his "Swiss guard"

10:26 zilti: The developer is Swiss?

10:27 llasram: That was a failed attempt at humor :-)

10:27 zilti: Oh :)

10:28 muhoo: they carry those weird halbards

10:28 zilti: And they all are Swiss

10:28 muhoo: which -<> kinda looks like

10:29 llasram: Huh: http://en.wikipedia.org/wiki/Swiss_arrow

10:29 zilti: That paste doesn't have enough context for me to at all tell what's going on

10:29 Re-paste the current definition of `fx` ?

10:30 Actuall

10:30 Actually, even

10:30 Is `fx` still a macro?

10:30 And what does it return?

10:30 zilti: llasram: https://www.refheap.com/20431#L-268 It returns, as it should, a Java class

10:31 llasram: This code is complete, but I don't know if it'll work on Java 7 (I'm using Java 8 EA)

10:31 llasram: It returns a Class? It looks like it returns an instance object

10:32 zilti: Yeah, sorry. An instance object.

10:32 llasram: Well then the error makes total sense

10:32 zilti: Why?

10:32 clojurebot: why not?

10:32 llasram: Because it's a macro, it's returning an instance object at macro-expansion time

10:32 So the compiler then needs to embed that instance object into the code being compiled

10:33 zilti: But why does the last example work, and the second one doesn't?

10:33 llasram: The `def` special form just binds a value to a var, and thus doesn't require in-code embedding

10:33 zilti: And I still also don't get why the first of my 3 examples doesn't work?

10:34 llasram: Because it's still forcing the compiler to emit code embedding the *result* of the call to `fx`

10:34 Which is some arbitrary Java object

10:34 As far as I can tell, your problem is that `fx` should be a function, not a macro

10:35 zilti: But I want the arguments to not get evaluated

10:35 llasram: Why?

10:35 clojurebot: http://clojure.org/rationale

10:35 llasram: Thanks, clojurebot

10:35 And even if that were true, then

10:35 zilti: Because if they are, I'll always have to quote them

10:36 llasram: the right way to do this is have a macro which expands to a call to a function w/ the quoting-needing arguments quoted

10:36 bja: I wonder what the consequences of using gensym to derive ids for divs will be

10:36 llasram: In my experience, a macro as large as `fx` is usually a code smell. Returning something from a macro other than a syntax-quoted form is also usually a code smell

10:37 Yeah, so just have an `fx` macro which expands: (fx menu-item :text "Moin") => (fx* 'menu-item :text "Moin")

10:37 Then `fx*` can just be a function

10:37 zilti: I'll try that

10:38 llasram: Although really -- I think better would be to design your interface so it doesn't depend on implicit quoting of arguments

10:38 any reason `menu-item` can't be the keyword `:menu-item` instead?

10:38 muhoo: right, yeah, it's more readable to have the guts in a fn and just the hairy stuff in a small macro. too many foo#'s make me nervous

10:38 zilti: No, no particular reason except... aesthetics?

10:40 llasram: Interesting. I'd argue the aesthetics the other direction :-) I'd expect a bare symbol to resolve, and thus find `menu-item` there confusing

10:40 zilti: Now it works.

10:41 And I think I now understand why, and understand a little better how the reader works

10:43 llasram: s,reader,compiler, ?

10:44 zilti: llasram: hmm. Isn't that the same thing in Clojure?

10:44 llasram: Nope!

10:45 Reading translates the source text into source data structures like lists, and does involve handling things like tagged literals, doesn't involve any symbol-resolution, macro-expansion, etc

10:45 The latter steps are all the compiler

10:54 bja: is it impossible to both :refer and :as from the same namespace in cljs?

10:55 i.e. (ns foo (:require [jayq.core :as jq :refer [$]]))

10:55 bbloom: bja: that should work. does it not? what goes wrong?

10:57 bja: err, I'm apparently going crazy and can't count parens....

10:58 danlentz: does the new cider no longer pick up the dependencies when you cider-jack-in while in project.clj?

10:58 oh, or is it that its not running at that point and so thats why?

10:59 it used tl work for ,e back in the olden days of two weeks ago

10:59 back when it was still nrepl

11:17 * seangrove just used juxt in anger for the first time

11:18 danlentz: wow it never occurred to me that i'd even have access to jruby.ffi

11:18 bbloom: seangrove: doesn't it just give you a warm fuzzy feeling?

11:19 seangrove: bbloom: It's certainly fuzzy, but more in a vague way

11:20 I wish there was nicer syntax for this though: #((.-sin js/Math) %)

11:20 ...which I guess is just (.-sin js/Math)

11:20 That's reasonable enough

11:55 makkalot: hi, what is the preferred way of refreshing a namespace in clojurescript repl ?

11:57 dobry-den: been clojurin for like 1 year and i still restart repls errytime

11:58 makkalot: :D

11:58 dobry-den: in fact 5 min ago i redefined a function. whoops, this already refers to nsfoo/func. better restart

11:59 when my netbook was my only machine for 2 years, i was much more of a problemsolver

12:00 makkalot: there should be a better way

12:01 seangrove: makkalot: What do you mean refreshing a namespace?

12:01 Just evaluate the new ns-form?

12:01 bbloom: i think a lot of folks just do browser refreshes :-/

12:01 seangrove: Yeah, with austin, that's a pretty good setup

12:01 makkalot: seangrove, no, refresh the namespace, reset global data and etc

12:02 seangrove: makkalot: Ah, and you're just using the raw repl?

12:02 With something like nrepl.el, you just load the whole file, C-c C-k

12:02 pepijndevos: dobry-den, are you Czech? (I'm not, and very OT, but just curious)

12:02 makkalot: seangrove, rhino repl

12:03 dobry-den: pepijndevos: nah, but've been livin in prague

12:03 makkalot: seangrove, so i should learn emacs then :D

12:03 seangrove: makkalot: Does load-file now work?

12:04 s/now/not

12:04 makkalot: Well, eventually probably, or vim. Maybe best to start with LightTable, it looks very nice to start with

12:04 dobry-den: yall've got a nrepl-like workflow working with clojurescript?

12:05 I couldn't find a clojurescript solution that gives me nrepl-like file eval. Sadly, I load code into the repl or depend on tests to see what's goin on

12:06 makkalot: seangrove, i'm using sublime, but probably it is not best way of developing clojure/clojurescript

12:07 pepijndevos: If an iSeq implements Seqable, should it just return self?

12:07 dobry-den: makkalot: i think 90% of what matters is that (1) you have some sort of paredit tool for making parens easy to deal with abd (2) you can eval files/lines of code a la carte

12:07 seangrove: dobry-den: Doesn't nrepl.el cover both of that?

12:08 dobry-den: seangrove: right, but im suggesting that if you can replicate that in another editor (they use sublime) youre doing pretty well

12:08 seangrove: Ah, got it.

12:41 the-anome: hi

13:23 `cbp: bitemyapp: wakey wakey

13:29 arrdem: `cbp: sssh I'm enjoying the quiet

13:30 `cbp: lazy sunday

13:40 arrdem: daylight savings sunday

13:42 seangrove: What's the clean syntax for accessing nested attributes in js-objects?

13:42 (.. graph axes x) isn't quite right

13:43 Looking for a nice short hand for graph.axes.x

13:43 bitemyapp: `cbp: blah

13:43 `cbp: noisy fuckin' roommates.

13:43 `cbp: soup?

13:43 seangrove: I would've figured ..

13:44 `cbp: bitemyapp: hi, I saw your commit and played arount in the repl

13:44 seangrove: bitemyapp: I guess it's actually aget

13:44 bitemyapp: `cbp: ah fuck, just saw the thing-jig.

13:44 `cbp: the what?

13:44 bitemyapp: muh-bad.

13:44 the ticket.

13:44 seangrove: (.. graph axes x) => (graph.axes().x())

13:44 `cbp: Oh

13:46 bitemyapp: So yeah I think I grok it. Except for the read-into-conn fn

13:46 wait do you wanna do this on a separate chat?

13:52 bitemyapp: `cbp: I don't really care. It doesn't seem like we'd be disrupting much.

13:52 bja: is there a better way of working with javascript event handlers than defining a fn macro that binds this to (js* "this")? I mean, a way other than actually writing (Js* this) all over the place?

13:52 `cbp: bitemyapp: Ok. I don't really understand the timing of the while loop

13:52 bitemyapp: `cbp: it's possible I fucked up the while loop, btw. I think I might be using the wrong predicate.

13:52 `cbp: timing?

13:53 it blocks until there are bytes to read, and since it uses fetch-response, it grabs whole protobuf messages at a time.

13:53 it doesn't "spin" when there aren't any bytes on the stream though.

13:53 `cbp: Oh uhm

13:53 Yeah that's what I meant

13:53 bitemyapp: pretty standard behavior I *think*

13:54 unless I've totally misunderstood the nature of the universe ^_^

13:54 `cbp: I guess I did

13:54 bitemyapp: `cbp: fyi, I was kinda winging it last night when I wrote this.

13:54 `cbp: and there's almost zero error handling.

13:55 `cbp: in particular, agent errors need to be kicked into the promises.

13:55 `cbp: hmm yeah

13:56 bitemyapp: probably what I'll do is add the error handling to send-term.

13:56 and if it detects an error in the conn agent, it spits it into the promise.

13:57 `cbp: Also the dissoc-in removes the :waiting key from the agent. Is that what you meant to do?

13:58 bitemyapp: `cbp: no, only the inner key. my bad.

13:58 `cbp: I'll fix it. Are there any other comments or feedback?

13:58 `cbp: did things mostly make sense in the REPL?

13:58 `cbp: bitemyapp: yeah just need a close fn too

13:59 bitemyapp: `cbp: you mean to fix the close fn?

13:59 to work with the new dilly?

13:59 `cbp: yeah

13:59 bitemyapp: ah that shouldn't be too big of a deal.

14:00 `cbp: bitemyapp: Well, let me know if you need help or if you're busy and need me to step in or something

14:00 bitemyapp: `cbp: I'm good so far, we definitely need to start getting the tests passing tho.

14:00 `cbp: so that's something you could put your attention to in the meantime.

14:02 `cbp: bitemyapp: Ok

14:04 luxbock: after updating from nrepl.el to cider I get "eldoc error: (void-function -elem-index)" with eldoc

14:04 has anyone else had this problem? I tried searching for that string in the source code of both modes but I stopped once I realized eldoc is written in C and I have no idea what's going on there

14:05 arrdem: luxbock: what cider command were you running?

14:05 bitemyapp: ~cider is rage-inducing

14:05 clojurebot: In Ordnung

14:05 bitemyapp: ~cider

14:05 clojurebot: cider is rage-inducing

14:05 bitemyapp: good bot.

14:06 luxbock: I don't know what the command is, but it's whatever eldoc uses to display the function name + it's expected parameters at the message line

14:06 bitemyapp: `cbp: pushed a new version of close.

14:06 arrdem: bitemyapp: you have to remind us all, don't you.

14:07 `cbp: bitemyapp: kk

14:07 arrdem: luxbock: that's gonna involve some digging to find...

14:09 luxbock: eldoc works fine in the nREPL buffer

14:09 coventry: luxbock: What version of emacs are you using? I have -elem-index in dash.el, "A modern list library for Emacs"

14:10 luxbock: 24.3

14:10 I'm also running it on Win 7 in case that makes any difference

14:10 maybe it's related to this: https://github.com/clojure-emacs/cider/issues/314

14:10 bitemyapp: `cbp: anyway, any other concerns?

14:11 coventry: Same here. Well, I don't know what pulled in dash.el, but that may be what you would need to fix it. However, I would just go back to nrepl.el for the time being, if I were you, unless you're out to shave off cider's rough edges.

14:11 `cbp: bitemyapp: Not atm. I'll be working on the tests

14:11 bitemyapp: if not, I'm going to make tea and possibly breakfast.

14:11 `cbp: bitemyapp: Maybe we can look over the retry stuff later

14:11 luxbock: alright

14:11 arrdem: ~food

14:11 clojurebot: Gabh mo leithscéal?

14:11 bitemyapp: `cbp: oh-gad. I'm not really looking forward to the connection retry stuff

14:11 arrdem: clojurebot: food is (> '.')># waffle!

14:11 clojurebot: Ack. Ack.

14:12 `cbp: :-p

14:12 bitemyapp: retry stuff might not be a "today" thing, unless massive progress is made.

14:12 Mostly I'd be hoping to just things cleaned up and working with passing tests.

14:12 if we can accomplish that much, I'll be 100% comfortable pushing a release and pinging Slava.

14:13 `cbp: Ok

14:13 Well, glhf

14:16 bitemyapp: seangrove: https://news.ycombinator.com/item?id=6663133

14:16 `cbp: try to push frequently so I can jump in please. :)

14:17 `cbp: okies

14:19 seangrove: bitemyapp: This looks interesting, but I doubt I'll have time for it in the near future, working on getting our new product out

14:20 bitemyapp: seangrove: just putting stuff in your universe, you obviously will organize the orbit of planetoids yourself :)

14:20 seangrove: good luck on the new product! (what is it? can you say?)

14:20 seangrove: You still working on simonides

14:20 ?

14:20 bitemyapp: Yeap.

14:20 seangrove: bitemyapp: Yeah, will demo it to you sometime this week or next

14:20 Wouldn't mind getting some additional feedback

14:21 bitemyapp: Oh that's exciting. I look forward to it :)

14:21 seangrove: Bookmarked this, will put it on my kindle and read through it on the bus

14:23 bitemyapp: seangrove: might be a rough read in that context, having a ghci console handy is pretty necessary I think.

14:23 unless you already know Haskell pretty well

14:24 seangrove: bitemyapp: Got it, will rethink that strategy then.

14:25 ffs, does every js library have to grab multiple global bindings?

14:31 luxbock: hmm, I wonder why core.matrix has set-row but no set-column

14:32 bitemyapp: luxbock: I suspect that would be rather slow.

14:32 luxbock: core.matrix isn't a column store :P

14:32 but I might be wrong.

14:33 luxbock: I'm doing the Coursera ML course and doing the excercises in both Octave and Clojure

14:33 adding columns was the first thing I couldn't figure out how to do

14:37 SegFaultAX: I wouldn't characterize core.matrix as a "store" of any kind.

14:37 `cbp: bitemyapp: Ok we pass tests now

14:37 SegFaultAX: But yea, the point remains that it likely uses a row-oriented representation.

14:37 bitemyapp: SegFaultAX: you put it better, thank you.

14:37 SegFaultAX: Row by column vs. column by row.

14:38 bitemyapp: `cbp: oh wow, you got those tests passing in a hurry.

14:38 well damn.

14:38 haha @ rr

14:39 `cbp: bitemyapp: Just some weirdness with group-by and set-intersection

14:39 luxbock: any idea how Octave handles the issue? i.e. would adding columns be really slow as well, but it's still included as a feature

14:39 joinr: why is there a "name?" parameter in the fn special form? I thought fn was for anonymous functions.

14:40 luxbock: I guess I can always do (-> M transpose (set-row x [:a :b :c]) transpose) if I really need it

14:41 SegFaultAX: That would be quite expensive indeed for even moderately large matrices.

14:41 coventry: I thought core.matrix provided an interface to multiple internal representations. The ndarray implementation claims to be similar to numpy's, so it should at least be possible to modify rows efficiently.

14:42 SegFaultAX: coventry: Rows, sure. Columns is what luxbock wants.

14:42 coventry: sorry, s/rows/columns/, as in numpy.

14:42 bitemyapp: luxbock: are you going to be doing a ton of modification to mostly columns?

14:42 luxbock: not yet, now I'm just watching an Octave basics video and following along :)

14:43 bitemyapp: well, just skip it for now then.

14:43 unless you really want to make a rabbit-hole out of it.

14:43 SegFaultAX: luxbock: You could always reach out to Mike directly, or post something on the mailing list (he's super active there and on SO)

14:45 luxbock: I think I should probably finish this course before I go asking around for features that I have no clue how to use :)

14:46 bitemyapp: `cbp: it seems the examples in the README should be fixed to use (run conn) as the terminal form?

14:46 SegFaultAX: http://typicalprogrammer.com/abject-oriented/ hhhehehe

14:46 bitemyapp: `cbp: I think users might be confused when (-> (r/db "test") (r/table-create-db "authors")) doesn't immediately return results.

14:46 mtp: i'm a fan of that coinage

14:46 SegFaultAX: bitemyapp: Whatcha doin?

14:46 mtp: AOO?

14:47 `cbp: bitemyapp: Ok I'll modify them

14:48 bitemyapp: SegFaultAX: https://github.com/bitemyapp/revise/ shit works yo

14:48 SegFaultAX: `cbp picked up my abandoned and 5% completed RethinkDB client library for Clojure and made it 95% completed. I just made the connection system async and thread-safe.

14:48 He did all the real work and API design.

14:48 mtp: SegFaultAX‘ abject-oriented

14:49 SegFaultAX: mtp: Heh, yea. Me too! :)

14:49 mtp: i have been using those words for a while

14:50 SegFaultAX: mtp: It would not be possible to use a language like Clojure under AOO.

14:50 bitemyapp: `cbp: I'm moving the work to master

14:51 `cbp: bitemyapp: Ok

14:51 bitemyapp: `cbp: I'll pull the changes into master and send them up, you should switch over too

14:51 SegFaultAX: You just couldn't generate enough code relative to eg Java, C++, or even Scala.

14:51 bitemyapp: this is mainline now

14:54 `cbp: everything is on master now.

14:54 marcopolo2: Can I extend clojure's datastructures to fit my protocol?

14:54 bitemyapp: I'll fix the stoopid dissoc-in.

14:54 `cbp: okies, I'm trying to make the time stuff pass

14:55 SegFaultAX: marcopolo2: As in extend a protocol over a regular map? No.

14:55 You'll have to introduce a new type for that.

14:55 bitemyapp: bitemyapp.revise.connection> (dissoc-in {:waiting {0 1 2 3}} [:waiting 0])

14:55 {:waiting {2 3}}

14:55 `cbp: ^^ seems fine to me?

14:55 marcopolo2: SegFaultAX: thanks

14:56 `cbp: bitemyapp: if it doesn't eat the key '1' sure :-p

14:56 bitemyapp: `cbp: 1 is a value, not a key.

14:56 `cbp: bitemyapp: er ignore that

14:56 bitemyapp: lol ^_^

14:58 `cbp: is it safe to say the overall design of the query API is stable at this time?

15:00 biggbear: not-related: any one knows how it works that tor hiddes services?

15:00 `cbp: bitemyapp: Yeah, but then again I still have to do some "real world" tests

15:00 bitemyapp: `cbp: modulo the stuff that doesn't have passing tests yet?

15:00 * seancorfield finishes reading thru yesterday's chat... wow, that was some mean beat down of Morgawr about private...

15:00 `cbp: bitemyapp: modulo?

15:00 seancorfield: i hadn't realized the strength of feeling against private in (some parts of) the clojure world :)

15:01 bitemyapp: `cbp: http://www.thefreedictionary.com/modulo "Correcting or adjusting for something, as by leaving something out of account: This proposal is the best so far, modulo the fact that parts of it need modification."

15:01 `cbp: I'm labeling the library as alpha-grade. Satisfactory description?

15:02 SegFaultAX: seancorfield: What was the tl;dr?

15:02 `cbp: bitemyapp: sure. The failing tests are already commented out though :-P

15:02 bitemyapp: I know that :P

15:05 `cbp: bitemyapp: Would you let me deploy? I wanna do it since I haven't done it before + it's prolly better since I'm the maintainer.

15:07 bitemyapp: `cbp: sure, checking to see how to add people

15:07 ah okay.

15:08 `cbp: do you have an account on clojars?

15:08 `cbp: and do you have your gpg stuff setup?

15:08 `cbp: bitemyapp: yeah

15:08 bitemyapp: `cbp: basically, whichever one of us does the first deploy, owns the app/group

15:09 `cbp: and that'll be "revise" based on the unqualified name in the project.clj

15:09 `cbp: so whoever does that, needs to add the other to the clojars group.

15:09 `cbp: do you want to do the first one?

15:09 `cbp: bitemyapp: yeah

15:09 bitemyapp: `cbp: k, it should be ready for pushing if you pull from master.

15:09 this is version 0.0.2

15:10 `cbp: bitemyapp: ok

15:10 bitemyapp: `cbp: what's your account name?

15:10 `cbp: bitemyapp: cbp

15:10 bitemyapp: I created the group "revise" and added both of us.

15:10 `cbp: push 'er up. :)

15:10 I'm going to make tea.

15:20 `cbp: bitemyapp: It works!

15:21 bitemyapp: Just gonna clean make the docs presentable now.

15:22 blr: query around project layout, if building a fat client webapp in cljs, does it make more sense to split the frontend and backend into separate projects?

15:26 bitemyapp: `cbp: awesome :)

15:26 blr: depends on what you're doing. That's common in Pedestal but I wouldn't personally do it.

15:26 SegFaultAX: blr: I think so, yes. IMHO that has nothing to do with Clojure[script] in particular.

15:26 I think architecturally it's usually beneficial to keep your view layer completely decoupled.

15:26 blr: see, two conflicting suggestions! :)

15:27 bitemyapp: The point I would make is that you can have a decoupled view layer without having to maintain two project.cljs

15:27 I also like the idea of having atomic commits that cover frontend and backend simultaneously, at least until the project gets truly complex.

15:27 blr: yeah intuitively I feel like I should keep them separate, however I've done that in the past with a django/angular app and it made it a bit challenging to run integration tests

15:28 bitemyapp: fair enough, can always move the frontend into a new project later if necessary

15:28 SegFaultAX: By the time it gets "truly complex" you're already well beyond the point where you could easily decouple them.

15:29 bitemyapp: relying on separate projects to maintain decoupling is a blunt instrument.

15:30 SegFaultAX: Maybe if the overhead for multiple projects was very high, which it isn't in Clojure (and many other dynamic languages)

15:32 blr: SegFaultAX: I guess my only concern is functional/integration testing, but presumably I could write a lein task that would work across multiple projects

15:36 bitemyapp: blr: can you?

15:36 SegFaultAX: blr: I mean, that's a problem whether they are separate or not. You still need to provide the front-end mock data.

15:36 blr: well, I don't know tbh bitemyapp

15:37 bitemyapp: I don't think that's an official thing.

15:37 you might be able to make the frontend app depend on the backend app and expose something that will let you fire it up

15:37 but that's extra work.

15:37 seancorfield: SegFaultAX: the tl;dr on private was "don't use it" - design code without hidden bits and pieces before private indicates a design smell / code smell

15:38 bitemyapp: if it really needs to be un-fuck-with-able - use closures, not a private var.

15:38 this arrangement actually works nicely for me because muggles that write bad Clojure code won't understand how to use closures for that sort of thing anyway.

15:38 blr: SegFaultAX: I like to test the frontend in isolation, but also like to run real integration tests on staging with real data from the api

15:38 seancorfield: bitemyapp: yeah, i can see why private atoms etc are bad (even tho' i use them sometimes)

15:38 bitemyapp: blr: anything is possible, it's just a question of friction.

15:39 seancorfield: and for functions there's no real point to having private functions if they're pure

15:39 SegFaultAX: blr: And what's stopping you from doing that?

15:39 seancorfield: and if you have impure functions, you have other problems :)

15:39 SegFaultAX: blr: More to the point, what does that have to do with keeping the fe/be code separate?

15:39 bitemyapp: SegFaultAX: they just want to know they're not walking into a bear-trap.

15:39 seancorfield: unfortunately i deal with a LOT of database updating code so my life isn't quite that simple

15:39 SegFaultAX: bitemyapp: Ok, but the line of questioning makes no sense.

15:40 BAMbanda: Is it possible to write firefox extensions using clojurescript? I have a .js file and a .xul file. The JS code has certain objects that are exposed only by privileged access by firefox such as: Components.classes["contractID"] as well as Components.utils.import

15:40 SegFaultAX: Especially in a staging environment where you likely have the entire application deployed as it would be in production (isn't that sorta the point?)

15:40 bitemyapp: seancorfield: the point is to separate the pure and impure parts.

15:41 seancorfield: bitemyapp: oh totally understand, yes, but when you have a very database-heavy app, that can be tricky - or at least sometimes more work than it is really worth

15:41 SegFaultAX: seancorfield: I don't feel that strongly about private vars. Private mutable state, sure, but if my namespace exports a function, people might think it's ok to use it even if it's just an implementation detail of my algorithm.

15:41 bitemyapp: seancorfield: if it's a "tricky" app then it would behoove you to be more careful, not less.

15:42 BAMbanda: the firefox extension directory structure is also different than whats produced by leingen

15:42 bitemyapp: seancorfield: I do a lot of the same work and I'm skeptical there are any legitimate excuses for letting the project fall into being a ball of mutable mud.

15:42 same sort of work*

15:42 Deeply skeptical.

15:42 seancorfield: bitemyapp: yeah, don't start lecturing me on that sort of stuff :)

15:43 bitemyapp: Like one step removed from my status as an atheist.

15:43 seancorfield: I'll leave you alone, just expressing reservations.

15:44 SegFaultAX: If you're using a PLOP database, some non-trivial aspect of your application will depend on the mutable mud ball.

15:44 BAMbanda: bitemyapp, do you think its possible to port my firefox extension over to clojurescript?

15:44 seancorfield: bitemyapp: trust me, i have reservations about some of the code i write that has a slew of DB updates intermingled with business logic - but untangling it completely can make the flow of the logic much harder to understand

15:45 bitemyapp: seancorfield: I'm not so sure.

15:45 SegFaultAX: seancorfield: Needs more monads.

15:45 bitemyapp: what SegFaultAX said, actually.

15:45 * SegFaultAX ducks

15:45 bitemyapp: but I'm thinking in general of declarative ways of describing computation.

15:45 seancorfield: yes, and i appreciate the clarity that approach can bring sometimes

15:46 SegFaultAX: seancorfield: Have you looked at synthread?

15:46 seancorfield: but sometimes an imperative flow is just easier to understand

15:46 bitemyapp: there's no one approach being described, more the effort to improve how we do our work.

15:46 seancorfield: I would disagree.

15:46 seancorfield: i know you would - we'll just have to agree to disagree

15:47 bitemyapp: seancorfield: imperative is more facile and obvious to those unfamiliar with the alternatives being proposed, they're not easier to reason about or compose at all.

15:47 and ultimately, the real complexity limitations of a project have more to do with the latter and less to do with the former.

15:47 not to mention maintainability.

15:48 seancorfield: amit rathore presented an updated version of his DDD talk (from Clojure/West?) to the local user group and we drilled into this separation of logic and DB access and even he admitted that you have to jump thru a lot of hoops sometimes to maintain that separation and it can make the flow non-obvious and more complex

15:49 SegFaultAX: seancorfield: Which UG?

15:49 bitemyapp: one flawed implementation doesn't define the entirety of what's possible.

15:49 seancorfield: you're free to argue that he doesn't know what he's talking about of course :)

15:49 bitemyapp: SegFaultAX: http://www.cs.cmu.edu/~rwh/courses/hott/

15:49 seancorfield: don't argue from authority, it demeans both of us.

15:49 seancorfield: you just did the same tho' with harper :)

15:50 bitemyapp: sorry, Harper?

15:50 seancorfield: that course

15:50 coventry: Bwahaha. "Pot to kettle: You are BLACK! BLACK, I SAY!!"

15:50 seancorfield: precisely

15:50 bitemyapp: seancorfield: er, no. I was offering something inteesting to SegFaultAX

15:50 seancorfield: it had nothing to do with our conversation.

15:50 seancorfield: anyway, i think you're too dogmatic

15:50 bitemyapp: seancorfield: so no, it isn't comparable.

15:50 SegFaultAX: seancorfield: I've been looking for a Clojure user group, is there one around here?

15:50 seancorfield: define "here"

15:51 SegFaultAX: seancorfield: You're in the bay, I thought.

15:51 bitemyapp: seancorfield: my deeper point is that there is an infinite space to explore for improving upon how we do things and it's only the blub programmer mentality that slows us down from exploring it.

15:51 seancorfield: yes, there are monthly meetups in both San Francisco and San Mateo

15:51 and a monthly dojo in San Francisco as well

15:51 bitemyapp: popularizing article for "blub programmer": http://www.paulgraham.com/avg.html

15:51 SegFaultAX: the dojo is where we did the gilded rose exercise.

15:51 seancorfield: bitemyapp: i'm not disagreeing with you on the overall principles or approach

15:51 bitemyapp: at ThoughtWorks

15:52 SegFaultAX: seancorfield: On meetups?

15:52 seancorfield: yes

15:52 SegFaultAX: seancorfield: Cool, thanks.

15:52 seancorfield: harper does that existential types blog... he's a bit... pompous...

15:52 SegFaultAX: I looked about a year ago and didn't find many Clojure specific meetups.

15:52 seancorfield: and very dogmatic

15:53 the bay area clojure meetup has been around for several years

15:53 i've been running it for two years!

15:53 `cbp: bitemyapp: have you contacted the rdb guys?

15:53 SegFaultAX: Hmph. Maybe I just missed it then :)

15:53 seancorfield: at the least the SF arm

15:53 `cbp: bitemyapp: btw I updated the readme with your suggestion

15:53 bitemyapp: `cbp: not yet, about to.

15:53 seancorfield: http://www.meetup.com/The-Bay-Area-Clojure-User-Group/

15:54 SegFaultAX: seancorfield: I was thinking about trying to start up an East Bay arm. EBCUG

15:54 bitemyapp: SegFaultAX: population: 2

15:54 SegFaultAX: you don't have to organize an east bay CUG, you can just invite me to a meal you know.

15:54 SegFaultAX: bitemyapp: That's why I haven't yet. Thee has to be at least ONE other clojure hacker in Walnut Creek.

15:54 bitemyapp: be the same result either way ^_^

15:55 SegFaultAX: There*

15:55 bitemyapp: (I keed, I keed)

15:55 seancorfield: population: 3 at least

15:55 I'm in Castro Valley

15:56 SegFaultAX: Maybe I should make it more general, EBFPUG

15:56 (Functional programming UG)

15:56 seancorfield: and be overrun by smug Haskell weenies? (joking!)

15:57 `cbp: bitemyapp: which version of rdb are you using?

15:57 SegFaultAX: Or worse, start an all out war between Scala AND Haskell weenies.

15:57 bitemyapp: `cbp: I dunno. A reasonably recent one.

15:58 `cbp: I emailed the founder of RethinkDB and cc'd his private email.

15:58 I'll let you know if he responds.

15:58 `cbp: bitemyapp: nice, thanks

15:58 bitemyapp: `cbp: also I'm joining #rethinkdb - do you want to announce the library in the channel?

15:58 seancorfield: would Scala devs actually attend a Functional Programming User Group I wonder? :)

15:59 bitemyapp: `cbp: I think you should.

15:59 `cbp: bitemyapp: ok

15:59 bitemyapp: seancorfield: nah, too much var.

15:59 SegFaultAX: seancorfield: Sure they would.

15:59 As long as I sell it as an OOP-friendly environment.

15:59 bitemyapp: LOL

16:00 Start FP user group, turns out to be a trap for sacrificing OOP coders to Ba'al.

16:00 SegFaultAX: I'll put one of these signs outside: http://chickenmonkeydog.com/wp-content/uploads/2009/02/safe-place.jpg

16:01 seancorfield: lol

16:01 ok, my curry glands are empty and need to be refilled... off to Aroma for lunch!

16:01 SegFaultAX: I see those signs all over the place around here, particularly near the fire stations.

16:01 But they're kinda... creepy.

16:01 teslanick: Clojure newbie: I have a vector that I want to rearrange based on some kind of mapping. Right now I'm representing that mapping with a map of current-index: desired-index. What would be the best way of doing this?

16:02 bitemyapp: SegFaultAX: what do they mean?

16:02 SegFaultAX: bitemyapp: ... that it's a safe place

16:03 I assume that means if your car breaks down or you're fleeing from an attacker of some kind.

16:03 Pirates, zombies, the works.

16:03 coventry: teslanick: What are the drawbacks with your current approach?

16:03 bitemyapp: SegFaultAX: if you carry the means to protect yourself, everywhere you go is a safe place, no?

16:03 I think I prefer the portable version. Can I get that sign as a t-shirt?

16:03 SegFaultAX: bitemyapp: Nice try, NSA.

16:03 bitemyapp: LOL

16:04 teslanick: I'm not familiar enough with the collection functions to know which ones I need to use.

16:04 I'm rubbing sticks together and no sparks are coming out.

16:04 coventry: teslanick: It's hard to know which way to point you without a clearer idea of where you're trying to go.

16:04 bitemyapp: coventry: no, this is doable.

16:05 teslanick: you want to make incremental/compounding changes to the collection, right?

16:05 teslanick: so conceptually you want to shift items in the vector around by the index mapping and compound those changes?

16:05 SegFaultAX: This is easy, just sort by desired index, them map the vector over the current indices.

16:05 bitemyapp: teslanick: what you want is reduce, you'll reduce over the mappings and "carry" the vector getting changed.

16:06 teslanick: bitemyapp: Not sure what you mean by "compounding"

16:06 bitemyapp: teslanick: meaning you want to carry the changes from one iteration to the next, not "forget" them or just map them.

16:06 ,(map #(+ % 1) (range 10))

16:06 clojurebot: (1 2 3 4 5 ...)

16:06 bitemyapp: ,(reduce #(+ % 1) (range 10))

16:06 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: sandbox$eval61$fn>

16:06 bitemyapp: (reduce + (range 10))

16:06 ,(reduce + (range 10))

16:06 clojurebot: 45

16:07 bitemyapp: you get the idea.

16:07 teslanick: above, the result of addition is getting "carried" forward as it iterates through (range 10)

16:07 teslanick: I do. I think I can triangulate a path forward. :)

16:07 bitemyapp: teslanick: this is fundamental to the nature of folds in general.

16:07 teslanick: cool, have fun :)

16:07 teslanick: conceptually reduce in Clojure is left fold with "reduced" for short-circuiting.

16:07 you can accomplish most of what you could conceivably want to do just with that.

16:09 SegFaultAX: That's a weird way to describe reduce.

16:09 bitemyapp: SegFaultAX: I have weird folksy ways of framing these things in my head.

16:10 SegFaultAX: bitemyapp: Well I mean, you're assuming the listener already knows what a fold is.

16:10 teslanick: I'm reasonably familiar with reduce operations on sets, I just hadn't thought to use it to solve my problem. (Don't know why)

16:10 bitemyapp: SegFaultAX: listener knows because I'd already explained reduce. the "carrying forward"

16:10 teslanick: that's the epiphany you needed. reduce is the general-purpose toolkit for processing collections.

16:10 SegFaultAX: bitemyapp: Sure, but that's also weird.

16:11 bitemyapp: teslanick: left folds with short-circuiting are almost universally applicable. You can implement map, filter, and everything else with just Clojure's reduce.

16:11 SegFaultAX: bitemyapp: What do you mean by short-circuiting in this context?

16:12 sveri: hi, i want to test a function which checks for links in a string, now, how do i pass something like: <a href="sfjh"... into a method as a parameter from clojure? can i escape the " somehow?

16:12 bitemyapp: SegFaultAX: (reduced ...)

16:12 SegFaultAX: haskell's foldr

16:13 arrdem: sveri: &(println "\"foo\"bar")

16:13 * arrdem kicks lazybot

16:13 sveri: arrdem: thanks, that & is important?

16:14 arrdem: sveri: no, the & was a failed attempt to get lazybot to print the result. the \" is the escape you want.

16:14 sveri: arrdem: ok, good to know

16:14 thanks once more

16:37 pyrtsa: Is there a recommended way of dealing with <, >, <=, min, max and the like when the arguments are not Numbers but Comparables?

16:38 I.e. which wheel am I reimplementing if defining my own?

16:39 jared314: pyrtsa: have you looked at Numbers.java yet? https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Numbers.java

16:40 zilti: Is there a special way how I have to handle overloaded methods in a reify? This seems to be the wrong way https://www.refheap.com/20436

16:40 All type hints are set correct

16:41 pyrtsa: jared314: I'm not sure you understood my question. I'm looking for a simple uniform way to do e.g. (<' str1 str2) or (max' date1 date2) with my own definition of <' and max'.

16:41 (I mean, that I did already. Now thinking whether there was a Better Way™.)

16:41 jared314: pyrtsa: oh ok, that is different

16:42 pyrtsa: (< (compare a b) 0) is a bit clumsy.

16:42 ...Let alone when there are more arguments, like (< x y z ...) allows.

16:43 brehaut: it may just be easier to write a reduce

16:43 (reduce (fn [a v] (<' a v

16:44 jared314: there used to be a contrib that did that

16:44 brehaut: )) …)

16:44 pyrtsa: brehaut: Sure.

16:46 brehaut: pyrtsa: simply because all that stuff is not overloadable

16:46 pyrtsa: brehaut: So do you confirm my guess that there's no True Right Way™ to compare e.g. dates.

16:46 brehaut: pyrtsa: not with < and java.util.catastrophy.Date

16:47 pyrtsa: clj-time (which is built on joda) does have a function for you

16:47 pyrtsa: Heh, I'm using clj-time (which I think is lacking a lot, but that's another story). But its after? and before? read a lot worse than < and >, IMO.

16:48 brehaut: pyrtsa: be as it may, < and > work on numbers (just by lookingat the source in core and clojure.lang.Numbers

16:48 pyrtsa: (after? a b) vs. (>' a b)

16:49 brehaut: ,(< 1 "foo")

16:49 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number>

16:49 pyrtsa: brehaut: Of course I am *not* going to compare different types against each other here, just trying to make it easy to write correct code.

16:50 IMO, clj-time.core/after? and clojure.core/compare don't make it easy per se.

16:51 brehaut: pyrtsa: yeah thats partly a jvm thing; clojure provides primative operations for things that are primative operations in java, and < and > are for primatives not objects

16:51 pyrtsa: the primative / object seperation is both annoying and a performance tool

16:51 pyrtsa: Cool. Makes sense.

16:51 brehaut: (primatives are always basically monomorphic)

16:51 pyrtsa: Yeah, I'm leaning towards it being annoying. :)

16:51 brehaut: (or have very fixed morphism)

16:52 pyrtsa: yes. however clojure is a dynamically typed systems programming language, not a scripting language

16:52 mtp: i find that distinction to be practically useless

16:52 and so i try not to make it

16:53 jared314: pyrtsa: you could use with-redefs and replace them

16:53 brehaut: mtp: its pretty simple: the later will make compromises for convenience at the expensive of just about anything else, the former often wont

16:53 jared314: pyrtsa: nm that doesn't work

16:54 brehaut: mtp: now, if thats a distinction that doesn't matter for your work then fine, that works for you

16:54 pyrtsa: I wrote a three-line helper function that defines a relational operator with a comparator and a primitive comparison, and defined (def <' (relop compare <)) and others. Simple thing.

16:54 mtp: brehaut‘ that is the first time i have heard that definition, let me add it to the 3097291879821 other meaningless distinctions along the same line :)

16:55 pyrtsa: Was just thinking whether that was already implemented somewhere that I would reuse.

16:55 brehaut: mtp: well, its one of the principles rhickey uses in the design of clojure so even if you think its meaningless, it matters to the design of clojure

16:55 mtp: likewise clojure isnt intended to displace ruby, its intended to replace java

16:56 mtp: and fine grained distinctions is why there are hundreds of programming langauges, not 3

16:56 pyrtsa: brehaut: And it will. Especially with the help of core.typed.

16:56 (I seriously can't think of Clojure as a systems programming language without more static typing aid.)

16:56 brehaut: pyrtsa: for a certain category of programmer anyway

16:58 pyrtsa: as much as i like core.typed (and i like it a lot), types are not the sole tool for reasoning about code

16:59 pyrtsa: fwiw i value referential transparency far more than types

16:59 pyrtsa: Of course not. But it's crazy how many bugs I wouldn't just ever have created in Clojure with static typing in place.

16:59 brehaut: Me too.

17:00 brehaut: pyrtsa: actually for me, i dont find types help me with the initial bugs in clojure so much (repl turn around for testing and iterating on a function is so fast), but the types help longer term maintainance

17:01 pyrtsa: I meant regression bugs. ;)

17:08 BAMbanda: I have some .cljs code in my source path and I'm able to compile successfully, but when I check to see what's been outputed, the produced .js file is simply: ;(function(){ })();

17:08 and nothing else...

17:08 I was expecting atleast a console.log from (.log js/console "test")

17:43 yeoj___: hi, i have a function that is running out of heap size... i can't spot anything that is non-lazy... is there anywhere to tell what area might be causing the problem?

17:43 posted here (again) https://www.refheap.com/20437

17:47 seancorfield: you're using :as-arrays? which isn't lazy

17:48 :as-arrays? true forces the result set to be realized as a single vector of row values

17:49 in general, java.jdbc/query is deliberately not lazy: it opens a connection, runs a query, and closes it

17:50 the "correct" approach would be to pass your processing logic in as row-fn instead of trying to get the query result and then processing it

17:50 bitemyapp: oh, this again.

17:50 seancorfield: think of query as a sort of "map" or "doseq" function in and of itself

17:51 bitemyapp: http://book.realworldhaskell.org/read/using-databases.html

17:51 they have some neat patterns for lazy querying.

17:51 might be worth thinking about.

17:52 yeoj___: hmm. ok.

17:52 maps aren't super handy for writing csv files

17:52 because order doesn't mean anything it seems

17:52 thats why i needed something like :as-arrays

17:53 bitemyapp: i'll read up on that also.

17:53 if i figure this out ever i'll replace all my jython stuff

17:53 seancorfield: yeoj___: i'd strongly recommend passing your processing logic is as your row-fn then

17:53 tbaldridge: yeoj___: if you want an order, just have the user specify the order and then pull the values out of the map. It's kindof a bad idea to leave the order of columns up to the DB.

17:53 bitemyapp: yeoj___: there are sorted maps, but really, most people use vectors of vectors for csv.

17:54 yeoj___: tbaldridge: it's for a sort-of etl tool

17:54 i might be able to query the table to get the ordinal

17:56 with :as-arrays? true omitted it still runs out of heap

18:01 ubikation: does anyone have any experience with docjure? I am having trouble getting the following bit of code to run: https://gist.github.com/ubikation/7295854 https://gist.github.com/ubikation/7295857

18:01 here is my test xls file: http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CCwQFjAA&url=http%3A%2F%2Fbase.google.com%2Fbase%2Fproducts.xls&ei=rNV2UrS7M8iZjALMpYDIAQ&usg=AFQjCNG14jmUqPAYkIeHk284qD-Zc8ZejA&sig2=3tMgJ0tYaqLIPoMahDr3IQ&bvm=bv.55819444,d.cGE

18:01 sorry: base.google.com/base/products.xls

18:02 bitemyapp: yeoj___: I bet you could make a lazy wrapper for JDBC using pagination and chunking!

18:02 yeoj___: how cool would that be?

18:02 yeoj___: bitemyapp: i think the issue might be with postgres.jar jdbc driver

18:03 bitemyapp: it's amazing... i wonder how projects like kettle and talend do it.

18:03 bitemyapp: i think i would require some additional logic to fire multiple queries though, pagination is more a of a db-specific thing... i'm trying to make something that will work on anything (someday)

18:04 i.e. top 100 or limit 100 or fetch first 10 rows only

18:04 i have a monetdb data set somewhere around, i'm going to see if it explodes with that too.

18:05 i've tried visual vm also, but am not really sure what/where i should be looking

18:05 seancorfield: query is the only piece that makes the overall result non-lazy

18:05 zilti: And here's the first working version of my ClojureFX lib: https://github.com/zilti/clojurefx

18:06 seancorfield: if you pass a row-fn that does what you need and returns nil (because you don't care about the result), the worst you'll get is a large vector of nils :)

18:10 I suppose I could change it to (if as-arrays? (vec (result-set-fn (cons (first rs) (map row-fn (rest rs))))) (result-set-fn (map row-fn rs))) but that precludes result-set-fn from returning a non-vector argument when used with as-arrays? true

18:10 yeoj___: bitemyapp: doseq doesn't make it blow... it's something about with-open that is caching it.

18:14 korma has a function called with-lazy-results that sounds interesting

18:15 bitemyapp: yeoj___: *cringe*

18:15 yeoj___: let me know if it works for you ^_^

18:16 yeoj___: i don't want korma... i just want that function. I don't think a tool for database folks needs orm.

18:16 bitemyapp: yeoj___: Korma ain't an ORM.

18:16 it just generates queries.

18:17 yeoj___: bitemyapp: why does it have log4j in there then?

18:17 indigo: For logging? :P

18:17 yeoj___: it seems overkill for me.

18:17 i don't understand why that's bundled

18:17 bitemyapp: yeoj___: you're touching on issues that are near and dear to my heart, but I didn't make those design decisions.

18:17 `cbp: connection pooling is also bundled :P

18:17 bitemyapp: yeoj___: but Korma is most assuredly not an ORM and logging doesn't make it one.

18:18 `cbp: god dammit don't encourage him.

18:18 yeoj___: lol

18:18 bitemyapp: I would like to believe Revise is more representative of how I think db drivers should work ;_;

18:18 tbaldridge: define ORM and then you'll understand why it isn't one

18:18 bitemyapp: tbaldridge: thank you.

18:18 yeoj___: it's a 'lets take structure query langugae' and make a 'structured query language'

18:18 indigo: Oh dear

18:19 yeoj___: i guess i called it an orm because i don't like orms

18:19 lol

18:19 tbaldridge: I mostly say that because I utterly despise ORMs

18:20 bitemyapp: I'm not a fan of object-mutation soup -> database bridges either. So it's a good thing Korma isn't that.

18:20 tbaldridge: that's not to say I don't have my own issues with Korma :-)

18:21 bitemyapp: tbaldridge: I'm open to improving Korma, I'd just need to discuss it with my compatriots and come up with a good idea of what people want and how a clean-break should happen.

18:21 the main reason I haven't proceeded with a lot of the simplifications I have in mind for Korma is that nobody has asked for it from me.

18:22 so in the absence of some evidence of "demand", I'm not going to allocate the labor.

18:22 tbaldridge: what would you improve?

18:26 tbaldridge: I tend to either do most of my work in SQL SPs, or pull it into memory and work with it in native structures. Any other abstraction often ends up hurting me more than helping. Therefore I really prefer razor thin libraries that expose as much of the DB as possible.

18:27 Query helpers may work well for others, but I more often than not don't need it.

18:29 bitemyapp: tbaldridge: sensible. The part of Korma I find useful is the composability, not the "helper" bits.

18:30 seancorfield: hmm, maybe the solution with query and as-arrays? is to default result-set-fn to vec instead of doall if you ask for array results? then it's easier to override... thoughts?

18:32 that would let people process the sequence-of-vectors version lazily by passing in their own result-set-fn but wouldn't change the default behavior

18:34 yeoj___: seancorfield: that sounds nice to me... but i probably don't understand all implications.

18:43 BAMbanda: how come :output-to "~/Desktop/file.js" does not create a file there even though lein is reporting a successful compile?

18:45 mtp: it probably doesn't do ~-expansion

18:45 BAMbanda: so it can only output to directories thats in the same level as project.clj?

18:46 ivan: why does https://github.com/juxt/jig use classloaders?

18:46 does it provide some advantage with Java dependencies?

18:48 hm, I guess tearing down a classloader is more reliable than (refresh)ing to a new version

18:57 ubikation: well if anyone has used docjure I would really appreciate any help. I can't seem to write anything to an excel file and I don't know why.

18:59 seancorfield: yeoj___: http://dev.clojure.org/jira/browse/JDBC-72 (and others who care about java.jdbc and laziness and as-arrays?)

19:00 bitemyapp: arrdem: http://www.haskell.org/haskellwiki/All_About_Monads

19:06 concur: hey

19:07 I need a little guidance on where to start on an assignment

19:07 bitemyapp: concur: probably with either reading or writing.

19:07 concur: I need to implement a readers-writer locking mechanism

19:07 lol

19:07 llasram: In Clojure?

19:07 concur: well

19:08 the assignment is in any JVM language

19:08 joinr: ubikation: I saw the code. what kind of error is spewing

19:08 concur: I'm using clojure

19:08 ubikation: no error. It's just not writing to the file.

19:08 joinr: ubikation: that's because you're working with a spreadsheet object in memory

19:08 ubikation: so how do I write it?

19:08 llasram: concur: Well, what sort of guidance do you need?

19:09 concur: I'm trying to figure out how to make a thread wait in a queue

19:09 llasram: Same way you would in Java

19:09 ubikation: save-workbook... sorry about that.

19:09 I guess I was just really impatient when I was trying to get it to work.

19:09 joinr: ubikation: you typically create workbook and do stuff to it, like mutating your cell, but you need to write back out once you're done; i.e. the workbook has to be spit out.

19:09 concur: I'm trying to use semaphores and a queue of waiting-readers and waiting-writers

19:10 but I'm not sure exactly what to put in those queues

19:10 I tried doing something with .wait and .notify

19:10 but I can't figure out how those work in clojure

19:10 arrdem: bitemyapp: pushing reading stack...

19:10 yeoj___: seancorfield: wow great thanks.

19:11 concur: and the internet doesn't seem to have much on how that works

19:11 llasram: concur: Well, that's a reasonable question, but really does yield the answer "same as you would in Java"

19:11 You can call the `(.wait obj)` method for any Object `obj`

19:12 And then `(.notify obj)` that same `obj` later to wake up one of the waiting threads

19:12 Just like you would from Java

19:12 concur: I've never done this in java either, just seen examples, so it's still a bit vague to me

19:12 what exactly should I be using for obj?

19:13 the thread itself?

19:13 something else?

19:13 cYmen: Hm...is "remove" like "filter" with a built-in "not"?

19:13 llasram: Anything -- an oddity of the JVM is that everything has a "monitor" you can use as a mutex or condition.

19:14 concur: But this really is general JVM stuff. Sounds like what you're probably supposed to figure out for your assignment :-)

19:14 concur: the assignment is really about performance testing mine vs a JVM implementation

19:14 but yeah, that's part of it too

19:15 llasram: cYmen: Pretty much

19:15 cYmen: llasram: thanks

19:16 concur: I really wish I had done more of this assignment weeks ago :S

19:16 I wrote an optimistic read lock at first, which seemed to work ok

19:16 llasram: Haha. Said pretty much every student ever

19:17 concur: and was going to write another mechanism that would switch between the orl and some less optimistic lock

19:17 brehaut: except for students with graphics programming assignments

19:17 concur: when appropriate

19:17 but I gave up on that

19:17 especially after I did more extensive testing on my lock and found it didn't work

19:18 llasram: brehaut: Actually, I recall procrastinating pretty long on the game I wrote for my undergrad computer graphics class :-)

19:18 brehaut: llasram: you were both doing undergrand more right and less right than me :)

19:20 llasram: brehaut: heh

19:20 concur: now, wait() and notify() are only allowed in synchronized methods in java, right?

19:20 how does that translate to clojure?

19:20 brehaut: concur: you are going to trust randoms on IRC about that over just reading the javadocs?

19:20 joinr: if the assignment is java agnostic, and you're using clojure, can you simulate a lock with a clojure primitive? like an agent

19:20 concur: yeah

19:20 I can pretty much do whatever I feel like

19:21 as long as sometimes it's read-only and other times write-only

19:21 I was trying to think of ways to use agents

19:21 maybe put agents in those queues

19:21 return the agent to whatever is trying to read/write

19:22 and then execute the agent when it finally gets dequeued

19:22 but I don't really understand how agents work :\

19:22 joinr: agents remind me of mailboxes

19:22 they have a message queue

19:23 they sit on some state

19:23 llasram: concur: A `synchronized` method just injects code to `synchronize()` on `this` during the dynamic scope of the method. The Clojure equivalent is the core `locking` macro.

19:23 joinr: or they can

19:23 so if you have something responding to messages, sitting on state, then it can control the types off access to said state

19:24 llasram: joinr, concur: I really don't think agents provide a way to implement a read-write lock

19:25 concur: agents are meant for asynchronous tasks

19:25 coventry: ,(java.util.concurrent.locks.ReentrantReadWriteLock.) :-)

19:25 clojurebot: #<ReentrantReadWriteLock java.util.concurrent.locks.ReentrantReadWriteLock@13fbf24[Write locks = 0, Read locks = 0]>

19:25 concur: and read-write locks are more for synchronous tasks

19:25 llasram: (inc coventry)

19:25 lazybot: ⇒ 4

19:25 llasram: :-)

19:25 concur: which is what made me doubt using them

19:25 I'll probably use a ReentrantReadWriteLock for the builtin lock I performance test against

19:26 llasram: concur: Indeed. Clojure's reference types are all about *non-locking* concurrency. It's a total mismatch

19:26 concur: but I need to devise something of my own

19:26 yeah

19:26 clojure is probably a bad choice for this assignment

19:26 llasram: I think it's a perfectly reasonable choice

19:26 joinr: if your agent controls the state, and the only way to read or write state is through the agent, then the agent can decide what's readable, writeable, via messaging. seems like an erlang-style lock.

19:26 llasram: You'll just end up writing pretty much the same code you would in Java

19:27 Only using using Clojure s-expressions

19:27 joinr: performance aside, I don't see why you can't simulate a lock using an agent.

19:27 llasram: But I still count that as a win :-)

19:27 concur: well, at least idiomatic clojure is a bad way to do this assignment

19:27 llasram: joinr: How is a raven like a writing desk?

19:27 ubikation: joinr: thank you so much! Your help is most appreciated.

19:28 concur: is there anything that explains clojure's reference types more in-depth than the stuff on clojure.org?

19:28 joinr: ubikation: no problem

19:28 concur: and gives more examples?

19:28 everything I read on there is so vague to me

19:29 llasram: joinr: Not to be too glib, but -- the point of a lock is to force synchronization by only allowing one thread to execute, blocking others. Yes?

19:29 danielszmulewicz: concur: the chapter in the book joy of clojure is pretty good and comprehnsive

19:29 llasram: (inc danielszmulewicz)

19:29 lazybot: ⇒ 1

19:29 concur: thanks

19:29 llasram: /JoC/ is great

19:30 joinr: amit's book is better for you I think.

19:30 llasram: /Clojure in Action/?

19:30 Um

19:31 Writing a book is hard, but I was seriously disappointed by that text

19:31 It's out-of-date, superficial, and poorly structured

19:31 I do not recommend it

19:34 Raynes: Clojure Programming is a good book.

19:34 concur: I'm taking a look at JoC right now

19:34 bitemyapp: I agree with Raynes.

19:34 Raynes: you have no reason to continue using MongoDB now: http://github.com/bitemyapp/revise/

19:34 concur: I wish I could just pause time for a week

19:34 and read this entire thing

19:35 bitemyapp: concur: that's grad school.

19:35 Raynes: bitemyapp: Exactly that it works and moving over is work.

19:35 bitemyapp: Raynes: well, for new projects maybe?

19:35 Raynes: Sure.

19:35 bitemyapp: yay :D

19:35 Raynes: bitemyapp: Also s/Exactly/Except/

19:35 EXACTLY THAT IT WORKS LOL

19:35 :p

19:36 llasram: You're so exacting, Raynes

19:37 joinr: my reading sequence went programming clojure, joy of clojure, clojure in action ; did not get around to clojure programming (but it looks good)

19:37 concur: my reading has all been clojure.org, stackoverflow, and that one site I can't remember the name of

19:37 joinr: that'll get you pretty far actually

19:38 lots of good blog posts too

19:38 actually, reading source is pretty killer

19:38 concur: a lot of my questions go unanswered though

19:38 joinr: github

19:38 llasram: concur: What questions go unanswered?

19:38 bitemyapp: I need to start using lein-pedantic.

19:39 concur: I forget exactly what questions have come up

19:39 but I've just had a lot of vague understandings of things

19:39 llasram: Makes it a bit difficult to figure out how to answer them :-)

19:39 concur: yeah, lol

19:39 I need to spend more time with IRC open

19:40 so I can ask them when they come up

19:42 I feel like the class I'm taking needs to be taken by itself

19:42 with no other classes at the same time

19:42 so much to digest

19:42 llasram: concur: Are you a full-time student, or is this a MOOC or such?

19:42 concur: having never written a concurrent program 2 months ago

19:43 I'm a full-time undergrad

19:43 17 credits

19:43 including my senior research project in astrophysics

19:44 it feels like nearly every assignment I've been getting requires me to dedicate an entire week to it

19:44 alone

19:44 and no other assignments

19:44 so everything has been pretty last-minute and not thorough

19:45 somehow I think I still have an A/A- average this semester

19:45 I think that's just because my professors are pretty lax graders

19:45 brehaut: concur: your tutors and lecturers aren't actually expecting perfect code; that would rtequire that this stuff wasn't new to you.

19:45 concur: yeah

19:45 so long as the assignment is done on time and works, it's a guaranteed 100

19:46 and "on time" is a very lax term

19:46 he makes it sound like it's due earlier than it really is

19:47 and as long as you suffer enough, being a little late won't get penalized :P

19:52 llasram: Well, there is the hypothesis that the primary purpose of college is prove a willingness to suffer while jumping through hoops for social acceptance

19:54 cYmen: btw what does this actually mean: java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn

19:54 llasram: ,(1)

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

19:54 llasram: i.e., trying to use a number as a function

19:54 cYmen: ah.

19:54 Didn't know what clojure.lang.IFn is.

19:55 concur: it's the function interface

19:55 clojurebot: Excuse me?

19:55 llasram: It's the JVM interface which makes an object a Clojure function

19:55 Yeah

19:55 concur: anything with the "I" prefix is an interface

19:55 llasram: Well, by convention. Although it's not followed to the letter even with Clojure

19:56 Well, in the positive statement I suppose it is at least :-)

19:56 concur: what violates the convention in clojure?

19:56 llasram: I was being over-broad. Everything that's named IWhatever is an interface. There are just non-I-prefixed interfaces, like Seqable

19:57 concur: oh

19:59 is there an idomatic way to block in clojure?

20:00 coventry: Depends on how you want to block. There's (Thread/sleep 1000) for instance

20:00 brehaut: @(promise) ;)

20:01 dabd: how can I make clojure print a sequence with whitespace as commas so that it prints ["a" "b] as ["a", "b"]?

20:02 llasram: dabd: I think you're going to need to use something like bbloom's fipp: https://github.com/brandonbloom/fipp

20:03 joinr: you could manually grunge it with interpose

20:03 llasram: concur: I'm going to say "no" -- if you're building from scratch, I'm pretty sure you're going to need to call `locking` and `.wait`

20:11 concur: so the locking macro is pretty similar to synchronized in java?

20:11 llasram: s,similar,identical,

20:11 Generate some bytecode, decompile, and compare :-)

20:13 concur: I see from (source locking) that it's pretty much the same thing

20:15 jared314: where do I submit issues with one of the clojure contrib projects?

20:15 abaranosky: Jira somewhere

20:15 coventry: jared314: http://dev.clojure.org/jira/secure/BrowseProjects.jspa

20:16 concur: ohh, so .wait and .notify just need to be put inside (locking ...)

20:16 abaranosky: meanwhile, clone it and deploy your copy, use that... then wait forever for the contrib to be fixed (rofl)

20:16 concur: I think I'm starting to understand this

20:16 llasram: concur: Yes

20:18 jared314: it's just a wrong version number on the read me. do I have to go through jira for that?

20:18 `cbp: bitemyapp: you might wanna remove the (experimental) part of the github repo description? :)

20:18 llasram: jared314: I believe it's up to the individual contrib projects.

20:21 jared314: llasram: then who is doing the java.classpath contrib project?

20:21 abaranosky: bitemyapp: looked over Fabric and Cuisine last night. They look promising, certainly I'd push for them over Rex

20:22 bitemyapp: abaranosky: I take it you didn't get my github link?

20:22 `cbp: yes sorry

20:22 abaranosky: https://github.com/bitemyapp/fabric_recipes I put this up after my work on Revise last night.

20:23 simplistic and a bit cut-down from my actual day job scripts, but gets the point across methinks.

20:27 bbloom: dnolen: any word from the mountain tops regarding (catch :default ... ) ?

20:28 you said that you'd take a patch for that in cljs, but i'm curious about clj/cljs sharing

20:29 llasram: jared314: I'm afraid that I do not know

20:30 abaranosky: bitemyapp: thx. nope, didn't get it. I need a way to get offline messages form IRC I guess

20:31 coventry: jared314: That table I linked before says that Stuart Sierra is the project lead of java.classpath.

20:32 jared314: coventry: all this work to just tell someone they didn't update their readme

20:33 coventry: oh well

20:34 coventry: I suppose the flipside is that it's a one-time effort to learn to use jira. *shrug*

20:35 bbloom: learning jira is not a one time effort :-P

20:35 abaranosky: bitemyapp: I'm going to share those recipes with the team at work

20:45 bitemyapp: abaranosky: persistent IRC session yo, s'what I do.

20:45 abaranosky: let me know if they have any questions.

20:45 I'm off to hoist now.

20:47 abaranosky: wtt is a hoist?

20:48 bitemyapp: abaranosky: lifting.

20:48 jared314: bro, do you even hoist?

20:48 bitemyapp: ^^ this guy.

20:49 abaranosky: jared314, bitemyapp: hoist... what a great synonym for lift :D

20:49 bitemyapp: abaranosky: I avoid saying lift because it reminds me of monad transformers. Hoist is more specific.

20:49 (to my addled mind)

20:49 abaranosky: how about "weight training"

20:50 bitemyapp: that makes me sound like I go to fat camp.

20:50 strength training lends too much seriousness to what I do.

20:51 abaranosky: well then. Ahoy!

20:52 arrdem: abaranosky: irssinotifier is pretty osum

20:53 jared314: belated high five

20:54 bitemyapp: got real indian food, the korma was underwhelming

20:54 abaranosky: arrdem: I cannot use non-Emacs solutions it is against my religion

20:54 arrdem: abaranosky: see.. I run irssi, irssiproxy, and then erc through to that.

20:54 abaranosky: that's how I'm always lurking :D

20:54 TimMc: arrdem: Make some!

20:55 bitemyapp: arrdem: the fault probably lies in their korma. that's okay though.

20:55 abaranosky: ZNC + notifier -> erc

20:55 abaranosky: arrdem: any links on details of how to set that up?

20:55 * arrdem never managed to get znc set up

20:55 bitemyapp: okay, leaving now 4realz.

20:55 arrdem: bitemyapp: gtfo

20:56 abaranosky: yeah it isn't too bad... lemme writeup my config and I'll shoot it to you.

20:56 abaranosky: arrdem: that'd rock

20:57 arrdem: abaranosky: just remember to use ssl for IRC... the netsec guys here on campus give me shit because they know my /identify password. I rolled no ssl for about eight months and was the #1 source of zone alarm logs.

21:09 kovasb: how to make emacs eval echo in the repl buffer?

21:10 i found this http://stackoverflow.com/questions/13103177/nrepl-el-how-to-eval-clojure-buffer-form-to-nrepl-buffer-instead-of-echo-area

21:10 but it doesn't say how to install those definitions into emacs

21:26 concur: hey, what would be an idiomatic way of creating a unique, arbitrary object to use as a lock?

21:26 llasram: ,(Object.)

21:26 clojurebot: #<Object java.lang.Object@105fee0>

21:27 concur: nice

21:27 thanks

21:28 ooh, if I put a comma before an expression that bot will evaluate it?

21:28 , (+ 2 2)

21:28 clojurebot: 4

21:28 concur: :D

21:29 jared314: lazybot will do that too

21:29 llasram: Yah, and for lazybot ##"like this"

21:29 concur: ##"like this?"

21:29 llasram: Er

21:29 ##(str "like this")

21:29 lazybot: ⇒ "like this"

21:29 llasram: Ha

21:29 &(str "or like this")

21:29 lazybot: ⇒ "or like this"

21:29 concur: ##(str "it's gotta be in an S-expression?")

21:29 lazybot: ⇒ "it's gotta be in an S-expression?"

21:29 llasram: The ## form you can use ##(str "anywhere")

21:29 lazybot: ⇒ "anywhere"

21:30 llasram: But &(str "doesn't work heer")

21:30 concur: I see

21:30 llasram: here, even

21:30 jared314: what about this?/or that?

21:30 nope

21:31 * arrdem mutters darkly about unicode whitespace and shoddy scripts

21:31 concur: Will it throw exceptions? ##(/ 1 0)

21:31 lazybot: java.lang.ArithmeticException: Divide by zero

21:31 concur: :)

21:31 arrdem: abaranosky: bam. http://arrdem.com/2013/11/03/irssi-and-erc.html

21:32 abaranosky: could be better written, but it should help.

21:32 namespace: What version of clojure does Ubuntu 12.10 ship with?

21:33 concur: ubuntu ships with clojure?

21:33 llasram: namespace: Are you building Ubuntu packages, or trying to develop with Clojure?

21:33 concur: that's surprising

21:33 arrdem: namespace: ship with? it doesn't. clojure 1.4 or 1.5 is in the standard package repos.

21:33 namespace: Err.

21:33 Not ship with.

21:33 In repos.

21:33 TimMc: Huh, that's new to me.

21:33 That's through Debian, right?

21:34 llasram: namespace: Same diff. If you're just trying to learn or use Clojure, just manually install Leiningen, and let it pull in an appropriate Clojure version http://leiningen.org/

21:34 jared314: http://packages.ubuntu.com/quantal/clojure

21:34 it exists

21:34 xuser: namespace: install Java from apt and use leiningen as llasram said.

21:35 dav`: Whoooa the web frontend to freenode irc is cool..

21:35 arrdem: namespace: +1 for leiningen.

21:35 namespace: don't apt-get install leiningen. do install directly.

21:36 jared314: use leiningen, because the version in the repos is old

21:36 namespace: Well there goes like ten minutes of bandwidth.

21:36 dav`: I think you can install a newer version of lein from an old one

21:36 arrdem: dav`: sure but why bother.

21:37 sritchie: fun thought - wouldn't it be cool if lein could depend on a gist?

21:37 * namespace sighs

21:37 sritchie: so if someone posts a middleware or something like that with a namespace decl, boom, one could try it out in a project

21:37 concur: arrdem: because it's better to use your OS's package manager?

21:38 jared314: sritchie: for project config?

21:38 namespace: Okay, how do I "install" this opaque bash script?

21:38 concur: ./script.sh maybe?

21:38 arrdem: concur: when you're just gonna type `lein update` and ignore the jar it packeged?

21:38 sritchie: jared314: well, say someone publishes a clever utility function that's helpful,

21:39 arrdem: s/update/upgrade/

21:39 sritchie: jared314: and tweets it - you could just pull it in immediately, and you have a versioned single function dependency

21:39 that's extremely lightweight

21:39 concur: @arrdem wouldn't apt-get remove at least uninstall it then?

21:39 arrdem: namespace: download the leiningen script, chmod +x, ./lein self-install

21:39 kovasb: sritchie: have a emacs q that maybe u can help with

21:39 sritchie: trying to implement http://stackoverflow.com/questions/13103177/nrepl-el-how-to-eval-clojure-buffer-form-to-nrepl-buffer-instead-of-echo-area

21:39 but don't know where to put that code..

21:39 jared314: sritchie: as part of your project?

21:39 arrdem: concur: no, because any new jars it pulls down won't be tracked by the package manager.

21:39 concur: hmm

21:40 well that's shitty

21:40 xuser: concur: using leiningen built-in update system will probably bork the debian package

21:40 concur: canonical should update their repos

21:40 arrdem: concur: I just have the lein script in /home/arrdem/bin/, with all the jars in ~/.m2 and ~/.lein.

21:40 concur: it's my mess and it's in my home.

21:40 namespace: canonical doesn't update their repos from what I can tell.

21:40 sritchie: jared314: yup

21:41 concur: well that's partly why I don't use canonical's software :P

21:41 arrdem: arch linux 4 lyfe

21:41 jared314: sritchie: that sounds neat, that might go along well with my lein-source plugin

21:41 sritchie: nice

21:41 concur: I second that

21:41 namespace: concur: Are you telling me to switch to Arch?

21:41 concur: yes

21:41 lol

21:41 arrdem: namespace: not if this is your first time on linux

21:41 sritchie: jared314: it's kind of similar to

21:41 https://github.com/tobyhede/lein-git-deps

21:41 namespace: I would, except that Gentoo and Arch both insist on not working with my Ethernet card.

21:41 arrdem: namespace: get like two Ubuntu major versions in first. then think about switching.

21:42 namespace: It's 2013, Ethernet should Just Work (TM).

21:42 concur: have you tried arch recently?

21:42 sritchie: kovasb: I'm not really an emacs-lisp wiz :)

21:42 arrdem: namespace: ... mount the arch USB, chroot in and pkgstrap /dev/sda? :D

21:42 concur: or was it a while ago?

21:42 arrdem: namespace: I'm joking. please don't try that.

21:42 jared314: sritchie: actually, gists are accessible via git

21:42 dav: arrdem: because it installs a whole bunch of deps that lein and clojure need. apt-get autoremove -s leiningen | grep ^Remv | cut -f 2 -d \ | wc -l => 97 packages!

21:43 namespace: Plus they didn't sign their packages until very recently, which signals all sorts of bad things about the mindset of the maintainers.

21:43 sritchie: yeah, so it should be exactly like that - except I think that plugin needs a lein proj at that location?

21:43 arrdem: dav: that's ... horrifying. all I needed on Arch was the JVM and I was good to go.

21:43 xuser: namespace: ubuntu is fine, is better if you get familiar with it first, you don't to run arch in production :)

21:43 +want

21:44 namespace: (Speaking of which, leiningen really installs from a shell script over http?)

21:44 arrdem: https I hope..

21:44 but yes.

21:44 namespace: No, I'm pretty sure it's http.

21:44 * arrdem panics and submits a pr

21:45 arrdem: namespace: nope https.

21:45 namespace: Oh good.

21:45 arrdem: namespace: and it does aggressive signature checking.

21:45 namespace: tech knows what he's doing I'm glad to say.

21:45 concur: I wonder if the NSA injects spyware into every insecure install over http

21:45 if anybody can, it's them

21:45 namespace: concur: Probably not.

21:46 Not because they can't.

21:46 concur: ...not yet

21:46 namespace: But because it raises the risk of detection by savvy users.

21:46 arrdem: namespace: they totally could, I just think they can't be bothered in most cases.

21:46 namespace: It's better to save your badass malware for when you need it.

21:46 dav: arrdem: pretty sure the jvm is a big chunk of these 97 packages

21:46 concur: pshh, they have the budget to blow

21:46 namespace: That way it doesn't get found by non-targets.

21:46 arrdem: dav: probably.

21:47 dav: arrdem: actually it's not i just checked

21:47 arrdem: mostly a bunch of java libraries

21:47 xuser: In think MITM attacks have been proof on https already

21:48 dav: arrdem: non libs = leiningen ant-optional ant bsh-gcj bsh clojure-contrib clojure1.2 clojure1.4 fop gcj-4.8-jre-lib java-wrappers junit junit4 rhino rlwrap

21:49 kovasb: sritchie: ah yes in my desperation I've mixed u up with the other sam

21:49 namespace: Or to put it another way.

21:49 sritchie: kovasb: no worries, we all talk -

21:49 we have a club

21:49 namespace: If you could reasonably assume that the NSA exploited all possible attack vectors.

21:49 kovasb: heh

21:49 arrdem: sritchie: your joke is bad. thank you for leaving it hanging.

21:49 namespace: Somebody chomping at the bit to see their malware could set up a honey pot using a few boxes.

21:49 kovasb: ah i see tbaldridge is back

21:50 sritchie: arrdem: haha

21:50 kovasb: i saw him doing it in the deep walking macro video and was extremely envious

21:50 namespace: Having proof that the NSA is deliberately and indiscriminately infecting US users with malware would be a shit storm.

21:51 kovasb: tbaldridge: u alive?

21:51 namespace: Part of the reason they get away with what they do is that they claim it's only targetted at foreigners.

21:52 blr: given the antipathy towards everything that has been disclosed so far, I wouldn't bet on it namespace

21:52 arrdem: namespace: stay on topic... not that I disagree with you but this is #clojure not #tinfoil-hats

21:52 xuser: namespace: they don't have to infect, they already have access to everything ;)

21:52 * arrdem disengages the grinch drive

21:52 namespace: arrdem: I don't think talking about the NSA infecting people with malware is tinfoil hat at this point.

21:53 Though it is possibly off topic.

21:53 (Actually, being realistic it was never tin foil hat, the 60's should have been enough for people to reasonably conclude everything in the Snowden leaks.)

21:53 * namespace is done

21:54 AimHere: Well by the 1970s, they outlawed half of what the NSA was up to in the '60s

21:54 They just got 40 years of legal loopholes and secret lawbreaking since then

21:56 namespace: Where does the script install it to?

21:56 I need to alias 'lein' to it apparently.

21:57 arrdem: namespace: I totally agree with you. The sad reality of the matter is that as a mere junior in college who has some background in military history, the cold war and computer security I don't doubt the capabilities of the NSA at this point. I also don't doubt the lack of security in our existing systems. Half of the Snowden incident's interest for me was seeing how many of my suspicions were confirmed. If an ultra-powerful entity like

21:57 dav: arrdem: I got rid of all of it and things still seem to work..

21:57 arrdem: the NSA or the CIA wanted to compromise me or my systems, I'm sure that there's an 0day somewhere in my software stack that would let them without having to target me with much more than that. However I'm also convinced that if anyone actually cared that much about me that they'd get UT to unlock the door to my office and hand them my webserver rather than wasting an 0day on me. My threat model is literally my employer and my drinking

21:57 buddies :P

21:57 EOF

21:58 srreh for ranting.

21:58 dav: yeah leiningen is pretty awesome that way.

21:59 dav: last semester I did a compiler in clojure and my instructions to the TA were "lein install; lein run -03 infile.pas"

22:01 dav: arrdem: you gave him a jar?

22:01 concur: writing concurrent code is *haaard*

22:01 I think I'm just going to work on the other parts of the assignment for now

22:01 and that way I'll have something to test my read-write lock when it's done

22:02 arrdem: dav: I wish. I offered to do a jar and the prof insisted on source no matter whether the TA was able to read it or not. I just packaged the leiningen script with the source, and that totally worked.

22:04 dav: arrdem: I see

22:04 namespace: Is there somewhere I can get a brief overview of the JVM so I understand what the heck is going on?

22:06 TimMc: VisualVM?

22:06 arrdem: (doc nth)

22:06 clojurebot: "([coll index] [coll index not-found]); Returns the value at the index. get returns nil if index out of bounds, nth throws an exception unless not-found is supplied. nth also works for strings, Java arrays, regex Matchers and Lists, and, in O(n) time, for sequences."

22:08 namespace: (print print)

22:09 IIRC, the last time I tried breaking the bot I managed to get it to print a couple hundred numbers into chat.

22:09 Felt really bad afterwards.

22:10 concur: (loop [] (print "!!!") (recur))

22:10 namespace: (-_-)

22:11 * namespace still can't get lein to run

22:12 justin_smith: ((fn forkbomb [] (println "fork you") [(future (forkbomb)) (future (forkbomb)) (future (forkbomb))]))

22:12 arrdem: (inc justin_smith)

22:12 lazybot: ⇒ 9

22:12 namespace: It won't let you use functions.

22:12 arrdem: namespace: false

22:12 namespace: I mean it won't let you use fn.

22:12 arrdem: ,(let [f (fn [x] (+ x 1))] (f 2))

22:12 clojurebot: 3

22:12 justin_smith: ,((fn [] 42))

22:12 clojurebot: 42

22:13 namespace: Oh god.

22:13 concur: one of my professors doesn't give a shit about his account on the school's solaris server

22:13 and made the password abc123 so everybody can use it

22:14 I'm a little tempted to try starting a forkbomb from it

22:14 namespace: concur: No.

22:14 arrdem: concur: don't be that guy.

22:14 concur: hey, I had the idea half a year ago, and haven't done it yet

22:14 it would be a lesson in security though

22:14 arrdem: concur: besides if your sysadmin is halfway competent you'll get ps limited so the forkbomb won't do anything besides get the prof some flack.

22:15 concur: yeah

22:15 namespace: concur: Do I need to tell the Stallman password story?

22:15 concur: I figure they have safeguards

22:15 and the sysadmin is doug lea

22:15 who is more than halfway competant

22:15 justin_smith: solaris has good per-user resource management

22:16 namespace: I would presume that any university worth it's salt has students try and break stuff all the time.

22:16 He'd probably see the forkbomb and laugh.

22:16 concur: yeah

22:17 well, I'll be back in a little while

22:18 muhoo: is there a way to partition-by a group of values?

22:18 arrdem: muhoo: so partition if the value is a member of a set?

22:18 muhoo: sets are IFn...

22:18 muhoo: i.e. a seq that is a byte stream, say of packetized data, and i want to partition it by [0x03 0x26]

22:18 namespace: Please guys, I don't want to wrestle with this all night, what do I do after leiningen installs? Because right now I'm just getting the message debian distros give you to install a package from repos when I try and use it.

22:19 justin_smith: namespace: is the lein script in your PATH?

22:19 arrdem: namespace: what have you done?

22:19 muhoo: so if there's a stream [0x39 0x21 0x03 0x26 0x83 0xf2...] i want to split t at the [0x03 0x26]

22:19 namespace: arrdem: Downloaded lein (no file extension), ran it.

22:19 With privileges.

22:19 muhoo: it's for unframing binary network data. no i am not incontrol of the data an can't use protobufs

22:19 arrdem: namespace: okay. "./lein self-install"

22:20 namespace: justin_smith: It might not be.

22:20 I'll check.

22:20 justin_smith: namespace: no need for priveleges, better to run it as a regular user

22:20 arrdem: namespace: "./lein repl" should work now.

22:20 justin_smith: and it is best to have it in your PATH (I use ~/bin)

22:20 arrdem: ~/bin is best bin.

22:20 clojurebot: Ack. Ack.

22:20 arrdem: clojurebot: I wasn't talking to you.

22:20 clojurebot: excusez-moi

22:20 arrdem: clojurebot: no.

22:20 clojurebot: excusez-moi

22:21 namespace: arrdem: Do I use the shell script I installed with as my executable?

22:21 arrdem: namespace: yep!

22:21 justin_smith: clojurebot: the stupidest bot says "excusez-moi"

22:21 clojurebot: It's greek to me.

22:21 justin_smith: :(

22:21 namespace: Oh okay.

22:21 That explains it.

22:21 Thank you.

22:22 justin_smith: yeah, the script you download is the program (until you make it do a self upgrade and it replaces itself)

22:22 arrdem: namespace: yeah so just make a ~/bin, add it to your $PATH in .bashrc or .zshrc or whatever you use, log in again and type "lein". should work. it's what I use everywhere.

22:39 arohner: is there a library fn for sugaring reduce, similar to how 'for sugars 'map?

22:39 Raynes: 'for' does a whole lot more than provide syntactic sugar for map.

22:40 It's a list comprehension.

22:41 brehaut: arohner: loop recur ;)

22:42 (only partially kidding)

22:43 arohner: Raynes: I'm aware, but they achieve the same basic goals

22:43 also, I want to avoid nested reduces

22:43 brehaut: arohner: 'for is closer to sugaring 'mapcat than plain map

22:44 arohner: for doesn't concat though

22:44 anyways, I'll assume the answer is 'no'

22:44 brehaut: yes, it does

22:44 just not how you think it might

22:45 mapcat is bind for the list monad, and list comprehensions are a sugar for the list monad (well, a monad plus really)

22:46 anything you could write with for has a mechanical transformation to mapcat if you wanted to do so

22:46 </things i always say>

22:47 SegFaultAX: In Scala, for comprehensions are just sugar for map+mapcat+filter

22:48 (flatMap rather than mapcat, but you get the idea)

22:49 arohner: my goal here is readability. Obviously it's possible to write this in nested reduces, I'd just rather avoid it

22:50 justin_smith: arohner: sometimes putting the reduce in a function, then recuring the function helps, if the same reduction should be done at each level

22:50 SegFaultAX: arohner: Can you give us more information about the general problem you're trying to solve? It might help to frame our responses.

22:50 justin_smith: s/recur/recursive call

22:51 muhoo: ooh, gloss

22:52 arohner: I have a list of objects. Each object has another list inside it. I'm reducing over the inner lists, updating a map. the structure looks like:

22:52 (reduce (fn [state foo] (reduce (fn [state bar]) (:bars foo)) foos)

22:53 oh, and the inner reduce is (update-in [state] ...), using both foo and bar

22:56 brehaut: so [{:foo {:bars […]}} {:foo {:bars […]}} …] -> {? ?}

22:56 danlarkin: that seems fine to me, I don't know what more you could hope for

22:56 brehaut: personally, i'd wrap up the reduce reduce update-in operation as a new primative that takes the update-in function

22:57 in the same way that (frex) map, filter, max, etc can all be written in terms of reduce

23:08 concur: well, I'm back

23:08 for what it's worth

23:21 ravals: Can someone help me understand this bit of Clojure? https://gist.github.com/sidraval/7298029 It's from "Clojure Programming" by Emerick/Carper/Grand and I don't get it...

23:22 jared314: ravals: it adds key value pairs to a transient map

23:22 ravals: then returns the persistent version of it

23:22 amalloy: ravals: it is incorrect and bad; you should not understand it

23:23 oh, i see, they are pointing out that it's bad. well done

23:23 ravals: i'm trying to understand why it only adds key/value pairs up to 7

23:23 even though the doseq has a range up to 100

23:23 i assume this is the reason it is bad :) but why 7? what is going on?

23:23 amalloy: ravals: the point they are making is that assoc! is not *guaranteed* to have side effects; it is *allowed* to have side effects. so you have to save the return value of assoc! just like you would with assoc

23:24 it goes up to 7 because, as an implementation detail, that's the point at which assoc! decides to do something different than mutating the existing transient

23:24 ravals: oh, interesting

23:25 jared314: you are suppose to use the resulting transient of assoc!

23:25 ravals: right, so they're saying don't reference previously mutated transients

23:26 jared314: yes

23:27 ravals: thanks :)

Logging service provided by n01se.net