#clojure logs

2014-02-28

11:11broquaintThanks, edbond :)
11:12broquaintww
11:14roybattyanybody that uses Cursive(intellij) know how to set up a keyboard shortcut to switch from current editor window to the repl and back again. kind of like you ctrl-tab between two files
12:01michaniskindo leiningen templates support any form of composition?
12:02michaniskinlike `lein new [template1 template2 template3] my-composed-project
12:02johnjelinekhihi all
12:02hyPiRionmichaniskin: how would they compose together? What do you do if both templates creates some specific file?
12:03gfrederickslein new rails spring django arduino billing-app
12:03michaniskinhyPiRion: yeah this is why i'm asking :)
12:04michaniskinhyPiRion: i'm looking for prior art for a project i'm working on
12:04johnjelinekgot a question, I have a future that makes an HTTP request with clj-http, and it returns a 401: "java.util.concurrent.ExecutionException: clojure.lang.ExceptionInfo: clj-http: status 401" -- I want to catch this
12:04gfredericksjohnjelinek: clj-http has an option for not throwing
12:04hyPiRionmichaniskin: Ah. Well, lein templates doesn't compose, if that answered your question :p
12:04technomancymichaniskin: it's a neat idea, but the fact that templates take arbitrary args makes it a bit trickier
12:04johnjelinekgfredericks: can I catch though?
12:04johnjelinekI want (fn [req-fut] (instance? java.util.concurrent.ExecutionException (try @req-fut (catch Exception e (.getCause e)))))
12:04johnjelinekI thought this would return true
12:04johnjelinekbut it's false
12:04technomancymichaniskin: worth pursuing though I think
12:05dakronejohnjelinek: you need to put the try/catch inside of your future if you want to do that
12:05michaniskintechnomancy: i am thinking about it for what would be equivalent to maybe a combination of profiles and plugins, like you'd use the templates to set up your build process by composing different plugins and such
12:05clojurebotexcusez-moi
12:06johnjelinekdakrone: I think I misspoke, I want it to return true
12:06johnjelineknot false
12:06johnjelinekif I change to (instance? Exception ... it returns true
12:07michaniskintechnomancy: like if you're setting up a new clojurescript project, but you want to have a ring server and maybe garden css compiler, too
12:07johnjelinekbut I want it to return true when the exception is java.util.concurrent.ExecutionException
12:07dakronejohnjelinek: also, just one .getCause may not be the exception you want, you probably want (root-cause e)
12:07johnjelinekor, whatever it is when it returns 401
12:07slagyrClojureScript question: It is possible to disable this warning? "WARNING: clojure.core/==, all arguments must be numbers"
12:07hyPiRionmichaniskin: wouldn't that mean they need to merge the project.clj?
12:07dakronejohnjelinek: it's far easier to use {:ignore-exceptions true} in clj-http itself and handle the 401
12:08johnjelinekdakrone: ok, let me try that
12:08michaniskinhyPiRion: well i'm not using lein specifically, i'm using boot, so things compose differently there
12:08michaniskinhyPiRion: but yes, they'd end up merging a file in pretty much the same way
12:09hyPiRionmichaniskin: right, gotcha.
12:09hyPiRionHrm, I guess it would be interesting to look into at least.
12:09johnjelinekdakrone: do I apply {:ignore-exceptions true} on the client/get?
12:10dakronejohnjelinek: yes
12:10johnjelinekdakrone: because it's not ignoring
12:10michaniskinhyPiRion: i wonder if there are other build tools i should look at that might have such a thing?
12:10dakronejohnjelinek: what version of clj-http? (also, it might be :ignore-exceptions? instead of :ignore-exceptions)
12:10dakronein 0.9.0 I unified the booleans so I don't have to remember whether it ends in ? or not
12:10technomancymichaniskin: this could go hand-in-hand with the proposed programmatic modifications of project.clj
12:11johnjelinekdakrone: both didn't work
12:11johnjelinekdakrone: I'm using 0.7.9
12:11hyPiRionmichaniskin: hm, I'm pretty sure there's nothing for Clojure, but I wouldn't be surprised if there were some JS build tool which did that somehow
12:11dakronejohnjelinek: "didn't work"? didn't throw an exception? didn't give you the right response? can you gist your code somewhere?
12:12technomancymichaniskin: you could say "to make a template composable, return a function that modifies a project.clj instead of simply writing the bytes to disk" or something
12:13michaniskintechnomancy: are there plans to make project.clj into a program instead of a declarative data file?
12:13hyPiRionOr, you know, it could be something different, but closely related to templates.
12:13hyPiRionmichaniskin: it is already a program
12:13hyPiRion:p
12:14michaniskin:) you know what i mean
12:14technomancyactually I don't think I do?
12:15hyPiRionI don't think I do either
12:15michaniskinno worries, i think the answer is "no" :)
12:15Anderkentmichaniskin: if you put (println "BOO!") on top of you rproject.clj, it'll print boo
12:16Anderkentit can't get more programmy than that
12:17ToBeReplacedassuming answer is no but quick question -- can i (go-loop [] (alt! ch (recur)))?
12:17technomancyAnderkent: well it could if we calculated some fibbonacci
12:17technomancythat is empirically the programmiest you can get
12:17AnderkentI thought that was fizzbuzz?\
12:18rasmusto~fizzbuzz
12:18clojurebotNo entiendo
12:18michaniskinhahaha
12:18johnjelinekdakrone: didn't work means still threw an exception, but didn't return true
12:18johnjelinekI'll pastebin something up for you
12:18hyPiRionmichaniskin: I mean, https://github.com/hyPiRion/hello-swearjure/blob/master/project.clj is a legal project.clj file.
12:19technomancyman, not even an nsfw warning or anything?
12:19hyPiRionsorry
12:19technomancyhehe
12:20hyPiRionthat is nsfpcp (Not safe for professional clojure programmers)
12:20technomancynot safe for people who take themselves too seriously
12:20rasmustoi am a software professional
12:21AnderkentI'm dissapointed by the meta ns-map
12:21clgvhyPiRion: swearjure seems great for obfuscation ;) :P
12:21hyPiRionAnderkent: I accept pull requests
12:21technomancydid you know the word "amateur" comes from the same root as "amour"? in essence, doing it out of love rather than simply in order to feed yourself.
12:21ambrosebshyPiRion: holy crap! :)
12:22technomancyso when taken literally, not all that mutually exclusive with professional
12:22hyPiRionAnderkent: the core.clj uses only `ns-map` though. Is that okay for you?
12:22AnderkenthyPiRion: 4 times better
12:23hyPiRionambrosebs: Now you made me think about using dynalint on that monster. Hrmm...
12:24johnjelinekdakrone: http://pastebin.com/9TvuvEvp
12:24johnjelinekwhat I expect is (true true true ...)
12:25ambrosebshyPiRion: I have zero idea how swearjure works. Does it rely on implementation details of Clojure?
12:26AnderkenthyPiRion: you generate that code, right? right?
12:29hyPiRionambrosebs: Heh... yeah, heavily. It crashes if the hash map order in (ns-map 'clojure.core) is changed.
12:31hyPiRionAnderkent: Well, sort of. I could probably generate it now if I wrote a generator for it, but most of it was just a lot of copypaste
12:31ambrosebshyPiRion: LOL
12:31ambrosebshyPiRion: that's amazing
12:31dakronejohnjelinek: https://gist.github.com/dakrone/01c46b660465356bf0d2
12:31hyPiRionI tried to create a generator for it in the beginning, but the amount of argument calls made the JVM crash, so I had to do some compression by hand
12:32dakronejohnjelinek: my fault, it's actually :throw-exceptions, not :ignore-exceptions
12:33hyPiRionambrosebs: It's a bit sad actually, because it's not that easy to upgrade from 1.5.1 to 1.6 :p
12:34johnjelinekdakrone: success!
12:34johnjelinekthanks
12:34ambrosebshyPiRion: I'll bet
12:35dakronejohnjelinek: you're welcome!
12:36johnjelinekdakrone: now, if I wanted to check it for the 401 to know the reason why it wasn't successful, I should do what?
12:36johnjelinekI guess just read the @req-fut and parse?
12:37dakronejohnjelinek: instead of client/success? you can just do (:status @ret-fut) and see the HTTP status yourself
12:44johnjelinekdakrone: awesome, thanks
12:44ToBeReplacedusing the alt! macro for the first time, and i'm confused; (go (alt! x ([v] v)) is returning a RuntimeException Unable to resolve symbol: v
12:45ToBeReplacedto me, that appears to be the example in the docs
12:45ToBeReplacedi wanted to say "read from the channel and return the val"... how do i express that correctly?
12:46seangrovednolen_: Just about finished up with the ReactDevTools fix
12:46dnolen_seangrove: SWEET
12:47seangrovednolen_: Are you thinking that the name of the component should be passed in along with {:opts ...} etc.?
12:47dnolen_seangrove: no will be a protocol IDisplayName
12:47seangrovednolen_: Got it, sounds good
12:48dnolen_seangrove: I can add it now, of course won't do anything unless you use a React build from master.
12:48seangrovednolen_: Oh, I was adding it to a local check of Om right now, the ReactDevTools side is already finished
12:48seangroveI have it coming out hard-coded, was just adding the protocol. Happy to let you do it if you'd like though ;)
12:49dnolen_seangrove: I can do it, it's a simple change
12:49ToBeReplacedandddd my issue was alt! not imported, so the go macro failing ;)
12:49seangrovednolen_: Ok, sounds good. I'll check with the React people about the code changes. Let me know when yours is pushed so I can test it out locally
12:50seangroveDoesn't need to be published, I'll just clone master
12:52dnolen_seangrove: https://github.com/swannodette/om/commit/f50fb2b35cd4326478ea8937eae8c0d1b3cd9bf0
12:53seangrovednolen_: Ok, testing it out...
12:54dnolen_seangrove: oops typo fixing
12:54dnolen_seangrove: fixed
13:00seangrovednolen_: Look about right? http://dl.dropbox.com/u/412963/Screenshots/cx.png
13:02dnolen_seangrove: looks good to me, would be nice if you could suppress Om private props
13:02dnolen_seangrove: but already looks useful
13:03seangrovednolen_: I'll as about how to do that
13:03dnolen_seangrove: might be out of scope since technically that's the idea behind props
13:04seangrovednolen_: But they show up on the right-hand side I think
13:04dnolen_seangrove: and we use props differently, but worth bringing up
13:04seangrovewhich I cut out... One second
13:04mr-foobari'm using enlive. (enlive-html/append "<div>some content</div>") is escaping and giving me &lt;div ... any option that I can stop the escaping ?
13:05dnolen_seangrove: heh, actually probably the simplest thing would be don't show props with leading __
13:05dnolen_seangrove: React can't display ClojureScript data structures anyway
13:05seangrovednolen_: Something weird is up with my local RDT, but it's find to have them show up in the list http://dl.dropbox.com/u/412963/Screenshots/cy.png
13:06dnolen_seangrove: anyways, this is useful - but I think doing our own instrumentation in the end will be more powerful
13:06dnolen_seangrove: React Dev Tools are never going to be able to display CLJS data properly
13:06dnolen_seangrove: well not never, but just seems out of scope
13:07seangrovednolen_: I agree, I think this will go away eventually, btu for the time being it's fast and very nice. Especially for trying to track down these damn 'unique keys' warning Sablono seems wont to put out
13:12isaacbwshouldn't clojure-mode have special indentation for macros?
13:12technomancyisaacbw: which macros?
13:13isaacbwtechnomancy: any macro. I know that common lisp's SLIME treats macros differently with indentation
13:13technomancyisaacbw: it's technically possible, but it's not a good idea
13:14technomancyindentation rules that change depending on whether you're connected or not are kinda nuts
13:14isaacbwtechnomancy: I see, okay
13:15technomancyif your macros need special indentation, call them with-foo
13:15rasmustowell, indentation is different for def*, right? I guess that doesn't require connection :)
13:15technomancyrasmusto: right
13:16technomancyhaving clojure-mode depend on cider would be a circular dependency anyway
13:16Bronsatechnomancy: is it just me or with-bindings is indented wrongly by clojure-mode?
13:17technomancyBronsa: not afaict
13:17seangrovetechnomancy: A lot of the setups for emacs recommend custom indentation for compojure routes as well
13:17Anderkentit's pretty easy to give things the 'defun indent mode - I used to do it for midjes facts.
13:18Anderkentjust check in the relevant configs :P
13:18technomancyseangrove: yeah, some kind of portable declaration for that would be neat
13:18technomancyas long as it can be determined statically
13:18technomancygetting it from nrepl is just wrong though
13:18Bronsatechnomancy: .. weird, now it gets indented correctly for me too. Pretty sure it was indenting like a function before though
13:19technomancyyou'd have different indentation depending not on whether you were connected, but on which namespaces have been compiled so far
13:20seangrovetechnomancy: I agree with the static requirement
13:20Bronsalooks like with-bindings indentation starts to get messed up after I connect with slime :/
13:21isaacbwdoes anyone know why (put-clojure-indent 'GET 1) isn't working for (GET within (defroutes? Is it because it's within (defroutes?
13:21isaacbw)))
13:22isaacbwoh, wait
13:23isaacbwah, I needed to do (put-clojure indent 'GET 2) based on how I was formatting it
13:23isaacbwis there more fine-tuned indentation control, for example only do this for GET within a defroutes?
13:25amalloyisaacbw: that sounds kinda like backtracking indent, such as for deftype and reify, but i don't think you really want to do it anyway
13:27amalloyBronsa: even in the source buffer? the slime repl doesn't follow the clojure indent rules, but it shouldn't be able to break the indentation of your source files
13:28Bronsaamalloy: yeah, not in the repl
13:28amalloywild
13:29amalloyyou can always try M-x customize-variable clojure-defun-indent
13:29Bronsaamalloy: I'm not 100% sure it's slime's fault though, it worked fine after connecting for ~30 seconds
13:39isaacbwoh hey, the compojure docs list the commands for proper indentation. That could have been easier than trying to figure it out myself :P
13:40seangrovetechnomancy: LT will solve all of our problems. Clojure and proper data structures all the way down.
13:40TravisDAny top-level var with metadeta ^{:private true} will not be exported?
13:41amalloywellll, "exported" is a weird word, TravisD. nothing is ever exported, since vars stay in their namespace
13:41`cbpI don't know if it's just because of webkit's bad handling of international keyboards but LT is nearly unusable for me =(
13:41TravisDHmm, I guess it wont be available from other namespaces?
13:41amalloybut when you require a namespace with a private var, no mapping is created from the symbol naming it to the var itself
13:42amalloyyou can always access the var anyway, if you want, using the var syntax
13:42TravisDAh, what's the var syntax?
13:42technomancyseangrove: heeh
13:42amalloy&[(var clojure.core/inc) #'inc]
13:43technomancy`cbp: shouldn't that be an OS concern?
13:43amalloygod, lazybot has been so unreliable recently
13:43amalloy,[(var clojure.core/inc) #'inc]
13:43clojurebot[#'clojure.core/inc #'clojure.core/inc]
13:44hiredman~clojurebot
13:44clojurebotclojurebot is highly unlikely
13:44rasmusto~lazybot
13:44clojurebotlazybot is echo ~lazybot
13:45`cbptechnomancy: I think LT uses keyCodes given to it by webkit and on international keyboards that get's all f'ed up (the keyCode for [, ], {, } are the same etc). So I guess it's partly LTs fault for trusting those keyCodes and having no engineers working on it with international keyboards.
13:45TravisDamalloy: cool, I'll need to look at that some more. Anyways, you can use defn- to define a private function. Is there a more general way to define private vars without explicitly adding the metadata yourself?
13:45`cbpAlso it has some pretty annoying common bugs like it suddenly starts registering my keypresses on a tab that isn't the one i'm looking at and I'm not sure if that's because of the same reason
13:46seangrovednolen_: Is seb suggesting we add a check to see if the prop is starting with "__", or that we list all the properties we don't want shown?
13:47patchworkI have an uberjar that works fine locally, but on heroku returns from (wrap-resource "public") on a request with {:uri "/"}… ?
13:47patchworkAnyone seen this before?
13:47patchworkIt is as if (wrap-resource) is matching a file with no name?
13:47patchworkVery strange
13:48justin_smithpatchwork: wait, what does it return for /?
13:48technomancypatchwork: yeah, that's a known bug in older ring versions
13:48patchworkIt should return the home page
13:48patchworktechnomancy: Ahh… okay
13:48patchworkI keep upgrading ring… apparently I am still behind!
13:49patchworkOr maybe some dependency is pulling in an old version
13:49patchworkThanks technomancy
13:49technomancypatchwork: https://github.com/ring-clojure/ring/pull/97
13:54pyrtsa`cbp: AFAIK, LightTable uses Mousetrap (http://craig.is/killing/mice) for handling key bindings, and it only supports the US keyboard layout. Bad, bad. :(
13:55`cbpHmm yeah..
13:55`cbpWell it's still pretty nice what they've managed in a year or so
13:55sdegutislazybot where art thou
13:56pyrtsahttps://github.com/ccampbell/mousetrap/issues/2
13:57pyrtsa`cbp: Indeed. And I've managed to make many key bindings work on my Finnish keyboard layout, regardless of Mousetrap's limitations. Had to do a few tricks there, though.
14:00pyrtsa`cbp: In particular, `"alt-[" [(:editor.open-pair "[")]`, `"alt-shift-[" [(:editor.open-pair "{")]`, and similar treatment for the `]` key made brackets and braces work on my keyboard.
14:02`cbpYeah I had to remap a bunch of alt-* keys because I use them to type some characters and light table uses them as shortcuts :-P
14:02`cbpBut that's no biggie
14:03pyrtsaYeah, I just disabled pretty much all of the alt-* bindings. I use alt all the time for not-so-special characters like @, $, [, ], { and }.
14:03`cbpalthough that makes them not register as an actual [ or something. So there is no automatic ] put by the editor
14:04pyrtsaMy trick above does exactly that.
14:05`cbpOH!
14:07`cbphehe I used alt-[ and now I can't type {, gonna have to make that combo alt-shift-[ do it. As you did I guess
14:07pyrtsaHere: https://gist.github.com/pyrtsa/9277551
14:11`cbpThanks, haha. "You use the [ and { keys to write [ and shift on the [ key (not the { key) to type {"
14:12pyrtsaOn the FI keyboard, [ is alt-8, { is alt-shift-8, ] is alt-8 and } is alt-shift-9. That's why.
14:12pyrtsa] = alt-9, of course.
14:13pyrtsaAnd parentheses are shift-8 and shift-9. Much different from the en_US, unfortunately.
14:14technomancyhack your layout; unshifted parens are awesome =)
14:14`cbpYeah it doesn't work for me unfortunately, my [] and {} are in different positions =(
14:15pyrtsaWhich layout are you?
14:16gtrakwhat's up with lazybot?
14:16pyrtsatechnomancy: I bet. But believe or not, 30 years of this layout does leave you with some muscular memory as well.
14:16amalloygtrak: he's having some kind of connection problem. can't log into freenode
14:17gtrakI had that yesterday
14:17pyrtsa(Or well, maybe 23 years since I started typing.)
14:17`cbpspanish-iso
14:17gtrak7070 was broken on a few servers for some reason, 7000 worked on card.freenode
14:17technomancypyrtsa: https://github.com/technomancy/atreus
14:17gtrakmaybe related
14:18gtrakI'm on dickson now, actually
14:19gtraklooks like they're having a DDoS attack
14:19gtrakhttps://twitter.com/freenodestaff
14:19technomancysadface
14:20technomancythey changed their organizational structure so they can't accept donations anymore either
14:20patchworkHmm… ring-json is pulling in an old version of ring-core
14:20`cbpFortunately I will be getting an english keyboard soon and I will recover the blissful ignorance where everything open source works that I gained when I moved away from Windows =)
14:20patchworkDo I need to fork ring-json to upgrade? Funny it is living on its own rather than part of ring like the other middlewares
14:20pyrtsatechnomancy: The thing you might find hard to believe is, we do need some "special" characters (in my case, ä and ö) almost as often as you need your a and o. Of course not as much when programming but the context switches between coding-oriented and prose-oriented key layouts do have their price.
14:21amalloypatchwork: there are jillions of middlewares. for them all to live in ring would be not just silly but impossible
14:21technomancypyrtsa: I'm not saying to use mine, just to take what you have and make it suit your own needs better
14:21patchworkamalloy: Right, but this one is pretty standard
14:22patchworkForking...
14:22gfrederickspatchwork: you can normally override indirect deps if you need to
14:22pyrtsaI'm pretty fine with mine atm. And now I'm even fine with LightTable, once I found my hack to support the FI layout in it. But it could be better.
14:22gfredericksso as long as it's compatible with the newer version...
14:22`cbpAlthough I'm not entirely sure how the computer would respond with two different keyboar layouts..
14:22patchworkgfredericks: Ah good call
14:44johnjelinekhihi all
14:45johnjelinekso, to preface: I haven't read the little lisper -- so, my question is prolly obvious -- but how do I make a function in the REPL that repeats itself every 5 seconds?
14:45mmitchellI have a protocol and a record. For the record, I'd like to add a private function, I'm guessing that doesn't work with protocols, so I instead though a letfn over the defrecordr -- dang, that doesn't work either. Is there a way to around this?
14:45johnjelinekhere's my attempt: (def repeat-me (future (do (Thread/sleep 5000) (println "Repeating") repeat-me)))
14:46johnjelinekbut this does not repeat
14:46amalloymmitchell: just don't attach the function to the record. define a function that takes your record in and does whatever
14:47RickInAtlantajohnjelinek: you could do it with core.async
14:47johnjelinekRickInAtlanta: isn't that a little overkill?
14:47amalloyyes :P
14:47mmitchellamalloy: right yeah, that's definitely the most straight forward way
14:47mmitchellI'll do that
14:47amalloy(future (loop [] ... (recur)))
14:48amalloyalthough i sorta expect this experiment of having another thread doing things to your repl indefinitely to go kinda Sorceror's Apprentice
14:48johnjelinek??
14:48clojurebotBOT FIGHT!!!!!111
14:49sdegutislol
14:49amalloyi mean you'll accidentally have more than one such thread and/or be unable to stop them
14:50amalloy$google sorceror's apprentice wikipedia
14:50johnjelinek(def repeat-me (future (loop [] (do (Thread/sleep 5000) (println "Repeating")) (recur)))),
14:50johnjelinekworks:)
14:50amalloyoh right. no lazybot
14:50amalloyhttp://en.wikipedia.org/wiki/The_Sorcerer's_Apprentice
14:51johnjelinekooooh, the disney fantasia story
14:51amalloysure, although much older than that, of course
14:51johnjelinekright
14:51johnjelinekso -- on every recur, does this spawn a new thread?
14:51amalloya socratic answer: how do you spawn a new thread?
14:52johnjelinek(future
14:52amalloyand do you (future in the loop?
14:52johnjelinekno
14:52amalloytada!
14:52johnjelinekso, I have my answer :)
14:57janiczekHi, if I wanted to do some kind of logger / visualizer for core.async processes and channels, would I need to somehow hack on core.async itself? Or would hooking it from outside be enough? (I am looking into Rackets future-visualizer and Racket has logging baked right inside...)
14:58amalloyjaniczek: you might take a look at the graphviz stuff in lamina. i don't know how applicable it is to core.async, but it's pretty cool
14:58technomancyI doubt there's anything as nice as Racket's
14:59ztellmaninteresting: http://docs.racket-lang.org/future-visualizer/index.html
14:59ztellmandidn't know about this
14:59janiczekThats exactly it.
15:04sdegutisAnyone in here love Docker?
15:09TravisDI'm always shocked by how expensive it is to print things
15:11bbloomTravisD: yup.
15:11amalloylike...because printer ink costs thousands of dollars per gallon, or because sending strings to your repl takes a while?
15:11bbloomamalloy: both.
15:11TravisDOh, hehe, I was talking about sending strings to the repl :)
15:14sverihi there, i tried to unit test the lib-noir validation rules, however, when i call one method from the test i get this error: Exception in thread "main" java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to java.util.concurrent.Future Any ideas how one can test the validation rules?
15:16amalloy,@clojure.core/unquote
15:16clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to java.util.concurrent.Future>
15:17TimMcTravisD: Printing, or display on terminal? :-P
15:17amalloysveri: you probably have to use with-noir or something. i remember there being an atom you have to bind dynamically
15:17amalloyTimMc: too late by miles
15:17TravisDTimMc: displaying in cider :)
15:17TimMchttps://stackoverflow.com/questions/21947452/why-is-printing-b-dramatically-slower-than-printing
15:17amalloythat question was neat
15:18TimMcamalloy: No, by printing I meant just output.
15:18TimMcShould have been more explicit. :-)
15:20TravisDwoah, that's actually surprising
15:23sveriamalloy: thank you, there is something like that in the noir sources, i give it a try
15:31sveriamalloy: awesome, it works :-) thank you once again
15:38johnjelinekdo any of you use LT?
15:38`cbpjohnjelinek: ye
15:38johnjelinekdoes it make you crazy that CTRL+F doesn't move the cursor forward?
15:38johnjelinekit does a fuzzy file search instead
15:38johnjelinekdrives me crazy (since 0.6.1)
15:39TravisDjohnjelinek: The key bindings are customizable, no?
15:39johnjelinekI didn't see how to configure the cursor movement
15:39TravisDah, I don't know much about it
15:39johnjelinekbut also, I don't know what I'd change my fuzzy file finder to instead
15:42TravisDThere used to be a way to enable emacs bindings, but I couldn't get it to work when I tried out LT
15:43johnjelinekyea, I still can't get it to work (emacs bindings)
15:43johnjelinekthe plugin seems incomplete
15:47TravisDActually, I'm noticing that ctrl + f actually moves my cursor forward. I'm on a mac though
15:47johnjelinekwhat version? I'm on a mac too
15:47TravisD0.6.4
15:47johnjelinekme too
15:47TravisDhm, strange
15:48TravisDI think my config is also the default that it ships with
15:48johnjelinekmine too, for the most-part
15:48johnjelinekwhen I go to the file menu, it shows ^F for navigator
15:48johnjelinekbut I didn't set that
15:48TravisDfor me it is Command + O
15:49johnjelinekcmd+O does it for me too
15:49johnjelinek:|
15:49kevinfishanybody got any comments on using Heroku?
15:49RaynesIt is expensive for open source projects.
15:49RaynesThat's my comments.
15:50johnjelineklol
15:50RaynesWell, for non-trivial open source projects.
15:50RaynesFor example, need ssl support? Fo-ged-aboud-eeeeet
15:50kevinfishRaynes: k, thx.
15:50gtrakpssh ssl
15:50RaynesBut it's a great platform.
15:50RaynesI host tryclojure, fwiw.
15:50kevinfishRaynes: IOW, it gets expensive fast?
15:51kevinfishRaynes: you host it on there?
15:51RaynesYes.
15:51RaynesThat project is completely free because I don't need ssl or databases or anything that would cost monies.
15:51johnjelinekquestion: I have a collection of futures, some have completed, some are pending -- how do I filter the ones that have completed so I can only deref those?
15:52johnjelinekI was thinking (filter (map future-done? my-futures))
15:52johnjelinekbut that no worky
15:52Raynesum
15:52DomKMjohnjelinek: realized? I think
15:52gtrakderef takes a timeout argument
15:52Raynes(filter future-done? my-futures)
15:53Raynesrealized? is more generic, but also should work
15:53kevinfishanyone got any good ideas on a decent, cheap database backend that acts somewhat like datomic, in that you are not really devolving into something like SQL query language, but are pretty much just dealing with clojure containers as if they were resident in memory?
15:53johnjelinekRaynes: nice
15:53johnjelinekI was close
15:53gtrakaww, tryclj doesn't like futures
15:53gtrak,(deref (future 3) 0 0)
15:53clojurebot#<SecurityException java.lang.SecurityException: no threads please>
15:53gtrakjeez
15:53RaynesHahaha
15:53RaynesI don't even remember writing that error message.
15:53RaynesNice.
15:54gtrak,(deref (promise) 0 0)
15:54clojurebot0
15:54gtrak,(deref (promise) 0 :not-yet)
15:54clojurebot:not-yet
15:54hiredmankevinfish: core.logic has the new pldb stuff
15:56kevinfishhiredman: ok, nice. What would be the advantage of datomic over that, say?
15:56hiredmankevinfish: in what context?
15:57kevinfishhiredman: for like building web applications that may grow in use fairly rapidly
15:57hiredmancore.logic is open source and free, which is nice, core.logic isn't strictly datalog
15:57hiredmancore.logic is a database though
15:57hiredmaner
15:57hiredmanisn't
15:59kevinfishhiredman: I was looking at plob (persistent lisp objects) for something like that back when I was playing with common lisp. Pretty much normal lisp data except you could flag which were "persistent" and which elements had indexes on them, etc... Otherwise, it pretty much gave the illusion you were dealing with in-ram data
15:59hiredmankevinfish: there is nothing like that
16:00hiredmanthe closest you might come is some kind of datagrid like infinispan, etc, which would use java serialization to store stuff
16:02kevinfishhiredman: k, thx. Unfortunately, I know lisp a fair bit, clojure a little, and java almost none.
16:02johnjelinekdakrone: you around?
16:03johnjelinekdakrone: even with {:throw-exceptions false} I still get exceptions in the scenario where I get "Connection reset"
16:03hiredmankevinfish: I would recomend using any of a number of fine sql databases then
16:04kevinfishhiredman: I don't know that very much either :(
16:04hiredmannow is your chance then
16:05kevinfishhiredman: ya, oh joy.
16:05hiredmanclojure data tends to map to sql very well, maps are just rows in a table
16:06hiredmanfilter is select, etc
16:07hiredmanI not familiar with how plob works, but generally those kind of systems are heavy on define lots of new types with some attributes so the serialization whatever can stick them in the right place
16:08hiredmanclojure tends to de-emphasize the creation of custom types, relying on just generic maps to carry associated data around, which maps well to the relational world
16:20zachmassiaI'm testing out the austin brepl sample, and I have a java process using ~1G ram and 25% CPU and it's also caused emacs to use 25% CPU
16:20zachmassiaShould I be launching it through a command line repl instead of cider?
16:28dsrxshouldn't matter
16:29dsrxdo you have some sort of autocomplete mode enabled in cider, like company or auto-complete?
16:29dsrxthose can wreak havoc in a piggiebacked REPL
16:30zachmassiadsrx: Yep, auto-complete
16:31amalloyi want an eastwood rule that looks for (apply str (interpose x ys)), and murders the person who wrote it
16:31zachmassiaNot sure what kind of magic that sample project is doing, but I copied all the relevant code into my project and get a nullpointerexception on the (def repl-env ...) command
16:31technomancyamalloy: I think you're stuck with http://p.hagelb.org/punch.png
16:32zachmassiaI'll disable auto-complete and see if that helps. About to just give up on the brepl lol
16:33abpamalloy: technomancy usb rocket launcher hooked
16:35gtrakamalloy: one of the few uses I've had for interpose.
16:35dsrxzachmassia: have you required cemerick.austin.repls and cemerick.austin at your repl?
16:35dsrx(the clojure side of it)
16:35TEttinger##(apply str (interleave ["Hi" "amalloy" "how" "are" "you"] (repeat 5 " ")))
16:35lazybot⇒ "Hi amalloy how are you "
16:35TEttingereven worse?
16:36amalloyTEttinger: i feel like if someone goes to that kind of effort just to get a wrong answer, they already have enough problems
16:36zachmassiadsrx: For the sample I didn't have to, it just worked. But in my project, I tried with and without requiring those namespaces and it was the same result.
16:36amalloygtrak: joke?
16:36gtrakactually no. I've only used interpose, like twice.
16:36technomancyinterpose: great for getting amalloy to want to kill you
16:37amalloybut like, that shouldn't be one of the times you used it
16:37dsrxwell in the sample project IIRC the repl starts you in a namespace that's already required those namespaces
16:37johnjelinekout of memory error? :| do I need to be manually killing my futures when the finish?
16:37johnjelinekthey*
16:37TEttingertrue
16:37dsrxlike browser-sample.whatever.something
16:37gtrakheh, yes, yes it was. I learned string/join, so I stopped using interpose.
16:37gtrakcan't think of other times I've had to use it.
16:37TEttingerjohnjelinek, how many futures did you create?
16:38johnjelinek36000
16:38RaynesI distinctly remember arguments with amalloy about join vs apply str interpose when I was like 16.
16:38johnjelinekthey're making async web requests
16:38gtrakin a 24kloc code-base, we use it once, and we should use string/join.
16:38gtrakso... that's my point.
16:38TEttingerI have a feeling that's too many at one time, but it probably depends on what it's running on
16:38johnjelinekshould I space them out?
16:39amalloyoh my
16:39zachmassiadsrx: Ya it sets the init-ns key. I tried setting it to 'myapp.core' which requires the same namespace the sample projects .clj does
16:39amalloyjohnjelinek: you need a better async primitive than future
16:39johnjelinekhow would I add a take-delay?
16:39amalloylike a threadpool
16:39johnjelinekhrmm ... well, clj-http has a connectionmanager, maybe I should use that instead of spinning up my own futures
16:40amalloyclj-http supports non-blocking io, i think, so you shouldn't need any threads at all
16:40amalloyjust issue all the requests, and set a callback for each one
16:40gtrakI want/need statistics on every public clojure codebase in existence.
16:41technomancygtrak: clojuresphere
16:41gtrakmy first thought.
16:41gtrakI bet 95% of uses of interpose are inappropriate string/joins.
16:41johnjelinekamalloy: out of the box, I don't think clj-http does async, that's what made http-kit popular methinks
16:41seangrovednolen_: Ok, both PRs were merged
16:41johnjelinekbut http-kit can't do streaming http requests, so I'm going back to clj-http
16:42dnolen_seangrove: RAD
16:42seangrovednolen_: Not sure when the next release will go out, but the merging bit was quite fast
16:42amalloyoh, i can't keep those straight. i just use aleph if i want async
16:42dnolen_seangrove: yes they are very responsive
16:43johnjelinekamalloy: lol, another library :|
16:43gtrakarguably, interpose decomplects .toString from string/join
16:43gtraktherefore is good.
16:43gtrak:-)
16:44amalloyinterpose is fine, i'm glad it exists
16:44amalloybut don't use it for strings, since join exists
16:45technomancybut amalloy what if I don't want to go up to the top of my file to add :require [clojure.string :as str] to the ns form
16:45sdegutisThe sole usage of interpose in our codebase: (interpose "<br>" messages)
16:45amalloytechnomancy: emacs keyboard macro for adding that, of course
16:45technomancyamalloy: the correct answer was slamhound
16:45gtraksdegutis: you should use more semantic markup
16:46technomancyfive points from hufflepuff
16:46amalloyi had a keyboard macro for adding flatland.useful.debug
16:46hiredman~#10
16:46clojurebot10. Get into a rut early: Do the same process the same way. Accumulate idioms. Standardize. The only difference(!) between Shakespeare and you was the size of his idiom list - not the size of his vocabulary. -- Alan J. Perlis
16:46amalloyhiredman: shakespeare cheated by making up half of english
16:46seangrovetechnomancy: Are you mad? You should alias it :as string anyway.
16:46hiredmanamalloy: tell it to perlis
16:46amalloy:as s, man
16:46technomancyseangrove: that's 2x as many characters
16:47amalloyeveryone knows what s/join means
16:47technomancyseangrove: if ns aliases were first-class that'd be a problem
16:47technomancyand I wish they were
16:47gtrakthe likelihood that some other namespace has required it is very high, just don't worry about it.
16:47technomancybut they're not
16:47seangroveMadness
16:48seangrovetechnomancy: I guess you get used to dnolen_ telling you, "Oh your application works as an accident of undefined behavior, which we've decided to fix/change/revert"
16:48amalloygtrak: the likelihood is 100%
16:49technomancyseangrove: I'd be so happy to have first-class namespaces that I wouldn't mind fixing the breakage =D
16:49amalloyclojure.string is one of the namespaces that's always required
16:49seangrovetechnomancy: I agree it'd be delightful.
16:50technomancyamalloy: I thought that changed in 1.3
16:50technomancyor was it just clojure.set
16:50muhooi'm having a miserable time trying to get booleans to work with om
16:51muhoo(om/value something) returns either true or false, but it lies
16:51muhoobecause tests like (if something) always succeed!
16:51muhooand tests like (= true (om/value something)) always fail
16:52bob2is it in fact a string
16:52bob2technomancy, they're not first class?
16:53technomancybob2: eh
16:53technomancyno reader syntax
16:53muhooin short, i have no idea whether i'm doing something really stupid, or if booleans just don't work in cljs/om
16:53sdegutisamalloy: I always forget the ordering, like 99% of the time
16:54technomancybob2: they're kinda like functions in lisp-2. you can pass em around and stuff, but they always feel awkward like not-quite-values
17:05patchworktechnomancy: Hmm… upgraded to ring 1.2.1, still getting a blank response from (wrap-resource) on requests {:uri "/"}
17:05patchworkI even unzipped the jar and made sure your pull request got in: https://github.com/ring-clojure/ring/pull/97
17:06patchworkring.util.response is checking (directory-url? …)
17:06patchworkAny leads?
17:06patchworkI realize now it happens on any uberjar, not just heroku (heroku just creates an uberjar)
17:07technomancypatchwork: can you remove the directory entry with :uberjar-exclusions or something?
17:08patchworkHmm… just /resources/public/ ?
17:08patchworkI'll check that out
17:08technomancysure; whatever it is that's getting returned by wrap-resource
17:09patchworkThe thing is everything else lives in /resources/public. it is not an empty dir
17:09technomancyjust to see if it works around the problem; not as a full solution
17:09patchworkCan I exclude just that path without excluding the rest of the files in that dir?
17:09patchworkI will check out :uberjar-exclusions
17:09technomancyyou should be able to use a regex that matches the directory without matching the files under it
17:09patchworkOkay
17:10broquaintmuhoo: Try out ankha and see what data you've really got? https://github.com/noprompt/ankha
17:11johnjelinekwhy does this return "not done yet" even when the future is done? (if (future-done? symbols) "not done yet" (count @symbols))
17:11zachmassiadsrx: If you or anyone has time to look over this, here's the errors and relevant files for my project when trying to get a brepl with austin working. https://gist.github.com/ZachMassia/462f7560016643dcd8fc
17:12amalloyjohnjelinek: because if the future is done you return "not done yet"...
17:13johnjelineklololol
17:13johnjelinekamalloy: thanks for that
17:14rasmusto~netsplit
17:14clojurebotI don't understand.
17:14amalloy,(doc deref)
17:14clojurebot"([ref] [ref timeout-ms timeout-val]); Also reader macro: @ref/@agent/@var/@atom/@delay/@future/@promise. Within a transaction, returns the in-transaction-value of ref, else returns the most-recently-committed value of ref. When applied to a var, agent or atom, returns its current state. When applied to a delay, forces it if not already forced. When applied to a future, will block if computation n...
17:14zoldarI'm going through Om tutorial and the code snippets have quite a nice formatting. On the other hand, LightTable, which I've started using recently is doing much worse, indenting often goes too deep or to shallow. Anybody got around custmizing it? Are there any knobs available on the editor level or is it necessary to fiddle with LT clojure mode directly?
17:15amalloyjohnjelinek: you could also just write (deref symbols 0 "not done yet")
17:15matthavenerjohnjelinek: hey there :)
17:15johnjelinekmatthavener: hey :)
17:17dnolen_johnjelinek: that question is probably best directed to the Light Table mailing list
17:17johnjelinekmatthavener: how U?
17:17gtraktechnomancy: is 'lein install' away from a project supposed to work? Seems like it overwrites the clojure dep in ~/.m2.
17:17gtrakjust did it by accident
17:17johnjelinekdnolen_: which question, the CTRL+F?
17:17dnolen_johnjelinek: oops sorry
17:17dnolen_that was for zoldar ^
17:18johnjelineklol
17:19patchworktechnomancy: Added :uberjar-exclusions [#"resources/public/?"] to my project.clj, didn't seem to help
17:19zoldardnolen_: ok, thanks
17:19patchworkFunny, I can hit every other route or file in the app!
17:19patchworkAnother pattern maybe?
17:20technomancypatchwork: getting rid of wrap-resources makes the problem go away?
17:23patchworktechnomancy: Yes. Removing wrap-resource gives me the home page at {:uri "/"}
17:24patchworkbut without styling, js etc as those are resources
17:24patchworkwith wrap-resource I get all those, but not the home page!
17:24technomancypatchwork: I'm about to go into a call, but if you pm me the app name I can investigate further when it's done
17:25amalloypatchwork: why do you get the home page at / to begin with?
17:25amalloydo you have some middleware that replaces that with index.html or something?
17:26patchworkamalloy: No the home page is not a resource, it is generated by the app
17:26patchwork(wrap-resource) is just for the static stuff
17:26patchworkThe app is a handler that lives at the bottom of the middleware stack
17:26patchworkwhich is currently never getting hit at {:uri "/"}
17:27patchworkbecause (wrap-resource) is hijacking it and returning a blank file
17:27amalloyright, because there's a resource that exists at / (even if it's silly to consider a directory a resource)
17:27sveri1Hi, Anyone here having an idea about my problem i described here: https://groups.google.com/forum/#!topic/clojure/0VMwgCpeoU4 ?
17:28amalloyinstead of (wrap-resource handler ...), have you tried (routes handler (resources ...))?
17:29muhoobroquaint: oh, is that the floating window thing?
17:29patchworkamalloy: Strange, it only fails if it is running in an uberjar
17:30patchworkThat is why I just discovered it, I was trying to work out heroku support
17:30patchworkSo you are suggesting looking for resources if the route itself is not matched?
17:30muhoonoprompt: huh, that's pretty cool. i was just complaining about having to flip back and forth between cljs/nrepl and google console trying to see what these objects are or aren't.
17:31amalloyi'm suggesting explicitly giving your handler priority, if you don't like what wrap-resources is doing
17:31patchworkRight, but many of the resources are shadowed by routes that match variable paths
17:31patchworkso it would never fall through to find the resources
17:32patchworkwhich is why it hits the resources first in the stack
17:32patchworkThe usual behavior is if the resource is not found, it falls through to the app. Which is actually what it does unless it's in an uberjar!
17:33patchworkI wonder what is different there?
17:33amalloywell, that's what it does even if it's in an uberjar
17:33amalloyi speculate that something about being in the uberjar makes it think / is a resource, so it's not "not found"
17:33nopromptmuhoo: ankha?
17:33amalloy(routes (GET "/" req (handler req)) (wrap-resources ... handler))
17:34muhoonoprompt: ya
17:34amalloyfor even more delicate route-untangling
17:34patchworkRight, which seems like what technomancy's earlier pull request should have fixed
17:34noprompti'm having a weird problem w/ my project not picking up a dependency and i have no clue what's wrong.
17:35patchworkamalloy: Right, I guess I can directly inspect the incoming request and bypass (wrap-resources) in that case
17:36patchworkseems like a hack! But it will work I suppose
17:37muhooanyway, still miserable with the booleans
17:40noprompti'm trying to use the newest version of clojure.tools.cli but i keep ending up with the old version
17:41nopromptlein deps :tree doesn't report a dependency on the old version :|
17:41`cbpwhen all else fails.. lein clean?
17:42noprompti've done lein clean :S
17:43muhooah, solution is, (om/value somebool) fails. but (.valueOf somebool) works!
17:43`cbpthen go nuclear and delete .m2 xD ?
17:44amalloynoprompt: google exorcism services
17:44nopromptamalloy: haha, what?
17:45amalloysince your computer is apparently haunted
17:45amalloyor possessed
17:45amalloywhatever it is you exorcise
17:46patchworkamalloy technomancy: This solved it! https://www.refheap.com/49113
17:47amalloypatchwork: there are a couple ways to improve that
17:47patchworkamalloy: Sure, what did you have in mind?
17:47amalloythe first is to wrap-resource once, outside the fn, and use it inside; this probably doesn't matter, but if wrap-resource were expensive to initialize...
17:47patchworkAh, right
17:47patchworkeven hacks should be well-engineered
17:48amalloythe second is to do what i suggested, ie (GET "/"). checking (= "/" uri) will fail if the uri is actually /?test=1
17:48patchworkAh, yeah not using compojure
17:49amalloyreally? well, to each his own i guess
17:51patchworkI don't like the macros. Using this: https://github.com/caribou/polaris
17:51patchworkI guess I could do a comparable thing with polaris
17:52amalloyi think the only macros i've ever used in compojure are GET and POST
17:52patchworkI get to the point where I want to use GET or POST as a value somewhere and then end up writing something like (fn [route] (GET route))
17:53patchworkwhich just seems wrong
17:53amalloyit doesn't just seem wrong, it like...is wrong? that shouldn't work at all
17:54patchworkWell, that is pseudocode
17:54patchworkI forget exactly what the args to GET are
17:54patchworkBut that is the spirit : )
17:54amalloydoesn't really matter what they are, since it's a macro - if route is at all interesting, calling it like that won't work
17:55patchworkRight, it has some quoting I believe
17:55patchworkbeen awhile since I've done it, since I switched to something that treats routes as data and not fuzzy macro sugar
17:56patchworkIt is funny, when I first got into lisp (and read through "on lisp" what, 10 years ago?) I thought macros were the ultimate
17:57patchworkNow I never touch the things
17:57patchworkCan't take the value of a macro, they are useless to me
17:58seangrovepatchwork: core.async is useless to you?
17:58patchworkAh, no I love core.async
17:58patchworkAlso: let
17:59patchworkAnd: fn
17:59patchworkI just haven't written one
17:59patchworkThey are good for fundamental things like that I suppose
18:00patchworkbut most of the time I want to compose things programmatically
18:00patchworka macro is like a compositional dead-end
18:03seangrovepatchwork: I agree, best avoided if possible
18:05johnjelinekdakrone: what does Connection Pool shut down mean?
18:10dakronejohnjelinek: that the connection pool has been shut down? can you give me more context?
18:11johnjelinekdakrone: it's a little ways behind me now, I bypassed it by removing a doall on my async requests in the with-connection-pool
18:12dakronejohnjelinek: okay, happy to help if I can
18:15johnjelinekdakrone: will this still use the number of threads I specified in the connection manager? (client/with-connection-pool {:timeout 5 :threads 4 :default-per-route 2 :insecure? false} (let [req-futs (map #(future (client/get % {:oauth-token (:access_token @access-token) :throw-exceptions false :as :json-s
18:17dakronejohnjelinek: ahh, I see the issue
18:17johnjelineksince I use (future in req-futs I have suspicion that the thread count may increase to accomodate (take 26 urls)
18:17dakronejohnjelinek: the with-connection-pool creates a connection manager, and then closes it at the end, but since you are creating futures that may run after the manager has been closed, it's possible to try and use a previously-closed manager
18:18dakronejohnjelinek: a better solution is to create a manager and use the :connection-manager option, as in the second example here: https://github.com/dakrone/clj-http/#using-persistent-connections
18:18johnjelinekwhat is the recommended way to use the connection manager and still get a collection of futures that I can watch?
18:18dakronejohnjelinek: then, once all futures have been realized, you can close it at your leisure
18:19johnjelinekahh, ok
18:19technomancypatchwork1: that kind of stuff shouldn't be necessary though
18:19johnjelinekhow do I close it at my leisure?
18:19technomancyit worries me that the issue is still present despite that patch being merged
18:19johnjelinekjust set it to nil?
18:19technomancydo you have a repro case I could check out?
18:20johnjelinekdakrone: Ideally, all I want is for my function not to block
18:20dakronejohnjelinek: there is a shutdown-manager function in clj-http.conn-mgr
18:20johnjelinekso (map (future ... I thought would get me that
18:20dakronejohnjelinek: yes, so create the manager once, use it throughout your program, then when you're shutting down, you can finally shut it down
18:20johnjelinekgreat :)
18:21patchwork1technomancy: I will put one together, in a meeting currently
18:21johnjelinekbtw, you may want to add shutdown-manager to the example on the github
18:21dakronejohnjelinek: good idea!
18:21technomancypatchwork1: thanks.
18:22dakronejohnjelinek: added, thanks
18:23johnjelinekyw
18:29rasmusto,(and (nil? 'nil) (true? 'true) (false? 'false))
18:29clojurebottrue
18:30rasmustogood to know
18:32amalloy,(instance? String)
18:32clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core/instance?>
18:32amalloynice
18:33rasmusto,(instance 'true)
18:33clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: instance in this context, compiling:(NO_SOURCE_PATH:0:0)>
18:33rasmusto,(instance? 'true)
18:33clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core/instance?>
18:33rasmusto,(instance? 'true java.lang.Boolean)
18:33clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.Class>
18:33johnjelinekdakrone: ok, so now I have my 26 futures, how do I make sure that only 4 threads are being used as enforced by the conn-mgr?
18:34rasmusto,(instance? java.lang.Boolean 'true)
18:34clojurebottrue
18:34dakronejohnjelinek: threads for the actual futures themselves, or threads for the connection manager?
18:34johnjelinekthe latter
18:34dakronejohnjelinek: the connection manager will manage that, you can enabled the apache debug logs and see it do that if you desire
18:35johnjelinekbtw, how will this work -- the 26 threads for the futures will reduce to the 4 specified by the conn-mgr?
18:36dakronejohnjelinek: a future doesn't spawn a thread, internally it uses clojure's ThreadPoolExecutor based on the number of processors in your machine
18:36johnjelinekdakrone: oh -- from what I read, I was under the impression is spawns a thread
18:36johnjelinekto manage concurrency
18:36dakronejohnjelinek: it spawns a thread from the threadpool, which may or may-not actuall spawn a thread :)
18:37johnjelinekgotcha
18:37dakronejohnjelinek: if it's a fixed threadpool of size 4, then only 4 threads will be spawned at a time, the rest of the ops will be queued
18:37hiredmandakrone: the future threadpool is unbounded
18:37dakronehiredman: oh, for some reason I thought it was CPU-limited
18:38dakroneahh yea, pmap uses a limited threadpool
18:38amalloythat's for agents
18:38dakronewell *one* of the threadpools is limited, somewhere ;D
18:39johnjelinekbut in my case of (map #(future ... then it's spawning more threads to keep it non-blocking, but the requests in the futures may be queued by the threads in the conn-mgr
18:39amalloydakrone: pmap uses an unbounded threadpool (ie, the future threadpool), it just tries not to realize too many elements at once
18:39dakroneamalloy: ahh okay
18:39hiredmanjohnjelinek: when using map and future it is important to keep in mind that map is lazy
18:40johnjelinekshould I use something else?
18:40johnjelinekI'm just using map to pump the URLS into my client/get argument
18:40hiredmandepends what you want, I would use an executor and a queue of results
18:41dakronejohnjelinek: you may be able to utilize something like https://github.com/TheClimateCorporation/claypoole for this
18:41johnjelinekdakrone: claypoole was recommended to me yesterday, but I'm trying to keep my samples simple enough so I can ship something ;)
18:42dakronejohnjelinek: in that case I wouldn't be too worried about having every single future executing an HTTP request at the same time, I'd set the connection manager threads to a reasonable value and keep stuff in futures like you have
18:45johnjelinekI thought maybe I could swap the map and future around to be (future (map ... so I would have it execute all requests by the conn-mgr and still send a future I can check the status of ... but this blocks :|
18:48johnjelineklol, so it blocks and returns a finished future
19:06johnjelinekwhy is this non-blocking: (future (into #{} (map #(% :Name) (flatten (map #(% :body) (pmap client/get urls (repeat {:oauth-token (:access_token @access-token) :throw-exceptions false :as :json-strict-string-
19:06gtrakanyone know of a way to expand Ant Filesets in clojure?
19:06johnjelinekoh, it didn't paste everything
19:06gtrakjohnjelinek: don't paste multiple lines
19:06`cbpjohnjelinek: refheap
19:06johnjelinekrefheap?
19:06clojurebothttps://www.refheap.com/
19:06`cbp~botsnack
19:06clojurebotThanks, but I prefer chocolate
19:07hiredman~pmap
19:07clojurebotpmap is not what you want
19:07`cbp: (
19:07rasmusto~doall
19:07clojurebotI don't understand.
19:07hiredman~flatten
19:07clojurebotflatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.
19:08hiredman#(% :Name) is so gross
19:09hiredmanetc etc
19:09johnjelinekhere's a pastebin: http://pastebin.com/DzkWvt0N
19:09rasmusto,((comp :name :body) {:body {:name "foo"}})
19:09clojurebot"foo"
19:10johnjelinekso, why is the latter blocking?
19:11johnjelinekoh, hurp durp* I need to prolly future my get-all-symbols
19:12rasmustothe #(str "https://example.com&quot;) isn't doing anything, you're missing a % (an aside)
19:13johnjelineksorry, I replaced the real stuff with "example.com" and forgot the %
19:13rasmustokk, was just nitpicking anyways :)
19:14johnjelinekhttp://pastebin.com/1xik5pEx
19:14johnjelinekjust for you :)
19:14rasmusto,'<3
19:14clojurebot<3
19:16rasmustojohnjelinek: are you saying that it blocks before you try to dereference it?
19:18johnjelinekrasmusto: yes
19:20johnjelinekrasmusto: actually, it's weird behavror -- (future-done? is true
19:20johnjelinekbut (deref blocks
19:21johnjelinek(meaning (future-done? should've been false
19:24gtrakoh wow, ant's FileSet has a handy iterator function. This might be easier than I thought.
19:24johnjelinek g2g
19:24patchworktechnomancy: Here you go: https://github.com/caribou/caribou-development/tree/develop
19:25technomancypatchwork: thanks
19:26patchworktechnomancy: Thank you! I have to run, maybe leave a comment on that repo if you find anything?
19:26technomancypatchwork: sounds good
19:40stcred0Is there any way that I can get Clojure to generate a Java superclass and two subclasses with disparate state implementing the same protocol?
20:02gfredericksdisparate state?
20:02stcred0yes, they have none of the same attributes
20:02stcred0but they both implement the same protocol
20:03gfrederickswhy do you need the subclass relationship?
20:04stcred0I seem to be having difficulty getting things to compile. The Clojure compiler doesn't seem to like it when I have the return-type hint be the protocol
20:05gfrederickswhy do you need to type hint w/ a protocol?
20:05stcred0Won't that result in faster code?
20:06gfredericksif `lein check` doesn't tell you there's specific reflective code being generated, then there's no problem to solve
20:06gfrederickstype hints only help w/ reflection
20:06stcred0I have set warn-on-reflection true in all those source files, so that's the same thing?
20:07gfredericksprobably so
20:08stcred0So, if I have a ight loop where I'd like there to be polymorphic dispatch and for that to be compiled to what I'd expect it to be in Java, I don't have to do anything?
20:08gfrederickswell protocols have a bit of overhead compared to interfaces
20:08gfredericksbut each protocol has an underlying interface
20:09gfrederickswhich is sometimes implemented by the classes satisfying the protocol, dependending
20:09gfredericksbut protocols aren't going to be obscenely slow like reflection
20:10stcred0But if I can get the two classes satisfying the protocol to implement the interface, won't that result in even faster code?
20:10gfredericksyou can measure to check
20:10stcred0Potentially, things would be JIT-ed
20:10gfredericksif you use deftype or defrecord and do the protocol definition inline, it'll implement theh interface
20:11stcred0I am using defrecord for the two things implementing the protocol. What do you mean about doing the protocol definition inline?
20:11gfrederickswithin the defrecord expression
20:11gfrederickscontrasted with extend-type or extend-protocol
20:12stcred0So then how would I get that to happen with polymorphism between two classes?
20:12gfredericks,(defprotocol IFoo (foo [_]))
20:12clojurebotIFoo
20:12gfredericks,(defrecord A [] IFoo (foo [_] "I am an A"))
20:12clojurebotsandbox.A
20:13gfredericks,(defrecord B [] IFoo (foo [_] "I am a B"))
20:13clojurebotsandbox.B
20:13gfredericks,(type sandbox/IFoo)
20:13clojurebotclojure.lang.PersistentArrayMap
20:13gfredericks,(import 'sandbox.IFoo)
20:13clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Var cannot be cast to java.lang.Class>
20:13gfredericks,sandbox.IFoo
20:13clojurebotsandbox.IFoo
20:13gfredericks,(type sandbox.IFoo)
20:13clojurebotjava.lang.Class
20:13gfredericks,(satisfies? (A.) sandbox/IFoo)
20:13clojurebot#<NullPointerException java.lang.NullPointerException>
20:14gfredericks,(satisfies? sandbox/IFoo (A.))
20:14clojurebottrue
20:14gfredericks,(instance? sandbox.IFoo (A.))
20:14clojurebottrue
20:14gfredericks,(foo (A.))
20:14clojurebot"I am an A"
20:14gfredericks,(.foo (A.))
20:14clojurebot"I am an A"
20:14stcred0I think that's what I'm doing.
20:15gfredericksnote the difference between the last two
20:15gfredericksthe first one is never reflective and type hints don't help; the second can be reflective and you would type hint with the interface name
20:15gfredericks,(.foo ^sandbox.IFoo (B.))
20:15clojurebot"I am a B"
20:16gfredericks,(time (.foo (B.)))
20:16clojurebot"Elapsed time: 0.112743 msecs"\n"I am a B"
20:16gfredericks,(time (.foo ^sandbox.IFoo (B.)))
20:16clojurebot"Elapsed time: 0.107861 msecs"\n"I am a B"
20:16gfredericks,(set! *warn-on-reflection* true)
20:16clojurebot#<IllegalStateException java.lang.IllegalStateException: Can't change/establish root binding of: *warn-on-reflection* with set>
20:16gfrederickstime on clojurebot might be funky
20:16stcred0Well, you'd have to keep at it to warm up the JIT
20:17gfredericksthere's usually an immediate factor of 100-1000x difference
20:17gfredericksif one is reflective
20:17gfredericksbut since the constructor is inline it might not have been
20:17gfredericks,(time (#(.foo %) (B.)))
20:17clojurebot"Elapsed time: 0.225027 msecs"\n"I am a B"
20:17gfrederickswhatever
20:17hyPiRion,(.bindRoot #'*warn-on-reflection* true)
20:17clojurebotnil
20:18gfrederickshyPiRion: aw snap
20:18gfredericks,#(.foo %)
20:18clojurebot#<CompilerException java.lang.SecurityException: denied, compiling:(NO_SOURCE_PATH:0:0)>
20:18gfredericks,(+ 1 2)
20:18clojurebot3
20:18stcred0so the key is to define the constructor inline?
20:18gfredericksstcred0: no ignore that part
20:18gfredericksthat was just about timing on clojurebot
20:18gfredericksstcred0: if you use the interface methods and type hint with the interface, it should either work right or blow up
20:19gfredericksso unlikely you're subtly messing up
20:19stcred0okay, so I'll just not worry about it for now, since I an doing a defprotocol and defrecord-ing the two types.
20:20stcred0it's only when I do more hinting than that that I have compile problems.
20:20gfrederickssure
20:20gfredericksyeah wait till you have definite perf problems to worry past that :)
20:20stcred0I'm trying to fit 1000's of simultaneous users into one instance of my MMO.
20:27bbloomBronsa: so have you do a line count on your analyzer/emitters and the java impls?
20:29Bronsabbloom: t.a + t.a.j + t.e.j is ~5.2k locs
20:30BronsaCompiler.java is 8.5k + Reflector.java 500
20:31bbloomBronsa: and those are more or less equiv functionality?
20:31Bronsabbloom: tools.* is modular & extensible, the java impl not at all
20:32bbloomBronsa: sure, but that's a given :-P
20:32bbloomcool, thanks for the metrics
20:32bbloomi was curious, but wasn't sure which bits to count precisely
20:33Bronsabbloom: also ~300locs in t.a/t.a.j are not actually needed but are passes provided for the users
20:34bbloomBronsa: what's that mean exactly?
20:34Bronsabbloom: e.g. the datomic support or the emit-form pass to convert an ast back to clojure source
20:34bbloomah ok cool
20:35Bronsaso yeah, I think it's fair to say that it's 5k vs 8.5k taking into account that Compiler.java has a bunch of commented out classes
20:36chareso if you try to make a 1milion threads in clojure is that going to end up badly, is the jvm unable to handle that kind of scale?
20:37bbloomchare: your operating system is going to be the bottleneck, not the jvm
20:37charenot if the threads are not mapped 1 to 1 to os threads
20:38bbloomwe don't call those "threads" anymore. you can probably make 1 million green threads with core.async without much difficulty
20:38chareso clojure has green threads? are those from java or did clojure implement somehow green threads on its own
20:39bbloomchare: start here: http://clojure.com/blog/2013/06/28/clojure-core-async-channels.html
20:40seangrovechare: Also, erlang is nice
20:43chareso core.async is meant to do stuff similar to erlang?
20:44nopromptif i'm implementing IFn is there any benefit to implementing it for all 20 arg positions?
20:44dnolen_chare: more similar to channels in Go
20:44dnolen_noprompt: not really, at some point I would like to spend some time to figure out how to make implementing IFn sensible
20:45nopromptdnolen_: how do i deal w/ & more in that case?
20:47dnolen_noprompt: if you want to correctly handle variadic I would just write a macro over IFn
20:47chareso if you're trying to get something like erlang style stuff in clojure and you use akka does that mean the threads are heavyweight since i'm assuming that akka is meant for java
20:47nopromptdnolen_: that works out then because i've already written the code generation for the specs.
20:48nopromptdnolen_: working on a better selector api for garden. :)
21:08chareso which clojure books cover core.async?
21:09nopromptchare: none that i know of.
21:10nopromptchare: i just came out last year.
21:10chareno no no
21:10noprompt*it
21:10chareso theres no good tutorial for newbies?
21:10nopromptchare: sure. there plenty of stuff out there.
21:11charewhats the best?
21:12nopromptchare: well, there are a handful of videos mentioned in the README. a quick google search might show some blogs.
21:12nopromptchare: afa the "best" is concerned there really isn't one that comes to mind. just watch the videos, hack, and ask questions.
21:13charecrap
21:13noprompt?
21:14charenoprompt how about you write a book sell it for $9 and i'll buy it
21:14nopromptlol
21:14chareso write a clojure book on async
21:14charego go go
21:15nopromptchare: yo, just research. *learn*
21:17nopromptchare: dnolen_ has some good cljs core.async examples that helped me when i first started. the core.async repo is full of examples and the videos will help you a lot too.
21:18nopromptchare: swannodette.github.io
21:18nopromptchare: https://github.com/clojure/core.async/
21:18charehow are green threads even implemented, and why doesn't java have them (or does java already have it?)
21:18noprompt:
21:18noprompt:|
21:19charewhat?
21:19clojurebothttp://paste.lisp.org/display/74305
21:19seangrove~guards
21:19clojurebotSEIZE HIM!
21:19nopromptseangrove: hey!
21:19noprompt:)
21:19seangrovenoprompt: Hey
21:19nopromptseangrove: i think gf3 and i are gonna try and remote pair on secretary this weekend if you're down.
21:20seangroveRunnng out right now, but want to catch up at some point
21:20seangroveOh, that might be good
21:20nopromptseangrove: sure thing. :)
21:20seangroveI'm going to write an om component this weekend for saving state
21:20nopromptseangrove: ah, yeah, definitely hit me up!
21:20seangroveclick-click-click to where ou're developing, hit a key, state is saved to localStorage, refresh and it's restored straight to that point
21:20charenoprompt: you don't know the answer for java?
21:20nopromptchare: not to be rude, but frankly, i don't care how it's implemented.
21:21charewtf how can you not care?
21:21nopromptchare: easy.
21:21nopromptchare: i just don't care.
21:22nopromptchare: i've never run in to a problem where that sort of thing was relevant.
21:22nopromptchare: i only care when something's a problem.
21:22nopromptchare: or when i want to know for myself. then i *research*.
21:22nopromptchare: not trying to be a jerk here.
21:22nopromptchare: why should i care?
21:22charebut what happens when I have to maintain a legacy java codebase so i HAVE to use java only
21:23nopromptchare: ask around in #java?
21:23noprompti'm really, really, not trying to be rude here.
21:29bbloomnoprompt: now that i think about it, i'm pretty sure chare was banned for trolling at some point
21:29charei'm not a troll
21:29seangroveBest to just /ignore
21:30seangroveCould see that one coming a mile away
21:30chareI'm not a troll
21:31S11001001eI hear, in space, it is very cold.
21:34nopromptbbloom: oh, didn't know that. :*(
21:34bbloomnoprompt: i had forgotten for a moment myself
21:35bbloomwhat else floats? very small rocks.
21:35nopromptbbloom: actually, now that i think about it, you're right. i remember chare from a few months ago.
21:35gfrederickshe reminded me because I think the opening line is "I'm not a witch, I'm not a witch."
21:35nopromptbbloom: i'll just block him.
21:35bbloomshh, we've said his name twice now. if you say it 3 more times, he might show back up like beattlejuice
21:35charei'm not troll, my questions above meaningful
21:36nopromptchare: fuck off bro.
21:36nopromptlol
21:36bbloomnoprompt: ignore, don't engage
21:36nopromptbbloom: you going to clojure west?
21:36bbloomnoprompt: yup
21:37nopromptbbloom: cool. i'm excited to meet everyone.
21:37noprompti couldn't make it last year cause i couldn't afford it. :(
21:38goldfeldeveryone's going!
21:38goldfeldit's where it's at
21:39nopromptwhat does "Marker protocol" mean for Fn in cljs?
21:40gfredericksnoprompt: I think that refers to empty protocols that act as flags
21:40nopromptgfredericks: flags for...?
21:40nopromptgfredericks: for satisfies?
21:40Bronsa(satisfies? IFn some-boj)
21:40BronsaFn*
21:41Bronsaobj*
21:41nopromptinteresting. so when would one want to create a marker protocol?
21:41seancorfieldMe and one of my team will be there... unlike last year where I sent the whole of my team :)
21:42nopromptis rhickey going to be there?
21:43gfredericksI don't think he's missed clojure-{conj,west} so far
21:43noprompti didn't see his name on the list of speakers.
21:43gfredericksit's gotta happen eventually though
21:44goldfeldwell, not necessarily
21:44gfrederickshe's probably tired of having to say something interesting every six months :)
21:44gfrederickshe didn't do a keynote at the conj I don't think
21:44bbloomhe's said as much
21:44bbloomalso, if you've ever given a talk, you know they are A LOT of work
21:44nopromptwell he could get up there and just tell software jokes. he's really funny actually.
21:44bbloomha
21:44seangroveWow, a state save/restore for super easy dev in 2 lines of code
21:44seancorfieldthere's a TBD keynote on day two - could still be rich
21:44goldfeldoh, but him being there doesn't have to mean he has to give a talk
21:45seangroveNeeds a visual component to polish it off, but man frontend stuff if fun now
21:45goldfelddo you thin that's an expectation?
21:45goldfeldthink*
21:45nopromptseangrove: what i wanted to make was a vcr w/ branching.
21:46gfredericksgoldfeld: he's also probably tired of being a celebrity, so maybe if we stop gossiping about it he won't get scared off ;-)
21:46nopromptseangrove: record. navigate through changes, etc.
21:47goldfeldis that an om component you're talking about?
21:47nopromptgoldfeld: yah.
21:47nopromptgoldfeld: lots of fun work in that space.
21:47nopromptseangrove: i'd really love to know how you're using secretary.
21:47goldfelddefinitely
21:48goldfeldwhere's the one you're talking about?
21:48seangrovenoprompt: An example is in omchaya
21:48nopromptseangrove: in conjunction w/ om anyway.
21:48seangroveIt's not as in-depth as our prod app, but it's there to show how
21:48seangroveIt's pretty loosely coupled
21:49nopromptseangrove: so one of the patterns we came upon was when you have go blocks inside of your defroute.
21:50nopromptseangrove: every go block returns a next-state which gets merged with a blank-state on dispatch!
21:50seangroveHeh, we do have one of those in our prod app, but it's to handle waiting until some data from the server is loaded before firing
21:50nopromptseangrove: that's precisely the use case.
21:51nopromptseangrove: the only downside is the weird hash change in the url while waiting for the view to render for a slow response.
21:52nopromptit'd be awesome to get the om folks together in a google hangout or something to discuss ideas/patterns etc.
21:52seangroveOh man, finished this right before I had to go, in ~4minutes from start to finish https://www.dropbox.com/s/vdnjnmfb5b120gk/om_save_restore.mov
21:52goldfeldcompany i'm in goes as far as hosting the city's clojure meetup, but it's been hard talking my boss into just going with om instead of react plus probably mori for some business logic, main thing for him is it would take a frontend dev a while to get running with a clojure workflow and mindset
21:52seangrovenoprompt: definitely, looking forward to clojure/west
21:52seangroveOk, really have to go!
21:52nopromptdnolen_: are you open to something like that?
21:53nopromptdnolen_: cyber table coders?
21:53noprompt:)
21:57nopromptgoldfeld: you just have to do it and show your boss/team there's value.
21:58nopromptgoldfeld: the team i'm on was using angular/coffeescript and the first week i was there i suggested clojurescript + om. so far it's been a success an folks are happy w/ it.
21:59nopromptgoldfeld: there's a learning curve, and new problems along the way, but so far the team/client have loved it so far.
22:00nopromptgoldfeld: iow you can't ask permission. it's like Programming Clojure book says, "show value"
22:00nopromptgoldfeld: just spike on it. :)
22:01nopromptok i'm yammering too much. sorry. :)
22:04nopromptRaynes, my old friend!
22:04noprompt:)
22:04goldfeldnoprompt: no that's actually great advice and to be fair i'm allowed leeway on that front, he's actually done a thing or two in clojurescript back when he was the frontend team so i can do libraries/components in it and i'm looking forward to it, but the project hasn't started yet and i'm still stuck on an ex-backbone codebase on another project
22:05goldfeldright now i'm the frontend team, so i could even say "hey all the team is loving it!"
22:06nopromptgoldfeld: bring it in at "gunpoint". :)
22:06nopromptgoldfeld: hell, i brought garden in because "why wouldn't you want your entire codebase in one language?" :P
22:07goldfeldmy coworker who's an html/css/standards specialist would be kinda sad
22:07nopromptwhy?
22:07clojurebotwhy is Why
22:08goldfeldi guess he like his sass
22:08goldfeldlikes*
22:08goldfeldwhich i don't
22:08nopromptcss is weird. at least garden gives you the power to abstract the weirdness away into something that's uniform and you have control over.
22:09nopromptthe next version of garden, which i'm working on ATM, is going to expose several new protocols too.
22:09goldfeldi know! i'll be using garden on my next web-based side project, but i think the audience for it is precisely a programmer-minded one, which he isn't
22:09goldfeldright now i'm deep in node+cljs
22:10goldfeldi could be wrong though
22:10nopromptcool! just make sure you share libraries!
22:10goldfeldi've been pulling out some, the node cljs landscape is so sparse
22:11goldfeldi've seen the source for lighttable has done a lot of precisely what i've done wrapping nodejs's core modules, but i haven't seen any library wrapper released for that, so i'm pushing mine to clojars soon
22:11nopromptawesom.
22:12goldfeldplus there's this really cool curses lib for node called blessed which i'm evolving a bit under clojure, and maybe i'll take a hint or two from you on styling it
22:12goldfeldi mean, from your code, when i get to it
22:12noprompti think once the secretary team can figure out how to make GET/POST/etc routes work in cljs we can target node js aswell.
22:13noprompttechnically secretary will work w/ node but we'd like to have the verbs in the browser there. we just don't know the "right" way to do it.
22:13goldfeldthe only effort i've seen on node+cljs servers is bodil's dogfort
22:13goldfeldand her redlobster lib for working with promises is really awesome
22:13nopromptoh the curses thing in cljs would be awesome!
22:14goldfeldyeah, easy interactive terminal apps in cljs for everyone!
22:14goldfeldi'm brushing it up
22:14nopromptgah! too much awesome stuff happening here.
22:15goldfeldi'm also got some work done on an org-parser in cljs+node, if that's of interest to anyone
22:15goldfeldstill gotta pull out of my main project too
22:16goldfeldwould love to talk more about the node+cljs story on clojure west
22:17nopromptdefinitely!
22:18alewwhat deployment and configuration management tools do people use for clojure apps here?
22:23goldfeldyou mean something like pallet?
22:23goldfeldit's got connectors to most cloud services
22:24alewI mean exactly like pallet
22:24goldfeldso is pallet a good answer or are you looking for something else?
22:24alewI wanted to use pallet, but it's a little bit early
22:24alewI'm currently trying out ansible, but I was just curious what others found worked well
22:25goldfeldi actually don't have experience on that front but pallet's what i got my eyes on for when i need that
22:25goldfeldbut ansible i guess would be my natural non-clojure option
22:26alewPallet has a pretty fantastic philosophy and I like the direction they are heading
22:26alewbut the new version had quite a few breaking changes so you would have to put in a bit of work to get a lot of basic stuff working from what I experienced
22:53bob2is clojure.xml still the thing to be using for simple xml generation?
22:54devnbob2: there's clojure.data.xml
23:03bob2I was slightly scared off it due to it being 0.0.7 and having had no code commits in 4 months
23:03bob2but maybe it's just done-ish
23:15devnbob2: xml is after all, a pretty old problem
23:15bob2heh
23:21devnyay for promises