#clojure logs

2014-05-31

01:27kenrestivofifosine: actually the indenting in that if-let makes it a bit confusing. it'd be nice if the link-to was on the line below to make it clearer that it's the else branch of the if.
01:38Frozenlock"If none of those are a good fit you can contact our general mailbox below, and should hear back within a few weeks." Oh Automatic, how awesome of you...
01:38Frozenlock*automattic
01:38FrozenlockI think it's the first time I see a company saying they'll come back to me 'in a few weeks'.
01:39FrozenlockThis is the Internet age... Civilizations are born, mature and dies in a few weeks.
01:39Frozenlock*die
02:10tolstoyFinally discovered "box-sizing: border-box". That sure solves a lot of problems.
03:04danielcomptonIs company the auto complete the cool kids are using for emacs?
03:06asdasdasdnnnnn1=Random AU serverSERVER:irc.au.dal.net:6665-6668,7000GROUP:DALnet
03:19zeroem,(merge {:foo "bar"} {:foo "baz")
03:19clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>
03:19zeroem,(merge {:foo "bar"} {:foo "baz"})
03:19clojurebot{:foo "baz"}
03:19zeroem,(conj {:foo "bar"} {:foo "baz"})
03:19clojurebot{:foo "baz"}
03:31l3dxhm. what's a good way to generate 2d positions? I want all [x y] within limits of width and height
03:32AimHereDepends what exactly you mean
03:32AimHereIf you just want all points on a grid within x- and y- ranges, for would be a good choice
03:33l3dxmy goal is to create a map like this {[0 0] "something" [1 0] "something}
03:33AimHere,(for [x (range 3 6) y (range 3 6)] [x y])
03:33clojurebot([3 3] [3 4] [3 5] [4 3] [4 4] ...)
03:34l3dxoh, yes. that looks good
03:34l3dxthanks
03:34AimHereThen you can squirt it into a map with zipmap or reduce or something
04:34fifosine,(for [x (range 3 6) y (range 3 6)] [x y])
04:34clojurebot([3 3] [3 4] [3 5] [4 3] [4 4] ...)
05:49ajking(+ 2 40)
05:49clojurebot*suffusion of yellow*
05:50jjl`has anyone written somewhere about why to use ring-server over ring-jetty-adapter? googling for something and i'm getting the impression people disrecommend the latter
05:56muhukis autodoc out of question for lein2 users? http://pastebin.com/bSMWJiiG
06:59justin_s`jjl`: "use ring-server over ring-jetty-adaptor" is kind of like "get a vehicle instead of an automobile"
07:00justin_s`the point of ring-server is you can pick the backend, ring-jetty-adaptor is one of them
07:02jjl`ah right, gotcha
07:03jjl`and there's obviously less fiddling with java objects too
07:04muhukcodox's markdown references is awesome. Is there any way to add cross-project references? something like http://en.wikipedia.org/wiki/Special:Search?go=Go&amp;search=clojure.core/delay ?
07:05muhuk(I didn't mean to wikipediaze the link)
07:05muhukI suppose the only way to do that is to use a custom reader. (Especially since clojure doesn't use codox for documentation.
08:44caternwhenever I type something in Java in the CIDER repl, it spams me with minibuffer queries for "Method name: "
08:45caternany ideas what the problem is?
09:32muhukcatern: I'm not an emacs user, but why should repl accept java?
09:44caternmuhuk: of course I mean something like (.someMethod something)
09:45muhukcatern: I see. Could it be about aot compilation?
09:46muhukcatern: nah, you're not creating types, it's existing java classes
09:46muhukcatern: since you have an instance, you don't need to import anything as well
09:47muhukcatern: did you check `something` is really an instance of the class you think it is?
09:47muhukcatern:
09:47muhukcatern: (type something)
09:48caternyeah
09:51caternI'm trying to trigger it again, and failing. so maybe it is just a problem with importing or whatever like you said? The first time it happened I was just exploring in the REPL, and maybe I hadn't actually called the relevent things yet
11:18Lajjlafelixflores,
11:18Lajjlawhat is your opinion on the objective-who
11:31justin_smithcatern: this is part of the cider auto-doc stuff I think
11:32justin_smithcatern: they have been talking about similar issues on the cider repo not long ago (I follow their issues because if it goes a few months without something that breaks the world I may just upgrade from nrepl to cider)
11:35caternwell, at least it's a known issue, so i can assume it will be fixed eventually
12:00justin_smithcatern: my issue is that there is massive motivation in that project to redesign the infrastructure and add features, and very little motivation to make one given release that is solid and well behaved
12:01justin_smith(but gtrack is getting on their case about that at least)
12:33caternoh, I thought it was the standard software that everyone uses
12:33caternClojure For The Brave And True led me to believe that, I suppose it has lied to me ;_;
12:40technomancycatern: it's the most common tool, sure, but the maintainer has some very peculiar ideas about stability
12:41technomancyluckily with the name change people who don't want to ride the bleeding edge can stick with nrepl.el
12:42shep-homeHas anyone successfully interacted with the Clojure JIRA installation programmatically?
12:45rlbshould a :configurator setting in project.clj :ring work?
12:45Lajjlatechnomancy, do you know where Chousuke is at?
12:56l3velI'm looking to learn clojure from a Java, Python and JavaScript background. Are there any recommended resources for this?
12:59noncom|2l3vel: http://www.clojurebook.com/
13:00noncom|2considered to be *the* book
13:00noncom|2and surely find a good ide
13:00l3velThank you, looks like exactly what I was looking for.
13:00noncom|2if you're coming from java, try Eclipse + CounterClockWise
13:01noncom|2or there are plugins for Idea and Netbeans too afail
13:01noncom|2*afaik :)
13:01noncom|2and of course, ask here should any irresolvable questions arise
13:01l3velThanks
13:03rlbdoesn't looks like the project :ring :configurator is being called -- what I'm trying to do is get hold of the server instance at startup so I can find the ssl port (for redirects). Perhaps there's a better way?
13:04rlb(this is for a toy server, fwiw)
13:08caternwhat's an idiomatic way to take [1 2 3 4 5 6 7 8] and produce [1 3 5 7] and [2 4 6 8]?
13:08noncom|2does anyone know, in emacs live, i get real-time commands proposal (at M-x), but prelude does not seem to have that. how can i add that?
13:08whaleyi'm just getting started on clojure and I'm noticing that I'm somewhat able to write code well enough (practicing with 4clojure.com) but actually reading it requires tons of mental juggling. Can I assume that goes away with time and is just due to my not being used to prefix notation?
13:09noncom|2whaley: absolutely, just go on
13:10caternoho
13:10caterntake-nth
13:10clojurebotNo entiendo
13:11caternsilly clojurebot
13:42justin_smith,(vals (group-by even? (range 1 9))) ; catern
13:42clojurebot([1 3 5 7] [2 4 6 8])
13:42justin_smithwhaley: yeah, it is a kind of literacy
13:43justin_smithwhaley: eventually it is actually easier to read lisp - fewer special cases can mean more quickly figuring things out
13:43whaleyjustin_smith: it was a rather new sensation... most times when I'm dinking with a new language, I find the opposite is true (reading is easy, writing is hard)
13:43justin_smithyeah, lisps don't try to use the conventions inherited from math history (for better and worse), most other languages do
13:43justin_smith*most of the conventions
13:56tolstoyI was kinda shocked that with Clojure (anyway), hitting the "source" button was often times actually helpful.
13:56dbaschanother way is
13:56dbasch,((juxt filter remove) even? (range 1 9))
13:56clojurebot[(2 4 6 8) (1 3 5 7)]
13:57dbasch,((juxt remove filter) even? (range 1 9))
13:57clojurebot[(1 3 5 7) (2 4 6 8)]
14:06bbloom(inc Raynes)
14:06lazybot⇒ 46
14:06bbloomRaynes: for your fs utils lib, thanks
14:06RaynesWhat did I do?
14:06RaynesOh
14:06RaynesYou're welcome sir
14:30bbloomi am *done* with lein plugins... never again
14:34dbaschbbloom: why?
14:34bbloomb/c i can never debug what they do at all
14:34bbloomit's just a giant mystery to me
14:35bbloomi'd rather 10 lines of clear code than 3 config entries
14:35bbloomgetting cljsbuild to do what i want is a nightmare
14:35bbloomcalling the build function from the cljs.closure namespace worked on the first try
14:36bbloomand trying to work w/ ring was a pain too b/c it would block a terminal, meaning i'd have to connect to that jvm instance from elsewhere
14:36bbloomi'd rather just call a (start) function
14:36bbloompassing {:join? false} to run-jetty made that problem go away
14:37bbloomi don't want anything that adds tasks to lein either
14:37tolstoybbloom: the lein ring plugin puts me off. Seems easier to have a main that starts up a jetty or httpkit adapter.
14:37bbloomi pretty much only ever use `lein repl`
14:37bbloomi don't want lein to do anything else but set the classpath & run main
14:38bbloomtolstoy: yeah, that's what i'm saying
14:38tolstoylein = build project, repl, that's it! :)
14:38dbaschthat’s one of the things I like from python’s philosphy
14:38dbasch“There should be one-- and preferably only one --obvious way to do it.”
14:38tolstoyMy interaction with cljsbuild is to not want what it can't do.
14:39bbloomi don't even want it for build project, since most of my build tasks don't require starting the jvm
14:39bbloomso if lein gets itself involved in the build project, it jsut slows down every command
14:39tolstoyMaybe we need a new system, lean-again.
14:40kenrestivodbasch: that was, as i recall, a rebellion against the perl way, where there was deliberately a multitude of ways to do it
14:42dbaschkenrestivo: yes, I remember. perl even had an acronym for that
14:43dbaschcljs on the other hand is not the most welcoming environment at this point
14:43kenrestivocljs is built on javascript. nuff said.
14:43dbaschyou need to be involved with the java world as well as the js world
14:43kenrestivoright, that too
14:43bbloomdbasch: i've made some non-trivial contributions to the cljs compiler
14:43bbloomi have no idea how people manage to use cljs for day to day work
14:43bbloomblows my mind
14:44bbloommaybe it's less terrible from emacs
14:44dbaschbbloom: it’s significantly better than it was when I first encountered
14:44bbloombut the browser repl situtation is unworkable from my perspective
14:44kenrestivonaw, if you're used to javascript, cljs is heaven
14:44kenrestivoi use weasel and love it
14:44tolstoybbloom: I found a cljsbuild config that works, then just use "auto". Works fine.
14:44cbp```i've heard good things about weasel
14:44bbloomtolstoy: i don't want auto
14:44bbloomi *hate* auto
14:44dbaschbbloom: I remember a bug that made auto build crash with an exception when your program didn’t compile
14:44kenrestivoi could not get austin or the built in brepl to work without nightmares. weasel just does what i want, along with nrepl.el.
14:44bbloomsometimes, i change stuff.. but i don't want to compile it instantly
14:45bbloomsometimes, i write 3 things down and want to evaluate ONE of them
14:45bbloomsometimes i want to evaluate a particular file
14:45bbloomsometimes i want to rebuild the file
14:45bbloomor the project
14:45bbloombut never always rebuild the project
14:45bbloomunless you're going to also auto-reload the page for me
14:45bbloom... destroying my repl env
14:45kenrestivothe workflow in javascript is refresh the page, right?
14:45bbloomyeah, and if i wanted that workflow, i'd use coffeescript
14:45bbloomi want a better workflow, i want a lisp workflow
14:46kenrestivoi got pretty close to that with weasel, but when using om i found myself reloading pages
14:46bbloomthis may be why i keep shouting "the browser repl situtation is broken"
14:47bbloomand lots of folks are like "works for me"
14:47kenrestivodoesn't lighttable address that? been a while since i looked at it
14:47tolstoyWith om, it's difficult to trigger a re-render when your component local state is kinda hidden.
14:47dbaschbbloom: if you do a kickstarter to fix it I’ll pitch in
14:47bbloomif you're using cljsbuild auto, you're doing it wrong, imo
14:48dbaschbbloom: cljsbuild auto works well when you’re trying to fix relatively minor things and retry often
14:48technomancyyeah, I don't get the auto stuff either
14:48technomancyseems like it's just for people who haven't bothered to set up a more fine-grained setup yet
14:49tolstoyauto is just a kind of Control-C, up-arrow, return thing.
14:50tolstoyA cljs repl is fine, but when you refresh the page, all your changes are gone because they've not yet been compiled into JS.
14:50bbloombut the compilation unit is your project, i want the compilation unit to be an expression
14:50bbloomtolstoy: why are you refreshing a page?
14:51bbloomeven when i worked on coffee/sass/node stuff, i hated that workflow, but js doesn't give you much choice. at least for css i'd swap out the stylesheet w/o reloading the page
14:51tolstoyWhen working with OM and, say, forms, and you re-compile a component, it won't change until the "state" is tickled.
14:51bbloomit's a beautiful thing when you have a bunch of dialogs open and can tweak the styles without losing your scroll position or UI state
14:51tolstoyBut the state is enclosed.
14:52bbloomtolstoy: i intend to solve that problem if i ever get a working environment
14:53dbaschtolstoy: you could have a “debug” component just to change state at will from the browser
14:53tolstoyHeh. I tried adding a channel somewhere so that I could just put something in it to trigger changes, but it seemed needlessly complicated compared to refresh, click, click.
14:54tolstoydbasch: Yep. There are solutions. One of which is "refresh the page". That hasn't been painful enough yet.
14:57bbloomok w/ the fully manual approach + weasel, i'm getting something that's not-terrible-enough for a while
14:57bbloomargh.
14:58amalloynot terrible enough, huh? i bet we can make it more terrible for you
14:58amalloyactually it sound like you may have beaten us to it
14:59bbloomi know you know what i meant, but for the sake of clarity:
14:59bbloomi have something that will cause my hair to fall out on its own, albeit at an accelerated pace, rather than me pulling it out forcibly later today
15:01cbpcrystal clear
15:01dbaschI’m not happy when I find myself reverting to js when the cljs workflow gets in the way of what I want to do
15:02dbaschI hate js with the fire of ten thousand suns
15:02dbaschalthough that’s less than I used to
15:23tolstoyOy. Tinyproxy.
15:24duck1123Hey guys, I tried updating lein-cljsbuild and now I’m getting an error where cljs.core.PersistentArrayMap is undefined at one point so the rest of my code isn’t loading right. I found some threads about this, but it looks like that issue was fixed. anyone know what could be up?
16:20mi6x3mhey clojure, are :.test :#test special keywords in some way?
16:32cshellmi6x3m: i dont thnk so
17:01cbpno
18:47PinkPrincessHow would I go about typing (using core.typed) the use of .readLine on a java.net.Socket?
18:47PinkPrincessIt seems I can't just (ann .readLine [...]).
18:48hiredmanPinkPrincess: if you type hint the call site it will figure it out
18:48PinkPrincessAh. :)
18:48PinkPrincessI'll try that.
18:48hiredmanthere is no readline method on Socket, fyi
18:48PinkPrincessWell, that might be the first of my issues, then.
18:48hiredmanso if you try and type hint it, it will just error out
18:49PinkPrincessYeah, it's called on (clojure.java.io/reader ...)
18:49PinkPrincessSo that's, what, a BufferedReader?
18:49hiredmanmost likely
18:53PinkPrincessSo is ann-form inside my function the way to go for annotating the use of .readLine?
18:55hiredmanno, if everything is type hinted correctly so no reflection is being used, core.typed will figure it out
18:56hiredmanPinkPrincess: what makes you think it isn't working?
18:56PinkPrincess"Type Error (clojirc/core.clj:37:3) Unresolved host interop: readLine
18:56PinkPrincessAdd type hints to resolve the host call."
18:56PinkPrincessI suppose that's exactly what you're also telling me to do.
18:56hiredmanthe return type core.typed uses for .readLine is likely (U nil String) so you'll need to assert that it is a string for core.typed to accept it as a String
18:57hiredmanPinkPrincess: ah yes, exactly
18:58hiredmanhttps://github.com/clojure/clojure/blob/master/src/clj/clojure/java/io.clj#L86 reader is type hinted just for Reader not BufferedReader
18:58PinkPrincessAh.
19:01PinkPrincessIf I don't explicitly annotate it, I seem to get "Type Error Unannotated var clojure.java.io/reader".
19:28PinkPrincesshiredman, what's the easiest way to add, say, (HMap :mandatory {:a SomeType}) as the type of the argument to a function?
19:29PinkPrincessI have a lot of cases where I'd like to add such argument typing to my defn's.
19:30PinkPrincessMy question is specifically about how I can accomplish it, being completely new to core.typed.
19:32rhg135PinkPrincess, i've been using schema for this as c.t is compile time checking and is useless for inputs from runtime
19:33rhg135but for non-user input it's very useful
19:36PinkPrincessI bet my issue is really simple. I just don't know how to add the type info I want to add: https://www.refheap.com/86149
19:36rhg135i assume this is user input because maps usually are
19:37PinkPrincessI have enough knowledge about the "network" map to really narrow down the type of (:listeners network).
19:37PinkPrincessBut I have no idea how to tell core.typed this.
19:37rhg135ah ic
19:37rhg135sorry but i don't know exactly
19:38PinkPrincessBasically I picked up core.typed minutes ago because it sounded cool, and now I'm trying to type an existing project.
19:39PinkPrincessThe 'Arguments' part is looking rather daunting.
19:39rhg135it's a goal of mine to use c.t and schema on a project to eliminate typish bugs
19:40PinkPrincessIt seems like it'll be excellent at just that.
19:40PinkPrincessHave you found some good literature on the matter?
19:40rhg135c.t for xompile-time and schema for runtime
19:41rhg135now about dem logic bugs...
19:41rhg135about which matter PinkPrincess
19:41PinkPrincessI find the c.t wiki fine for looking up specific types, etc., but not really as a general introduction, guiding me through a specific, toy-size project.
19:41PinkPrincessWhich is really what I want.
19:42rhg135hmm
19:43rhg135i doubt i'll write it lol
19:43rhg135i haven't used c.t
19:46seancorfieldPinkPrincess: there's a #typed-clojure channel that might be more helpful...
19:49PinkPrincessThat would probably be really helpful, yeah.
19:51seancorfieldIt's quieter than this channel and it's where most active core.typed users hang out
19:56PinkPrincessI'll give it a try.
20:10tolstoyWow. Dealing with a compojure app under "context" and "non-context" scenarios: not so easy.
20:21pdkyou just gotta...
20:21pdkkeep your compojure
20:25rhg135pdk, so much pun
20:54Frozenlo`Ugh.. so before getting violently disconnected, I was asking this:
20:54Frozenlo`How can I capture the ns where a function was defined? Say (defn foo [] ...) ----> (foo) --> "Foo was defined in namespace my-lib.core"
20:54Frozenlo`I naively used *ns*, but of course it only tells you the current namespace :-/
20:56akhudekFrozenlo`: what about the namespace function?
20:57Frozenlo`How would you get the namespace? By using a local keyword?
20:57Frozenlo`,(namespace ::a)
20:57clojurebot"sandbox"
20:58dbasch,#’namespace
20:58clojurebot#<ArrayIndexOutOfBoundsException java.lang.ArrayIndexOutOfBoundsException: 8217>
20:58dbasch&#’namespace
20:58lazybotjava.lang.ArrayIndexOutOfBoundsException: 8217
20:58dbasch,#'reduce
20:58clojurebot#'clojure.core/reduce
20:59dbaschFrozenlo`: just look at the fully qualified variable name
21:00AWizzArdjust resolve it
21:01AWizzArd,(resolve '+)
21:01clojurebot#'clojure.core/+
21:02Frozenlo`But how would you translate that into a function? (defn foo [] (str "was defined in: "(resolve ?)))
21:03AWizzArd,(ns-name (:ns (meta (resolve '+))))
21:03clojurebotclojure.core
21:03AWizzArd,(meta (resolve '+))
21:03clojurebot{:added "1.2", :ns #<Namespace clojure.core>, :name +, :file "clojure/core.clj", :inline-arities #<core$_GT_1_QMARK_ clojure.core$_GT_1_QMARK_@45a62e>, ...}
21:03AWizzArd,(:ns (meta (resolve '+)))
21:03clojurebot#<Namespace clojure.core>
21:03Frozenlo`(:ns (meta #()))
21:03Frozenlo`,(:ns (meta #()))
21:03clojurebotnil
21:04dbasch,(defn foo [] (resolve foo))
21:04clojurebot#'sandbox/foo
21:05AWizzArdFrozenlo`: you want to find the namespace of an anonymous FN?
21:06AWizzArdYou can resolve functions that were defn’ed somewhere.
21:06AWizzArdThere it actually makes sense.
21:10FrozenlockThere, I think this represents well want I'm trying to do: https://www.refheap.com/86153
21:10AWizzArdProbably `add-ns` was supposed to have a parameter vector.
21:11Frozenlockpfff, no..... :-p
21:11AWizzArdhmmmmmmm ^^
21:12Frozenlockhttps://www.refheap.com/86154
21:12AWizzArdFrozenlock: so, wherever you call (add-this-ns) you want its current NS to be stored?
21:12AWizzArdFrozenlock: well, in that case you will need a macro.
21:13AWizzArdOr you do it with a function which would be a leaky abstraction, cause you will manually have to pass the *ns*
21:13AWizzArd,(ns-name *ns*)
21:13clojurebotsandbox
21:14Frozenlock*ns* doesn't work, because if I call `foo` from say 'yet-another-namespace', it's 'y-a-n' that will be added, not 'my-other-namespace'
21:15dbaschFrozenlock: but you are defining add-ns in my-ns, so you might as well just create a function that prints my-ns
21:15dbaschI don’t understand
21:16dbaschand you’re importing my-ns so you can call add-ns which will tell you that it comes from my-ns
21:16Frozenlockdbasch: https://github.com/Frozenlock/doevery#pool-notes
21:16FrozenlockI thought everything was working, until *ns* blew in my face.
21:17AWizzArdFrozenlock: so you want to have several namespaces in which you define functions. Some of those functions will include a (add-ns) expression. Right so far?
21:17AWizzArdWhenever one of those functions gets called you want to record/track the namespace it was defined in?
21:17dbaschwhy are you using namespaces as your storage of running things?
21:19AWizzArdFrozenlock: just expand the ns during macroexpansion time then.
21:19Frozenlockdbasch: Why wouldn't I?
21:19AWizzArdSo (defmacro add-current-ns [] `(add-ns ~(ns-name *ns*)))
21:19dbaschFrozenlock: because you’re creating unnecessary complication for yourself
21:20AWizzArdwith the tilde, so it will record not yet-another-namespace but instead the one `foo` was defined in.
21:20Frozenlockdbasch: How you would store the pools, if not by namespace?
21:20FrozenlockAWizzArd: I'll give it a try
21:20dbaschFrozenlock: any data structure
21:20FrozenlockThe data structure I'm using is a map
21:20FrozenlockThe namespace is the key
21:21dbaschwhy does the namespace need to be the key?
21:21AWizzArdBtw, you may decide to just do ~*ns* without the ns-name, or you can wrap that into a (name …) call to have it as string.
21:21FrozenlockBecause I need a key. If I don't use the namespace, I'll have to provide a key manually.
21:22rhg135vectors are associative
21:22dbaschFrozenlock: no, you can generate one automatically
21:22rhg135or use gensyms as keys
21:22Frozenlockdbasch: how?
21:22dbaschwhat rhg135 said
21:22AWizzArd,(gensym)
21:22clojurebotG__51
21:23dbaschthat’s what gensym is for
21:23FrozenlockNo, yes, I know
21:23Frozenlock:-p
21:23rhg135,(keyword (gensym))
21:23clojurebot:G__76
21:23rhg135if you like kws
21:23FrozenlockI know what's gensym. If I use gensym, I won't be able to group multiple things in the same pool
21:23dbasch,(gensym “pool”)
21:23AWizzArdrhg135: why should anyone *not* like them? ;)
21:23clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: “pool” in this context, compiling:(NO_SOURCE_PATH:0:0)>
21:23AWizzArddbasch: Neo keyboard layout?
21:24rhg135AWizzArd, idk masochism?
21:24FrozenlockThe -whole point- was to have an easy way to store together things that are most probably related, thus the namespace.
21:24AWizzArdFrozenlock: then use the macro from above or a similar one and add a `ns` parameter to your `add-ns` function.
21:25FrozenlockAWizzArd: yes, I'm trying it
21:25rhg135,(get [1] 0)
21:25rhg135dat lag
21:25clojurebot1
21:25AWizzArdrhg135: that’s actually much slower than using „nth” (:
21:26rhg135AWizzArd, ik just showing it
21:26AWizzArd,([1] 0)
21:26clojurebot1
21:26rhg135nicer
21:26rhg135but NPE prone if not literal
21:26AWizzArdActually I find the version with get or nth nicer.
21:27AWizzArdAlso, if it is not a critical section in code I would always use (contains? my-set element) instead of (my-set element).
21:27rhg135yes!
21:27rhg135down with NPEs
21:28AWizzArdI find it also is a nice documentation of the code.
21:28rhg135unless the set is named xxx?
21:29rhg135it's bad on external input though
21:30AWizzArdrhg135: what did Morpheus say? “Welcome to the real world.”
21:31rhg135mhm
21:31rhg135the abundance of NPEs frighten me
21:31AWizzArdrhg135: core.typed is your friend.
21:32rhg135c.t and core.async aren't very nice together
21:32rhg135and i like async more
21:32AWizzArdBtw, is that in principle, or is this just the current situation and will likely change over the next monthyears?
21:33rhg135prob just temporary
21:33FrozenlockAWizzArd: Macro worked, thanks
21:33AWizzArdrhg135: and what do you use async for?
21:33rhg135AWizzArd, asynchronous http requests
21:34rhg135and async io
21:34AWizzArdrhg135: can’t clj-http do async requests?
21:35rhg135i use http-kit AWizzArd and the problem is managing them without 'callback hell'
21:36duck1123So, today I tried my hand at getting webjars to serve again. I'm using compojure's resource handler. I'm seeing all the data being sent in like 77ms, but then the connection hangs for a minute. Anyone know what might be going on here?
21:40tolstoyduck1123: A total guess on my part (hobbiest): add an explicit "Connection: close" header to the response?
21:41tolstoyduck1123: Or the request (with curl).
21:41duck1123when I curl the url, it responds quickly and exits, but says that the connection is left open
21:42duck1123any idea how I can add a header to the resource handler?
21:42tolstoyA middleware of some sort.
21:43tolstoyIs it just the jars themselves?
21:44tolstoy(wrap-test-close [handler] (fn [request] (if (.endsWith (:uri "request") ".jar") ..... )
21:44tolstoy(assoc (handler request) update-in [:headers] "Connection" "close")
21:44duck1123it serves static resources out of META-INF/resources/webjars/ not the jars themselves
21:44tolstoysomething like that?
21:45duck1123I have this as a route: (route/resources "/webjars/" {:root "META-INF/resources/webjars/"})
21:45tolstoyIf using curl doesn't cause the problem, it doesn't seem like it's a compojure issue.
21:46tolstoyCould you pprint the request and see what's different between the fast curl version and the other version?
21:47tolstoyI just remember having odd issues depending on whether or not the app was proxied, etc, but that's about all I remember.
21:47duck1123sure, let me try that
21:47duck1123well, I'm also running this via aleph behind nginx
21:49tolstoyI remember something like having to add an extra header to my curl command (when using the proxy) to get it to drop the connection sooner.
21:49tolstoy-H "Connection: close" was probably it. ;)
21:55tolstoyI have a name "notes.local" in /etc/hosts (osx), and curl takes a LONG time to connect to nginx. Strange!
22:07duck1123The only real difference I see is that chrome is sending a bunch of cache headers, but I wouldn't think that would affect the END of the request
22:08duck1123I can check in the network tab, all the data gets sent, but the request doesn't end until after 1.1 minutes
22:09tolstoySame with other browsers? Hm.
22:09duck1123even after adding in middleware to add a connection close header to those requests.
22:09duck1123http://renfer.name/webjars/jquery/2.1.1/jquery.min.js
22:09tolstoyYeah, that was just a wild guess.
22:13tolstoyIf hitting the java process itself with Chrome is fine, then it's nginx, no?
22:14duck1123no, if i hit java directly, same issue. (just tried)
22:15tolstoySwap out to jetty adapter? (Scraping the bottom now. ;))
22:16duck1123yeah, I might try that when I try to produce a minimal test case. There's no way I'd be able to swap out adapters right now.
22:17duck1123I think this whole webjars thing might get put back on the backburner for a couple months again.
22:20tolstoyYou might try back here when more knowledgeable people show up.
22:29duck1123ok, including the resource call into the example compojure app works like a charm. Time to continue hunting
22:35dbaschduck1123: what does your response look like?
22:36duck1123https://gist.github.com/duck1123/bcaa6bb15d88275c1ca1
22:37dbaschduck1123: and does it look the same on the browser side?
22:40duck1123it looks like after I log that response (which is in the middleware I just added around this resource call) it gets changed back to keep-alive and gets gzipped
22:42dbaschduck1123: are you using nginx? you can disable keep-alive
22:42dbaschwhat are you using for proxying?
22:42duck1123I am. I can give that a try
22:43duck1123nginx, but it happens even without
22:44dbaschso you may have a wrapper that’s altering your response
22:44dbaschwhat do your routes look like?
22:45duck1123https://github.com/duck1123/jiksnu/blob/master/src/jiksnu/modules/web/routes.clj
22:46duck1123currently, very minimal
22:49dbaschduck1123: I suspect it’s aleph
22:50duck1123yeah, that's currently my suspicion as well. my compojure test worked fine
22:55dbaschbtw, what’s the timeout on keep-alive?
22:56duck1123How would I check that? I can already telly you that it's probably 1 min. (something is set to 1 min)
22:57dbaschdoesn’t the header in the browser say?
22:59duck1123not that I'm seeing
22:59duck1123I see a 65 in nginx
23:06dbaschkeepalive_timeout?
23:07dbaschso if aleph is removing your close, the connection should remain open for that many seconds
23:22caternis there a way not to have symbols go to their fully-qualified versions when using `?
23:23caterni just want to be able to replace some vars with their values..
23:23akhudek`’blah
23:23akhudekor rather ~’blah
23:24caternwhat quote is that?
23:24caterndoesn't look like '..
23:25duck1123back tick. (shares with ~)
23:25amalloycatern: i mean, you can unquote to leave the backquote context, then use a regular quote. but your followup is confusing: if you're actually replacing a local with its value, it doesn't get qualified
23:26caternduck1123: no, the second one
23:26duck1123oh wow. i didn't see that. odd
23:26caternamalloy: yeah. I want some unqualified symbols alongside my replaced symbols
23:27caternand, the unquote then regular quote doesn't work. I have something like '(foo bar), and I want to replace bar but not foo
23:28caternif I do `~'(foo bar) I don't know a way to replace bar
23:28akhudek‘test
23:28akhudekwat
23:28akhudekguess my irc client is playing with quotes
23:29duck1123using Microsoft Word for irc?
23:29akhudekcolloquy
23:30caternhow "helpful" of it to use smart quotes...
23:30catern:)
23:31duck1123aww, you missed the chance for the ironic smart quotes
23:31akhudek‘I’ can do it