#clojure logs

2013-07-30

00:00clj_newb_2345either that, or I'm stupid
00:00clj_newb_2345where is clojure code example?
00:02tbaldridgeclj_newb_2345: try this https://github.com/Datomic/day-of-datomic/tree/master/src/datomic/samples
00:02tbaldridgeclj_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
00:04clj_newb_2345tbaldridge: yeah, I was going to ask -- these examples are really short and I have no idea what's gong on
00:04clj_newb_2345tbaldridge: the 2nd example looks much better, thanks!
00:05tbaldridgeclj_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.
00:08asteveI'm new to compojure and I'd like to serve an html file as the response to a GET
00:08asteveshould I use (route/files ...)?
00:08asteveI believe I should place the files in resources/public
00:11eggheadasteve: no reason why you couldnt use route/resources {:root "public"}
00:12eggheadexcept it'd serve at somewhere like index.html
00:13clj_newb_2345https://github.com/Datomic/day-of-datomic/blob/master/samples/seattle/getting-started.clj <-- should the seattle-schema.edn be .dtm ?
00:14asteveegghead: ok, now how do I route my GET "/" to that resource?
00:15asteveI would like to serve the index.html located in resources/public when a GET "/" happens
00:17eggheadasteve: and you don't want any sort of templating/dynamic behavior?
00:17asteveI'm trying to start very simple to understand how the pieces come together
00:19egghead(GET "/" [] (slurp (clojure.java.io/resource "public/index.html")))
00:19eggheadthat doesn't cache tho
00:19eggheadwill re-read the file every request
00:20asteveah
00:20eggheadI've been using enlive for my latest clj app, quite nice
00:25asteveegghead: thank you
00:25eggheadofc
00:28clj_newb_2345oh shit
00:28clj_newb_2345typing the code of https://github.com/Datomic/day-of-datomic/blob/master/samples/seattle/getting-started.clj into this
00:28clj_newb_2345already makes me feel smarter
00:28clj_newb_2345as if I'm learning from great masters
00:28clj_newb_2345the Gates foundation should make a donation to relevance software so datomic gets open sourced
00:42callenegghead: you should try Selmer. :)
00:43eggheadinteresting
00:46eggheadI'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
01:22zeroemegghead: almost got that streaming working :F
02:30cmatheson/exit/exit
02:30cmathesonoops
03:49hyPiRionbabilen: no problemo, I'll push out a new version in some hours
07:28wakeuphi
07:28dbushenkohi
07:28edbond__Hi
07:29wakeupwhat would be clojure's parallel to CL's WITH-OUTPUT-TO-STRING ?
07:29edbond__,(doc with-out-str)
07:29manutter|2,(doc with-out-str)
07:29clojurebot"([& body]); Evaluates exprs in a context in which *out* is bound to a fresh StringWriter. Returns the string created by any nested printing calls."
07:29clojurebot"([& body]); Evaluates exprs in a context in which *out* is bound to a fresh StringWriter. Returns the string created by any nested printing calls."
07:29manutter|2there an echo in here? :)
07:30hyPiRionecho foo
07:30lazybotfoo
07:30edbond__echo echo
07:30lazybotecho
07:31wakeup(thanks!) in emacs's clojure mode, how do I start the repl?
07:31wakeupe.g. get an interactive session?
07:31edbond__C-c M-j
07:31wakeupor, whats the preferred way to get an environment similar to SLIME?
07:31dbushenkoyou need nrepl
07:31dbushenkothen M-x nrepl-jack-in
07:31edbond__wakeup, https://github.com/clojure-emacs/nrepl.el
07:31wakeuphave it installed, that worked thanks
07:32wakeupjust didn't know how to start it :D
08:07dotemacsClojure workshop in Munich: http://clojureworkshop.com/
08:07dotemacspretty cool idea
08:07dotemacsand the best part is that they are doing it for free
10:24tbaldridgeI 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&amp;utm_medium=videos_homepage&amp;utm_campaign=videos_row1
10:24tbaldridgeGood stuff, and Tom's library looks pretty impressive.
10:27dark_elementtbaldridge is it the one with d3 demos?
10:28dark_elementtbaldridge yup it is.
11:09hexaanyone 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:10hexaor could it be because my id is itself ajax generated... humm
11:11stuartsierrahexa: Does the link exist in the DOM at the time when you call `listen!`
11:11stuartsierra?
11:11hexastuartsierra, nope good point hehe
11:12hexaI guess I'll try calling it after I render the node :)
11:14hexayep working now :) doh
12:40clj_newb_2345in 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:44alandipertclj_newb_2345: something like https://www.refheap.com/17033 perhaps?
12:44clj_newb_2345alandipert: exactly. thanks!
12:51eggheadwoah
12:51eggheadcore.async channels can get backed up pretty easily apparently
12:52bbloomegghead: 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:52bbloomasync puts are effectively an unbounded buffer
12:53bbloomif you have a >! within a go nested within another go, you might be doing an async put
12:55tim__bbloom: I wouldn't call them unbounded, more like bounded to the number of gos
12:56bbloomtbaldridge: isn't that like saying the heap is bounded by OOM errors?
12:59tbaldridgebbloom: 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:00bbloomtbaldridge: 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:00tbaldridgethat 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:01bbloomheh, we just wrote the same thing basically, i was talking about put, you about take
13:01dnolentbaldridge: btw, is there any reason binding names aren't preserved? This breaks macros that work with locals.
13:01dnolentbaldridge: ^ is a question about the IOC compilation stuff in core.async
13:02tbaldridgebreaks macros that work with locals...example?
13:02dnolentbaldridge: like locals matching in core.match
13:02bbloomtbaldridge: 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:02dnolen(let [x 1 y 1] (match x y :match :else :no-match))
13:02tbaldridgebbloom: lol.
13:02clojurebotbbloom: readability is not binary
13:03dnolenwon't work in a go block
13:03eggheadhm
13:03eggheadI am probably doing that bbloom
13:03tbaldridgeYeah I may have to do a screencast at some point...I'm really a horrible blog writer.
13:03bbloomegghead: i know you're probably doing that. that's why i explained it :-)
13:03dnolentbaldridge: note that example requires that y not be renamed
13:03eggheadhah, thanks :)
13:04tbaldridgednolen: 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:04tbaldridgeor is there something in core.match that does (name sym)?
13:05dnolentbaldridge: it doesn't do anything to the symbol at all - if a symbol appears in &env we leave it untouched.
13:05bbloomegghead: 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:05bblooma trivial macro could fix that up
13:05eggheadwhat do you mean that 'async puts are an unbounded buffer' -- wouldn't (put! foo :bar) just use the buffer of foo?
13:05bbloomegghead: no, put! will schedule a callback to be executed when foo is ready to accept a value
13:06tbaldridgeegghead: 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:07bbloomtbaldridge: (defmacro << [& body] `(<! (go ~@body))) ; I think this is only needed for ! not for !!, since <!! is already true blocking.. right?
13:07tbaldridgednolen: 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:08tbaldridgebbloom: ish...yeah <!! is exactly what you have there, except it uses promise/deliver.
13:08bbloomtbaldridge: right, but <!! doesn't work in cljs
13:09tbaldridgebbloom: right.
13:09bbloomtbaldridge: so maybe in cljs we can define <!! as (<! (go ~@body))
13:09bbloomthat's an interesting thought ^^
13:09eggheadI didn't even know that you could use <! outside of a go block
13:09bbloomegghead: i'm assuming anested go block, hence it's a macro and not a function
13:09eggheadah :p
13:10tbaldridgebbloom: 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:10bbloomtbaldridge: heh, not a bad idea
13:10bbloomwould be bad if you never trip it in dev, then it happens in prod tho :-/
13:10tbaldridgesame with OOM right :-)
13:11bbloomanyway, i think i like that <!! idea, i need to think about it some more tho
13:11bbloomtbaldridge: 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:12bbloomtbaldridge: what do you think of that <!! idea?
13:12bbloomor something similar
13:12tbaldridgebbloom: 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:12dnolentbaldridge: hrm, so does go fully expand all macros before it applies it's own transformation?
13:12tbaldridgednolen: yes
13:14bbloomtbaldridge: 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:14tbaldridgebbloom: 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:14bbloomtbaldridge: yeah, ok. i'll need to think more about it before i make any suggestions :-)
13:15dark_elementdnolen Is there any work going on for supporting user defined tagged literals in cljs ?
13:15dnolendark_element: I'm not working on it no, but there are tickets about that which need more eyes and more feedback
13:15dark_elementdnolen yes I was looking at this one right now http://dev.clojure.org/jira/browse/CLJS-335
13:17dnolendark_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:18bbloomdnolen: 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:18bbloomjavascript-constants, that is
13:19dnolenbbloom: oh right, a different ticket w/o a patch
13:19dark_elementdnolen I share the same feeling about the ticket. I have no patch sets or even a clue how to do it right now.
13:19bbloomyeah i'm not sure what ticket is which, but i think kovas just ran into a problem & didn't understand the underlying problem
13:19bbloomif we fix the underlying issue, his ticket will surely go away or make more sense
13:20dnolentbaldridge: it's very strange, it seems to me that locals are being rewritten before the match macro expands
13:20dark_elementdnolen I am working on a javascript datetime library and support for tagged literals would make dev a little faster
13:20gfredericksevery 10 seconds somebody somewhere considers writing a custom macro variant of defn to support some particular thinger
13:20dnolendark_element: sure
13:20bbloombut 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:21bbloomdnolen: plus i know you want to do constant lifting for perf reasons :-)
13:21dark_elementdnolen i can do away with some debug functions for now i guess
13:21technomancygfredericks: "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:21technomancygfredericks: https://github.com/Fuco1/clippy.el
13:23dnolentbaldridge: ok, yeah ioc_macros.clj doesn't do a deep expand, it's incremental with the SSA compilation process it seems to me.
13:23gfrederickstechnomancy: 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:24gfrederickse.g., by registering handlers for metadata keys
13:25dark_elementdnolen 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:25technomancygfredericks: what about just walking existing namespaces, examining metadata and alter-var-rooting after the fact? =)
13:25gfrederickstechnomancy: I assume that's a joke, but also you might want to do things at macroexpand time as well
13:25gfredericksand e.g. look for metadata on the arg list
13:26dnolendark_element: you should probably look at this ticket - http://dev.clojure.org/jira/browse/CLJS-512
13:27technomancygfredericks: sounds evil, but whatever. there's always a place for evil.
13:28dnolendark_element: updated ticket w/ more precise IRC discussion link
13:29dark_elementdnolen cool
13:30tbaldridgednolen: ah...yeah, it deep expands up to a fn boundary...is that what you're thinking?
13:30innar_madehey 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:30tbaldridgednolen: although it does restore all the locals, so closures work.
13:31tbaldridgednolen: restore all locals at the point of creating a closure that is.
13:32innar_madepls don't share code to make it work, just some hints
13:32innar_madeso I can go in right direction
13:34innar_made(let [form '(/ 16 8)] `(~@form)) => (/ 16 8) , still symbols
13:34dnolentbaldridge: minimal case http://dev.clojure.org/jira/browse/ASYNC-15
13:36tbaldridgednolen: 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:36dnolentbaldridge: cool thanks
13:36tbaldridgednolen: it should be super easy in CLJs, perhaps not as easy in CLJ (yay for more compiler interop!)
13:41innar_made(let [[f & vs] '(/ 16 8)] `~f) f still remains as symbol
13:47bbloominnar_made: yeah, that makes sense. ~ doesn't exist outside of `, because outside of ` it is basically val
13:47bbloomeval* i mean
13:47bbloom(let [[f & vs] '(/ 16 8)] (eval f))
13:48innar_madeI cannot use eval
13:48innar_made4clojure does not allow it
13:48dnoleninnar_made: the hint - look into resolving symbols
13:48bbloominside a macro, you'll get the right result because the expansion will be resolved
13:48innar_maderesolve is also not allowed
13:49bbloomwhich problem is this?
13:49dnoleninnar_made: oops missed that above.
13:49innar_madenp
13:49bbloominnar_made: which 4clojure puzzle is it?
13:50bbloomthe infix calculator?
13:50innar_madehttps://www.4clojure.com/problem/121
13:50innar_madeI basically have solved rest of the problem, only making symbol as function remains
13:51bbloominnar_made: just make your own mini-resolver. use a map
13:51bbloom,({'+ +, '- -, '/ /, '* *} '/)
13:51clojurebot#<core$_SLASH_ clojure.core$_SLASH_@1fa5c7a>
13:52innar_madebbloom: oh man, that's cool idea
13:53bbloominnar_made: that's pretty much how resolve works anyway :-P
13:53innar_madebbloom: thanks, I think I am un-stuck now :)
13:57aphyrWeird question: how do I do a narrowing primitive cast in Clojure?
13:57alandipertaphyr: what do you mean by narrowing? floor or precision loss?
13:58aphyre.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:58aphyrloljava, I know
13:59aphyrIIRC, there's no sign preservation in narrowing integer primitive casts in java, so (short) x should do the trick.
14:00alandiperti think so too
14:00alandipertappropriate in the summer as well
14:00alandiperti guess that would be #'shorts
14:00aphyrheh
14:00aphyrbut yeah, (short 63335) does a range check and throws
14:01innar_madebbloom: thanks again, one more problem solved :)
14:01Bronsaaphyr: ##(.shortValue 63335) maybe?
14:01bbloomi love 4clojure, helped me a lot when i was getting started
14:01lazybot⇒ -2201
14:02aphyrInteresting, but that should be -1
14:02aphyrAha, I think maybe unchecked-short is what I want
14:02Bronsathat returns the same thing
14:03Bronsaaphyr: ##(.shortValue 65535)
14:03lazybot⇒ -1
14:03Bronsaalso unchecked-short
14:03innar_madebbloom: 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:04bbloominnar_made: the resolve function would enable you to circumvent the security restrictions
14:04innar_madeok, just like eval
14:06innar_madebbloom: the resolve fn implementation does not seem to do anything dangerous, ok maybe smth dangerous could happen inside clojure.lang.Compiler/maybeResolveIn
14:06bbloominnar_made: it's not the resolve that's dangerous. it's the functions that might be returned from resolve :-)
14:06bbloom(resolve (symbol "eval"))
14:06innar_madebbloom: ah yeah, good point
14:07aphyrThanks guys :)
14:15sdegutisgfredericks: yep, deftest, defspec, etc
14:33alexebertshi all - does anyone know how to make paredit accept a quote after a hashmark in emacs?
14:33alexebertsI can do it by preceeding the hash wish C-q but it gets tiring quickly when doing regular expressions in clojure
14:35rboyd_alexeberts: ? it works ok here
14:37stuartsierraalexeberts: Is this related to https://github.com/clojure-emacs/clojure-mode/pull/169 ?
14:38alexebertsrboyd_ : 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:38hiredmanyes
14:38rboyd_alexeberts: yea..
14:39rboyd_alexeberts: my dotfiles are on github if you want to manually diff environments somehow
14:40alexebertsok, thanks. I must be using an older version of clojure-mode
14:40rboyd_stuartsierra: I pulled the trigger and ordered a kineses after seeing you loved yours enough to drag it along to lambdajam =)
14:40stuartsierrarboyd_: Congratulations! Hope it's equally worth it for you.
14:40stuartsierraI'm on my second after dragging it all over the world.
14:40alexebertsstuartsierra: 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:40alexebertsrboyd_ thx - much appreciated!
14:44rboyd_stuartsierra: have you seen the ergodox? would be kind of cool just for the lightsaber aspect of building it from the kit
14:45stuartsierrarboyd_: I didn't understand that sentence. :)
14:45rboyd_stuartsierra: http://vimeo.com/67847164
14:45rboyd_you know, a jedi builds his own lightsaber
14:46stuartsierraOh, I didn't know what Ergo-Dox was.
14:47hiredmanright now, as far as I know, no one is selling the kit, but massdrop has it from time to time
14:47stuartsierralooks kinda cool
14:47stuartsierraI really like the curved key wells of the Kinesis though.
14:50seangroveJesus, a lot of clojure people at Factual
14:51gfredericks$seen jesus
14:51lazybotI have never seen jesus.
14:53hyPiRiongfredericks: oh, you
14:54RayneshyPiRion, gfredericks: you guys
14:54Raynesseangrove: I randomly saw a Clojure guy who recognized me in the alley behind the Geni office last night when I was leaving.
14:55RaynesTotally wasn't being stalked… right?
14:55RaynesRight.
14:55seangroveHigh-end recruiters are indistinguishable from kidnap and hit squads
14:57callenRaynes: lol
14:57callenseangrove: s/firearms/free lunches/g
14:58callenseangrove: well they use Clojure.
14:58callen(@ Factual clojure people)
15:00Raynes"Well, we've got a shitload of Clojure code here. Here's a wild idea… we should hire people who know Clojure."
15:00callenthat's pretty much how I figured it worked.
15:05clj_newb_2345anyone 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:06callenclj_newb_2345: CSS is its own thing, totally independent.
15:06callenclj_newb_2345: the Mozilla Developer documentation is best.
15:06callenclj_newb_2345: seek a holistic understanding, it'll lead to less frustration later.
15:07clj_newb_2345is there something like a "structured approach to css" rather than "here's lots of little examples"
15:07llasramHow about the spec? http://www.w3.org/TR/CSS2/
15:07clj_newb_2345callen: yes, how do I get this holistic understanding rather than separate examples?
15:07clj_newb_2345llasram: is this something that I can work through along the way to check my understanding?
15:08callenclj_newb_2345: Mozilla Developer documentation.
15:08callenclj_newb_2345: and work with examples + test projects.
15:09clj_newb_2345callen: https://developer.mozilla.org/en-US/docs/Web/Guide/CSS ?
15:10duck11231start with "getting started"
15:14seangrovetbaldridge: This seems like pure madness
15:14tbaldridgeseangrove: ?
15:14seangroveForked objects with mutations on the js side that are invisible from cljs?
15:14seangroveNot quite finished, but maybe he comes around and explains how it's all ok in the end :)
15:15tbaldridgenope...it's pretty much interop at all consts
15:15tbaldridge*costs
15:17clj_newb_2345"cascade" = browser, user preference, css file; "inheritance" = go up the ancestor tree in the DOM ?
15:17seangroveclj_newb_2345: probably best to ask in the css channel
15:17clj_newb_2345seangrove: wasn't aware there was once; thanks
15:17noncomztellman: 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:18ztellmannoncom: pipelines in lamina have a "restart" signal, which allows you to do async looping
15:19ztellmanbut honestly, threads are cheap enough that unless you have thousands of live connections it's okay to waste them
15:19noncomso you'd go with threads?
15:20konrIs there an equivalent to clojure.contrib/show?
15:25noncomztellman: yeah, i won't have thousands, so you'd recommend to go with futures, right?
15:25ztellmannoncom: for an initial implementation, sure
15:25ztellmanit's easy enough to switch over to something more complicated later
15:26noncomok, good i think then it will fit the scenario for now!
15:26ztellmanthough if each message is independent, receive-all would also work
15:31noncomztellman: 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:32ztellmanif you cancel the only consumer on a channel, by default it's closed
15:32noncomgood! i didn't get that from the docs
15:32ztellmanhttps://github.com/ztellman/lamina/wiki/Channels#how-closing-propagates
15:33ztellmancancel-callback ~ "closing" the callback
15:33noncomaahh.. 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:34ztellmanno worries, it's a lot to absorb
15:41lynaghkztellman, bbloom: you have a hot sec for an architecture question about my upcoming zeromq core.async library?
15:42lynaghkRight 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:42bbloomlynaghk: cool, how's that working out?
15:42clojurebotlynaghk: 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:42lynaghkI need to communicate real Java objects from the async thread to the zeromq thread
15:43dnolenoh clojurebot
15:43lynaghkinstead of just strings/byte arrays, which is all I can send via an inprocess zeromq socket from async thread to zeromq thread
15:43bbloomlynaghk: but zmq only allows strings on it?
15:43lynaghkyeah
15:43bbloomyou need an "exchange heap"
15:43bblooma la erlang :-P
15:43lynaghkso I was thinking of just setting up a java.util.concurrent queue to put stuff on
15:43lynaghkand the async thread would basically just be saying, "yo, I left some shit for you on the queue, go unblock and get it"
15:44bbloomyeah, that'd probably do the trick
15:44lynaghkvia the zeromq in process socket
15:44bbloomexchange queue, heap whatever :-)
15:44lynaghkthat'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:44lynaghkI 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:45lynaghkdnolen: I just impulse-bought that book you tweeted about an hour ago, btw
15:45lynaghkdnolen: we'll see if it arrives before I head out to NYC on Thursday = )
15:45bbloomlynaghk: the issue is one of resource management
15:46bbloomdoes the sender need to send the object every time the client may need it?
15:46dnolenlynaghk: haha, amazing book! seriously a must read for anyone involved in computing IMO.
15:46lynaghkdnolen: yeah, I studied a bit of lick's stuff during my undergrad thesis.
15:47lynaghkbbloom: 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:48bbloomlynaghk: ah ok, then yeah, you can probably get away w/ a synchronized queue
15:48lynaghkbbloom: what do you mean by "synchronized queue"?
15:48bbloomi mean both synchronized access (mutable, concurrent, etc) and synchronized with the communication channel
15:49lynaghkah, right. okay, yeah.
15:49bbloomyou 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:49bbloomer no
15:49bbloomnevermind, no multiplexing
15:49lynaghkbbloom: no, the zeromq thread needs to block
15:49lynaghkon zeromq sockets
15:51bbloomso yeah, then what i said before where synchronized means "parallel to the pump link" and "concurrent mutable queue"
15:54glosoliany suggestions what kind of packages I should install for best experience with Clojure ?
15:56gfredericksglosoli: if you want to here more that "leiningen" you'll have to qualify that a bit more
15:56gfrederickshear*
15:56gfredericksthan*
15:56gfredericksI wonder if my ability to spell quickly never recovered from the dvorak transition
15:57glosoligfredericks: well would like to have REPL like experience in side by side window (or whatever that thing is appropriate to call in emacs)
15:57gfredericksglosoli: so "emacs" was a relevant detail
15:57glosoligfredericks: aaaaah sorry
15:57gfredericksclojure-mode and nrepl.el are the normal combo I think
15:57glosoliI thought I have mentioned it
15:58glosoligfredericks: just curious what's "dvorak transition" ?
15:59gfredericks$google dvorak keyboard layout
15:59lazybot[Dvorak Simplified Keyboard - Wikipedia, the free encyclopedia] http://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard
15:59RaynesIt's what coding hipsters do to be cool.
16:00gfrederickswe spend our time complaining about the colmac hipsters
16:00Raynesgfredericks: My boss uses colemak. I can't really say anything about colemak. :p
16:01gfredericksman there is no nice way to express (if a {b c, d e} {b c})
16:01glosoli;/ it would be stupid of me to ask what's wrong with qwerty I assume
16:01gfredericksthe least repetitive I know of is (cond-> {b c} a (assoc d e)) but that's lameo
16:01Raynesglosoli: Well, it was designed to slow you down for one.
16:01ToxicFrog,(doc cond->)
16:01clojurebot"([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:02Raynes</myth>
16:02gfredericks"The QWERTY keyboard layout was designed in 1924 with the goal of slowing down glosoli."
16:02glosolilol
16:02ToxicFrogRaynes: untrue. It was designed to place commonly used letter pairs on opposite sides, allowing it to be used at high speed without jamming.
16:03rboyd_gfredericks: how long did it take you to ramp up on dvorak?
16:03RaynesToxicFrog: [12:46:36] Raynes: </myth>
16:03gfredericksrboyd_: maybe a month
16:03RaynesUgh gfredericks uses dvorak?
16:03RaynesAnd here I thought we could be good friends.
16:03clj_newb_2345is there a separate clojurescript channel, or are clojurescript questions fair game here?
16:03llasramdvorak 4 aoeu
16:03Raynesclj_newb_2345: Fair game her.
16:03Rayneshere*
16:04gfredericksRaynes: my fingers were hurting; I was desparate.
16:04Raynesgfredericks: Stop writing COBOL.
16:04gfredericksyou'll understand when you're older
16:05Raynesgfredericks: You want to take this out on the promenade?
16:05gfredericksyes.
16:07glosoligfredericks: would it be rude to ask how old are you mr ?
16:07RaynesOlder than me.
16:07RaynesMost people are.
16:07nDuff...that hardly says much.
16:07nDuff(ahh, was going to say...)
16:09gfredericksan interesting question what the age distribution in the room is; I might conjecture I'm about the median
16:10gfrederickscemerick should start adding demographic info to his annual survey
16:10gfredericksmaybe just "A/S/L"
16:10Raynes"Most of the Clojure community is between 27 and 44. And then theres Raynes, screwing up this whole bloody chart."
16:11glosoliOld folks
16:11gfrederickswell if _that's_ true I'd be solidly at the bottom
16:11RaynesYou're 27?
16:11gfredericksI think so
16:11RaynesGood to know.
16:11llasramMost of the Clojure community is between 2 and 7,963
16:12gfredericksbring your baby to #clojure day
16:12hiredmansee if they can write swearjure
16:12hexaHumm how would I use a function return value in a regex .. like : (match #( (str "abc")) ?
16:13gfrederickshexa: sounds like you want to assemble the regex programmatically
16:13gfredericks&(doc re-pattern)
16:13lazybot⇒ "([s]); Returns an instance of java.util.regex.Pattern, for use, e.g. in re-matcher."
16:14hexagfredericks, that's it thx ! :)
16:21kovastime to rage
16:24bbloomKOVAS SMASH
16:26kovasbazzaaam!
16:26kovascomputation mofos
16:28kovasbbloom: yesterday I was reflecting how sketchup follows the model of genesis 1
16:28bbloomhuh?
16:28kovasiterative process of separating and refining areas
16:29kovasrather than just dropping a spec fully formed
16:29bbloomah 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:30bhaumanbbloom: here here
16:30kovasthey call that the apocalypse
16:30bhaumanfunny
16:31kovasuniverse not created using waterfall model
16:31bbloomif your refinement steps are too large, you may oscillate around the solution, introducing error, and ultimately diverging
16:32bbloomwaterfalls are iterative refinement too, but relying on the process of evaporation and precipitation isn't a good plan
16:32bbloomrivers dry up sometimes :-P
16:32kovasheh
16:33Derandergl hf optimizing this: http://en.wikipedia.org/wiki/Rosenbrock_function with iterative steps :-)
16:33bbloomDerander: ah the good ol "banana function"
16:34bbloomthe solution is simulated annealing
16:34bbloomwhich is approximated by giving your dev team LSD
16:35kovaslol
16:36clojurenoobHow do I get the insertion order in hash-set (apply hash-set "Leeeeeerrroyyy")? Thanks
16:37bbloomclojurenoob: sets are un-ordered
16:38clojurenoobThanks. Is there a built-in or should I have to write one?
16:38bbloomthere are built-in sorted sets, but no built in manually ordered sets
16:39bbloomyou could create one by encapsulating a sorted-map with a set. i'm sure that exists on github somewhere
16:39clojurenoobThanks :)
16:42clojurenoobquit
16:57jonasendnolen: feedback for CLJS-564 and CLJS-565 welcome (when you have time to look at them)
16:57dnolenjonasen: will do
17:12Raynescallen: This may very well be the first time I want to complain about having to do a work project in Clojure. :p
17:13ToxicFrogOh?
17:13RaynesI'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:13RaynesI wish I had kept up with Elixir. I've totally forgotten most things.
17:14seangroveElixir?
17:14Raynesseangrove: Best language ever besides Clojure. :p
17:14seangroveElixir is ruby-inspired functional on the erlang-vm
17:15Raynesseangrove: It is heavily influenced by Clojure.
17:15gfredericksRaynes: is there anything good about it besides its vm?
17:15callenRaynes: an embarrassment of riches.
17:15RaynesJose consults with me a lot about Clojure design decisions when making choices.
17:15callenRaynes: at least with Clojure you have NIO/NIO2/Netty/Aleph/lamina/core.async
17:15Raynesgfredericks: It's author is a huge selling point.
17:15callenRaynes: I don't get to use Elixir or Clojure. I am in pleb-land and it's Python every time all the time.
17:16nDuff...well, at least, that one.
17:16ToxicFrogHere it's mostly Python, and when it's not Python it's C++.
17:16ToxicFrogOr Java, for those poor doomed bastards in mobile-land.
17:16Raynesgfredericks: Amazingly nice guy, answers questions in #elixir-lang, debates design decisions openly with everyone, etc.
17:16callenJose Valim is seriously awesome.
17:17callenhe's the only nice Rails core dev, lol.
17:17technomancywhat? tenderlove is nice.
17:17bbloomtender even.
17:17bbloom(sorry)
17:18Raynestechnomancy 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:18technomancyhehe
17:18Rayneshttp://elixir-lang.org/getting_started/mix/1.html Look at that, second paragraph.
17:18eggheaddnolen: in cljs a partial of no applied args doesn't work
17:18technomancyI 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:18callenRaynes: you did well on Mix. It's proper. :)
17:18technomancyit looks like that's changing
17:18eggheadfor instance (partial inc) <-- why would I want to do this?
17:19callentechnomancy: it's going to end up like Clojure.
17:19eggheadanyhow, it works in clj but not cljs
17:19sdegutisRaynes: i would miss s-expressions if i used elixir
17:19callentechnomancy: eventually stuff gets papered over for most peoples' purposes, but there's always a frontier where you have to drop down.
17:19callensdegutis: hello my darling.
17:19sdegutishi
17:19sdegutisupvote this guys https://news.ycombinator.com/item?id=6129965
17:19technomancyelixir used to claim it was homoiconic, but it looks like it's dropped that?
17:19callensdegutis: you should wear shorts that show a little more leg.
17:19callentechnomancy: I think that's because it isn't
17:20technomancyI see
17:20Raynestechnomancy: 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:20technomancyRaynes: <3
17:20RaynesIt does unfortunately use git for dependencies, but at least it has a lock file.
17:20callenRaynes: is there a way to define Elixir version in the mix file?
17:21technomancyRaynes: understandable given the lack of a sane alternative
17:21RaynesJose took what we said about repeatability to heart.
17:21callenRaynes: thank god
17:21Raynescallen: I don't think so. Elixir is a compiler-in-usr/bin sort of language.
17:21callenRaynes: I know. I actually dislike that.
17:21nDuffsdegutis: you could at least provide a little more context when pasting a blind link than "upvote this".
17:22callenI want a self-bootstrapping-magic-script thingamajig.
17:22Raynescallen: Can't say I disagree, mate.
17:23RaynesIt's all painful because Elixir is a AOT compiled language all the time
17:23sdegutisnDuff: oh yeah
17:23sdegutisso, i added ruby 2.0 support to my hackable Mac OS X window manager
17:24sdegutisand i want people to know about it, so thats a link to a hacker news link to it
17:24sdegutisyou dont have to upvote it. and honestly theres no good reason to.
17:24squidzsdegutis: why ruby?
17:24sdegutisexcept maybe an act of kindness
17:24technomancyRaynes: so does mix walk the whole git tree and use some sort of "closest to root" logic to resolve conflicting versions?
17:24sdegutissquidz: cuz before this it only had JS/CoffeeScript support, and i couldnt tolerate that
17:25sdegutissquidz: also cuz most people i know use/love ruby
17:25technomancy"git tree" being not the actual tree in git, but the tree of git trees
17:25sdegutisalso 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:25nDuffsdegutis: ...not to harp too much, but that's relevant in #clojure why, exactly?
17:25sdegutisso i figured a huge influx of upvotes might help
17:26Raynes"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:26Raynes your project and Mix will use that SCM information to fetch the dependency."
17:26Raynestechnomancy: ^
17:26bbloomsdegutis: an influx of upvotes will surely get you hell banned
17:26sdegutisnDuff: cuz you guys are friendly and theres a lot of you, that might push it to the main page
17:26sdegutisbbloom: oh?
17:26bbloomyes.
17:26sdegutisfrom here or HN?
17:26bbloomHN
17:26sdegutisnDuff: sorry
17:26RaynesnDuff: We're talking about Elixir right now, fyi.
17:26sdegutissorry all.
17:27nDuffRaynes: True. But at least it's a functional language. :)
17:27Raynessdegutis: I'm fine with it. I upvoted it in fact. I'm interested in seeing what HNers think of it.
17:27nDuffRaynes: ...and a LISP.
17:27technomancyRaynes: cool. kinda like :pedantic :warn by default.
17:27RaynesElixir is not a Lisp.
17:27sdegutisRaynes: thanks :)
17:27RaynesIt has macros, but isn't quite a Lisp.
17:27Rayneshttp://elixir-lang.org/getting_started/5.html
17:27technomancyRaynes: rule 17 of lisps: any language with first class functions will eventually be called a scheme
17:27sdegutisis Elixir's stdlib comparable to Clojure's?
17:28sdegutisthats the main thing i miss from most languages is a clojure-quality core lib
17:28sdegutisruby almost has it but its so not as good as clojure
17:28nDuffHuh. I was thinking of something else.
17:28RaynesProbably 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:29rboyd_joxa
17:29RaynesOr LFE.
17:29technomancylisp-2 =(
17:29RaynesErlang. =(
17:32sdegutisis elixir production-ready?
17:32RaynesSure.
17:33sdegutisk
17:33Raynes:P
17:33callensdegutis: what is production for you anyway?
17:34sdegutisa clojure app
17:34sdegutisfor websites
17:34sdegutisi mean, a clojure web app
17:34sdegutisim not proud of how it looks, so im not gonna tell you which one it is.
17:34technomancyfunny how "production" used to mean "building in a factory"
17:34technomancy"in production" -> "being produced"
17:35sdegutisit 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:35sdegutisand remembering this makes me sad.
17:35sdegutisso stop reminding me
17:35technomancydrown your sorrows in a refreshing cup of elixir sdegutis
17:35gfrederickstechnomancy: I think it still means that in normals-world
17:36jtoyhow would you guys recommmend I turn this: {"user[model]" "toyota" "user[year]" 2012 "user[color]" "red" } into {"model" "toyota" "year" 2012 "color" "red"} ?
17:36sdegutisheh
17:36gfredericksjtoy: depends on the edge cases
17:36RaynesUse a less crappy query param parser.
17:36Raynes:p
17:36sdegutisid show the three designs side-by-side to explain better, but i think that might be inappropriate somehow
17:38jtoyRaynes: haha, which one do you recommend? I am using the ring params one currently
17:38jtoywrap-params
17:39Raynesjtoy: I don't think there is one for Clojure that actually handles that elegantly sadly.
17:39jtoyyes, rails does a great job though
17:40justin_smith(into {} (map (fn [[k v]] [(regex-magic k) v]) params))
17:40justin_smithregex-magic being the regex that extracts the keys you want from the keys you have
17:41technomancyjustin_smith: clojure's missing map-keys drives me nuts some times =\
17:41justin_smithheh
17:41justin_smithyeah
17:41jtoytechnomancy: who has it and what does it do?
17:42technomancyjtoy: everyone writes their own
17:42technomancy(zipmap (map f (keys m)) (vals m))
17:42patchworktechnomancy justin_smith: I have written that function at least 5 separate times
17:42technomancyplus one that just maps keys
17:42technomancythat and rpartial
17:43koderdemknoszlig: ping
17:44rasmustotechnomancy: what's rpartial do?
17:44justin_smithtechnomancy: 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:44technomancyrasmusto: partial but filling the args in from the other direction
17:44justin_smithnot that this is a huge efficiency problem most of the time I guess
17:45technomancyjustin_smith: I think the version that uses into+for is probably more efficient
17:45justin_smithhow about into+map (which is what I usually do)
17:46justin_smithmap and for are about the same with one arg I assume?
17:47rasmustotechnomancy: ah, thanks. That's a bit mind-bending to me still
17:48seangrovetechnomancy: 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:50Raynes"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:50RaynesOh ffs. Why is Rails a damned goal in functional languages?
17:50dnolenegghead: please file a ticket
17:51Raynes:p
17:51callenRaynes: because people get a lot of work done with it.
17:51Raynescallen: I don't.
17:52callenRaynes: and they prefer it to rolling their own artisanal solution to what is frankly a very boring and repetitive form of work.
17:52callenRaynes: you don't make a lot of websites front-to-back. You do more interesting stuff than that.
17:52callenif you were churning out whole sites week-in week-out, you'd start extracting patterns
17:52calleneventually you'd have a framework. GG
17:52rasmustog.g. indeed
17:53Raynescallen: I'd have a bunch of compojure sites.
17:53callenI 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:53Raynescallen: Now shush and listen to http://www.youtube.com/watch?v=a4IsS8jlIBY
17:55callenRaynes http://www.youtube.com/watch?v=MrAvwd_UHUI
17:56callenwhile there's a building-ones-own-lightstaber element to rolling a personal web stack, it's pretty senseless.
17:57callenRaynes: this song is working for me. it's a nice follow up to Death Grips.
17:58Raynes:p
17:59clj_newb_2345does anyone have a tutorial on using clojure.tools.namespace and vim fireplace together?
18:01callenRaynes: you ever listen to Death Grips? How is the Jex Thoth treating you?
18:03Raynescallen: It was good until she started making noises.
18:03justin_smithIs writing a monad tutorial the Building Your Own Lightsaber of the haskell world?
18:03seangroveThe youtube player seems so janky
18:03callenjustin_smith: no, it's writing your own monad transformer library.
18:03seangroveI'm sure it's incredibly sophisticated, but damn it seems unpleasant recently
18:03eggheadwill do dnolen
18:07mischovseangrove: I can't remember the last pleasant change they've made to the youtube player...
18:07jtoyjustin_smith: gfredericks Raynes technomancy this is the version I came up with: https://www.refheap.com/17037
18:08technomancymischov: or any google product?
18:10callenhg commit -m "murjd"
18:10callenI can't get caremad about commit messages when it's Mercurial.
18:10mischovtechnomancy: So far I
18:10mischovtechnomancy: am not upset about android 4.3
18:10technomancymischov: I miss 2.x =\
18:11eggheadticket filed
18:11technomancywhere gmail didn't put the sender in larger type than the frakking subject line
18:11eggheadyawwwn, I'm doing something retarded with core.async where my first message disappears
18:11technomancyand maps didn't refuse to function without giving Google background GPS prvileges
18:13isaacbwman, clojure is fun
18:14isaacbwI've started working through project euler to learn clojure
18:14callenisaacbw: I don't know that that is an environment where the niceties of Clojure really shine, but cool :)
18:14mischovtechnomancy: 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:15mischovtechnomancy: their new strategy is making things worse and worse so people have low expectations and their jobs are easier
18:15technomancymischov: like that time they realized they had the whole spam-detection module of google groups commented out
18:15isaacbwcallen: mostly it's just fun to solve the problems recursively, which is a bit of a mental stretch coming from an imperative background
18:16callenisaacbw: I find that at least in ~75% of practical day to day stuff, recursion maps better.
18:16clj_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:17jkjRaynes: any ideas on detecting template change automatically with laser?
18:18technomancyclj_newb_2345_: need more context
18:18isaacbwcallen: my solutions are definitely far more succinct than the iterative counterparts
18:18jkjRaynes: 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:18callenisaacbw: no one approach will work for everything.
18:18isaacbwI'm sure things are going to get far more interesting the deeper I get
18:18isaacbw*into euler
18:19clj_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:19technomancyclj_newb_2345_: no, it's just that the nrepl protocol is more than just sending text over a stream
18:19technomancyit's about exchanging bencoded messages that contain metadata
18:20clj_newb_2345_yeah, so looking at https://github.com/clojure/tools.nrepl
18:20clj_newb_2345_I don't see a way to connect using etlnet or nc
18:20technomancyclj_newb_2345_: right; you need an nrepl client
18:21clj_newb_2345_technomancy: is this nrepl communication protocol not documented anywhere?
18:22technomancyclj_newb_2345_: probably the readme there is your best bet
18:22clj_newb_2345_https://github.com/clojure/tools.nrepl/blob/master/README.md ?
18:22technomancyyeah
18:25clj_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:25technomancyyou would bencode {:op eval :value "(+ 2 3)"} iirc
18:26mischovMacro question.. https://www.refheap.com/17038
18:28clj_newb_2345_technomancy: what's bencode? is it json?
18:29technomancyit's ... bencode?
18:29technomancyhttps://en.wikipedia.org/wiki/Bencode
18:29seangrovehttp://nakkaya.com/2009/11/14/bencoding-objects-in-clojure/
18:29seangrovebencode?
18:29seangroveDamnit clojurebot
18:30Raynescallen: I was just looking at dynamo. I think it introduces things anaphorically. :(
18:33callenRaynes: I'm contemplating deeper evils than that for a library.
18:33callenfar, far deeper evils.
18:34callenRaynes: what specifically do you object to? I'm curious.
18:35Raynescallen: Anaphora.
18:36clj_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:36Raynescallen: The fact that 'conn' appears out of thin air.
18:37callenRaynes: yeah, that's the sort of evil I'm contemplating, except worse.
18:37callenRaynes: it's so evil I think I'm going to have to refer to the macronomicon.
18:37seangrovebbloom?
18:37clojurebotbbloom is a dendrologist
18:37seangroveHe's usually the fireplace expert in here
18:38Raynesbbloom studies trees?
18:38callenRaynes: "branches"
18:38callenRaynes: I knew you meant anaphora, I just thought perhaps you had a specific example other than conn.
18:39clj_newb_2345was just disconnected
18:39clj_newb_2345in vim fireplace, how do I send a command over to nRepl ?
18:40clj_newb_2345in particular, I want to send "(+ 1 2)" over nRepl over vim fireplace
18:42cmathesonclj_newb_2345: cpp should evaluate the sexp under your cursor
18:49gfredericksdoes it sound plausible that you can only call static methods on fully-qualified class names if they begin with a capital letter?
18:50gfrederickscorrection -- you cannot call static methods on a fully qualified class name if that name is the same as a namespace
18:50sdegutiswho runs lazybot?
18:50sdegutisRaynes: ping
18:50callensdegutis: ping
18:50sdegutiscallen: pong
18:51callensdegutis: change into those short shorts yet?
18:51Raynessdegutis: Pong./
18:51hiredmanyes
18:51bbloomRaynes: yes, i do study trees. trees of data are awesome
18:51hiredmangfredericks: you cannot if you use the sugar syntax which is all anyone uses these days
18:52bbloomseangrove: what's up?
18:52hiredman(. classname methodname arg1 arg2 ...) should work
18:52gfrederickshiredman: ah indeed it does
18:53hiredman(. classname methodname arg1 arg2 ...) is sort of degenerate, the real retro way is (. classname (methodname arg1 arg2 ...))
18:53gfredericksah right
18:53sdegutisRaynes: never mind.
18:53sdegutissorry to bother
18:54jtoyhow 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:57llasramjtoy: (take n (concat coll (repeat nil)))
18:59jtoyllasram: nice one
18:59jtoythat is really cool
19:03eggheadfound some insane behavior in core.async
19:05squidzegghead: like what?
19:06eggheadmaking a minimum test case
19:17eggheadI blame dnolen
19:17egghead:p
19:20eggheadthe bug is that the first message in the 'observable' never gets sent: https://www.refheap.com/17041
19:21eggheadbut it works when you change it to: https://www.refheap.com/17041
19:21eggheadsome sort of core.async bug?
19:21eggheaddnolen: tbaldridge: ^
19:21eggheadshould be able to just paste that into a repl
19:22eggheadmight help if I included the definition of put-all! there...
19:24hiredmanegghead: those are both the same url
19:26eggheadah
19:26eggheadI've been doing edits
19:26eggheadignore everything before: if you paste this into your repl: https://www.refheap.com/17041 -- you will see only the second print
19:27eggheadif you swap the comments, and try again you will see it work
19:28hiredmanI bet oyu just have a race
19:29hiredmanthe 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:29eggheadaaaah
19:30eggheadso the listeners is dereferenced as empty before the channel is parked
19:30eggheadso dereferencing *after* the message is received solves the problem
19:30eggheadthanks hiredman
19:31clj_newb_2345is 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:36alandipertclj_newb_2345: https://github.com/technomancy/leiningen/wiki/Upgrading#user-level-settings perhaps
19:36alandipertclj_newb_2345: or rather, the user.clj mechanism
19:37clj_newb_2345alandipert: is user.clj locate in the "src/" or in the same dir as project.clj ?
19:37alandipertclj_newb_2345: i think in ~/.lein but i could be wrong
19:37clj_newb_2345so it's for lein, but not per project
19:37alandipertcorrect
19:38alandipertlynaghk: hey don't you do stuff w/ lein + user.clj + tools.namespace? how do you make go?
19:38technomancythat doesn't really have anything to do with the repl
19:38clj_newb_2345this is my fault for not being clearer
19:38hyPiRionthe name is profiles.clj, by the way, not user.clj
19:38clj_newb_2345I 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:40technomancyclj_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:45akurilinQuick question, in a ring app, where do I place static resources like random support data in xml/json? Is resources/ the right location?
19:45tbaldridgeegghead: 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:45technomancyakurilin: yeah, use resources/
19:46akurilintechnomancy, awesome. Is there any special magic I need to do to be able load files from that location when I uberjar?
19:46technomancyakurilin: shouldn't be
19:46akurilintechnomancy, 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:47technomancyno, not from the filesystem
19:47technomancyyou need to go through clojure.java.io/resource
19:47squidzwhats a good way to get this value given a value? The value in an array within a map
19:48squidzhttps://www.refheap.com/17042
19:48akurilintechnomancy, ah ok, I'll investigate that.
19:49Raynes&(first (filter (comp #{"2009-01-01 15:55:08"} :middate) (:values your-map))
19:49lazybotjava.lang.RuntimeException: EOF while reading, starting at line 1
19:50RaynesNot sure why I tried to evaluate that.
19:50RaynesAnyways.
19:50eggheadtbaldridge: 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:50squidzthanks 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:04tbaldridgeegghead: 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:04tbaldridgewhere using them wrong results in deadlock
20:07eggheadah :)
20:08clj_newb_2345using 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:09clj_newb_2345ah, lne
20:12tos9Yep, that's the location list (as opposed to the quickfix list which are the :c* stuff)
20:13clj_newb_2345tos9: you're also a fireplace user?
20:13clj_newb_2345it seems much better than vimclojure (which often froze on me for no reason)
20:13tos9I happen to be yeah, when I do any clojure.
20:21clj_newb_2345when 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:22rlbI'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:22rlbI'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:27Bronsatechnomancy: I have a fix for CLJ-1241 :P
20:29Bronsatechnomancy: also the bug wasn't only on get, it was when overriding every c.c var without :excluding it
20:30technomancyBronsa: I figured as such
20:30technomancywhat's the tl;dr on th efix?
20:31Bronsatechnomancy: wait a sec, I'll show you the patch, it's easier
20:33Bronsatechnomancy: http://sprunge.us/OcYO?diff
20:34Bronsatechnomancy: basically, DefExpr.parse did registerVar on the result of lookupVar
20:35technomancyBronsa: the indentation augh
20:35callenI'd forgotten how repetitious Python feels compared to Clojure
20:36callenI keep wanting to refactor a bunch of stuff and then have to stop myself because it'd quickly turn into crazy bad mojo.
20:36callenat least I have decorators :(
20:39Bronsatechnomancy: right, let me fix that (damn tabs)
20:39hiredmantechnomancy: it's not like you were going to read the java anyway
20:39technomancyBronsa: not your fault; it's just ...
20:39technomancyhiredman: it's not for reading
22:17lynaghkalandipert: as described in Stuart's post: http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded
22:29clj_newb_2345I have about 7000 LOC of clojure code
22:29clj_newb_2345I should start refactoring
22:29clj_newb_2345what's a good guide on creating my own little libraries
22:29clj_newb_2345namely things that I can tell lein to grab (with version numbers)
22:30gfredericksuse github and clojars?
22:30bbloomclj_newb_2345: lein has good docs
22:31clj_newb_2345hmm, was not aware lein can create these libraries for me
22:32clj_newb_2345technomancy: did you write lein?
22:32clj_newb_2345(I'm reading https://github.com/technomancy/leiningen/blob/preview/doc/TUTORIAL.md )
22:32gfrederickshe did write lein
22:42Kowboy(keyword "Vanden Bosch") -> :Vanden Bosch
22:42Kowboythis is correct behavior?
22:42bbloomKowboy: it's undefined behavior. clojure doesn't check it's args all that much
22:42Kowboyhmm
22:43bbloom"garbage in, garbage out"
22:43KowboyI probably can't use keywords here then
22:43bbloomstrings are still immutable and make perfectly good map keys :-)
22:44Kowboythis is a JSON body that I'm getting through clj-http.client/get
22:44Kowboyusing :as :json
22:45KowboyI can do :as :json-string-keys
22:45bbloomi disapprove of automatically keywordize-ing json keys, others disagree. they are wrong :-)
22:45amalloybbloom: it's not a bad default, as long as there's a way to turn it off
22:45KowboyI probably would have disagreed, until this happened
22:46Kowboyobviously, a space messes things up
22:46bbloomamalloy: it's not a bad option, as long as it's off by default ;-)
22:46Kowboyas I am pr-str'ing this and spitting it to a file
22:46amalloy*chuckle* i disagree, but not strongly
22:46bbloomamalloy: you're always pleasant to debate
22:47bbloom(inc amalloy)
22:47lazybot⇒ 68
22:47Kowboythen 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:47amalloyaww
22:47clj_newb_2345(re packaging lein libraries); what do I do after a "lein uberjar" ?
22:48amalloyclj_newb_2345: delete the uberjar
22:49clj_newb_2345rm -f target/monitor-0.0.1-standalone.jar
22:49clj_newb_2345done
22:49clj_newb_2345what next?
22:50echo-area(inc bbloom)
22:50lazybot⇒ 11
22:50amalloy$google clojars help
22:50lazybot[Pushing · ato/clojars-web Wiki · GitHub] https://github.com/ato/clojars-web/wiki/Pushing
22:50echo-areaHow did everyone get a number?
22:50bbloom$help karma
22:50lazybotbbloom: Checks the karma of the person you specify.
22:50bbloom(karma echo-area)
22:50bbloom$karma echo-area
22:50lazybotecho-area has karma 0.
22:50bbloom(inc echo-area)
22:50lazybot⇒ 1
22:50bbloomthere you go buddy, getting you started
22:50clj_newb_2345wtf
22:51clj_newb_2345all all I type is "lein deploy clojars" ?
22:51echo-areabbloom: Ah, good to know, thanks :)
22:51sdegutisworked for me
22:51sdegutiscc clj_newb_2345
22:51amalloyclj_newb_2345: well, you need to have a clojars account set up and lein needs to know about it
22:51amalloybut then, yes
22:52amalloy$google lein readme deploying
22:52lazybot[immutant/lein-immutant · GitHub] https://github.com/immutant/lein-immutant
22:52amalloyugh
22:53bbloomboo
22:55clj_newb_2345one more dumb question:
22:56clj_newb_2345how do I deploy to a local directory rather than clojars?
22:57xeqilein deploy file://some/file/path
22:58xeqiiirc
22:58xeqior setup a :deploy-repository with a name and a file:// path
22:59amalloyxeqi: id that better than `lein install` somehow?
22:59clj_newb_2345fuck, I need to setup gpg
22:59clj_newb_2345damn it :-)
23:00amalloyclj_newb_2345: i was surprised by how easy it was, if that's any consolation
23:00clj_newb_2345I'm sure it's one of these things
23:00clj_newb_2345where in retrospect, it's clearly obvious
23:00xeqiclj_newb_2345: theres a fun part
23:01xeqiif 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:01xeqibut I strongly prefer you get gpg
23:01xeqiamalloy: they do different things with respect to -SNAPSHOTs and checksums
23:02amalloywell, once you've set up gpg to encrypt your clojars credentials, you might as well use it to sign the jar
23:03xeqiif 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:06clj_newb_2345https://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:06clj_newb_2345why is it relative to project root and not global ?
23:08xeqiamalloy: 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:08xeqiclj_newb_2345: because then its not portable on another machine
23:09clj_newb_2345maybe I'm solving the wrong problem; let me re-think my specs and ask the right question
23:10muhoowhy would i be getting "can't create iseq from symbol" on a persistentvector when calling first on it?
23:10xeqimuhoo: because you have a symbol instead of a persistentvector ?
23:11muhooi have data like #{[2] [3]}. each item isn't a symbol, it's a persistent vector. running (type) on it says o
23:11muhoorunning first on each of it, gives me this weird error
23:12muhooso (for [p #{[2] [3]}] (-> p type)) shows a persistent vector.
23:12muhoo(for [p #{[2] [3]}] (-> p first)) gives me that weird error
23:12muhoomind you, not on that above sample data, but on my actual data set :-/
23:13amalloymuhoo: perhaps the object at the front of the vector throws an exception in its toString method
23:14amalloynothing else makes much sense
23:14muhooyeah, this is a really weird one
23:14muhoooh..! nevermind.
23:14amalloymuhoo: try (-> p first type)
23:14muhooi did that, i found the problem
23:15amalloywell, don't leave us hanging
23:15muhooit was a huge 10k data set, which got pr-str'ed to a file and then read-edn'ed back in, ad...
23:15muhoohere's the end of the file:
23:15muhoo[4081455882183270] [510806782706245813] [44050902578321702] ...}
23:15muhoothose literal ellipsis are in there :-/
23:15muhoodoh
23:15amalloyah
23:15muhoolaziness.
23:16xeqiclj_newb_2345: what are you trying to do?
23:16muhoowhen i used map or for, it blew up. apparently, on the LAST item, not the first
23:17amalloyi don't really get that, though; shouldn't the {x y ...} have thrown an exception when you read it?
23:17amalloysince it's a map literal with an odd number of forms
23:18muhooit's a set not a map
23:18muhoo#{} not {}
23:18amalloyah
23:19muhoothe 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:19callenmuhoo: never set timeouts or maximum sizes unless it's going to kill somebody.
23:20callenand even then...maybe.
23:20muhooi try to never make absolute statements ever :-P
23:20callenmuhoo: I try to scare people straight >:)
23:23xeqihmm, too bad search doesn't say what repo it is in :/
23:24xeqiwell that was a random previous line
23:25bbloommuhoo: 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:26bbloommight not work well if you have a deeply nested structure, since it caps the right-margin-search at col-width
23:26muhoobbloom: thanks, will look at it!
23:26bbloombut if you have a generally flat structure, it works great for large files
23:27bbloomflat == sensibly pretty prints at < 80 columns (adjustable)
23:27muhooi'm doing datomic stuff with a couple hundred thousand records, and i'm sanity checking my queries by looking at data dumps
23:28bbloomlet me know if it helps you!
23:28bbloomi'm on a quasi-quest to pretty-print-by-default clojure-wide :-)
23:32amalloybbloom: my instinct is that this would be terrible
23:33bbloomwhy?
23:33clojurebotbbloom: because you can't handle the truth!
23:33bbloom*sigh*
23:34amalloyIME 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:34amalloybut i'm willing to believe i could be wrong here
23:34bbloomamalloy: if you're pretty printing a large sequence of many small maps, it winds out working just fine
23:35bbloomwhich is what i deal with
23:35akurilinAre 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:35amalloybbloom: 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:36bbloomamalloy: it's for non-repl use. like you run a large batch job and print a random 100 results to eyeball or something
23:37amalloyyou said pprint by default throughout clojure
23:37bbloomoh, i thought you were talking about muhoo's use case
23:38muhooi have taken to doing the following
23:38bbloomas for in-repl use, you prefer long wrapping lines of values over neatly pretty printed blocks?
23:38muhooso as not to flip out nrepl or emacs
23:39amalloybbloom: i don't have so many pixels i can afford to spend 2/3 of them on whitespace :P
23:39muhooi send stuff thru my pretty printer, which i then spit to "/tmp/foo.edn"
23:39lynaghkbbloom: I'm going to open source this zeromq library tonight---as soon as I can think of a name. Any suggestions?
23:39muhooi have /tmp/foo.edn as an auto-revert buffer in emacs
23:39bbloomlynaghk: give me the two sentence sales pitch
23:39bbloomamalloy: i have lots of pixels :-) you're a programmer dammit. invest in a nice big screen
23:40TimMcLaptops, man.
23:40TimMcLaptops.
23:40amalloybbloom: i have one. i need to use it on large text at low res so that i can see it
23:40lynaghkbbloom: it exposes ZeroMQ sockets in a threadsafe way using core.async channels.
23:40amalloybut for the more common case: yes, laptops
23:40bbloomheh, i can't ever get any work done on my laptop. *shrug* maybe i now know why
23:40muhoolynaghk: "sockpuppet"
23:41lynaghkbbloom: there is already a cljzmq and clj-zmq, and clj-0MQ
23:41bbloomlynaghk: ZeroAsync?
23:41lynaghkmuhoo: I was thinking something like juggler, but yeah. Only concern is googability
23:41amalloybbloom: you may be amused to know that my "monitor" at home is 55"
23:41bbloomzeroasync is just about as much of a misnomer as zeromq itself :-P
23:41lynaghkbbloom: yeah, I was thinking about just the boring-but-explicit "zeromq-async"
23:42clj_newb_2345okay okay
23:42muhoolynaghk: or you could go with the technomany approach and pick something relatively obscure
23:42bbloomamalloy: sheesh, sounds like neck pains haha
23:42clj_newb_2345I got it all working with "lein localrepo"
23:42lynaghkbbloom: I could also go for "ØMQ-async" so everyone hates me.
23:42clj_newb_2345thanks to everyone for their help
23:42callenbbloom: yeah I was trying to remember the name of fipp. How fast is it anyway?
23:42clj_newb_2345this is indeed trivial, like 2 commands
23:42clj_newb_2345I should write a blog post about it
23:42malynlynaghk: zerosync? Less obvious, and yet still true. :)
23:42bbloomcallen: at least 5 times as fast, usually more, than clojure.pprint
23:42bbloomcallen: doesn't slow down w/ the size of the input either
23:42callenbbloom: <3
23:43amalloylynaghk: 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:43bbloomcallen: 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:43bbloomit should have concurrency of at least 5 or 6 or so
23:43muhoobbloom: thanks, fipp looks very cool
23:43bbloomthanks :-)
23:43lynaghkAn 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:44bbloomlynaghk: that's b/c you're supposed to communicate between threads with zero mq :-P
23:44bbloomthread safety isn't interesting to me, core.async ioc is interesting
23:45bbloombut free thread safety, i'll take that too :-)
23:45bbloomanyway, i like ZeroAsync
23:45bbloomgo with that
23:45lynaghkbbloom: yeah, I was totally going to do right up until I realized I wanted to pass more than bytestreams between my threads =P
23:45callenbbloom: you really can't contrive an 8-core++ dedi? Aren't you a trust fund kid or something?
23:46bbloomcallen: no, i'm not a trust fund kid or something
23:46amalloybbloom: you're a programmer, invest in a decent processor!
23:46callenamalloy: Processor(s)
23:46bbloomamalloy: i did. but it's a laptop ;-)
23:47callen(* 8 Processor(s))
23:47bbloom…. connected to my big display haha
23:47amalloyi guess it's true what they say. engineering is all about tradeoffs
23:47bbloomi was gonna spin up a big server on some cloud provider to benchmark it
23:47bbloombut i got lazy
23:47bbloomthat's my normal solution when i need bigger processors
23:47bblooms/bigger/more/
23:48amalloybbloom: 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:48bbloomhaha
23:49bbloomtoo many projects, not enough time
23:52callenamalloy: those VPSs are actually kinda awful.
23:53callenamalloy: and wouldn't really have the parallelism needed to exercise the bits under discussion.