#clojure log - Jul 30 2013

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

0:00 clj_newb_2345: either that, or I'm stupid

0:00 where is clojure code example?

0:02 tbaldridge: clj_newb_2345: try this https://github.com/Datomic/day-of-datomic/tree/master/src/datomic/samples

0:02 clj_newb_2345: eh...that's a bad example, this is better: https://github.com/Datomic/day-of-datomic/blob/master/samples/seattle/getting-started.clj

0:04 clj_newb_2345: tbaldridge: yeah, I was going to ask -- these examples are really short and I have no idea what's gong on

0:04 tbaldridge: the 2nd example looks much better, thanks!

0:05 tbaldridge: clj_newb_2345: np, and don't be afraid to ask questions here or on the mailinglist. Stu, Rich and Bobby answer most questions on the mailinglist within a day.

0:08 asteve: I'm new to compojure and I'd like to serve an html file as the response to a GET

0:08 should I use (route/files ...)?

0:08 I believe I should place the files in resources/public

0:11 egghead: asteve: no reason why you couldnt use route/resources {:root "public"}

0:12 except it'd serve at somewhere like index.html

0:13 clj_newb_2345: https://github.com/Datomic/day-of-datomic/blob/master/samples/seattle/getting-started.clj <-- should the seattle-schema.edn be .dtm ?

0:14 asteve: egghead: ok, now how do I route my GET "/" to that resource?

0:15 I would like to serve the index.html located in resources/public when a GET "/" happens

0:17 egghead: asteve: and you don't want any sort of templating/dynamic behavior?

0:17 asteve: I'm trying to start very simple to understand how the pieces come together

0:19 egghead: (GET "/" [] (slurp (clojure.java.io/resource "public/index.html")))

0:19 that doesn't cache tho

0:19 will re-read the file every request

0:20 asteve: ah

0:20 egghead: I've been using enlive for my latest clj app, quite nice

0:25 asteve: egghead: thank you

0:25 egghead: ofc

0:28 clj_newb_2345: oh shit

0:28 typing the code of https://github.com/Datomic/day-of-datomic/blob/master/samples/seattle/getting-started.clj into this

0:28 already makes me feel smarter

0:28 as if I'm learning from great masters

0:28 the Gates foundation should make a donation to relevance software so datomic gets open sourced

0:42 callen: egghead: you should try Selmer. :)

0:43 egghead: interesting

0:46 I'm doing some funny stuff using the defsnippet stuff from enlive, shipping the rendered html over a websocket to the client to be swapped by domina :3

1:22 zeroem: egghead: almost got that streaming working :F

2:30 cmatheson: /exit/exit

2:30 oops

3:49 hyPiRion: babilen: no problemo, I'll push out a new version in some hours

7:28 wakeup: hi

7:28 dbushenko: hi

7:28 edbond__: Hi

7:29 wakeup: what would be clojure's parallel to CL's WITH-OUTPUT-TO-STRING ?

7:29 edbond__: ,(doc with-out-str)

7:29 manutter|2: ,(doc with-out-str)

7:29 clojurebot: "([& body]); Evaluates exprs in a context in which *out* is bound to a fresh StringWriter. Returns the string created by any nested printing calls."

7:29 "([& body]); Evaluates exprs in a context in which *out* is bound to a fresh StringWriter. Returns the string created by any nested printing calls."

7:29 manutter|2: there an echo in here? :)

7:30 hyPiRion: echo foo

7:30 lazybot: foo

7:30 edbond__: echo echo

7:30 lazybot: echo

7:31 wakeup: (thanks!) in emacs's clojure mode, how do I start the repl?

7:31 e.g. get an interactive session?

7:31 edbond__: C-c M-j

7:31 wakeup: or, whats the preferred way to get an environment similar to SLIME?

7:31 dbushenko: you need nrepl

7:31 then M-x nrepl-jack-in

7:31 edbond__: wakeup, https://github.com/clojure-emacs/nrepl.el

7:31 wakeup: have it installed, that worked thanks

7:32 just didn't know how to start it :D

8:07 dotemacs: Clojure workshop in Munich: http://clojureworkshop.com/

8:07 pretty cool idea

8:07 and the best part is that they are doing it for free

10:24 tbaldridge: I was talking last week to someone about advanced cljs->js interop. I forget who it was, but that Clojure/West talk is out now: http://www.infoq.com/presentations/javascript-clojurescript?utm_source=infoq&utm_medium=videos_homepage&utm_campaign=videos_row1

10:24 Good stuff, and Tom's library looks pretty impressive.

10:27 dark_element: tbaldridge is it the one with d3 demos?

10:28 tbaldridge yup it is.

11:09 hexa: anyone using domina ? I'm trying to do a simple listen! on a <a href="#" id=myid> but it gets never called on click rather I get reset to the top of the page... it works fine if I test with a button ... there's something about a link it seems.. ideas?

11:10 or could it be because my id is itself ajax generated... humm

11:11 stuartsierra: hexa: Does the link exist in the DOM at the time when you call `listen!`

11:11 ?

11:11 hexa: stuartsierra, nope good point hehe

11:12 I guess I'll try calling it after I render the node :)

11:14 yep working now :) doh

12:40 clj_newb_2345: in clojure, is there a way to _capture_ the value of te while test? i.e. (while (some-test) body-of-code). I would like "body-of-code" to be able to refer to the value of (some-test).

12:44 alandipert: clj_newb_2345: something like https://www.refheap.com/17033 perhaps?

12:44 clj_newb_2345: alandipert: exactly. thanks!

12:51 egghead: woah

12:51 core.async channels can get backed up pretty easily apparently

12:52 bbloom: egghead: yup. are you using bounded or unbounded buffers? do you do any asynchronous puts/takes? that is either call put! or take! directly, or do a (go (>! …)) style operation

12:52 async puts are effectively an unbounded buffer

12:53 if you have a >! within a go nested within another go, you might be doing an async put

12:55 tim__: bbloom: I wouldn't call them unbounded, more like bounded to the number of gos

12:56 bbloom: tbaldridge: isn't that like saying the heap is bounded by OOM errors?

12:59 tbaldridge: bbloom: perhaps. I'm thinking of it this way: in normal core.async programming you shouldn't be writing go's that aren't synced somehow. If you follow that rule there is no such thing as unbounded queues in core.async.

13:00 bbloom: tbaldridge: yeah, you should avoid async send & unbounded queues. but i've seen a bunch of core.async examples, even from people who generally know what they are doing, that have (go (loop [..] .. (go (>! ..

13:00 tbaldridge: that is, the problem with this: (go (while true (go (<! c)))) is that you're not doing anything with the result of the inner go. The fact that this creates a unbounded queue is a side-effect of program.

13:01 bbloom: heh, we just wrote the same thing basically, i was talking about put, you about take

13:01 dnolen: tbaldridge: btw, is there any reason binding names aren't preserved? This breaks macros that work with locals.

13:01 tbaldridge: ^ is a question about the IOC compilation stuff in core.async

13:02 tbaldridge: breaks macros that work with locals...example?

13:02 dnolen: tbaldridge: like locals matching in core.match

13:02 bbloom: tbaldridge: i think core.async needs a good blog post explaining how to not create unbounded queues by accident :-) i understand it, but i've already got 100 blog posts backed up on a (hopefully bounded) queue

13:02 dnolen: (let [x 1 y 1] (match x y :match :else :no-match))

13:02 tbaldridge: bbloom: lol.

13:02 clojurebot: bbloom: readability is not binary

13:03 dnolen: won't work in a go block

13:03 egghead: hm

13:03 I am probably doing that bbloom

13:03 tbaldridge: Yeah I may have to do a screencast at some point...I'm really a horrible blog writer.

13:03 bbloom: egghead: i know you're probably doing that. that's why i explained it :-)

13:03 dnolen: tbaldridge: note that example requires that y not be renamed

13:03 egghead: hah, thanks :)

13:04 tbaldridge: dnolen: I find that odd, is the y inside a inner fn?. The go macro recursively renames all locals, so why wouldn't the y get renamed?

13:04 or is there something in core.match that does (name sym)?

13:05 dnolen: tbaldridge: it doesn't do anything to the symbol at all - if a symbol appears in &env we leave it untouched.

13:05 bbloom: egghead: tbaldridge: it's a little more difficult to avoid async put/take in core.async as compared to golang b/c go does it's transform globally & core.async does it locally. so sometimes you wind up with a lot of (<! (go …)) operations for promise-like single-valued channels

13:05 a trivial macro could fix that up

13:05 egghead: what do you mean that 'async puts are an unbounded buffer' -- wouldn't (put! foo :bar) just use the buffer of foo?

13:05 bbloom: egghead: no, put! will schedule a callback to be executed when foo is ready to accept a value

13:06 tbaldridge: egghead: he means that putting to a channel with no buffer (or a full buffer) gets attached to the channel as a callback. Do that in a loop and you can add callbacks till the cows come home.

13:07 bbloom: tbaldridge: (defmacro << [& body] `(<! (go ~@body))) ; I think this is only needed for ! not for !!, since <!! is already true blocking.. right?

13:07 tbaldridge: dnolen: so the answer is, technically no, there's no reason why we can't use the original symbol names. I'd just have to change the macros up a bit to be aware of local shadowing.

13:08 bbloom: ish...yeah <!! is exactly what you have there, except it uses promise/deliver.

13:08 bbloom: tbaldridge: right, but <!! doesn't work in cljs

13:09 tbaldridge: bbloom: right.

13:09 bbloom: tbaldridge: so maybe in cljs we can define <!! as (<! (go ~@body))

13:09 that's an interesting thought ^^

13:09 egghead: I didn't even know that you could use <! outside of a go block

13:09 bbloom: egghead: i'm assuming anested go block, hence it's a macro and not a function

13:09 egghead: ah :p

13:10 tbaldridge: bbloom: Rich did mention that he had thoughts of making a bound on the number of go's inflight at once. Something like, create 10000 go's and an exception is thrown that says "you shouldn't be doing this". It could be disabled (of course), but that might help new users a bit.

13:10 bbloom: tbaldridge: heh, not a bad idea

13:10 would be bad if you never trip it in dev, then it happens in prod tho :-/

13:10 tbaldridge: same with OOM right :-)

13:11 bbloom: anyway, i think i like that <!! idea, i need to think about it some more tho

13:11 tbaldridge: yeah, but OOM and stack overflow are high enough limits that generally correct code won't trip super easily. if you add an arbitrary low limit to detect fuckups, you're just making it more likely to happen unexpectedly

13:12 tbaldridge: what do you think of that <!! idea?

13:12 or something similar

13:12 tbaldridge: bbloom: so that's something I've been playing with, treating <! and go as async/await in C#. Every language with async support (besides go) has that patter, functions that return "tokens" and a "deref". I think there could be some nice composition fns here.

13:12 dnolen: tbaldridge: hrm, so does go fully expand all macros before it applies it's own transformation?

13:12 tbaldridge: dnolen: yes

13:14 bbloom: tbaldridge: C#'s async also has this crazy "cancellation source" idea too, they get pretty complex just trying to approximate the true semantics of the more complete primitives

13:14 tbaldridge: bbloom: I'm not sure why I'd need it, if I have (<! (go (>! c 42))) why not just do (>! c 42)? And if I want several puts in-flight at once, then I'll use parallel go's and then a join type thing.

13:14 bbloom: tbaldridge: yeah, ok. i'll need to think more about it before i make any suggestions :-)

13:15 dark_element: dnolen Is there any work going on for supporting user defined tagged literals in cljs ?

13:15 dnolen: dark_element: I'm not working on it no, but there are tickets about that which need more eyes and more feedback

13:15 dark_element: dnolen yes I was looking at this one right now http://dev.clojure.org/jira/browse/CLJS-335

13:17 dnolen: dark_element: I could never make heads or tails of that ticket, and I never saw a patch w/ tests - if you've got one I'll check it out.

13:18 bbloom: dnolen: tagged literals in cljs are totally broken like we discussed b/c macros run java side & so the macros need to receive java objects and then compilation needs to turn java objects into constants (not code)

13:18 javascript-constants, that is

13:19 dnolen: bbloom: oh right, a different ticket w/o a patch

13:19 dark_element: dnolen I share the same feeling about the ticket. I have no patch sets or even a clue how to do it right now.

13:19 bbloom: yeah i'm not sure what ticket is which, but i think kovas just ran into a problem & didn't understand the underlying problem

13:19 if we fix the underlying issue, his ticket will surely go away or make more sense

13:20 dnolen: tbaldridge: it's very strange, it seems to me that locals are being rewritten before the match macro expands

13:20 dark_element: dnolen I am working on a javascript datetime library and support for tagged literals would make dev a little faster

13:20 gfredericks: every 10 seconds somebody somewhere considers writing a custom macro variant of defn to support some particular thinger

13:20 dnolen: dark_element: sure

13:20 bbloom: but we need to do constant lifting first, for perf reasons & b/c we need to support new types of constants that are defined as snippets of code like (js/Date.)

13:21 dnolen: plus i know you want to do constant lifting for perf reasons :-)

13:21 dark_element: dnolen i can do away with some debug functions for now i guess

13:21 technomancy: gfredericks: "It looks like you're writing an ill-considered macro. Would you like to (0) have some sense smacked into you or (1) take a break?"

13:21 gfredericks: https://github.com/Fuco1/clippy.el

13:23 dnolen: tbaldridge: ok, yeah ioc_macros.clj doesn't do a deep expand, it's incremental with the SSA compilation process it seems to me.

13:23 gfredericks: technomancy: I've been wondering whether it'd be a terrible idea to have one library that defines a defn+ that can be customized externally

13:24 e.g., by registering handlers for metadata keys

13:25 dark_element: dnolen i'll see if i can send in a patch or at least get some basic idea ready to get things started on tagged literals on cljs

13:25 technomancy: gfredericks: what about just walking existing namespaces, examining metadata and alter-var-rooting after the fact? =)

13:25 gfredericks: technomancy: I assume that's a joke, but also you might want to do things at macroexpand time as well

13:25 and e.g. look for metadata on the arg list

13:26 dnolen: dark_element: you should probably look at this ticket - http://dev.clojure.org/jira/browse/CLJS-512

13:27 technomancy: gfredericks: sounds evil, but whatever. there's always a place for evil.

13:28 dnolen: dark_element: updated ticket w/ more precise IRC discussion link

13:29 dark_element: dnolen cool

13:30 tbaldridge: dnolen: ah...yeah, it deep expands up to a fn boundary...is that what you're thinking?

13:30 innar_made: hey guys, I am stuck with one 4clojure problem, basically I have list of symbols as input and I'd like to compute the value of that form (cannot use eval or resolve), so far I am scratching my head, i.e (let [[f & vs] '(/ 16 8)] `(~f vs))

13:30 tbaldridge: dnolen: although it does restore all the locals, so closures work.

13:31 dnolen: restore all locals at the point of creating a closure that is.

13:32 innar_made: pls don't share code to make it work, just some hints

13:32 so I can go in right direction

13:34 (let [form '(/ 16 8)] `(~@form)) => (/ 16 8) , still symbols

13:34 dnolen: tbaldridge: minimal case http://dev.clojure.org/jira/browse/ASYNC-15

13:36 tbaldridge: dnolen: I see now. It's a problem with &env during macro expansion, not a run-time/compile error. I'll see about fixing that this Friday

13:36 dnolen: tbaldridge: cool thanks

13:36 tbaldridge: dnolen: it should be super easy in CLJs, perhaps not as easy in CLJ (yay for more compiler interop!)

13:41 innar_made: (let [[f & vs] '(/ 16 8)] `~f) f still remains as symbol

13:47 bbloom: innar_made: yeah, that makes sense. ~ doesn't exist outside of `, because outside of ` it is basically val

13:47 eval* i mean

13:47 (let [[f & vs] '(/ 16 8)] (eval f))

13:48 innar_made: I cannot use eval

13:48 4clojure does not allow it

13:48 dnolen: innar_made: the hint - look into resolving symbols

13:48 bbloom: inside a macro, you'll get the right result because the expansion will be resolved

13:48 innar_made: resolve is also not allowed

13:49 bbloom: which problem is this?

13:49 dnolen: innar_made: oops missed that above.

13:49 innar_made: np

13:49 bbloom: innar_made: which 4clojure puzzle is it?

13:50 the infix calculator?

13:50 innar_made: https://www.4clojure.com/problem/121

13:50 I basically have solved rest of the problem, only making symbol as function remains

13:51 bbloom: innar_made: just make your own mini-resolver. use a map

13:51 ,({'+ +, '- -, '/ /, '* *} '/)

13:51 clojurebot: #<core$_SLASH_ clojure.core$_SLASH_@1fa5c7a>

13:52 innar_made: bbloom: oh man, that's cool idea

13:53 bbloom: innar_made: that's pretty much how resolve works anyway :-P

13:53 innar_made: bbloom: thanks, I think I am un-stuck now :)

13:57 aphyr: Weird question: how do I do a narrowing primitive cast in Clojure?

13:57 alandipert: aphyr: what do you mean by narrowing? floor or precision loss?

13:58 aphyr: e.g. I've got an int ranging from 0-65535, and want to get back a signed short containing the same byte representation as the unsigned short corresponding to the number, big-endian.

13:58 loljava, I know

13:59 IIRC, there's no sign preservation in narrowing integer primitive casts in java, so (short) x should do the trick.

14:00 alandipert: i think so too

14:00 appropriate in the summer as well

14:00 i guess that would be #'shorts

14:00 aphyr: heh

14:00 but yeah, (short 63335) does a range check and throws

14:01 innar_made: bbloom: thanks again, one more problem solved :)

14:01 * bbloom gives the thumbs up

14:01 Bronsa: aphyr: ##(.shortValue 63335) maybe?

14:01 bbloom: i love 4clojure, helped me a lot when i was getting started

14:01 lazybot: ⇒ -2201

14:02 aphyr: Interesting, but that should be -1

14:02 Aha, I think maybe unchecked-short is what I want

14:02 Bronsa: that returns the same thing

14:03 aphyr: ##(.shortValue 65535)

14:03 lazybot: ⇒ -1

14:03 Bronsa: also unchecked-short

14:03 innar_made: bbloom: only I wonder why would 4clojure not allow to use the resolve function, yesterday in my local machine I was able to solve the problem with that approach and tests were passing, but when pasted to 4clojure I tripped the alarm

14:04 bbloom: innar_made: the resolve function would enable you to circumvent the security restrictions

14:04 innar_made: ok, just like eval

14:06 bbloom: the resolve fn implementation does not seem to do anything dangerous, ok maybe smth dangerous could happen inside clojure.lang.Compiler/maybeResolveIn

14:06 bbloom: innar_made: it's not the resolve that's dangerous. it's the functions that might be returned from resolve :-)

14:06 (resolve (symbol "eval"))

14:06 innar_made: bbloom: ah yeah, good point

14:07 aphyr: Thanks guys :)

14:15 sdegutis: gfredericks: yep, deftest, defspec, etc

14:33 alexeberts: hi all - does anyone know how to make paredit accept a quote after a hashmark in emacs?

14:33 I can do it by preceeding the hash wish C-q but it gets tiring quickly when doing regular expressions in clojure

14:35 rboyd_: alexeberts: ? it works ok here

14:37 stuartsierra: alexeberts: Is this related to https://github.com/clojure-emacs/clojure-mode/pull/169 ?

14:38 alexeberts: rboyd_ : thanks, maybe it's something with my config.... are you able to type #() out of the box with paredit? (i.e. without paredit inserting a space between the # and () )

14:38 hiredman: yes

14:38 rboyd_: alexeberts: yea..

14:39 alexeberts: my dotfiles are on github if you want to manually diff environments somehow

14:40 alexeberts: ok, thanks. I must be using an older version of clojure-mode

14:40 rboyd_: stuartsierra: I pulled the trigger and ordered a kineses after seeing you loved yours enough to drag it along to lambdajam =)

14:40 stuartsierra: rboyd_: Congratulations! Hope it's equally worth it for you.

14:40 I'm on my second after dragging it all over the world.

14:40 alexeberts: stuartsierra: yes, I think it is related to 169... there seems to be a special case for spaces in paredit but I can't find a fn for "" yet...

14:40 rboyd_ thx - much appreciated!

14:44 rboyd_: stuartsierra: have you seen the ergodox? would be kind of cool just for the lightsaber aspect of building it from the kit

14:45 stuartsierra: rboyd_: I didn't understand that sentence. :)

14:45 rboyd_: stuartsierra: http://vimeo.com/67847164

14:45 you know, a jedi builds his own lightsaber

14:46 stuartsierra: Oh, I didn't know what Ergo-Dox was.

14:47 hiredman: right now, as far as I know, no one is selling the kit, but massdrop has it from time to time

14:47 stuartsierra: looks kinda cool

14:47 I really like the curved key wells of the Kinesis though.

14:50 seangrove: Jesus, a lot of clojure people at Factual

14:51 gfredericks: $seen jesus

14:51 lazybot: I have never seen jesus.

14:53 hyPiRion: gfredericks: oh, you

14:54 Raynes: hyPiRion, gfredericks: you guys

14:54 seangrove: I randomly saw a Clojure guy who recognized me in the alley behind the Geni office last night when I was leaving.

14:55 Totally wasn't being stalked… right?

14:55 Right.

14:55 seangrove: High-end recruiters are indistinguishable from kidnap and hit squads

14:57 callen: Raynes: lol

14:57 seangrove: s/firearms/free lunches/g

14:58 seangrove: well they use Clojure.

14:58 (@ Factual clojure people)

15:00 Raynes: "Well, we've got a shitload of Clojure code here. Here's a wild idea… we should hire people who know Clojure."

15:00 callen: that's pretty much how I figured it worked.

15:05 clj_newb_2345: anyone have a recommendation for "learn CSS the hard way / CSS for people who know C + Clojure?" i.e. I want to basically just invest 20 hours of my life, go through lots of examples, and understand how this CSS thing works

15:06 callen: clj_newb_2345: CSS is its own thing, totally independent.

15:06 clj_newb_2345: the Mozilla Developer documentation is best.

15:06 clj_newb_2345: seek a holistic understanding, it'll lead to less frustration later.

15:07 clj_newb_2345: is there something like a "structured approach to css" rather than "here's lots of little examples"

15:07 llasram: How about the spec? http://www.w3.org/TR/CSS2/

15:07 clj_newb_2345: callen: yes, how do I get this holistic understanding rather than separate examples?

15:07 llasram: is this something that I can work through along the way to check my understanding?

15:08 callen: clj_newb_2345: Mozilla Developer documentation.

15:08 clj_newb_2345: and work with examples + test projects.

15:09 clj_newb_2345: callen: https://developer.mozilla.org/en-US/docs/Web/Guide/CSS ?

15:10 duck11231: start with "getting started"

15:14 seangrove: tbaldridge: This seems like pure madness

15:14 tbaldridge: seangrove: ?

15:14 seangrove: Forked objects with mutations on the js side that are invisible from cljs?

15:14 Not quite finished, but maybe he comes around and explains how it's all ok in the end :)

15:15 tbaldridge: nope...it's pretty much interop at all consts

15:15 *costs

15:17 clj_newb_2345: "cascade" = browser, user preference, css file; "inheritance" = go up the ancestor tree in the DOM ?

15:17 seangrove: clj_newb_2345: probably best to ask in the css channel

15:17 clj_newb_2345: seangrove: wasn't aware there was once; thanks

15:17 noncom: ztellman: hi! is it idiomatic to make a tcp client with aleph when i wait for incoming messages in a future with loop/recur? i think that futures waste threads quickly and there should be some other, asynchronous way?

15:18 ztellman: noncom: pipelines in lamina have a "restart" signal, which allows you to do async looping

15:19 but honestly, threads are cheap enough that unless you have thousands of live connections it's okay to waste them

15:19 noncom: so you'd go with threads?

15:20 konr: Is there an equivalent to clojure.contrib/show?

15:25 noncom: ztellman: yeah, i won't have thousands, so you'd recommend to go with futures, right?

15:25 ztellman: noncom: for an initial implementation, sure

15:25 it's easy enough to switch over to something more complicated later

15:26 noncom: ok, good i think then it will fit the scenario for now!

15:26 ztellman: though if each message is independent, receive-all would also work

15:31 noncom: ztellman: so it will automatically make the tcp client to persistantly wait for incoming msgs and if any, pass them to the callback, that being continued unless i call cancel-callback? what happens to the client if i cancel the callback, is it utilized then?

15:32 ztellman: if you cancel the only consumer on a channel, by default it's closed

15:32 noncom: good! i didn't get that from the docs

15:32 ztellman: https://github.com/ztellman/lamina/wiki/Channels#how-closing-propagates

15:33 cancel-callback ~ "closing" the callback

15:33 noncom: aahh.. sorry, i'm kinda new to this paradigm, so it is very good that you pointed that out! :) read that doc, but.. takes time to accustomize

15:34 ztellman: no worries, it's a lot to absorb

15:41 lynaghk: ztellman, bbloom: you have a hot sec for an architecture question about my upcoming zeromq core.async library?

15:42 Right now I have two message pump threads, as per bbloom's orig design. Both threads block on their respective construct (an alts for the core.async thread, a zmq_poll for the zeromq thread)

15:42 bbloom: lynaghk: cool, how's that working out?

15:42 clojurebot: lynaghk: map unification is quite simple - it should be easy to see how it should be changed to do what you want for this new type.

15:42 lynaghk: I need to communicate real Java objects from the async thread to the zeromq thread

15:43 dnolen: oh clojurebot

15:43 lynaghk: instead of just strings/byte arrays, which is all I can send via an inprocess zeromq socket from async thread to zeromq thread

15:43 bbloom: lynaghk: but zmq only allows strings on it?

15:43 lynaghk: yeah

15:43 bbloom: you need an "exchange heap"

15:43 a la erlang :-P

15:43 lynaghk: so I was thinking of just setting up a java.util.concurrent queue to put stuff on

15:43 and the async thread would basically just be saying, "yo, I left some shit for you on the queue, go unblock and get it"

15:44 bbloom: yeah, that'd probably do the trick

15:44 lynaghk: via the zeromq in process socket

15:44 bbloom: exchange queue, heap whatever :-)

15:44 lynaghk: that's what I'm thinking. I just wanted to bounce it off someone to see if there would be a smarter way to do it

15:44 I was going to just use an atom, but then I realized that the core.async thread might ask for things faster than the zeromq thread could deliver

15:45 dnolen: I just impulse-bought that book you tweeted about an hour ago, btw

15:45 dnolen: we'll see if it arrives before I head out to NYC on Thursday = )

15:45 bbloom: lynaghk: the issue is one of resource management

15:46 does the sender need to send the object every time the client may need it?

15:46 dnolen: lynaghk: haha, amazing book! seriously a must read for anyone involved in computing IMO.

15:46 lynaghk: dnolen: yeah, I studied a bit of lick's stuff during my undergrad thesis.

15:47 bbloom: the objects sent around are internal plumbing of the lib: "here's a zeromq socket object that I need you to pump to/from" or "here's a bytebuffer I need you to send on the socket I gave you a while back with this id"

15:48 bbloom: lynaghk: ah ok, then yeah, you can probably get away w/ a synchronized queue

15:48 lynaghk: bbloom: what do you mean by "synchronized queue"?

15:48 bbloom: i mean both synchronized access (mutable, concurrent, etc) and synchronized with the communication channel

15:49 lynaghk: ah, right. okay, yeah.

15:49 bbloom: you could probably replace the entire communication between the two message pumps with a traditional java concurrent queue though… now that i think about it

15:49 er no

15:49 nevermind, no multiplexing

15:49 lynaghk: bbloom: no, the zeromq thread needs to block

15:49 on zeromq sockets

15:51 bbloom: so yeah, then what i said before where synchronized means "parallel to the pump link" and "concurrent mutable queue"

15:54 glosoli: any suggestions what kind of packages I should install for best experience with Clojure ?

15:56 gfredericks: glosoli: if you want to here more that "leiningen" you'll have to qualify that a bit more

15:56 hear*

15:56 than*

15:56 * gfredericks old

15:56 gfredericks: I wonder if my ability to spell quickly never recovered from the dvorak transition

15:57 glosoli: gfredericks: well would like to have REPL like experience in side by side window (or whatever that thing is appropriate to call in emacs)

15:57 gfredericks: glosoli: so "emacs" was a relevant detail

15:57 glosoli: gfredericks: aaaaah sorry

15:57 gfredericks: clojure-mode and nrepl.el are the normal combo I think

15:57 glosoli: I thought I have mentioned it

15:57 * glosoli young lol

15:58 glosoli: gfredericks: just curious what's "dvorak transition" ?

15:59 gfredericks: $google dvorak keyboard layout

15:59 lazybot: [Dvorak Simplified Keyboard - Wikipedia, the free encyclopedia] http://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard

15:59 Raynes: It's what coding hipsters do to be cool.

16:00 gfredericks: we spend our time complaining about the colmac hipsters

16:00 Raynes: gfredericks: My boss uses colemak. I can't really say anything about colemak. :p

16:01 gfredericks: man there is no nice way to express (if a {b c, d e} {b c})

16:01 glosoli: ;/ it would be stupid of me to ask what's wrong with qwerty I assume

16:01 gfredericks: the least repetitive I know of is (cond-> {b c} a (assoc d e)) but that's lameo

16:01 Raynes: glosoli: Well, it was designed to slow you down for one.

16:01 ToxicFrog: ,(doc cond->)

16:01 clojurebot: "([expr & clauses]); Takes an expression and a set of test/form pairs. Threads expr (via ->) through each form for which the corresponding test expression is true. Note that, unlike cond branching, cond-> threading does not short circuit after the first true test expression."

16:02 Raynes: </myth>

16:02 gfredericks: "The QWERTY keyboard layout was designed in 1924 with the goal of slowing down glosoli."

16:02 glosoli: lol

16:02 ToxicFrog: Raynes: untrue. It was designed to place commonly used letter pairs on opposite sides, allowing it to be used at high speed without jamming.

16:03 rboyd_: gfredericks: how long did it take you to ramp up on dvorak?

16:03 Raynes: ToxicFrog: [12:46:36] Raynes: </myth>

16:03 gfredericks: rboyd_: maybe a month

16:03 Raynes: Ugh gfredericks uses dvorak?

16:03 And here I thought we could be good friends.

16:03 clj_newb_2345: is there a separate clojurescript channel, or are clojurescript questions fair game here?

16:03 llasram: dvorak 4 aoeu

16:03 Raynes: clj_newb_2345: Fair game her.

16:03 here*

16:04 gfredericks: Raynes: my fingers were hurting; I was desparate.

16:04 Raynes: gfredericks: Stop writing COBOL.

16:04 gfredericks: you'll understand when you're older

16:05 Raynes: gfredericks: You want to take this out on the promenade?

16:05 gfredericks: yes.

16:07 glosoli: gfredericks: would it be rude to ask how old are you mr ?

16:07 Raynes: Older than me.

16:07 Most people are.

16:07 nDuff: ...that hardly says much.

16:07 (ahh, was going to say...)

16:09 gfredericks: an interesting question what the age distribution in the room is; I might conjecture I'm about the median

16:10 cemerick should start adding demographic info to his annual survey

16:10 maybe just "A/S/L"

16:10 Raynes: "Most of the Clojure community is between 27 and 44. And then theres Raynes, screwing up this whole bloody chart."

16:11 glosoli: Old folks

16:11 gfredericks: well if _that's_ true I'd be solidly at the bottom

16:11 Raynes: You're 27?

16:11 gfredericks: I think so

16:11 Raynes: Good to know.

16:11 llasram: Most of the Clojure community is between 2 and 7,963

16:12 gfredericks: bring your baby to #clojure day

16:12 hiredman: see if they can write swearjure

16:12 hexa: Humm how would I use a function return value in a regex .. like : (match #( (str "abc")) ?

16:13 gfredericks: hexa: sounds like you want to assemble the regex programmatically

16:13 &(doc re-pattern)

16:13 lazybot: ⇒ "([s]); Returns an instance of java.util.regex.Pattern, for use, e.g. in re-matcher."

16:14 hexa: gfredericks, that's it thx ! :)

16:21 kovas: time to rage

16:24 bbloom: KOVAS SMASH

16:26 kovas: bazzaaam!

16:26 computation mofos

16:28 bbloom: yesterday I was reflecting how sketchup follows the model of genesis 1

16:28 bbloom: huh?

16:28 kovas: iterative process of separating and refining areas

16:29 rather than just dropping a spec fully formed

16:29 bbloom: ah yes, iterative refinement is the correct solution to practically everything. you just need to be careful to define termination criteria, since you may never reach a true fixed point

16:30 bhauman: bbloom: here here

16:30 kovas: they call that the apocalypse

16:30 bhauman: funny

16:31 kovas: universe not created using waterfall model

16:31 bbloom: if your refinement steps are too large, you may oscillate around the solution, introducing error, and ultimately diverging

16:32 waterfalls are iterative refinement too, but relying on the process of evaporation and precipitation isn't a good plan

16:32 rivers dry up sometimes :-P

16:32 kovas: heh

16:33 Derander: gl hf optimizing this: http://en.wikipedia.org/wiki/Rosenbrock_function with iterative steps :-)

16:33 * bbloom once again proves that everything can be explained with a stretched analogy

16:33 bbloom: Derander: ah the good ol "banana function"

16:34 the solution is simulated annealing

16:34 which is approximated by giving your dev team LSD

16:35 kovas: lol

16:36 clojurenoob: How do I get the insertion order in hash-set (apply hash-set "Leeeeeerrroyyy")? Thanks

16:37 bbloom: clojurenoob: sets are un-ordered

16:38 clojurenoob: Thanks. Is there a built-in or should I have to write one?

16:38 bbloom: there are built-in sorted sets, but no built in manually ordered sets

16:39 you could create one by encapsulating a sorted-map with a set. i'm sure that exists on github somewhere

16:39 clojurenoob: Thanks :)

16:42 quit

16:57 jonasen: dnolen: feedback for CLJS-564 and CLJS-565 welcome (when you have time to look at them)

16:57 dnolen: jonasen: will do

17:12 Raynes: callen: This may very well be the first time I want to complain about having to do a work project in Clojure. :p

17:13 ToxicFrog: Oh?

17:13 Raynes: I've got a project here that I need to do that would be utterly perfect for Elixir, but I don't know enough Elixir to trust myself to get it done in a timely manner if I use Elixir.

17:13 I wish I had kept up with Elixir. I've totally forgotten most things.

17:14 seangrove: Elixir?

17:14 Raynes: seangrove: Best language ever besides Clojure. :p

17:14 seangrove: Elixir is ruby-inspired functional on the erlang-vm

17:15 Raynes: seangrove: It is heavily influenced by Clojure.

17:15 gfredericks: Raynes: is there anything good about it besides its vm?

17:15 callen: Raynes: an embarrassment of riches.

17:15 Raynes: Jose consults with me a lot about Clojure design decisions when making choices.

17:15 callen: Raynes: at least with Clojure you have NIO/NIO2/Netty/Aleph/lamina/core.async

17:15 Raynes: gfredericks: It's author is a huge selling point.

17:15 callen: Raynes: I don't get to use Elixir or Clojure. I am in pleb-land and it's Python every time all the time.

17:16 * nDuff wants Raynes's problems.

17:16 nDuff: ...well, at least, that one.

17:16 ToxicFrog: Here it's mostly Python, and when it's not Python it's C++.

17:16 Or Java, for those poor doomed bastards in mobile-land.

17:16 Raynes: gfredericks: Amazingly nice guy, answers questions in #elixir-lang, debates design decisions openly with everyone, etc.

17:16 callen: Jose Valim is seriously awesome.

17:17 he's the only nice Rails core dev, lol.

17:17 technomancy: what? tenderlove is nice.

17:17 bbloom: tender even.

17:17 (sorry)

17:18 Raynes: technomancy is obligated to love Elixir because the build tool was originally built by me and thus has Leiningen branding until the end of time.

17:18 technomancy: hehe

17:18 Raynes: http://elixir-lang.org/getting_started/mix/1.html Look at that, second paragraph.

17:18 egghead: dnolen: in cljs a partial of no applied args doesn't work

17:18 technomancy: I would like to give it a spin. I tried earlier but at that point it was clear there was basically no way you could learn Elixir without learning Erlang.

17:18 callen: Raynes: you did well on Mix. It's proper. :)

17:18 technomancy: it looks like that's changing

17:18 egghead: for instance (partial inc) <-- why would I want to do this?

17:19 callen: technomancy: it's going to end up like Clojure.

17:19 egghead: anyhow, it works in clj but not cljs

17:19 sdegutis: Raynes: i would miss s-expressions if i used elixir

17:19 * sdegutis <3 s-exps

17:19 callen: technomancy: eventually stuff gets papered over for most peoples' purposes, but there's always a frontier where you have to drop down.

17:19 sdegutis: hello my darling.

17:19 sdegutis: hi

17:19 upvote this guys https://news.ycombinator.com/item?id=6129965

17:19 technomancy: elixir used to claim it was homoiconic, but it looks like it's dropped that?

17:19 callen: sdegutis: you should wear shorts that show a little more leg.

17:19 technomancy: I think that's because it isn't

17:20 technomancy: I see

17:20 Raynes: technomancy: It's true that it has diverged a bit, but the environments stuff is based on profiles, tasks are functions in modules, has a very similar format for representing projects, same help system, etc.

17:20 technomancy: Raynes: <3

17:20 Raynes: It does unfortunately use git for dependencies, but at least it has a lock file.

17:20 callen: Raynes: is there a way to define Elixir version in the mix file?

17:21 technomancy: Raynes: understandable given the lack of a sane alternative

17:21 Raynes: Jose took what we said about repeatability to heart.

17:21 callen: Raynes: thank god

17:21 Raynes: callen: I don't think so. Elixir is a compiler-in-usr/bin sort of language.

17:21 callen: Raynes: I know. I actually dislike that.

17:21 nDuff: sdegutis: you could at least provide a little more context when pasting a blind link than "upvote this".

17:22 callen: I want a self-bootstrapping-magic-script thingamajig.

17:22 Raynes: callen: Can't say I disagree, mate.

17:23 It's all painful because Elixir is a AOT compiled language all the time

17:23 sdegutis: nDuff: oh yeah

17:23 so, i added ruby 2.0 support to my hackable Mac OS X window manager

17:24 and i want people to know about it, so thats a link to a hacker news link to it

17:24 you dont have to upvote it. and honestly theres no good reason to.

17:24 squidz: sdegutis: why ruby?

17:24 sdegutis: except maybe an act of kindness

17:24 technomancy: Raynes: so does mix walk the whole git tree and use some sort of "closest to root" logic to resolve conflicting versions?

17:24 sdegutis: squidz: cuz before this it only had JS/CoffeeScript support, and i couldnt tolerate that

17:25 squidz: also cuz most people i know use/love ruby

17:25 technomancy: "git tree" being not the actual tree in git, but the tree of git trees

17:25 sdegutis: also i dont know how you get on the main page of hacker news.. but id like to try getting on the main page of it

17:25 nDuff: sdegutis: ...not to harp too much, but that's relevant in #clojure why, exactly?

17:25 sdegutis: so i figured a huge influx of upvotes might help

17:26 Raynes: "If your dependency is another Mix or rebar project, Mix does the right thing: it will automatically fetch and handle all dependencies of your dependencies. However, if your project have two dependencies that share the same dependency and the SCM information for the shared dependency doesn't match between the parent dependencies, Mix will mark that dependency as diverged and emit a warning. To solve this issue you can declare the shared dependency in

17:26 your project and Mix will use that SCM information to fetch the dependency."

17:26 technomancy: ^

17:26 bbloom: sdegutis: an influx of upvotes will surely get you hell banned

17:26 sdegutis: nDuff: cuz you guys are friendly and theres a lot of you, that might push it to the main page

17:26 bbloom: oh?

17:26 bbloom: yes.

17:26 sdegutis: from here or HN?

17:26 * nDuff is only a tiny subset of "you guys", but is completely unfriendly to off-topic spam.

17:26 bbloom: HN

17:26 sdegutis: nDuff: sorry

17:26 * sdegutis rescinds request

17:26 Raynes: nDuff: We're talking about Elixir right now, fyi.

17:26 sdegutis: sorry all.

17:27 nDuff: Raynes: True. But at least it's a functional language. :)

17:27 Raynes: sdegutis: I'm fine with it. I upvoted it in fact. I'm interested in seeing what HNers think of it.

17:27 nDuff: Raynes: ...and a LISP.

17:27 technomancy: Raynes: cool. kinda like :pedantic :warn by default.

17:27 Raynes: Elixir is not a Lisp.

17:27 sdegutis: Raynes: thanks :)

17:27 Raynes: It has macros, but isn't quite a Lisp.

17:27 http://elixir-lang.org/getting_started/5.html

17:27 technomancy: Raynes: rule 17 of lisps: any language with first class functions will eventually be called a scheme

17:27 sdegutis: is Elixir's stdlib comparable to Clojure's?

17:28 thats the main thing i miss from most languages is a clojure-quality core lib

17:28 ruby almost has it but its so not as good as clojure

17:28 nDuff: Huh. I was thinking of something else.

17:28 Raynes: Probably not quite. There is lots of stuff, but a lot of it comes from OTP's libraries. Elixir occasionally wraps functions from OTP for various reasons.

17:28 * nDuff tries to remember what the more recent LISPy reformulation of Erlang is.

17:29 rboyd_: joxa

17:29 Raynes: Or LFE.

17:29 technomancy: lisp-2 =(

17:29 Raynes: Erlang. =(

17:32 sdegutis: is elixir production-ready?

17:32 Raynes: Sure.

17:33 sdegutis: k

17:33 * sdegutis switches production code to elixir

17:33 Raynes: :P

17:33 callen: sdegutis: what is production for you anyway?

17:34 sdegutis: a clojure app

17:34 for websites

17:34 i mean, a clojure web app

17:34 im not proud of how it looks, so im not gonna tell you which one it is.

17:34 technomancy: funny how "production" used to mean "building in a factory"

17:34 "in production" -> "being produced"

17:35 sdegutis: it was designed before i was hired. i did a redesign but the boss doesnt like it. so she hired an apprentice to do one, and it looks very 2007 but she likes it so we're going with it.

17:35 and remembering this makes me sad.

17:35 so stop reminding me

17:35 technomancy: drown your sorrows in a refreshing cup of elixir sdegutis

17:35 gfredericks: technomancy: I think it still means that in normals-world

17:36 jtoy: how would you guys recommmend I turn this: {"user[model]" "toyota" "user[year]" 2012 "user[color]" "red" } into {"model" "toyota" "year" 2012 "color" "red"} ?

17:36 sdegutis: heh

17:36 gfredericks: jtoy: depends on the edge cases

17:36 Raynes: Use a less crappy query param parser.

17:36 :p

17:36 sdegutis: id show the three designs side-by-side to explain better, but i think that might be inappropriate somehow

17:38 jtoy: Raynes: haha, which one do you recommend? I am using the ring params one currently

17:38 wrap-params

17:39 Raynes: jtoy: I don't think there is one for Clojure that actually handles that elegantly sadly.

17:39 jtoy: yes, rails does a great job though

17:40 justin_smith: (into {} (map (fn [[k v]] [(regex-magic k) v]) params))

17:40 regex-magic being the regex that extracts the keys you want from the keys you have

17:41 technomancy: justin_smith: clojure's missing map-keys drives me nuts some times =\

17:41 justin_smith: heh

17:41 yeah

17:41 jtoy: technomancy: who has it and what does it do?

17:42 technomancy: jtoy: everyone writes their own

17:42 (zipmap (map f (keys m)) (vals m))

17:42 patchwork: technomancy justin_smith: I have written that function at least 5 separate times

17:42 technomancy: plus one that just maps keys

17:42 that and rpartial

17:43 koderde: mknoszlig: ping

17:44 rasmusto: technomancy: what's rpartial do?

17:44 justin_smith: technomancy: will the zipmap keys m / vals m be smart enough to traverse the whole thing once, or does it redundantly work through the map?

17:44 technomancy: rasmusto: partial but filling the args in from the other direction

17:44 justin_smith: not that this is a huge efficiency problem most of the time I guess

17:45 technomancy: justin_smith: I think the version that uses into+for is probably more efficient

17:45 justin_smith: how about into+map (which is what I usually do)

17:46 map and for are about the same with one arg I assume?

17:47 rasmusto: technomancy: ah, thanks. That's a bit mind-bending to me still

17:48 seangrove: technomancy: I feel there's some nicer generalization of partial, fnil, rpartial, etc. that could be nice, but haven't sat down to think about it enough yet

17:50 Raynes: "Do you pine for a simpler time when web pages loaded in under one second? Chicago Boss is the answer to slow server software: a Rails-like framework for Erlang that delivers web pages to your users as quickly and efficiently as possible."

17:50 Oh ffs. Why is Rails a damned goal in functional languages?

17:50 dnolen: egghead: please file a ticket

17:51 Raynes: :p

17:51 callen: Raynes: because people get a lot of work done with it.

17:51 Raynes: callen: I don't.

17:52 callen: Raynes: and they prefer it to rolling their own artisanal solution to what is frankly a very boring and repetitive form of work.

17:52 Raynes: you don't make a lot of websites front-to-back. You do more interesting stuff than that.

17:52 if you were churning out whole sites week-in week-out, you'd start extracting patterns

17:52 eventually you'd have a framework. GG

17:52 rasmusto: g.g. indeed

17:53 Raynes: callen: I'd have a bunch of compojure sites.

17:53 callen: I prefer more minimalistic stacks myself, but I have no illusions that it's somehow more productive than a sharp guy with a full-featured stack he knows well.

17:53 Raynes: callen: Now shush and listen to http://www.youtube.com/watch?v=a4IsS8jlIBY

17:55 callen: Raynes http://www.youtube.com/watch?v=MrAvwd_UHUI

17:56 while there's a building-ones-own-lightstaber element to rolling a personal web stack, it's pretty senseless.

17:57 Raynes: this song is working for me. it's a nice follow up to Death Grips.

17:58 Raynes: :p

17:59 clj_newb_2345: does anyone have a tutorial on using clojure.tools.namespace and vim fireplace together?

18:01 callen: Raynes: you ever listen to Death Grips? How is the Jex Thoth treating you?

18:03 Raynes: callen: It was good until she started making noises.

18:03 justin_smith: Is writing a monad tutorial the Building Your Own Lightsaber of the haskell world?

18:03 seangrove: The youtube player seems so janky

18:03 callen: justin_smith: no, it's writing your own monad transformer library.

18:03 seangrove: I'm sure it's incredibly sophisticated, but damn it seems unpleasant recently

18:03 egghead: will do dnolen

18:07 mischov: seangrove: I can't remember the last pleasant change they've made to the youtube player...

18:07 jtoy: justin_smith: gfredericks Raynes technomancy this is the version I came up with: https://www.refheap.com/17037

18:08 technomancy: mischov: or any google product?

18:10 callen: hg commit -m "murjd"

18:10 I can't get caremad about commit messages when it's Mercurial.

18:10 mischov: technomancy: So far I

18:10 technomancy: am not upset about android 4.3

18:10 technomancy: mischov: I miss 2.x =\

18:11 egghead: ticket filed

18:11 technomancy: where gmail didn't put the sender in larger type than the frakking subject line

18:11 egghead: yawwwn, I'm doing something retarded with core.async where my first message disappears

18:11 technomancy: and maps didn't refuse to function without giving Google background GPS prvileges

18:13 isaacbw: man, clojure is fun

18:14 I've started working through project euler to learn clojure

18:14 callen: isaacbw: I don't know that that is an environment where the niceties of Clojure really shine, but cool :)

18:14 mischov: technomancy: Google used to make the mistake of doing things well and they've been paying for it with users unreasonable expectation that things should work nice and well ever since.

18:15 technomancy: their new strategy is making things worse and worse so people have low expectations and their jobs are easier

18:15 technomancy: mischov: like that time they realized they had the whole spam-detection module of google groups commented out

18:15 isaacbw: callen: mostly it's just fun to solve the problems recursively, which is a bit of a mental stretch coming from an imperative background

18:16 callen: isaacbw: I find that at least in ~75% of practical day to day stuff, recursion maps better.

18:16 clj_newb_2345_: (1) I'm using nRepl 0.2.3. (2) I've started lein with "lein repl", (3) I see the port number in target/repl-port. Now my question: how do I send a command to "localhost : target/repl-port" that executes "(+ 2 3)" ?

18:17 jkj: Raynes: any ideas on detecting template change automatically with laser?

18:18 technomancy: clj_newb_2345_: need more context

18:18 isaacbw: callen: my solutions are definitely far more succinct than the iterative counterparts

18:18 jkj: Raynes: i keep the templates in agents so they can be refreshed. haven't just figured out how to trigger the refresh yet. maybe just a timer

18:18 callen: isaacbw: no one approach will work for everything.

18:18 isaacbw: I'm sure things are going to get far more interesting the deeper I get

18:18 *into euler

18:19 clj_newb_2345_: technomancy: I run "lein repl" -- in target/repl-port, it provides me the port I can connect to for a networked repl. I tried "telnet localhost 52429" (where 52429 is the # from target/repl-port). In this telnet session, I type in "(+ 2 3) Ctrl-D" and nothing happens. Where am I being stupid?

18:19 technomancy: clj_newb_2345_: no, it's just that the nrepl protocol is more than just sending text over a stream

18:19 it's about exchanging bencoded messages that contain metadata

18:20 clj_newb_2345_: yeah, so looking at https://github.com/clojure/tools.nrepl

18:20 I don't see a way to connect using etlnet or nc

18:20 technomancy: clj_newb_2345_: right; you need an nrepl client

18:21 clj_newb_2345_: technomancy: is this nrepl communication protocol not documented anywhere?

18:22 technomancy: clj_newb_2345_: probably the readme there is your best bet

18:22 clj_newb_2345_: https://github.com/clojure/tools.nrepl/blob/master/README.md ?

18:22 technomancy: yeah

18:25 clj_newb_2345_: dumb question: how do I construct a minimal message (something I can type into telnet or "nc") that tells nrepl to execute "(+ 2 3)" ?

18:25 technomancy: you would bencode {:op eval :value "(+ 2 3)"} iirc

18:26 mischov: Macro question.. https://www.refheap.com/17038

18:28 clj_newb_2345_: technomancy: what's bencode? is it json?

18:29 technomancy: it's ... bencode?

18:29 https://en.wikipedia.org/wiki/Bencode

18:29 seangrove: http://nakkaya.com/2009/11/14/bencoding-objects-in-clojure/

18:29 bencode?

18:29 Damnit clojurebot

18:30 Raynes: callen: I was just looking at dynamo. I think it introduces things anaphorically. :(

18:33 callen: Raynes: I'm contemplating deeper evils than that for a library.

18:33 far, far deeper evils.

18:34 Raynes: what specifically do you object to? I'm curious.

18:35 Raynes: callen: Anaphora.

18:36 clj_newb_2345_: in Vim fireplace, ":Eval (+ 1 2)" <-- does not return for me 3. How do I use vim fireplace ot send messages over nRepl ?

18:36 Raynes: callen: The fact that 'conn' appears out of thin air.

18:37 callen: Raynes: yeah, that's the sort of evil I'm contemplating, except worse.

18:37 Raynes: it's so evil I think I'm going to have to refer to the macronomicon.

18:37 seangrove: bbloom?

18:37 clojurebot: bbloom is a dendrologist

18:37 seangrove: He's usually the fireplace expert in here

18:38 Raynes: bbloom studies trees?

18:38 callen: Raynes: "branches"

18:38 Raynes: I knew you meant anaphora, I just thought perhaps you had a specific example other than conn.

18:39 clj_newb_2345: was just disconnected

18:39 in vim fireplace, how do I send a command over to nRepl ?

18:40 in particular, I want to send "(+ 1 2)" over nRepl over vim fireplace

18:42 cmatheson: clj_newb_2345: cpp should evaluate the sexp under your cursor

18:49 gfredericks: does it sound plausible that you can only call static methods on fully-qualified class names if they begin with a capital letter?

18:50 correction -- you cannot call static methods on a fully qualified class name if that name is the same as a namespace

18:50 sdegutis: who runs lazybot?

18:50 Raynes: ping

18:50 callen: sdegutis: ping

18:50 sdegutis: callen: pong

18:51 callen: sdegutis: change into those short shorts yet?

18:51 Raynes: sdegutis: Pong./

18:51 hiredman: yes

18:51 bbloom: Raynes: yes, i do study trees. trees of data are awesome

18:51 hiredman: gfredericks: you cannot if you use the sugar syntax which is all anyone uses these days

18:52 bbloom: seangrove: what's up?

18:52 hiredman: (. classname methodname arg1 arg2 ...) should work

18:52 gfredericks: hiredman: ah indeed it does

18:53 hiredman: (. classname methodname arg1 arg2 ...) is sort of degenerate, the real retro way is (. classname (methodname arg1 arg2 ...))

18:53 gfredericks: ah right

18:53 sdegutis: Raynes: never mind.

18:53 sorry to bother

18:54 jtoy: how could I implement a take but that keeps adding nil if there is no more form the colleciton ,for example (take-more 4 [1 2 ] ) => (1 2 nil nil)

18:57 llasram: jtoy: (take n (concat coll (repeat nil)))

18:59 jtoy: llasram: nice one

18:59 that is really cool

19:03 egghead: found some insane behavior in core.async

19:05 squidz: egghead: like what?

19:06 egghead: making a minimum test case

19:17 I blame dnolen

19:17 :p

19:20 the bug is that the first message in the 'observable' never gets sent: https://www.refheap.com/17041

19:21 but it works when you change it to: https://www.refheap.com/17041

19:21 some sort of core.async bug?

19:21 dnolen: tbaldridge: ^

19:21 should be able to just paste that into a repl

19:22 might help if I included the definition of put-all! there...

19:24 hiredman: egghead: those are both the same url

19:26 egghead: ah

19:26 I've been doing edits

19:26 ignore everything before: if you paste this into your repl: https://www.refheap.com/17041 -- you will see only the second print

19:27 if you swap the comments, and try again you will see it work

19:28 hiredman: I bet oyu just have a race

19:29 the non-working case takes the value of listeners, then blocks on the channel, the working case blocks on the channel then takes the value of listeners

19:29 egghead: aaaah

19:30 so the listeners is dereferenced as empty before the channel is parked

19:30 so dereferencing *after* the message is received solves the problem

19:30 thanks hiredman

19:31 clj_newb_2345: is there a way to ahve a *.clj such that (1) it is executed once when I run "lein repl" and (2) it _NEVER_ gets executed during runs of (clojure.tools.namespace.repl/refresh)

19:36 alandipert: clj_newb_2345: https://github.com/technomancy/leiningen/wiki/Upgrading#user-level-settings perhaps

19:36 clj_newb_2345: or rather, the user.clj mechanism

19:37 clj_newb_2345: alandipert: is user.clj locate in the "src/" or in the same dir as project.clj ?

19:37 alandipert: clj_newb_2345: i think in ~/.lein but i could be wrong

19:37 clj_newb_2345: so it's for lein, but not per project

19:37 alandipert: correct

19:38 lynaghk: hey don't you do stuff w/ lein + user.clj + tools.namespace? how do you make go?

19:38 technomancy: that doesn't really have anything to do with the repl

19:38 clj_newb_2345: this is my fault for not being clearer

19:38 hyPiRion: the name is profiles.clj, by the way, not user.clj

19:38 clj_newb_2345: I want a blah.clj file that is (1) per project, (2) loaded when I run "lein repl" and (3) never loaded by clojure.tools.namespace/refresh

19:40 technomancy: clj_newb_2345: there's :init-ns and :init under :repl-options in `lein help sample` but I have no idea what clojure.tools.namespace does with that

19:45 akurilin: Quick question, in a ring app, where do I place static resources like random support data in xml/json? Is resources/ the right location?

19:45 tbaldridge: egghead: just a note: you really shouldn't mess with the protocols in core.async, they are subject to change without notice. They're considered "internal"

19:45 technomancy: akurilin: yeah, use resources/

19:46 akurilin: technomancy, awesome. Is there any special magic I need to do to be able load files from that location when I uberjar?

19:46 technomancy: akurilin: shouldn't be

19:46 akurilin: technomancy, so I should be able to read files from the fs as if they were under resources/ even though it's packaged in a jar, righT?

19:47 technomancy: no, not from the filesystem

19:47 you need to go through clojure.java.io/resource

19:47 squidz: whats a good way to get this value given a value? The value in an array within a map

19:48 https://www.refheap.com/17042

19:48 akurilin: technomancy, ah ok, I'll investigate that.

19:49 Raynes: &(first (filter (comp #{"2009-01-01 15:55:08"} :middate) (:values your-map))

19:49 lazybot: java.lang.RuntimeException: EOF while reading, starting at line 1

19:50 Raynes: Not sure why I tried to evaluate that.

19:50 Anyways.

19:50 egghead: tbaldridge: that was actually some code I plucked from dnolen, but I am doing a few things against those protocols.. do you see them changing much soon or just a 'dont rely on them, volatile, etc'

19:50 squidz: thanks Raynes just wasn't sure if there was a better way to get it without filter, but that was your first idea as well so ill go with it

20:04 tbaldridge: egghead: in CLJS it's just "they're volatile", in CLJ, it's more "the semantics are super hard to understand and it's super easy to use them wrong"

20:04 where using them wrong results in deadlock

20:07 egghead: ah :)

20:08 clj_newb_2345: using vim + fireplace; during a repl call, I get an error. typig in ":lopen" I get the file names + lines of the stack frames. Question: how do I get my editor to jump me to those files / line numbers? I've tried ":cn" (which works with C/C++ errors, but apparently not whatever :lopen is doing)

20:09 ah, lne

20:12 tos9: Yep, that's the location list (as opposed to the quickfix list which are the :c* stuff)

20:13 clj_newb_2345: tos9: you're also a fireplace user?

20:13 it seems much better than vimclojure (which often froze on me for no reason)

20:13 tos9: I happen to be yeah, when I do any clojure.

20:21 clj_newb_2345: when building a project with both a clj and a cljs component, should I have two separate directories with two seprate proejct.clj files, or should I have one project.clj file for both parts?

20:22 rlb: I'm working on some clojure code to talk to a squeezebox. It has to wait for a connection from the squeezebox, and then accept regular status packets from the device. It can also send back commands over the same socket.

20:22 I'm wondering how an api for that should look, i.e. should it have an internal thread for the status packets, or should it just expose a function that the user has to call regularly...

20:27 Bronsa: technomancy: I have a fix for CLJ-1241 :P

20:29 technomancy: also the bug wasn't only on get, it was when overriding every c.c var without :excluding it

20:30 technomancy: Bronsa: I figured as such

20:30 what's the tl;dr on th efix?

20:31 Bronsa: technomancy: wait a sec, I'll show you the patch, it's easier

20:33 technomancy: http://sprunge.us/OcYO?diff

20:34 technomancy: basically, DefExpr.parse did registerVar on the result of lookupVar

20:35 technomancy: Bronsa: the indentation augh

20:35 callen: I'd forgotten how repetitious Python feels compared to Clojure

20:36 I keep wanting to refactor a bunch of stuff and then have to stop myself because it'd quickly turn into crazy bad mojo.

20:36 at least I have decorators :(

20:39 Bronsa: technomancy: right, let me fix that (damn tabs)

20:39 hiredman: technomancy: it's not like you were going to read the java anyway

20:39 technomancy: Bronsa: not your fault; it's just ...

20:39 hiredman: it's not for reading

22:17 lynaghk: alandipert: as described in Stuart's post: http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded

22:29 clj_newb_2345: I have about 7000 LOC of clojure code

22:29 I should start refactoring

22:29 what's a good guide on creating my own little libraries

22:29 namely things that I can tell lein to grab (with version numbers)

22:30 gfredericks: use github and clojars?

22:30 bbloom: clj_newb_2345: lein has good docs

22:31 clj_newb_2345: hmm, was not aware lein can create these libraries for me

22:32 technomancy: did you write lein?

22:32 (I'm reading https://github.com/technomancy/leiningen/blob/preview/doc/TUTORIAL.md )

22:32 gfredericks: he did write lein

22:42 Kowboy: (keyword "Vanden Bosch") -> :Vanden Bosch

22:42 this is correct behavior?

22:42 bbloom: Kowboy: it's undefined behavior. clojure doesn't check it's args all that much

22:42 Kowboy: hmm

22:43 bbloom: "garbage in, garbage out"

22:43 Kowboy: I probably can't use keywords here then

22:43 bbloom: strings are still immutable and make perfectly good map keys :-)

22:44 Kowboy: this is a JSON body that I'm getting through clj-http.client/get

22:44 using :as :json

22:45 I can do :as :json-string-keys

22:45 bbloom: i disapprove of automatically keywordize-ing json keys, others disagree. they are wrong :-)

22:45 amalloy: bbloom: it's not a bad default, as long as there's a way to turn it off

22:45 Kowboy: I probably would have disagreed, until this happened

22:46 obviously, a space messes things up

22:46 bbloom: amalloy: it's not a bad option, as long as it's off by default ;-)

22:46 Kowboy: as I am pr-str'ing this and spitting it to a file

22:46 amalloy: *chuckle* i disagree, but not strongly

22:46 bbloom: amalloy: you're always pleasant to debate

22:47 (inc amalloy)

22:47 lazybot: ⇒ 68

22:47 Kowboy: then trying to slurp it back in later, at which point you can probably guess... I have a map with an uneven number of forms

22:47 amalloy: aww

22:47 clj_newb_2345: (re packaging lein libraries); what do I do after a "lein uberjar" ?

22:48 amalloy: clj_newb_2345: delete the uberjar

22:49 clj_newb_2345: rm -f target/monitor-0.0.1-standalone.jar

22:49 done

22:49 what next?

22:50 echo-area: (inc bbloom)

22:50 lazybot: ⇒ 11

22:50 amalloy: $google clojars help

22:50 lazybot: [Pushing · ato/clojars-web Wiki · GitHub] https://github.com/ato/clojars-web/wiki/Pushing

22:50 echo-area: How did everyone get a number?

22:50 bbloom: $help karma

22:50 lazybot: bbloom: Checks the karma of the person you specify.

22:50 bbloom: (karma echo-area)

22:50 $karma echo-area

22:50 lazybot: echo-area has karma 0.

22:50 bbloom: (inc echo-area)

22:50 lazybot: ⇒ 1

22:50 bbloom: there you go buddy, getting you started

22:50 clj_newb_2345: wtf

22:51 all all I type is "lein deploy clojars" ?

22:51 echo-area: bbloom: Ah, good to know, thanks :)

22:51 sdegutis: worked for me

22:51 cc clj_newb_2345

22:51 amalloy: clj_newb_2345: well, you need to have a clojars account set up and lein needs to know about it

22:51 but then, yes

22:52 $google lein readme deploying

22:52 lazybot: [immutant/lein-immutant · GitHub] https://github.com/immutant/lein-immutant

22:52 amalloy: ugh

22:53 bbloom: boo

22:55 clj_newb_2345: one more dumb question:

22:56 how do I deploy to a local directory rather than clojars?

22:57 xeqi: lein deploy file://some/file/path

22:58 iirc

22:58 or setup a :deploy-repository with a name and a file:// path

22:59 amalloy: xeqi: id that better than `lein install` somehow?

22:59 clj_newb_2345: fuck, I need to setup gpg

22:59 damn it :-)

23:00 amalloy: clj_newb_2345: i was surprised by how easy it was, if that's any consolation

23:00 clj_newb_2345: I'm sure it's one of these things

23:00 where in retrospect, it's clearly obvious

23:00 xeqi: clj_newb_2345: theres a fun part

23:01 if you really don't want to sign the jar you can set a flag on the repo config... :sign false maybe? it might be in the sample project.clj

23:01 but I strongly prefer you get gpg

23:01 amalloy: they do different things with respect to -SNAPSHOTs and checksums

23:02 amalloy: well, once you've set up gpg to encrypt your clojars credentials, you might as well use it to sign the jar

23:03 xeqi: if you are simulating clojars, use deploy. if you just want to install locally then either works. I'll tell you to use `lein install` if possible, and technomancy seems to prefer `lein deploy` to the local cache

23:06 clj_newb_2345: https://github.com/technomancy/leiningen/blob/master/sample.project.clj <-- quoting, ;; Override location of the local maven repository. Relative to project root. :local-repo "local-m2"

23:06 why is it relative to project root and not global ?

23:08 xeqi: amalloy: cemerick asked the maven ML the difference between the two last year and never really got an answer :/ http://maven.40175.n5.nabble.com/Functional-distinction-between-install-and-deploy-operations-td5506997.html

23:08 clj_newb_2345: because then its not portable on another machine

23:09 clj_newb_2345: maybe I'm solving the wrong problem; let me re-think my specs and ask the right question

23:10 muhoo: why would i be getting "can't create iseq from symbol" on a persistentvector when calling first on it?

23:10 xeqi: muhoo: because you have a symbol instead of a persistentvector ?

23:11 muhoo: i have data like #{[2] [3]}. each item isn't a symbol, it's a persistent vector. running (type) on it says o

23:11 running first on each of it, gives me this weird error

23:12 so (for [p #{[2] [3]}] (-> p type)) shows a persistent vector.

23:12 (for [p #{[2] [3]}] (-> p first)) gives me that weird error

23:12 mind you, not on that above sample data, but on my actual data set :-/

23:13 amalloy: muhoo: perhaps the object at the front of the vector throws an exception in its toString method

23:14 nothing else makes much sense

23:14 muhoo: yeah, this is a really weird one

23:14 oh..! nevermind.

23:14 amalloy: muhoo: try (-> p first type)

23:14 muhoo: i did that, i found the problem

23:15 amalloy: well, don't leave us hanging

23:15 muhoo: it was a huge 10k data set, which got pr-str'ed to a file and then read-edn'ed back in, ad...

23:15 here's the end of the file:

23:15 [4081455882183270] [510806782706245813] [44050902578321702] ...}

23:15 those literal ellipsis are in there :-/

23:15 doh

23:15 amalloy: ah

23:15 muhoo: laziness.

23:16 xeqi: clj_newb_2345: what are you trying to do?

23:16 muhoo: when i used map or for, it blew up. apparently, on the LAST item, not the first

23:17 amalloy: i don't really get that, though; shouldn't the {x y ...} have thrown an exception when you read it?

23:17 since it's a map literal with an odd number of forms

23:18 muhoo: it's a set not a map

23:18 #{} not {}

23:18 amalloy: ah

23:19 muhoo: the problem was some stupid homegrown prettyprinter i had which set the max size to 10k count. the data set is actually 27k+ count, and it truncated it

23:19 callen: muhoo: never set timeouts or maximum sizes unless it's going to kill somebody.

23:20 and even then...maybe.

23:20 muhoo: i try to never make absolute statements ever :-P

23:20 callen: muhoo: I try to scare people straight >:)

23:23 xeqi: hmm, too bad search doesn't say what repo it is in :/

23:24 well that was a random previous line

23:25 bbloom: muhoo: have you considered fipp? :-) pretty printing large data files w/o slowing to a crawl is one of the things i do with it

23:26 might not work well if you have a deeply nested structure, since it caps the right-margin-search at col-width

23:26 muhoo: bbloom: thanks, will look at it!

23:26 bbloom: but if you have a generally flat structure, it works great for large files

23:27 flat == sensibly pretty prints at < 80 columns (adjustable)

23:27 muhoo: i'm doing datomic stuff with a couple hundred thousand records, and i'm sanity checking my queries by looking at data dumps

23:28 bbloom: let me know if it helps you!

23:28 i'm on a quasi-quest to pretty-print-by-default clojure-wide :-)

23:32 amalloy: bbloom: my instinct is that this would be terrible

23:33 bbloom: why?

23:33 clojurebot: bbloom: because you can't handle the truth!

23:33 bbloom: *sigh*

23:34 amalloy: IME either the data structure i'm printing is small enough that i can see what's going on in the default print format, or it's large/deep enough that pprint makes it pretty illegible

23:34 but i'm willing to believe i could be wrong here

23:34 bbloom: amalloy: if you're pretty printing a large sequence of many small maps, it winds out working just fine

23:35 which is what i deal with

23:35 akurilin: Are java resources accessible through clojure.java.io all already in memory when you read them? As in, are they cached in memory when the jar is loaded?

23:35 amalloy: bbloom: doesn't it then take up so many lines that you can only see a couple of the maps in the repl anyway? might as well just (prn (take 2 maps))

23:36 bbloom: amalloy: it's for non-repl use. like you run a large batch job and print a random 100 results to eyeball or something

23:37 amalloy: you said pprint by default throughout clojure

23:37 bbloom: oh, i thought you were talking about muhoo's use case

23:38 muhoo: i have taken to doing the following

23:38 bbloom: as for in-repl use, you prefer long wrapping lines of values over neatly pretty printed blocks?

23:38 muhoo: so as not to flip out nrepl or emacs

23:39 amalloy: bbloom: i don't have so many pixels i can afford to spend 2/3 of them on whitespace :P

23:39 muhoo: i send stuff thru my pretty printer, which i then spit to "/tmp/foo.edn"

23:39 lynaghk: bbloom: I'm going to open source this zeromq library tonight---as soon as I can think of a name. Any suggestions?

23:39 muhoo: i have /tmp/foo.edn as an auto-revert buffer in emacs

23:39 bbloom: lynaghk: give me the two sentence sales pitch

23:39 amalloy: i have lots of pixels :-) you're a programmer dammit. invest in a nice big screen

23:40 TimMc: Laptops, man.

23:40 Laptops.

23:40 amalloy: bbloom: i have one. i need to use it on large text at low res so that i can see it

23:40 lynaghk: bbloom: it exposes ZeroMQ sockets in a threadsafe way using core.async channels.

23:40 amalloy: but for the more common case: yes, laptops

23:40 bbloom: heh, i can't ever get any work done on my laptop. *shrug* maybe i now know why

23:40 muhoo: lynaghk: "sockpuppet"

23:41 lynaghk: bbloom: there is already a cljzmq and clj-zmq, and clj-0MQ

23:41 bbloom: lynaghk: ZeroAsync?

23:41 lynaghk: muhoo: I was thinking something like juggler, but yeah. Only concern is googability

23:41 amalloy: bbloom: you may be amused to know that my "monitor" at home is 55"

23:41 bbloom: zeroasync is just about as much of a misnomer as zeromq itself :-P

23:41 lynaghk: bbloom: yeah, I was thinking about just the boring-but-explicit "zeromq-async"

23:42 clj_newb_2345: okay okay

23:42 muhoo: lynaghk: or you could go with the technomany approach and pick something relatively obscure

23:42 bbloom: amalloy: sheesh, sounds like neck pains haha

23:42 clj_newb_2345: I got it all working with "lein localrepo"

23:42 lynaghk: bbloom: I could also go for "ØMQ-async" so everyone hates me.

23:42 clj_newb_2345: thanks to everyone for their help

23:42 callen: bbloom: yeah I was trying to remember the name of fipp. How fast is it anyway?

23:42 clj_newb_2345: this is indeed trivial, like 2 commands

23:42 I should write a blog post about it

23:42 malyn: lynaghk: zerosync? Less obvious, and yet still true. :)

23:42 bbloom: callen: at least 5 times as fast, usually more, than clojure.pprint

23:42 callen: doesn't slow down w/ the size of the input either

23:42 callen: bbloom: <3

23:43 amalloy: lynaghk: you'll get unusually high numbers of google queries, because people will be searching for the library so they can copy/paste the name into their project.clj files

23:43 bbloom: callen: also, the threaded async branch is marginally faster, but i only have 2 cores, so i can't really tell how much it speeds things up on a 8+ core box

23:43 it should have concurrency of at least 5 or 6 or so

23:43 muhoo: bbloom: thanks, fipp looks very cool

23:43 bbloom: thanks :-)

23:43 lynaghk: An important distinction between my library and all of the others is that I'm not trying to replace java interop. Rather, I'm making ZeroMQ sockets threadsafe, which is the actual hard part of using them.

23:44 bbloom: lynaghk: that's b/c you're supposed to communicate between threads with zero mq :-P

23:44 thread safety isn't interesting to me, core.async ioc is interesting

23:45 but free thread safety, i'll take that too :-)

23:45 anyway, i like ZeroAsync

23:45 go with that

23:45 lynaghk: bbloom: yeah, I was totally going to do right up until I realized I wanted to pass more than bytestreams between my threads =P

23:45 callen: bbloom: you really can't contrive an 8-core++ dedi? Aren't you a trust fund kid or something?

23:46 bbloom: callen: no, i'm not a trust fund kid or something

23:46 amalloy: bbloom: you're a programmer, invest in a decent processor!

23:46 callen: amalloy: Processor(s)

23:46 bbloom: amalloy: i did. but it's a laptop ;-)

23:47 callen: (* 8 Processor(s))

23:47 bbloom: …. connected to my big display haha

23:47 amalloy: i guess it's true what they say. engineering is all about tradeoffs

23:47 bbloom: i was gonna spin up a big server on some cloud provider to benchmark it

23:47 but i got lazy

23:47 that's my normal solution when i need bigger processors

23:47 s/bigger/more/

23:48 amalloy: bbloom: what about that place that gives you a free unix VPS then tears it down half an hour later? i bet you could install clojure and benchmark fipp in half an hour

23:48 bbloom: haha

23:49 too many projects, not enough time

23:49 * bbloom has all the excuses

23:52 callen: amalloy: those VPSs are actually kinda awful.

23:53 amalloy: and wouldn't really have the parallelism needed to exercise the bits under discussion.

Logging service provided by n01se.net