#clojure logs

2013-11-03

00:14davdo people think this macro would be useful or is there a better way to implement this idiom? http://paste.debian.net/63619/
00:16jasonjck_dav: no need for a macro (if-let [[f & rst] (seq s) then else)
00:18davjasonjck_: thanks a lot that's exactly what I wanted :)
00:19davjasonjck_: for some reason one rarely sees this on 4clojure or even in the source of standard fuctions..
00:19jasonjck_it's called destructuring syntax
00:50davWhat about this? Would anyone find this useful? => (defn rcomp [& fs] (fn [x] (reduce #(%2 %1) x fs)))
00:50davit reads left to right (like the threading macros) but it's composing functions of 1 arg instead.
00:54jared314dav: it looks like comp but reversed
00:58davhence the name rcomp ;-)
01:00abaranoskyhmmm... anyone know the best way to fetch an XLSX file via HTTP?
01:00abaranoskyclj-http, my goto tool, doesn't understand the content-type
01:01abaranoskyI'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?
01:03bitemyappabaranosky: I use http-kit's client when I want something a bit "dumber"
01:03bitemyappclj-http attempts too much magic for me sometimes.
01:04abaranoskybitemyapp: checking it out, thx
01:05bitemyappabaranosky: has the bonus property of being async.
01:05abaranoskyyeah, we use it at work for some stuff
01:07bitemyapp`cbp: okay, what happened?
01:07bitemyapp`cbp: there's a bunch of stuff broken all over the place in the connections branch that wasn't before ?_?
01:09bitemyapp`cbp: ah wait, my fault, think I see it now. Sorry!@
01:12abaranoskybitemyapp: nice, that seems to worked much better for me thx
01:13abaranoskyI'm trying to use https://github.com/cgrand/spreadmap to read th XSLX, but it is throwing exceptions left and right
01:13srrubyI 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
01:19bitemyappsrruby: cheshire
01:19bitemyappsrruby: + pprint
01:20abaranoskysrruby: you want to print as CLojure data?
01:20srrubyI want the pretty printed output to be valid JSON
01:20srrubyjson data
01:32SegFaultAXsrruby: cheshire has a pretty printing mode.
01:32bitemyappsrruby: supplicate at the altar of the smiling kitty.
01:33BAMbandahttps://github.com/magomimmo/modern-cljs/blob/master/doc/tutorial-04.md
01:33BAMbandawhen do we use ".-" or just "."
01:33BAMbandawhat's the difference
01:36SegFaultAXBAMbanda: Depends on the usage of the symbol prefixed by ./.-
01:37muhoo. is function. .- is field
01:37SegFaultAXWell, that's not complete I think.
01:37SegFaultAX. is an application. .- is a field access (which could return a function object)
01:38SegFaultAXA function application, to be precise.
01:38BAMbandacan you specify what you mean by field?
01:38muhoo(.someMethod foo) vs (.-field foo) is what i've seen in cljs
01:39BAMbandai notice .- is used for events?
01:39BAMbandaas well as to see whenter getElementById was a valid method of the document object
01:39BAMbandathe example in /home/shai/Documents/modern_javascript_scripts/ch02/login.html
01:39BAMbandashows .- for a method as well...
01:40BAMbandaunless thats a typo?
01:40SegFaultAXBAMbanda: That's not a function application
01:40SegFaultAXIt's a field access.
01:40BAMbandais a field a term used in clj? I've never heard of it before
01:40SegFaultAXSo consider an object like: { foo: 1, bar: function() { ... } }
01:40BAMbandaohhhh, like a key
01:40SegFaultAXYou can apply our objects bar method like this (.bar obj)
01:41SegFaultAXBut you can get the function object itself like this: (.-bar obj)
01:41BAMbandaSegFaultAx, ohhhh getting the object, not calling it
01:41SegFaultAX(.foo obj) clearly makes no sense, since it's just a simple scalar value.
01:41muhooi think (.someMethod foo) compiles to foo.someMethod() in js or java, but (.-field foo) compiles to foo.field without the ()
01:42BAMbandanow that definitely makes sense
01:42BAMbandathanks fro the clarification
01:42SegFaultAXmuhoo: Yup, and that difference matters precisely in the above case where I may want to get the function object, and not /apply/ the function.
01:42SegFaultAXBAMbanda: Good luck!
01:43BAMbandaSegFaultAX, thanks!
01:43BAMbandathe clojure community rocks, I guess the best way to show appreciation is to develop modules/libraries along the road to keep it alive!
01:06BAMbandaif I typed something into the brepl and its not responding, how can I cancel that command without exiting the whole repl?
01:06BAMbandai have it wrapped with rlwrap
01:07davis there a performance difference between ((comp h g f) x) and (->> x f g h) ?
01:07BAMbandadav, the last one looks cooler
01:08davBAMbanda: the last one requires that the running variable be the last argument..
01:08andyfingerhutdav: 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
01:09andyfingerhutdav: https://github.com/hugoduncan/criterium
01:10davandyfingerhut: ok, thx.
01:10andyfingerhutdav: That was the long way of saying "I don't really know off hand" :-)
01:11SegFaultAXI don't actually know, but if I took a blind guess I'd say the macro is faster.
01:11davandyfingerhut: ;-)
01:11davSegFaultAX: yes I'd assume it lines more and has fewer function calls..
01:11SegFaultAXdav: Right, and fewer intermediate classes.
01:11davs/lines/inlines/
01:11SegFaultAXJust a guess, though.
01:11andyfingerhutdav: 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.
01:12davk, we're all on the same page.
01:12SegFaultAXPrecisely
01:12bitemyappbut, it doesn't matter.
01:12bitemyappcomp is more generally useful for composing HOFs.
01:12bitemyappthe performance difference is trivial.
01:13davwhat's a HOF?
01:13SegFaultAXHigher order function
01:13andyfingerhutYes, 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.
01:13SegFaultAXGenerally, a function that receives a function as an argument, or returns one as a result (or some combination thereof)
01:13seangrove~hof?
01:13clojurebotTitim gan éirí ort.
01:13seangrove~hof
01:13clojurebotHuh?
01:13seangrovehof?
01:14seangroveDamnit.
01:14davSegFaultAX: hmmm... I find that odd but I'll take your word for it.
01:14bitemyapp~hof is a higher order function - typically, a function that receives a function as an argument, or returns one as a result
01:14clojurebotIk begrijp
01:14bitemyapp~hof
01:14clojurebothof is a higher order function - typically, a function that receives a function as an argument, or returns one as a result
01:14SegFaultAXdav: Why do you find that odd?
01:15davSegFaultAX: in haskell composition isn't used more often for hofs than for regular functions..
01:15abaranoskyI too would expect ->> to be faster -- but criterium is the way to know for real
01:15davSegFaultAX: comp is itself a hof, but other than that, I don't see the link.
01:15bitemyappguesses are fine, measurements are better.
01:16SegFaultAXdav: Oh, you're responding to bitemyapp's comment?
01:16bitemyappseemingly. I don't really know why.
01:16SegFaultAXWell comp isn't particularly /more/ useful for combining hofs, no.
01:16davSegFaultAX: yes, sorry, should have been addressed to bitemyapp
01:18SegFaultAXdav: 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.
01:18davSo 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..
01:20SegFaultAXdav: Yea that one is tricky. I suggest finding an implementation that avoids all forms of guess-and-check.
01:22davSegFaultAX: 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..
01:26SegFaultAXdav: 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.
01:31davSegFaultAX: yes I can see that now, thanks.
01:33SegFaultAXMan 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. :(
01:33davI'm 459 :/
02:09bitemyappdav: pffft, I'm 1872. You have nothing to complain about.
02:16TEttingergah even with the string hint this is killing me
02:16TEttingerit works in the repl but not on 4clojure (same problem)
02:17TEttingerok it is timing out on later ones in the repl :|
02:18SegFaultAXTEttinger: I worked on that one for at least an hour.
02:19TEttingerouch
02:19SegFaultAXI was really determined to solve it numerically.
02:27shriphanihello. In the latest snapshot of incanter, I get this mental error: Caused by: java.lang.ClassNotFoundException: clojure.set , how is this possible ?
02:39bitemyappAgents are magical when you need them.
02:40bitemyappI need a macro for (pst (agent-error ...)) though.
03:08abaranoskybitemyapp: Fabric looks really simple and nice. I'm going to look at it more, but looks less shitty than Chef and Rex :)
03:17bitemyappabaranosky: I just got some work done on Revise, considering open-sourcing those fabric recipes.
03:52shriphanihello does anyone here have any experience with incanter matrices ?
03:53shriphaniI am trying to save a matrix using the default save method but it fails: https://www.refheap.com/20427
03:56bitemyappabaranosky: https://github.com/bitemyapp/fabric_recipes
04:22teromshriphani: 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
04:22teromshriphani: I suggest you file an issue
04:22shriphaniwow.
04:22shriphaniis there anything I can do before the fix is pushed ?
04:22shriphaniI will file an issue obv.
04:25teromshriphani: 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
04:26shriphaniI think the fix is straightforward. so I guess I could work with the snapshot
04:27teromYeah. One option is to use version 1.4.1 although it is quite old now.
04:29shriphaniI am not doing anything more complicated than SVDs
04:29shriphaniand I assuming that wasn't broken in 1.4.1
04:29shriphanibut yea this needs fixing
04:36shriphaniterom, btw it still fails in 1.4.1
04:36shriphanithis time it complains about incanter.Marix
04:36teromoh, damn :/
04:37shriphaniis this io stuff not tested ?
05:18davwhat do you guys think of this threading macro? http://paste.debian.net/63651/
05:19davit doesn't rely on the variable having to be the first or last arg
05:27davand 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.
05:31davlol the as-> macro is exactly that
05:31davgreat
07:36luxbockwith core.matrix, what is the difference between using (matrix (array v)) and just (matrix v)?
07:39luxbockit looks like I'm not missing anything by dropping the array call in the middle
08:42cYmenI 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...
08:57joegallocYmen: paste a link to a pastbin
08:57joegallopastebin, even ;)
08:57joegallolike refheap or gist.github.com or whatever
09:10cYmenhttp://pastebin.com/8i97abM6
09:11cYmenjoegallo: considered being a chicken for a moment and sending it to you in a query :)
09:34llasramcYmen: Instead of `condp =` for numbers, you could just use `case`
09:35llasramcYmen: You define an `any` function, but the only place you use it, you'd be better-served w/ the core `not-any?` function
09:36llasram(not (any (map #(divisible? n %) ...))) => (not-any #(divisible? n %) ...)
09:36llasrams,not-any,not-any?,
09:37llasramThis is something people have differing opinions on, but `partial` lets you write things like `#(divisible? n %)` as instead `(partial divisible? n)`
09:37llasramIt arguable makes intent clearer
09:37llasramarguably even
09:37`cbptheres no any fn :-D
09:37`cbpsome maybe
09:38llasramYeah, `some` is the equivalent
09:39llasramIMHO the one token saved by `(any ...)` vs `(some identity ...)` isn't worth introducing a new function
09:40llasramAnyway, that's all the Clojure-wise specific comments I can summon easily. Keep it up :-)
09:42cYmenSo basically, use partial if all you do is fill in some params because it is more obvious. Seems like good advice.
09:42cYmenI didn't know there was a "not any" that's why I wrote "any". :)
09:43cYmenI basically just type the function I want into google and in that case it gave me (some identity ...)
09:43cYmenBut yeah I could probably just write that instead.
09:44cYmenWell, thanks for looking at it!
09:55ziltiFor defmethod/defmulti, is there a "run-time macro" working in the background?
09:56llasramzilti: Not following your question. Clarify?
09:57ziltillasram: 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:00llasramDo you mean as a dispatch value? I'm not seeing that -- I'm able to use any arbitrary value
10:00ziltillasram: Hmm there seem to be some other weird things happening here at me. I'll tinker around a bit longer
10:22muhoodav: wat is ->>> ? i've only seen ->> and ->
10:22muhoo,(doc ->>>)
10:22clojurebotexcusez-moi
10:23dav,(doc as->)
10:23clojurebot"([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:23davI basically wrote as-> not knowing it already existed and called it ->>> -- it's just as->
10:23muhoooh
10:24ziltillasram: 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:24muhoothere's also -<> in swiss-arrows, which i like better than as->
10:25ziltiAs a Swiss, I still haven't figured out why they're called "Swiss arrows"
10:26llasramFor the same reason the Pope has his "Swiss guard"
10:26ziltiThe developer is Swiss?
10:27llasramThat was a failed attempt at humor :-)
10:27ziltiOh :)
10:28muhoothey carry those weird halbards
10:28ziltiAnd they all are Swiss
10:28muhoowhich -<> kinda looks like
10:29llasramHuh: http://en.wikipedia.org/wiki/Swiss_arrow
10:29llasramzilti: That paste doesn't have enough context for me to at all tell what's going on
10:29llasramRe-paste the current definition of `fx` ?
10:30llasramActuall
10:30llasramActually, even
10:30llasramIs `fx` still a macro?
10:30llasramAnd what does it return?
10:30ziltillasram: https://www.refheap.com/20431#L-268 It returns, as it should, a Java class
10:31ziltillasram: This code is complete, but I don't know if it'll work on Java 7 (I'm using Java 8 EA)
10:31llasramIt returns a Class? It looks like it returns an instance object
10:32ziltiYeah, sorry. An instance object.
10:32llasramWell then the error makes total sense
10:32ziltiWhy?
10:32clojurebotwhy not?
10:32llasramBecause it's a macro, it's returning an instance object at macro-expansion time
10:32llasramSo the compiler then needs to embed that instance object into the code being compiled
10:33ziltiBut why does the last example work, and the second one doesn't?
10:33llasramThe `def` special form just binds a value to a var, and thus doesn't require in-code embedding
10:33ziltiAnd I still also don't get why the first of my 3 examples doesn't work?
10:34llasramBecause it's still forcing the compiler to emit code embedding the *result* of the call to `fx`
10:34llasramWhich is some arbitrary Java object
10:34llasramAs far as I can tell, your problem is that `fx` should be a function, not a macro
10:35ziltiBut I want the arguments to not get evaluated
10:35llasramWhy?
10:35clojurebothttp://clojure.org/rationale
10:35llasramThanks, clojurebot
10:35llasramAnd even if that were true, then
10:35ziltiBecause if they are, I'll always have to quote them
10:36llasramthe right way to do this is have a macro which expands to a call to a function w/ the quoting-needing arguments quoted
10:36bjaI wonder what the consequences of using gensym to derive ids for divs will be
10:36llasramIn 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:37llasramYeah, so just have an `fx` macro which expands: (fx menu-item :text "Moin") => (fx* 'menu-item :text "Moin")
10:37llasramThen `fx*` can just be a function
10:37ziltiI'll try that
10:38llasramAlthough really -- I think better would be to design your interface so it doesn't depend on implicit quoting of arguments
10:38llasramany reason `menu-item` can't be the keyword `:menu-item` instead?
10:38muhooright, 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:38ziltiNo, no particular reason except... aesthetics?
10:40llasramInteresting. I'd argue the aesthetics the other direction :-) I'd expect a bare symbol to resolve, and thus find `menu-item` there confusing
10:40ziltiNow it works.
10:41ziltiAnd I think I now understand why, and understand a little better how the reader works
10:43llasrams,reader,compiler, ?
10:44ziltillasram: hmm. Isn't that the same thing in Clojure?
10:44llasramNope!
10:45llasramReading 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:45llasramThe latter steps are all the compiler
10:54bjais it impossible to both :refer and :as from the same namespace in cljs?
10:55bjai.e. (ns foo (:require [jayq.core :as jq :refer [$]]))
10:55bbloombja: that should work. does it not? what goes wrong?
10:57bjaerr, I'm apparently going crazy and can't count parens....
10:58danlentzdoes the new cider no longer pick up the dependencies when you cider-jack-in while in project.clj?
10:58danlentzoh, or is it that its not running at that point and so thats why?
10:59danlentzit used tl work for ,e back in the olden days of two weeks ago
10:59danlentzback when it was still nrepl
11:18danlentzwow it never occurred to me that i'd even have access to jruby.ffi
11:18bbloomseangrove: doesn't it just give you a warm fuzzy feeling?
11:19seangrovebbloom: It's certainly fuzzy, but more in a vague way
11:20seangroveI wish there was nicer syntax for this though: #((.-sin js/Math) %)
11:20seangrove...which I guess is just (.-sin js/Math)
11:20seangroveThat's reasonable enough
11:55makkalothi, what is the preferred way of refreshing a namespace in clojurescript repl ?
11:57dobry-denbeen clojurin for like 1 year and i still restart repls errytime
11:58makkalot:D
11:58dobry-denin fact 5 min ago i redefined a function. whoops, this already refers to nsfoo/func. better restart
11:59dobry-denwhen my netbook was my only machine for 2 years, i was much more of a problemsolver
12:00makkalotthere should be a better way
12:01seangrovemakkalot: What do you mean refreshing a namespace?
12:01seangroveJust evaluate the new ns-form?
12:01bbloomi think a lot of folks just do browser refreshes :-/
12:01seangroveYeah, with austin, that's a pretty good setup
12:01makkalotseangrove, no, refresh the namespace, reset global data and etc
12:02seangrovemakkalot: Ah, and you're just using the raw repl?
12:02seangroveWith something like nrepl.el, you just load the whole file, C-c C-k
12:02pepijndevosdobry-den, are you Czech? (I'm not, and very OT, but just curious)
12:02makkalotseangrove, rhino repl
12:03dobry-denpepijndevos: nah, but've been livin in prague
12:03makkalotseangrove, so i should learn emacs then :D
12:03seangrovemakkalot: Does load-file now work?
12:04seangroves/now/not
12:04seangrovemakkalot: Well, eventually probably, or vim. Maybe best to start with LightTable, it looks very nice to start with
12:04dobry-denyall've got a nrepl-like workflow working with clojurescript?
12:05dobry-denI 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:06makkalotseangrove, i'm using sublime, but probably it is not best way of developing clojure/clojurescript
12:07pepijndevosIf an iSeq implements Seqable, should it just return self?
12:07dobry-denmakkalot: 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:07seangrovedobry-den: Doesn't nrepl.el cover both of that?
12:08dobry-denseangrove: right, but im suggesting that if you can replicate that in another editor (they use sublime) youre doing pretty well
12:08seangroveAh, got it.
12:41the-anomehi
13:23`cbpbitemyapp: wakey wakey
13:29arrdem`cbp: sssh I'm enjoying the quiet
13:30`cbplazy sunday
13:40arrdemdaylight savings sunday
13:42seangroveWhat's the clean syntax for accessing nested attributes in js-objects?
13:42seangrove(.. graph axes x) isn't quite right
13:43seangroveLooking for a nice short hand for graph.axes.x
13:43bitemyapp`cbp: blah
13:43bitemyapp`cbp: noisy fuckin' roommates.
13:43bitemyapp`cbp: soup?
13:43bitemyappseangrove: I would've figured ..
13:44`cbpbitemyapp: hi, I saw your commit and played arount in the repl
13:44seangrovebitemyapp: I guess it's actually aget
13:44bitemyapp`cbp: ah fuck, just saw the thing-jig.
13:44`cbpthe what?
13:44bitemyappmuh-bad.
13:44bitemyappthe ticket.
13:44seangrove(.. graph axes x) => (graph.axes().x())
13:44`cbpOh
13:46`cbpbitemyapp: So yeah I think I grok it. Except for the read-into-conn fn
13:46`cbpwait do you wanna do this on a separate chat?
13:52bitemyapp`cbp: I don't really care. It doesn't seem like we'd be disrupting much.
13:52bjais 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`cbpbitemyapp: Ok. I don't really understand the timing of the while loop
13:52bitemyapp`cbp: it's possible I fucked up the while loop, btw. I think I might be using the wrong predicate.
13:52bitemyapp`cbp: timing?
13:53bitemyappit blocks until there are bytes to read, and since it uses fetch-response, it grabs whole protobuf messages at a time.
13:53bitemyappit doesn't "spin" when there aren't any bytes on the stream though.
13:53`cbpOh uhm
13:53`cbpYeah that's what I meant
13:53bitemyapppretty standard behavior I *think*
13:54bitemyappunless I've totally misunderstood the nature of the universe ^_^
13:54`cbpI guess I did
13:54bitemyapp`cbp: fyi, I was kinda winging it last night when I wrote this.
13:54bitemyapp`cbp: and there's almost zero error handling.
13:55bitemyapp`cbp: in particular, agent errors need to be kicked into the promises.
13:55`cbphmm yeah
13:56bitemyappprobably what I'll do is add the error handling to send-term.
13:56bitemyappand if it detects an error in the conn agent, it spits it into the promise.
13:57`cbpAlso the dissoc-in removes the :waiting key from the agent. Is that what you meant to do?
13:58bitemyapp`cbp: no, only the inner key. my bad.
13:58bitemyapp`cbp: I'll fix it. Are there any other comments or feedback?
13:58bitemyapp`cbp: did things mostly make sense in the REPL?
13:58`cbpbitemyapp: yeah just need a close fn too
13:59bitemyapp`cbp: you mean to fix the close fn?
13:59bitemyappto work with the new dilly?
13:59`cbpyeah
13:59bitemyappah that shouldn't be too big of a deal.
14:00`cbpbitemyapp: Well, let me know if you need help or if you're busy and need me to step in or something
14:00bitemyapp`cbp: I'm good so far, we definitely need to start getting the tests passing tho.
14:00bitemyapp`cbp: so that's something you could put your attention to in the meantime.
14:02`cbpbitemyapp: Ok
14:04luxbockafter updating from nrepl.el to cider I get "eldoc error: (void-function -elem-index)" with eldoc
14:04luxbockhas 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:05arrdemluxbock: what cider command were you running?
14:05bitemyapp~cider is rage-inducing
14:05clojurebotIn Ordnung
14:05bitemyapp~cider
14:05clojurebotcider is rage-inducing
14:05bitemyappgood bot.
14:06luxbockI 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:06bitemyapp`cbp: pushed a new version of close.
14:06arrdembitemyapp: you have to remind us all, don't you.
14:07`cbpbitemyapp: kk
14:07arrdemluxbock: that's gonna involve some digging to find...
14:09luxbockeldoc works fine in the nREPL buffer
14:09coventryluxbock: What version of emacs are you using? I have -elem-index in dash.el, "A modern list library for Emacs"
14:10luxbock24.3
14:10luxbockI'm also running it on Win 7 in case that makes any difference
14:10luxbockmaybe it's related to this: https://github.com/clojure-emacs/cider/issues/314
14:10bitemyapp`cbp: anyway, any other concerns?
14:11coventrySame 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`cbpbitemyapp: Not atm. I'll be working on the tests
14:11bitemyappif not, I'm going to make tea and possibly breakfast.
14:11`cbpbitemyapp: Maybe we can look over the retry stuff later
14:11luxbockalright
14:11arrdem~food
14:11clojurebotGabh mo leithscéal?
14:11bitemyapp`cbp: oh-gad. I'm not really looking forward to the connection retry stuff
14:11arrdemclojurebot: food is (> '.')># waffle!
14:11clojurebotAck. Ack.
14:12`cbp:-p
14:12bitemyappretry stuff might not be a "today" thing, unless massive progress is made.
14:12bitemyappMostly I'd be hoping to just things cleaned up and working with passing tests.
14:12bitemyappif we can accomplish that much, I'll be 100% comfortable pushing a release and pinging Slava.
14:13`cbpOk
14:13`cbpWell, glhf
14:16bitemyappseangrove: https://news.ycombinator.com/item?id=6663133
14:16bitemyapp`cbp: try to push frequently so I can jump in please. :)
14:17`cbpokies
14:19seangrovebitemyapp: This looks interesting, but I doubt I'll have time for it in the near future, working on getting our new product out
14:20bitemyappseangrove: just putting stuff in your universe, you obviously will organize the orbit of planetoids yourself :)
14:20bitemyappseangrove: good luck on the new product! (what is it? can you say?)
14:20seangroveYou still working on simonides
14:20seangrove?
14:20bitemyappYeap.
14:20seangrovebitemyapp: Yeah, will demo it to you sometime this week or next
14:20seangroveWouldn't mind getting some additional feedback
14:21bitemyappOh that's exciting. I look forward to it :)
14:21seangroveBookmarked this, will put it on my kindle and read through it on the bus
14:23bitemyappseangrove: might be a rough read in that context, having a ghci console handy is pretty necessary I think.
14:23bitemyappunless you already know Haskell pretty well
14:24seangrovebitemyapp: Got it, will rethink that strategy then.
14:25seangroveffs, does every js library have to grab multiple global bindings?
14:31luxbockhmm, I wonder why core.matrix has set-row but no set-column
14:32bitemyappluxbock: I suspect that would be rather slow.
14:32bitemyappluxbock: core.matrix isn't a column store :P
14:32bitemyappbut I might be wrong.
14:33luxbockI'm doing the Coursera ML course and doing the excercises in both Octave and Clojure
14:33luxbockadding columns was the first thing I couldn't figure out how to do
14:37SegFaultAXI wouldn't characterize core.matrix as a "store" of any kind.
14:37`cbpbitemyapp: Ok we pass tests now
14:37SegFaultAXBut yea, the point remains that it likely uses a row-oriented representation.
14:37bitemyappSegFaultAX: you put it better, thank you.
14:37SegFaultAXRow by column vs. column by row.
14:38bitemyapp`cbp: oh wow, you got those tests passing in a hurry.
14:38bitemyappwell damn.
14:38bitemyapphaha @ rr
14:39`cbpbitemyapp: Just some weirdness with group-by and set-intersection
14:39luxbockany 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:39joinrwhy is there a "name?" parameter in the fn special form? I thought fn was for anonymous functions.
14:40luxbockI guess I can always do (-> M transpose (set-row x [:a :b :c]) transpose) if I really need it
14:41SegFaultAXThat would be quite expensive indeed for even moderately large matrices.
14:41coventryI 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:42SegFaultAXcoventry: Rows, sure. Columns is what luxbock wants.
14:42coventrysorry, s/rows/columns/, as in numpy.
14:42bitemyappluxbock: are you going to be doing a ton of modification to mostly columns?
14:42luxbocknot yet, now I'm just watching an Octave basics video and following along :)
14:43bitemyappwell, just skip it for now then.
14:43bitemyappunless you really want to make a rabbit-hole out of it.
14:43SegFaultAXluxbock: You could always reach out to Mike directly, or post something on the mailing list (he's super active there and on SO)
14:45luxbockI think I should probably finish this course before I go asking around for features that I have no clue how to use :)
14:46bitemyapp`cbp: it seems the examples in the README should be fixed to use (run conn) as the terminal form?
14:46SegFaultAXhttp://typicalprogrammer.com/abject-oriented/ hhhehehe
14:46bitemyapp`cbp: I think users might be confused when (-> (r/db "test") (r/table-create-db "authors")) doesn't immediately return results.
14:46mtpi'm a fan of that coinage
14:46SegFaultAXbitemyapp: Whatcha doin?
14:46SegFaultAXmtp: AOO?
14:47`cbpbitemyapp: Ok I'll modify them
14:48bitemyappSegFaultAX: https://github.com/bitemyapp/revise/ shit works yo
14:48bitemyappSegFaultAX: `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:48bitemyappHe did all the real work and API design.
14:48mtpSegFaultAX‘ abject-oriented
14:49SegFaultAXmtp: Heh, yea. Me too! :)
14:49mtpi have been using those words for a while
14:50SegFaultAXmtp: It would not be possible to use a language like Clojure under AOO.
14:50bitemyapp`cbp: I'm moving the work to master
14:51`cbpbitemyapp: Ok
14:51bitemyapp`cbp: I'll pull the changes into master and send them up, you should switch over too
14:51SegFaultAXYou just couldn't generate enough code relative to eg Java, C++, or even Scala.
14:51bitemyappthis is mainline now
14:54bitemyapp`cbp: everything is on master now.
14:54marcopolo2Can I extend clojure's datastructures to fit my protocol?
14:54bitemyappI'll fix the stoopid dissoc-in.
14:54`cbpokies, I'm trying to make the time stuff pass
14:55SegFaultAXmarcopolo2: As in extend a protocol over a regular map? No.
14:55SegFaultAXYou'll have to introduce a new type for that.
14:55bitemyappbitemyapp.revise.connection> (dissoc-in {:waiting {0 1 2 3}} [:waiting 0])
14:55bitemyapp{:waiting {2 3}}
14:55bitemyapp`cbp: ^^ seems fine to me?
14:55marcopolo2SegFaultAX: thanks
14:56`cbpbitemyapp: if it doesn't eat the key '1' sure :-p
14:56bitemyapp`cbp: 1 is a value, not a key.
14:56`cbpbitemyapp: er ignore that
14:56bitemyapplol ^_^
14:58bitemyapp`cbp: is it safe to say the overall design of the query API is stable at this time?
15:00biggbearnot-related: any one knows how it works that tor hiddes services?
15:00`cbpbitemyapp: Yeah, but then again I still have to do some "real world" tests
15:00bitemyapp`cbp: modulo the stuff that doesn't have passing tests yet?
15:00`cbpbitemyapp: modulo?
15:00seancorfieldi hadn't realized the strength of feeling against private in (some parts of) the clojure world :)
15:01bitemyapp`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:01bitemyapp`cbp: I'm labeling the library as alpha-grade. Satisfactory description?
15:02SegFaultAXseancorfield: What was the tl;dr?
15:02`cbpbitemyapp: sure. The failing tests are already commented out though :-P
15:02bitemyappI know that :P
15:05`cbpbitemyapp: 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:07bitemyapp`cbp: sure, checking to see how to add people
15:07bitemyappah okay.
15:08bitemyapp`cbp: do you have an account on clojars?
15:08bitemyapp`cbp: and do you have your gpg stuff setup?
15:08`cbpbitemyapp: yeah
15:08bitemyapp`cbp: basically, whichever one of us does the first deploy, owns the app/group
15:09bitemyapp`cbp: and that'll be "revise" based on the unqualified name in the project.clj
15:09bitemyapp`cbp: so whoever does that, needs to add the other to the clojars group.
15:09bitemyapp`cbp: do you want to do the first one?
15:09`cbpbitemyapp: yeah
15:09bitemyapp`cbp: k, it should be ready for pushing if you pull from master.
15:09bitemyappthis is version 0.0.2
15:10`cbpbitemyapp: ok
15:10bitemyapp`cbp: what's your account name?
15:10`cbpbitemyapp: cbp
15:10bitemyappI created the group "revise" and added both of us.
15:10bitemyapp`cbp: push 'er up. :)
15:10bitemyappI'm going to make tea.
15:20`cbpbitemyapp: It works!
15:21`cbpbitemyapp: Just gonna clean make the docs presentable now.
15:22blrquery 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:26bitemyapp`cbp: awesome :)
15:26bitemyappblr: depends on what you're doing. That's common in Pedestal but I wouldn't personally do it.
15:26SegFaultAXblr: I think so, yes. IMHO that has nothing to do with Clojure[script] in particular.
15:26SegFaultAXI think architecturally it's usually beneficial to keep your view layer completely decoupled.
15:26blrsee, two conflicting suggestions! :)
15:27bitemyappThe point I would make is that you can have a decoupled view layer without having to maintain two project.cljs
15:27bitemyappI also like the idea of having atomic commits that cover frontend and backend simultaneously, at least until the project gets truly complex.
15:27blryeah 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:28blrbitemyapp: fair enough, can always move the frontend into a new project later if necessary
15:28SegFaultAXBy the time it gets "truly complex" you're already well beyond the point where you could easily decouple them.
15:29bitemyapprelying on separate projects to maintain decoupling is a blunt instrument.
15:30SegFaultAXMaybe if the overhead for multiple projects was very high, which it isn't in Clojure (and many other dynamic languages)
15:32blrSegFaultAX: I guess my only concern is functional/integration testing, but presumably I could write a lein task that would work across multiple projects
15:36bitemyappblr: can you?
15:36SegFaultAXblr: I mean, that's a problem whether they are separate or not. You still need to provide the front-end mock data.
15:36blrwell, I don't know tbh bitemyapp
15:37bitemyappI don't think that's an official thing.
15:37bitemyappyou might be able to make the frontend app depend on the backend app and expose something that will let you fire it up
15:37bitemyappbut that's extra work.
15:37seancorfieldSegFaultAX: 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:38bitemyappif it really needs to be un-fuck-with-able - use closures, not a private var.
15:38bitemyappthis 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:38blrSegFaultAX: 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:38seancorfieldbitemyapp: yeah, i can see why private atoms etc are bad (even tho' i use them sometimes)
15:38bitemyappblr: anything is possible, it's just a question of friction.
15:39seancorfieldand for functions there's no real point to having private functions if they're pure
15:39SegFaultAXblr: And what's stopping you from doing that?
15:39seancorfieldand if you have impure functions, you have other problems :)
15:39SegFaultAXblr: More to the point, what does that have to do with keeping the fe/be code separate?
15:39bitemyappSegFaultAX: they just want to know they're not walking into a bear-trap.
15:39seancorfieldunfortunately i deal with a LOT of database updating code so my life isn't quite that simple
15:39SegFaultAXbitemyapp: Ok, but the line of questioning makes no sense.
15:40BAMbandaIs 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:40SegFaultAXEspecially 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:40bitemyappseancorfield: the point is to separate the pure and impure parts.
15:41seancorfieldbitemyapp: 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:41SegFaultAXseancorfield: 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:41bitemyappseancorfield: if it's a "tricky" app then it would behoove you to be more careful, not less.
15:42BAMbandathe firefox extension directory structure is also different than whats produced by leingen
15:42bitemyappseancorfield: 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:42bitemyappsame sort of work*
15:42bitemyappDeeply skeptical.
15:42seancorfieldbitemyapp: yeah, don't start lecturing me on that sort of stuff :)
15:43bitemyappLike one step removed from my status as an atheist.
15:43bitemyappseancorfield: I'll leave you alone, just expressing reservations.
15:44SegFaultAXIf you're using a PLOP database, some non-trivial aspect of your application will depend on the mutable mud ball.
15:44BAMbandabitemyapp, do you think its possible to port my firefox extension over to clojurescript?
15:44seancorfieldbitemyapp: 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:45bitemyappseancorfield: I'm not so sure.
15:45SegFaultAXseancorfield: Needs more monads.
15:45bitemyappwhat SegFaultAX said, actually.
15:45bitemyappbut I'm thinking in general of declarative ways of describing computation.
15:45seancorfieldyes, and i appreciate the clarity that approach can bring sometimes
15:46SegFaultAXseancorfield: Have you looked at synthread?
15:46seancorfieldbut sometimes an imperative flow is just easier to understand
15:46bitemyappthere's no one approach being described, more the effort to improve how we do our work.
15:46bitemyappseancorfield: I would disagree.
15:46seancorfieldi know you would - we'll just have to agree to disagree
15:47bitemyappseancorfield: 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:47bitemyappand ultimately, the real complexity limitations of a project have more to do with the latter and less to do with the former.
15:47bitemyappnot to mention maintainability.
15:48seancorfieldamit 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:49SegFaultAXseancorfield: Which UG?
15:49bitemyappone flawed implementation doesn't define the entirety of what's possible.
15:49seancorfieldyou're free to argue that he doesn't know what he's talking about of course :)
15:49bitemyappSegFaultAX: http://www.cs.cmu.edu/~rwh/courses/hott/
15:49bitemyappseancorfield: don't argue from authority, it demeans both of us.
15:49seancorfieldyou just did the same tho' with harper :)
15:50bitemyappsorry, Harper?
15:50seancorfieldthat course
15:50coventryBwahaha. "Pot to kettle: You are BLACK! BLACK, I SAY!!"
15:50seancorfieldprecisely
15:50bitemyappseancorfield: er, no. I was offering something inteesting to SegFaultAX
15:50bitemyappseancorfield: it had nothing to do with our conversation.
15:50seancorfieldanyway, i think you're too dogmatic
15:50bitemyappseancorfield: so no, it isn't comparable.
15:50SegFaultAXseancorfield: I've been looking for a Clojure user group, is there one around here?
15:50seancorfielddefine "here"
15:51SegFaultAXseancorfield: You're in the bay, I thought.
15:51bitemyappseancorfield: 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:51seancorfieldyes, there are monthly meetups in both San Francisco and San Mateo
15:51seancorfieldand a monthly dojo in San Francisco as well
15:51bitemyapppopularizing article for "blub programmer": http://www.paulgraham.com/avg.html
15:51bitemyappSegFaultAX: the dojo is where we did the gilded rose exercise.
15:51seancorfieldbitemyapp: i'm not disagreeing with you on the overall principles or approach
15:51bitemyappat ThoughtWorks
15:52SegFaultAXseancorfield: On meetups?
15:52seancorfieldyes
15:52SegFaultAXseancorfield: Cool, thanks.
15:52seancorfieldharper does that existential types blog... he's a bit... pompous...
15:52SegFaultAXI looked about a year ago and didn't find many Clojure specific meetups.
15:52seancorfieldand very dogmatic
15:53seancorfieldthe bay area clojure meetup has been around for several years
15:53seancorfieldi've been running it for two years!
15:53`cbpbitemyapp: have you contacted the rdb guys?
15:53SegFaultAXHmph. Maybe I just missed it then :)
15:53seancorfieldat the least the SF arm
15:53`cbpbitemyapp: btw I updated the readme with your suggestion
15:53bitemyapp`cbp: not yet, about to.
15:53seancorfieldhttp://www.meetup.com/The-Bay-Area-Clojure-User-Group/
15:54SegFaultAXseancorfield: I was thinking about trying to start up an East Bay arm. EBCUG
15:54bitemyappSegFaultAX: population: 2
15:54bitemyappSegFaultAX: you don't have to organize an east bay CUG, you can just invite me to a meal you know.
15:54SegFaultAXbitemyapp: That's why I haven't yet. Thee has to be at least ONE other clojure hacker in Walnut Creek.
15:54bitemyappbe the same result either way ^_^
15:55SegFaultAXThere*
15:55bitemyapp(I keed, I keed)
15:55seancorfieldpopulation: 3 at least
15:55seancorfieldI'm in Castro Valley
15:56SegFaultAXMaybe I should make it more general, EBFPUG
15:56SegFaultAX(Functional programming UG)
15:56seancorfieldand be overrun by smug Haskell weenies? (joking!)
15:57`cbpbitemyapp: which version of rdb are you using?
15:57SegFaultAXOr worse, start an all out war between Scala AND Haskell weenies.
15:57bitemyapp`cbp: I dunno. A reasonably recent one.
15:58bitemyapp`cbp: I emailed the founder of RethinkDB and cc'd his private email.
15:58bitemyappI'll let you know if he responds.
15:58`cbpbitemyapp: nice, thanks
15:58bitemyapp`cbp: also I'm joining #rethinkdb - do you want to announce the library in the channel?
15:58seancorfieldwould Scala devs actually attend a Functional Programming User Group I wonder? :)
15:59bitemyapp`cbp: I think you should.
15:59`cbpbitemyapp: ok
15:59bitemyappseancorfield: nah, too much var.
15:59SegFaultAXseancorfield: Sure they would.
15:59SegFaultAXAs long as I sell it as an OOP-friendly environment.
15:59bitemyappLOL
16:00bitemyappStart FP user group, turns out to be a trap for sacrificing OOP coders to Ba'al.
16:00SegFaultAXI'll put one of these signs outside: http://chickenmonkeydog.com/wp-content/uploads/2009/02/safe-place.jpg
16:01seancorfieldlol
16:01seancorfieldok, my curry glands are empty and need to be refilled... off to Aroma for lunch!
16:01SegFaultAXI see those signs all over the place around here, particularly near the fire stations.
16:01SegFaultAXBut they're kinda... creepy.
16:01teslanickClojure 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:02bitemyappSegFaultAX: what do they mean?
16:02SegFaultAXbitemyapp: ... that it's a safe place
16:03SegFaultAXI assume that means if your car breaks down or you're fleeing from an attacker of some kind.
16:03SegFaultAXPirates, zombies, the works.
16:03coventryteslanick: What are the drawbacks with your current approach?
16:03bitemyappSegFaultAX: if you carry the means to protect yourself, everywhere you go is a safe place, no?
16:03bitemyappI think I prefer the portable version. Can I get that sign as a t-shirt?
16:03SegFaultAXbitemyapp: Nice try, NSA.
16:03bitemyappLOL
16:04teslanickI'm not familiar enough with the collection functions to know which ones I need to use.
16:04teslanickI'm rubbing sticks together and no sparks are coming out.
16:04coventryteslanick: It's hard to know which way to point you without a clearer idea of where you're trying to go.
16:04bitemyappcoventry: no, this is doable.
16:05bitemyappteslanick: you want to make incremental/compounding changes to the collection, right?
16:05bitemyappteslanick: so conceptually you want to shift items in the vector around by the index mapping and compound those changes?
16:05SegFaultAXThis is easy, just sort by desired index, them map the vector over the current indices.
16:05bitemyappteslanick: what you want is reduce, you'll reduce over the mappings and "carry" the vector getting changed.
16:06teslanickbitemyapp: Not sure what you mean by "compounding"
16:06bitemyappteslanick: meaning you want to carry the changes from one iteration to the next, not "forget" them or just map them.
16:06bitemyapp,(map #(+ % 1) (range 10))
16:06clojurebot(1 2 3 4 5 ...)
16:06bitemyapp,(reduce #(+ % 1) (range 10))
16:06clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: sandbox$eval61$fn>
16:06bitemyapp(reduce + (range 10))
16:06bitemyapp,(reduce + (range 10))
16:06clojurebot45
16:07bitemyappyou get the idea.
16:07bitemyappteslanick: above, the result of addition is getting "carried" forward as it iterates through (range 10)
16:07teslanickI do. I think I can triangulate a path forward. :)
16:07bitemyappteslanick: this is fundamental to the nature of folds in general.
16:07bitemyappteslanick: cool, have fun :)
16:07bitemyappteslanick: conceptually reduce in Clojure is left fold with "reduced" for short-circuiting.
16:07bitemyappyou can accomplish most of what you could conceivably want to do just with that.
16:09SegFaultAXThat's a weird way to describe reduce.
16:09bitemyappSegFaultAX: I have weird folksy ways of framing these things in my head.
16:10SegFaultAXbitemyapp: Well I mean, you're assuming the listener already knows what a fold is.
16:10teslanickI'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:10bitemyappSegFaultAX: listener knows because I'd already explained reduce. the "carrying forward"
16:10bitemyappteslanick: that's the epiphany you needed. reduce is the general-purpose toolkit for processing collections.
16:10SegFaultAXbitemyapp: Sure, but that's also weird.
16:11bitemyappteslanick: left folds with short-circuiting are almost universally applicable. You can implement map, filter, and everything else with just Clojure's reduce.
16:11SegFaultAXbitemyapp: What do you mean by short-circuiting in this context?
16:12sverihi, 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:12bitemyappSegFaultAX: (reduced ...)
16:12bitemyappSegFaultAX: haskell's foldr
16:13arrdemsveri: &(println "\"foo\"bar")
16:13sveriarrdem: thanks, that & is important?
16:14arrdemsveri: no, the & was a failed attempt to get lazybot to print the result. the \" is the escape you want.
16:14sveriarrdem: ok, good to know
16:14sverithanks once more
16:37pyrtsaIs there a recommended way of dealing with <, >, <=, min, max and the like when the arguments are not Numbers but Comparables?
16:38pyrtsaI.e. which wheel am I reimplementing if defining my own?
16:39jared314pyrtsa: have you looked at Numbers.java yet? https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Numbers.java
16:40ziltiIs 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:40ziltiAll type hints are set correct
16:41pyrtsajared314: 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:41pyrtsa(I mean, that I did already. Now thinking whether there was a Better Way™.)
16:41jared314pyrtsa: oh ok, that is different
16:42pyrtsa(< (compare a b) 0) is a bit clumsy.
16:42pyrtsa...Let alone when there are more arguments, like (< x y z ...) allows.
16:43brehautit may just be easier to write a reduce
16:43brehaut(reduce (fn [a v] (<' a v
16:44jared314there used to be a contrib that did that
16:44brehaut)) …)
16:44pyrtsabrehaut: Sure.
16:46brehautpyrtsa: simply because all that stuff is not overloadable
16:46pyrtsabrehaut: So do you confirm my guess that there's no True Right Way™ to compare e.g. dates.
16:46brehautpyrtsa: not with < and java.util.catastrophy.Date
16:47brehautpyrtsa: clj-time (which is built on joda) does have a function for you
16:47pyrtsaHeh, 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:48brehautpyrtsa: be as it may, < and > work on numbers (just by lookingat the source in core and clojure.lang.Numbers
16:48pyrtsa(after? a b) vs. (>' a b)
16:49brehaut,(< 1 "foo")
16:49clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number>
16:49pyrtsabrehaut: 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:50pyrtsaIMO, clj-time.core/after? and clojure.core/compare don't make it easy per se.
16:51brehautpyrtsa: 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:51brehautpyrtsa: the primative / object seperation is both annoying and a performance tool
16:51pyrtsaCool. Makes sense.
16:51brehaut(primatives are always basically monomorphic)
16:51pyrtsaYeah, I'm leaning towards it being annoying. :)
16:51brehaut(or have very fixed morphism)
16:52brehautpyrtsa: yes. however clojure is a dynamically typed systems programming language, not a scripting language
16:52mtpi find that distinction to be practically useless
16:52mtpand so i try not to make it
16:53jared314pyrtsa: you could use with-redefs and replace them
16:53brehautmtp: its pretty simple: the later will make compromises for convenience at the expensive of just about anything else, the former often wont
16:53jared314pyrtsa: nm that doesn't work
16:54brehautmtp: now, if thats a distinction that doesn't matter for your work then fine, that works for you
16:54pyrtsaI 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:54mtpbrehaut‘ 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:55pyrtsaWas just thinking whether that was already implemented somewhere that I would reuse.
16:55brehautmtp: 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:55brehautmtp: likewise clojure isnt intended to displace ruby, its intended to replace java
16:56brehautmtp: and fine grained distinctions is why there are hundreds of programming langauges, not 3
16:56pyrtsabrehaut: And it will. Especially with the help of core.typed.
16:56pyrtsa(I seriously can't think of Clojure as a systems programming language without more static typing aid.)
16:56brehautpyrtsa: for a certain category of programmer anyway
16:58brehautpyrtsa: as much as i like core.typed (and i like it a lot), types are not the sole tool for reasoning about code
16:59brehautpyrtsa: fwiw i value referential transparency far more than types
16:59pyrtsaOf course not. But it's crazy how many bugs I wouldn't just ever have created in Clojure with static typing in place.
16:59pyrtsabrehaut: Me too.
17:00brehautpyrtsa: 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:01pyrtsaI meant regression bugs. ;)
17:08BAMbandaI 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:08BAMbandaand nothing else...
17:08BAMbandaI was expecting atleast a console.log from (.log js/console "test")
17:43yeoj___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:43yeoj___posted here (again) https://www.refheap.com/20437
17:47seancorfieldyou're using :as-arrays? which isn't lazy
17:48seancorfield:as-arrays? true forces the result set to be realized as a single vector of row values
17:49seancorfieldin general, java.jdbc/query is deliberately not lazy: it opens a connection, runs a query, and closes it
17:50seancorfieldthe "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:50bitemyappoh, this again.
17:50seancorfieldthink of query as a sort of "map" or "doseq" function in and of itself
17:51bitemyapphttp://book.realworldhaskell.org/read/using-databases.html
17:51bitemyappthey have some neat patterns for lazy querying.
17:51bitemyappmight be worth thinking about.
17:52yeoj___hmm. ok.
17:52yeoj___maps aren't super handy for writing csv files
17:52yeoj___because order doesn't mean anything it seems
17:52yeoj___thats why i needed something like :as-arrays
17:53yeoj___bitemyapp: i'll read up on that also.
17:53yeoj___if i figure this out ever i'll replace all my jython stuff
17:53seancorfieldyeoj___: i'd strongly recommend passing your processing logic is as your row-fn then
17:53tbaldridgeyeoj___: 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:53bitemyappyeoj___: there are sorted maps, but really, most people use vectors of vectors for csv.
17:54yeoj___tbaldridge: it's for a sort-of etl tool
17:54yeoj___i might be able to query the table to get the ordinal
17:56yeoj___with :as-arrays? true omitted it still runs out of heap
18:01ubikationdoes 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:01ubikationhere is my test xls file: http://www.google.com/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=1&amp;cad=rja&amp;ved=0CCwQFjAA&amp;url=http%3A%2F%2Fbase.google.com%2Fbase%2Fproducts.xls&amp;ei=rNV2UrS7M8iZjALMpYDIAQ&amp;usg=AFQjCNG14jmUqPAYkIeHk284qD-Zc8ZejA&amp;sig2=3tMgJ0tYaqLIPoMahDr3IQ&amp;bvm=bv.55819444,d.cGE
18:01ubikationsorry: base.google.com/base/products.xls
18:02bitemyappyeoj___: I bet you could make a lazy wrapper for JDBC using pagination and chunking!
18:02bitemyappyeoj___: how cool would that be?
18:02yeoj___bitemyapp: i think the issue might be with postgres.jar jdbc driver
18:03yeoj___bitemyapp: it's amazing... i wonder how projects like kettle and talend do it.
18:03yeoj___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:04yeoj___i.e. top 100 or limit 100 or fetch first 10 rows only
18:04yeoj___i have a monetdb data set somewhere around, i'm going to see if it explodes with that too.
18:05yeoj___i've tried visual vm also, but am not really sure what/where i should be looking
18:05seancorfieldquery is the only piece that makes the overall result non-lazy
18:05ziltiAnd here's the first working version of my ClojureFX lib: https://github.com/zilti/clojurefx
18:06seancorfieldif 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:10seancorfieldI 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:10yeoj___bitemyapp: doseq doesn't make it blow... it's something about with-open that is caching it.
18:14yeoj___korma has a function called with-lazy-results that sounds interesting
18:15bitemyappyeoj___: *cringe*
18:15bitemyappyeoj___: let me know if it works for you ^_^
18:16yeoj___i don't want korma... i just want that function. I don't think a tool for database folks needs orm.
18:16bitemyappyeoj___: Korma ain't an ORM.
18:16bitemyappit just generates queries.
18:17yeoj___bitemyapp: why does it have log4j in there then?
18:17indigoFor logging? :P
18:17yeoj___it seems overkill for me.
18:17yeoj___i don't understand why that's bundled
18:17bitemyappyeoj___: you're touching on issues that are near and dear to my heart, but I didn't make those design decisions.
18:17`cbpconnection pooling is also bundled :P
18:17bitemyappyeoj___: but Korma is most assuredly not an ORM and logging doesn't make it one.
18:18bitemyapp`cbp: god dammit don't encourage him.
18:18yeoj___lol
18:18bitemyappI would like to believe Revise is more representative of how I think db drivers should work ;_;
18:18tbaldridgedefine ORM and then you'll understand why it isn't one
18:18bitemyapptbaldridge: thank you.
18:18yeoj___it's a 'lets take structure query langugae' and make a 'structured query language'
18:18indigoOh dear
18:19yeoj___i guess i called it an orm because i don't like orms
18:19yeoj___lol
18:19tbaldridgeI mostly say that because I utterly despise ORMs
18:20bitemyappI'm not a fan of object-mutation soup -> database bridges either. So it's a good thing Korma isn't that.
18:20tbaldridgethat's not to say I don't have my own issues with Korma :-)
18:21bitemyapptbaldridge: 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:21bitemyappthe 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:22bitemyappso in the absence of some evidence of "demand", I'm not going to allocate the labor.
18:22bitemyapptbaldridge: what would you improve?
18:26tbaldridgeI 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:27tbaldridgeQuery helpers may work well for others, but I more often than not don't need it.
18:29bitemyapptbaldridge: sensible. The part of Korma I find useful is the composability, not the "helper" bits.
18:30seancorfieldhmm, 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:32seancorfieldthat 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:34yeoj___seancorfield: that sounds nice to me... but i probably don't understand all implications.
18:43BAMbandahow come :output-to "~/Desktop/file.js" does not create a file there even though lein is reporting a successful compile?
18:45mtpit probably doesn't do ~-expansion
18:45BAMbandaso it can only output to directories thats in the same level as project.clj?
18:46ivanwhy does https://github.com/juxt/jig use classloaders?
18:46ivandoes it provide some advantage with Java dependencies?
18:48ivanhm, I guess tearing down a classloader is more reliable than (refresh)ing to a new version
18:57ubikationwell 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:59seancorfieldyeoj___: http://dev.clojure.org/jira/browse/JDBC-72 (and others who care about java.jdbc and laziness and as-arrays?)
19:00bitemyapparrdem: http://www.haskell.org/haskellwiki/All_About_Monads
19:06concurhey
19:07concurI need a little guidance on where to start on an assignment
19:07bitemyappconcur: probably with either reading or writing.
19:07concurI need to implement a readers-writer locking mechanism
19:07concurlol
19:07llasramIn Clojure?
19:07concurwell
19:08concurthe assignment is in any JVM language
19:08joinrubikation: I saw the code. what kind of error is spewing
19:08concurI'm using clojure
19:08ubikationno error. It's just not writing to the file.
19:08joinrubikation: that's because you're working with a spreadsheet object in memory
19:08ubikationso how do I write it?
19:08llasramconcur: Well, what sort of guidance do you need?
19:09concurI'm trying to figure out how to make a thread wait in a queue
19:09llasramSame way you would in Java
19:09ubikationsave-workbook... sorry about that.
19:09ubikationI guess I was just really impatient when I was trying to get it to work.
19:09joinrubikation: 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:09concurI'm trying to use semaphores and a queue of waiting-readers and waiting-writers
19:10concurbut I'm not sure exactly what to put in those queues
19:10concurI tried doing something with .wait and .notify
19:10concurbut I can't figure out how those work in clojure
19:10arrdembitemyapp: pushing reading stack...
19:10yeoj___seancorfield: wow great thanks.
19:11concurand the internet doesn't seem to have much on how that works
19:11llasramconcur: Well, that's a reasonable question, but really does yield the answer "same as you would in Java"
19:11llasramYou can call the `(.wait obj)` method for any Object `obj`
19:12llasramAnd then `(.notify obj)` that same `obj` later to wake up one of the waiting threads
19:12llasramJust like you would from Java
19:12concurI've never done this in java either, just seen examples, so it's still a bit vague to me
19:12concurwhat exactly should I be using for obj?
19:13concurthe thread itself?
19:13concursomething else?
19:13cYmenHm...is "remove" like "filter" with a built-in "not"?
19:13llasramAnything -- an oddity of the JVM is that everything has a "monitor" you can use as a mutex or condition.
19:14llasramconcur: But this really is general JVM stuff. Sounds like what you're probably supposed to figure out for your assignment :-)
19:14concurthe assignment is really about performance testing mine vs a JVM implementation
19:14concurbut yeah, that's part of it too
19:15llasramcYmen: Pretty much
19:15cYmenllasram: thanks
19:16concurI really wish I had done more of this assignment weeks ago :S
19:16concurI wrote an optimistic read lock at first, which seemed to work ok
19:16llasramHaha. Said pretty much every student ever
19:17concurand was going to write another mechanism that would switch between the orl and some less optimistic lock
19:17brehautexcept for students with graphics programming assignments
19:17concurwhen appropriate
19:17concurbut I gave up on that
19:17concurespecially after I did more extensive testing on my lock and found it didn't work
19:18llasrambrehaut: Actually, I recall procrastinating pretty long on the game I wrote for my undergrad computer graphics class :-)
19:18brehautllasram: you were both doing undergrand more right and less right than me :)
19:20llasrambrehaut: heh
19:20concurnow, wait() and notify() are only allowed in synchronized methods in java, right?
19:20concurhow does that translate to clojure?
19:20brehautconcur: you are going to trust randoms on IRC about that over just reading the javadocs?
19:20joinrif the assignment is java agnostic, and you're using clojure, can you simulate a lock with a clojure primitive? like an agent
19:20concuryeah
19:20concurI can pretty much do whatever I feel like
19:21concuras long as sometimes it's read-only and other times write-only
19:21concurI was trying to think of ways to use agents
19:21concurmaybe put agents in those queues
19:21concurreturn the agent to whatever is trying to read/write
19:22concurand then execute the agent when it finally gets dequeued
19:22concurbut I don't really understand how agents work :\
19:22joinragents remind me of mailboxes
19:22joinrthey have a message queue
19:23joinrthey sit on some state
19:23llasramconcur: 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:23joinror they can
19:23joinrso if you have something responding to messages, sitting on state, then it can control the types off access to said state
19:24llasramjoinr, concur: I really don't think agents provide a way to implement a read-write lock
19:25concuragents are meant for asynchronous tasks
19:25coventry,(java.util.concurrent.locks.ReentrantReadWriteLock.) :-)
19:25clojurebot#<ReentrantReadWriteLock java.util.concurrent.locks.ReentrantReadWriteLock@13fbf24[Write locks = 0, Read locks = 0]>
19:25concurand read-write locks are more for synchronous tasks
19:25llasram(inc coventry)
19:25lazybot⇒ 4
19:25llasram:-)
19:25concurwhich is what made me doubt using them
19:25concurI'll probably use a ReentrantReadWriteLock for the builtin lock I performance test against
19:26llasramconcur: Indeed. Clojure's reference types are all about *non-locking* concurrency. It's a total mismatch
19:26concurbut I need to devise something of my own
19:26concuryeah
19:26concurclojure is probably a bad choice for this assignment
19:26llasramI think it's a perfectly reasonable choice
19:26joinrif 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:26llasramYou'll just end up writing pretty much the same code you would in Java
19:27llasramOnly using using Clojure s-expressions
19:27joinrperformance aside, I don't see why you can't simulate a lock using an agent.
19:27llasramBut I still count that as a win :-)
19:27concurwell, at least idiomatic clojure is a bad way to do this assignment
19:27llasramjoinr: How is a raven like a writing desk?
19:27ubikationjoinr: thank you so much! Your help is most appreciated.
19:28concuris there anything that explains clojure's reference types more in-depth than the stuff on clojure.org?
19:28joinrubikation: no problem
19:28concurand gives more examples?
19:28concureverything I read on there is so vague to me
19:29llasramjoinr: 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:29danielszmulewiczconcur: the chapter in the book joy of clojure is pretty good and comprehnsive
19:29llasram(inc danielszmulewicz)
19:29lazybot⇒ 1
19:29concurthanks
19:29llasram/JoC/ is great
19:30joinramit's book is better for you I think.
19:30llasram /Clojure in Action/?
19:30llasramUm
19:31llasramWriting a book is hard, but I was seriously disappointed by that text
19:31llasramIt's out-of-date, superficial, and poorly structured
19:31llasramI do not recommend it
19:34RaynesClojure Programming is a good book.
19:34concurI'm taking a look at JoC right now
19:34bitemyappI agree with Raynes.
19:34bitemyappRaynes: you have no reason to continue using MongoDB now: http://github.com/bitemyapp/revise/
19:34concurI wish I could just pause time for a week
19:34concurand read this entire thing
19:35bitemyappconcur: that's grad school.
19:35Raynesbitemyapp: Exactly that it works and moving over is work.
19:35bitemyappRaynes: well, for new projects maybe?
19:35RaynesSure.
19:35bitemyappyay :D
19:35Raynesbitemyapp: Also s/Exactly/Except/
19:35RaynesEXACTLY THAT IT WORKS LOL
19:35Raynes:p
19:36llasramYou're so exacting, Raynes
19:37joinrmy reading sequence went programming clojure, joy of clojure, clojure in action ; did not get around to clojure programming (but it looks good)
19:37concurmy reading has all been clojure.org, stackoverflow, and that one site I can't remember the name of
19:37joinrthat'll get you pretty far actually
19:38joinrlots of good blog posts too
19:38joinractually, reading source is pretty killer
19:38concura lot of my questions go unanswered though
19:38joinrgithub
19:38llasramconcur: What questions go unanswered?
19:38bitemyappI need to start using lein-pedantic.
19:39concurI forget exactly what questions have come up
19:39concurbut I've just had a lot of vague understandings of things
19:39llasramMakes it a bit difficult to figure out how to answer them :-)
19:39concuryeah, lol
19:39concurI need to spend more time with IRC open
19:40concurso I can ask them when they come up
19:42concurI feel like the class I'm taking needs to be taken by itself
19:42concurwith no other classes at the same time
19:42concurso much to digest
19:42llasramconcur: Are you a full-time student, or is this a MOOC or such?
19:42concurhaving never written a concurrent program 2 months ago
19:43concurI'm a full-time undergrad
19:43concur17 credits
19:43concurincluding my senior research project in astrophysics
19:44concurit feels like nearly every assignment I've been getting requires me to dedicate an entire week to it
19:44concuralone
19:44concurand no other assignments
19:44concurso everything has been pretty last-minute and not thorough
19:45concursomehow I think I still have an A/A- average this semester
19:45concurI think that's just because my professors are pretty lax graders
19:45brehautconcur: your tutors and lecturers aren't actually expecting perfect code; that would rtequire that this stuff wasn't new to you.
19:45concuryeah
19:45concurso long as the assignment is done on time and works, it's a guaranteed 100
19:46concurand "on time" is a very lax term
19:46concurhe makes it sound like it's due earlier than it really is
19:47concurand as long as you suffer enough, being a little late won't get penalized :P
19:52llasramWell, there is the hypothesis that the primary purpose of college is prove a willingness to suffer while jumping through hoops for social acceptance
19:54cYmenbtw what does this actually mean: java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn
19:54llasram,(1)
19:54clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
19:54llasrami.e., trying to use a number as a function
19:54cYmenah.
19:54cYmenDidn't know what clojure.lang.IFn is.
19:55concurit's the function interface
19:55clojurebotExcuse me?
19:55llasramIt's the JVM interface which makes an object a Clojure function
19:55llasramYeah
19:55concuranything with the "I" prefix is an interface
19:55llasramWell, by convention. Although it's not followed to the letter even with Clojure
19:56llasramWell, in the positive statement I suppose it is at least :-)
19:56concurwhat violates the convention in clojure?
19:56llasramI was being over-broad. Everything that's named IWhatever is an interface. There are just non-I-prefixed interfaces, like Seqable
19:57concuroh
19:59concuris there an idomatic way to block in clojure?
20:00coventryDepends on how you want to block. There's (Thread/sleep 1000) for instance
20:00brehaut@(promise) ;)
20:01dabdhow can I make clojure print a sequence with whitespace as commas so that it prints ["a" "b] as ["a", "b"]?
20:02llasramdabd: I think you're going to need to use something like bbloom's fipp: https://github.com/brandonbloom/fipp
20:03joinryou could manually grunge it with interpose
20:03llasramconcur: 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:11concurso the locking macro is pretty similar to synchronized in java?
20:11llasrams,similar,identical,
20:11llasramGenerate some bytecode, decompile, and compare :-)
20:13concurI see from (source locking) that it's pretty much the same thing
20:15jared314where do I submit issues with one of the clojure contrib projects?
20:15abaranoskyJira somewhere
20:15coventryjared314: http://dev.clojure.org/jira/secure/BrowseProjects.jspa
20:16concurohh, so .wait and .notify just need to be put inside (locking ...)
20:16abaranoskymeanwhile, clone it and deploy your copy, use that... then wait forever for the contrib to be fixed (rofl)
20:16concurI think I'm starting to understand this
20:16llasramconcur: Yes
20:18jared314it's just a wrong version number on the read me. do I have to go through jira for that?
20:18`cbpbitemyapp: you might wanna remove the (experimental) part of the github repo description? :)
20:18llasramjared314: I believe it's up to the individual contrib projects.
20:21jared314llasram: then who is doing the java.classpath contrib project?
20:21abaranoskybitemyapp: looked over Fabric and Cuisine last night. They look promising, certainly I'd push for them over Rex
20:22bitemyappabaranosky: I take it you didn't get my github link?
20:22bitemyapp`cbp: yes sorry
20:22bitemyappabaranosky: https://github.com/bitemyapp/fabric_recipes I put this up after my work on Revise last night.
20:23bitemyappsimplistic and a bit cut-down from my actual day job scripts, but gets the point across methinks.
20:27bbloomdnolen: any word from the mountain tops regarding (catch :default ... ) ?
20:28bbloomyou said that you'd take a patch for that in cljs, but i'm curious about clj/cljs sharing
20:29llasramjared314: I'm afraid that I do not know
20:30abaranoskybitemyapp: thx. nope, didn't get it. I need a way to get offline messages form IRC I guess
20:31coventryjared314: That table I linked before says that Stuart Sierra is the project lead of java.classpath.
20:32jared314coventry: all this work to just tell someone they didn't update their readme
20:33jared314coventry: oh well
20:34coventryI suppose the flipside is that it's a one-time effort to learn to use jira. *shrug*
20:35bbloomlearning jira is not a one time effort :-P
20:35abaranoskybitemyapp: I'm going to share those recipes with the team at work
20:45bitemyappabaranosky: persistent IRC session yo, s'what I do.
20:45bitemyappabaranosky: let me know if they have any questions.
20:45bitemyappI'm off to hoist now.
20:47abaranoskywtt is a hoist?
20:48bitemyappabaranosky: lifting.
20:48jared314bro, do you even hoist?
20:48bitemyapp^^ this guy.
20:49abaranoskyjared314, bitemyapp: hoist... what a great synonym for lift :D
20:49bitemyappabaranosky: I avoid saying lift because it reminds me of monad transformers. Hoist is more specific.
20:49bitemyapp(to my addled mind)
20:49abaranoskyhow about "weight training"
20:50bitemyappthat makes me sound like I go to fat camp.
20:50bitemyappstrength training lends too much seriousness to what I do.
20:51abaranosky well then. Ahoy!
20:52arrdemabaranosky: irssinotifier is pretty osum
20:53arrdemjared314: belated high five
20:54arrdembitemyapp: got real indian food, the korma was underwhelming
20:54abaranoskyarrdem: I cannot use non-Emacs solutions it is against my religion
20:54arrdemabaranosky: see.. I run irssi, irssiproxy, and then erc through to that.
20:54arrdemabaranosky: that's how I'm always lurking :D
20:54TimMcarrdem: Make some!
20:55bitemyapparrdem: the fault probably lies in their korma. that's okay though.
20:55bitemyappabaranosky: ZNC + notifier -> erc
20:55abaranoskyarrdem: any links on details of how to set that up?
20:55bitemyappokay, leaving now 4realz.
20:55arrdembitemyapp: gtfo
20:56arrdemabaranosky: yeah it isn't too bad... lemme writeup my config and I'll shoot it to you.
20:56abaranoskyarrdem: that'd rock
20:57arrdemabaranosky: 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:09kovasbhow to make emacs eval echo in the repl buffer?
21:10kovasbi found this http://stackoverflow.com/questions/13103177/nrepl-el-how-to-eval-clojure-buffer-form-to-nrepl-buffer-instead-of-echo-area
21:10kovasbbut it doesn't say how to install those definitions into emacs
21:26concurhey, what would be an idiomatic way of creating a unique, arbitrary object to use as a lock?
21:26llasram,(Object.)
21:26clojurebot#<Object java.lang.Object@105fee0>
21:27concurnice
21:27concurthanks
21:28concurooh, if I put a comma before an expression that bot will evaluate it?
21:28concur, (+ 2 2)
21:28clojurebot4
21:28concur:D
21:29jared314lazybot will do that too
21:29llasramYah, and for lazybot ##"like this"
21:29concur##"like this?"
21:29llasramEr
21:29llasram##(str "like this")
21:29lazybot⇒ "like this"
21:29llasramHa
21:29llasram&(str "or like this")
21:29lazybot⇒ "or like this"
21:29concur##(str "it's gotta be in an S-expression?")
21:29lazybot⇒ "it's gotta be in an S-expression?"
21:29llasramThe ## form you can use ##(str "anywhere")
21:29lazybot⇒ "anywhere"
21:30llasramBut &(str "doesn't work heer")
21:30concurI see
21:30llasramhere, even
21:30jared314what about this?/or that?
21:30jared314nope
21:31concurWill it throw exceptions? ##(/ 1 0)
21:31lazybotjava.lang.ArithmeticException: Divide by zero
21:31concur:)
21:31arrdemabaranosky: bam. http://arrdem.com/2013/11/03/irssi-and-erc.html
21:32arrdemabaranosky: could be better written, but it should help.
21:32namespaceWhat version of clojure does Ubuntu 12.10 ship with?
21:33concurubuntu ships with clojure?
21:33llasramnamespace: Are you building Ubuntu packages, or trying to develop with Clojure?
21:33concurthat's surprising
21:33arrdemnamespace: ship with? it doesn't. clojure 1.4 or 1.5 is in the standard package repos.
21:33namespaceErr.
21:33namespaceNot ship with.
21:33namespaceIn repos.
21:33TimMcHuh, that's new to me.
21:33TimMcThat's through Debian, right?
21:34llasramnamespace: 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:34jared314http://packages.ubuntu.com/quantal/clojure
21:34jared314it exists
21:34xusernamespace: install Java from apt and use leiningen as llasram said.
21:35dav`Whoooa the web frontend to freenode irc is cool..
21:35arrdemnamespace: +1 for leiningen.
21:35arrdemnamespace: don't apt-get install leiningen. do install directly.
21:36jared314use leiningen, because the version in the repos is old
21:36namespaceWell there goes like ten minutes of bandwidth.
21:36dav`I think you can install a newer version of lein from an old one
21:36arrdemdav`: sure but why bother.
21:37sritchiefun thought - wouldn't it be cool if lein could depend on a gist?
21:37sritchieso if someone posts a middleware or something like that with a namespace decl, boom, one could try it out in a project
21:37concurarrdem: because it's better to use your OS's package manager?
21:38jared314sritchie: for project config?
21:38namespaceOkay, how do I "install" this opaque bash script?
21:38concur./script.sh maybe?
21:38arrdemconcur: when you're just gonna type `lein update` and ignore the jar it packeged?
21:38sritchiejared314: well, say someone publishes a clever utility function that's helpful,
21:39arrdems/update/upgrade/
21:39sritchiejared314: and tweets it - you could just pull it in immediately, and you have a versioned single function dependency
21:39sritchiethat's extremely lightweight
21:39concur@arrdem wouldn't apt-get remove at least uninstall it then?
21:39arrdemnamespace: download the leiningen script, chmod +x, ./lein self-install
21:39kovasbsritchie: have a emacs q that maybe u can help with
21:39kovasbsritchie: trying to implement http://stackoverflow.com/questions/13103177/nrepl-el-how-to-eval-clojure-buffer-form-to-nrepl-buffer-instead-of-echo-area
21:39kovasbbut don't know where to put that code..
21:39jared314sritchie: as part of your project?
21:39arrdemconcur: no, because any new jars it pulls down won't be tracked by the package manager.
21:39concurhmm
21:40concurwell that's shitty
21:40xuserconcur: using leiningen built-in update system will probably bork the debian package
21:40concurcanonical should update their repos
21:40arrdemconcur: I just have the lein script in /home/arrdem/bin/, with all the jars in ~/.m2 and ~/.lein.
21:40arrdemconcur: it's my mess and it's in my home.
21:40namespacecanonical doesn't update their repos from what I can tell.
21:40sritchiejared314: yup
21:41concurwell that's partly why I don't use canonical's software :P
21:41arrdemarch linux 4 lyfe
21:41jared314sritchie: that sounds neat, that might go along well with my lein-source plugin
21:41sritchienice
21:41concurI second that
21:41namespaceconcur: Are you telling me to switch to Arch?
21:41concuryes
21:41concurlol
21:41arrdemnamespace: not if this is your first time on linux
21:41sritchiejared314: it's kind of similar to
21:41sritchiehttps://github.com/tobyhede/lein-git-deps
21:41namespaceI would, except that Gentoo and Arch both insist on not working with my Ethernet card.
21:41arrdemnamespace: get like two Ubuntu major versions in first. then think about switching.
21:42namespaceIt's 2013, Ethernet should Just Work (TM).
21:42concurhave you tried arch recently?
21:42sritchiekovasb: I'm not really an emacs-lisp wiz :)
21:42arrdemnamespace: ... mount the arch USB, chroot in and pkgstrap /dev/sda? :D
21:42concuror was it a while ago?
21:42arrdemnamespace: I'm joking. please don't try that.
21:42jared314sritchie: actually, gists are accessible via git
21:42davarrdem: 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:43namespacePlus they didn't sign their packages until very recently, which signals all sorts of bad things about the mindset of the maintainers.
21:43sritchieyeah, so it should be exactly like that - except I think that plugin needs a lein proj at that location?
21:43arrdemdav: that's ... horrifying. all I needed on Arch was the JVM and I was good to go.
21:43xusernamespace: ubuntu is fine, is better if you get familiar with it first, you don't to run arch in production :)
21:43xuser+want
21:44namespace(Speaking of which, leiningen really installs from a shell script over http?)
21:44arrdemhttps I hope..
21:44arrdembut yes.
21:44namespaceNo, I'm pretty sure it's http.
21:45arrdemnamespace: nope https.
21:45namespaceOh good.
21:45arrdemnamespace: and it does aggressive signature checking.
21:45arrdemnamespace: tech knows what he's doing I'm glad to say.
21:45concurI wonder if the NSA injects spyware into every insecure install over http
21:45concurif anybody can, it's them
21:45namespaceconcur: Probably not.
21:46namespaceNot because they can't.
21:46concur...not yet
21:46namespaceBut because it raises the risk of detection by savvy users.
21:46arrdemnamespace: they totally could, I just think they can't be bothered in most cases.
21:46namespaceIt's better to save your badass malware for when you need it.
21:46davarrdem: pretty sure the jvm is a big chunk of these 97 packages
21:46concurpshh, they have the budget to blow
21:46namespaceThat way it doesn't get found by non-targets.
21:46arrdemdav: probably.
21:47davarrdem: actually it's not i just checked
21:47davarrdem: mostly a bunch of java libraries
21:47xuserIn think MITM attacks have been proof on https already
21:48davarrdem: 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:49kovasbsritchie: ah yes in my desperation I've mixed u up with the other sam
21:49namespaceOr to put it another way.
21:49sritchiekovasb: no worries, we all talk -
21:49sritchiewe have a club
21:49namespaceIf you could reasonably assume that the NSA exploited all possible attack vectors.
21:49kovasbheh
21:49arrdemsritchie: your joke is bad. thank you for leaving it hanging.
21:49namespaceSomebody chomping at the bit to see their malware could set up a honey pot using a few boxes.
21:49kovasbah i see tbaldridge is back
21:50sritchiearrdem: haha
21:50kovasbi saw him doing it in the deep walking macro video and was extremely envious
21:50namespaceHaving proof that the NSA is deliberately and indiscriminately infecting US users with malware would be a shit storm.
21:51kovasbtbaldridge: u alive?
21:51namespacePart of the reason they get away with what they do is that they claim it's only targetted at foreigners.
21:52blrgiven the antipathy towards everything that has been disclosed so far, I wouldn't bet on it namespace
21:52arrdemnamespace: stay on topic... not that I disagree with you but this is #clojure not #tinfoil-hats
21:52xusernamespace: they don't have to infect, they already have access to everything ;)
21:52namespacearrdem: I don't think talking about the NSA infecting people with malware is tinfoil hat at this point.
21:53namespaceThough it is possibly off topic.
21:53namespace(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:54AimHereWell by the 1970s, they outlawed half of what the NSA was up to in the '60s
21:54AimHereThey just got 40 years of legal loopholes and secret lawbreaking since then
21:56namespaceWhere does the script install it to?
21:56namespaceI need to alias 'lein' to it apparently.
21:57arrdemnamespace: 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:57davarrdem: I got rid of all of it and things still seem to work..
21:57arrdemthe 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:57arrdembuddies :P
21:57arrdemEOF
21:58arrdemsrreh for ranting.
21:58arrdemdav: yeah leiningen is pretty awesome that way.
21:59arrdemdav: last semester I did a compiler in clojure and my instructions to the TA were "lein install; lein run -03 infile.pas"
22:01davarrdem: you gave him a jar?
22:01concurwriting concurrent code is *haaard*
22:01concurI think I'm just going to work on the other parts of the assignment for now
22:01concurand that way I'll have something to test my read-write lock when it's done
22:02arrdemdav: 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:04davarrdem: I see
22:04namespaceIs there somewhere I can get a brief overview of the JVM so I understand what the heck is going on?
22:06TimMc VisualVM?
22:06arrdem(doc nth)
22:06clojurebot"([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:08namespace(print print)
22:09namespaceIIRC, the last time I tried breaking the bot I managed to get it to print a couple hundred numbers into chat.
22:09namespaceFelt really bad afterwards.
22:10concur(loop [] (print "!!!") (recur))
22:10namespace(-_-)
22:12justin_smith((fn forkbomb [] (println "fork you") [(future (forkbomb)) (future (forkbomb)) (future (forkbomb))]))
22:12arrdem(inc justin_smith)
22:12lazybot⇒ 9
22:12namespaceIt won't let you use functions.
22:12arrdemnamespace: false
22:12namespaceI mean it won't let you use fn.
22:12arrdem,(let [f (fn [x] (+ x 1))] (f 2))
22:12clojurebot3
22:12justin_smith,((fn [] 42))
22:12clojurebot42
22:13namespaceOh god.
22:13concurone of my professors doesn't give a shit about his account on the school's solaris server
22:13concurand made the password abc123 so everybody can use it
22:14concurI'm a little tempted to try starting a forkbomb from it
22:14namespaceconcur: No.
22:14arrdemconcur: don't be that guy.
22:14concurhey, I had the idea half a year ago, and haven't done it yet
22:14concurit would be a lesson in security though
22:14arrdemconcur: 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:15concuryeah
22:15namespaceconcur: Do I need to tell the Stallman password story?
22:15concurI figure they have safeguards
22:15concurand the sysadmin is doug lea
22:15concurwho is more than halfway competant
22:15justin_smithsolaris has good per-user resource management
22:16namespaceI would presume that any university worth it's salt has students try and break stuff all the time.
22:16namespaceHe'd probably see the forkbomb and laugh.
22:16concuryeah
22:17concurwell, I'll be back in a little while
22:18muhoois there a way to partition-by a group of values?
22:18arrdemmuhoo: so partition if the value is a member of a set?
22:18arrdemmuhoo: sets are IFn...
22:18muhooi.e. a seq that is a byte stream, say of packetized data, and i want to partition it by [0x03 0x26]
22:18namespacePlease 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:19justin_smithnamespace: is the lein script in your PATH?
22:19arrdemnamespace: what have you done?
22:19muhooso if there's a stream [0x39 0x21 0x03 0x26 0x83 0xf2...] i want to split t at the [0x03 0x26]
22:19namespacearrdem: Downloaded lein (no file extension), ran it.
22:19namespaceWith privileges.
22:19muhooit's for unframing binary network data. no i am not incontrol of the data an can't use protobufs
22:19arrdemnamespace: okay. "./lein self-install"
22:20namespacejustin_smith: It might not be.
22:20namespaceI'll check.
22:20justin_smithnamespace: no need for priveleges, better to run it as a regular user
22:20arrdemnamespace: "./lein repl" should work now.
22:20justin_smithand it is best to have it in your PATH (I use ~/bin)
22:20arrdem~/bin is best bin.
22:20clojurebotAck. Ack.
22:20arrdemclojurebot: I wasn't talking to you.
22:20clojurebotexcusez-moi
22:20arrdemclojurebot: no.
22:20clojurebotexcusez-moi
22:21namespacearrdem: Do I use the shell script I installed with as my executable?
22:21arrdemnamespace: yep!
22:21justin_smithclojurebot: the stupidest bot says "excusez-moi"
22:21clojurebotIt's greek to me.
22:21justin_smith:(
22:21namespaceOh okay.
22:21namespaceThat explains it.
22:21namespaceThank you.
22:22justin_smithyeah, the script you download is the program (until you make it do a self upgrade and it replaces itself)
22:22arrdemnamespace: 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:39arohneris there a library fn for sugaring reduce, similar to how 'for sugars 'map?
22:39Raynes'for' does a whole lot more than provide syntactic sugar for map.
22:40RaynesIt's a list comprehension.
22:41brehautarohner: loop recur ;)
22:42brehaut(only partially kidding)
22:43arohnerRaynes: I'm aware, but they achieve the same basic goals
22:43arohneralso, I want to avoid nested reduces
22:43brehautarohner: 'for is closer to sugaring 'mapcat than plain map
22:44arohnerfor doesn't concat though
22:44arohneranyways, I'll assume the answer is 'no'
22:44brehautyes, it does
22:44brehautjust not how you think it might
22:45brehautmapcat is bind for the list monad, and list comprehensions are a sugar for the list monad (well, a monad plus really)
22:46brehautanything you could write with for has a mechanical transformation to mapcat if you wanted to do so
22:46brehaut</things i always say>
22:47SegFaultAXIn Scala, for comprehensions are just sugar for map+mapcat+filter
22:48SegFaultAX(flatMap rather than mapcat, but you get the idea)
22:49arohnermy goal here is readability. Obviously it's possible to write this in nested reduces, I'd just rather avoid it
22:50justin_smitharohner: sometimes putting the reduce in a function, then recuring the function helps, if the same reduction should be done at each level
22:50SegFaultAXarohner: Can you give us more information about the general problem you're trying to solve? It might help to frame our responses.
22:50justin_smiths/recur/recursive call
22:51muhooooh, gloss
22:52arohnerI 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:52arohner(reduce (fn [state foo] (reduce (fn [state bar]) (:bars foo)) foos)
22:53arohneroh, and the inner reduce is (update-in [state] ...), using both foo and bar
22:56brehautso [{:foo {:bars […]}} {:foo {:bars […]}} …] -> {? ?}
22:56danlarkinthat seems fine to me, I don't know what more you could hope for
22:56brehautpersonally, i'd wrap up the reduce reduce update-in operation as a new primative that takes the update-in function
22:57brehautin the same way that (frex) map, filter, max, etc can all be written in terms of reduce
23:08concurwell, I'm back
23:08concurfor what it's worth
23:21ravalsCan 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:22jared314ravals: it adds key value pairs to a transient map
23:22jared314ravals: then returns the persistent version of it
23:22amalloyravals: it is incorrect and bad; you should not understand it
23:23amalloyoh, i see, they are pointing out that it's bad. well done
23:23ravalsi'm trying to understand why it only adds key/value pairs up to 7
23:23ravalseven though the doseq has a range up to 100
23:23ravalsi assume this is the reason it is bad :) but why 7? what is going on?
23:23amalloyravals: 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:24amalloyit 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:24ravalsoh, interesting
23:25jared314you are suppose to use the resulting transient of assoc!
23:25ravalsright, so they're saying don't reference previously mutated transients
23:26jared314yes
23:27ravalsthanks :)