#clojure log - May 31 2014

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

1:27 kenrestivo: fifosine: 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.

1:38 Frozenlock: "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...

1:38 *automattic

1:38 I think it's the first time I see a company saying they'll come back to me 'in a few weeks'.

1:39 This is the Internet age... Civilizations are born, mature and dies in a few weeks.

1:39 *die

2:10 tolstoy: Finally discovered "box-sizing: border-box". That sure solves a lot of problems.

3:04 danielcompton: Is company the auto complete the cool kids are using for emacs?

3:06 asdasdasdnnnn: n1=Random AU serverSERVER:irc.au.dal.net:6665-6668,7000GROUP:DALnet

3:19 zeroem: ,(merge {:foo "bar"} {:foo "baz")

3:19 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>

3:19 zeroem: ,(merge {:foo "bar"} {:foo "baz"})

3:19 clojurebot: {:foo "baz"}

3:19 zeroem: ,(conj {:foo "bar"} {:foo "baz"})

3:19 clojurebot: {:foo "baz"}

3:31 l3dx: hm. what's a good way to generate 2d positions? I want all [x y] within limits of width and height

3:32 AimHere: Depends what exactly you mean

3:32 If you just want all points on a grid within x- and y- ranges, for would be a good choice

3:33 l3dx: my goal is to create a map like this {[0 0] "something" [1 0] "something}

3:33 AimHere: ,(for [x (range 3 6) y (range 3 6)] [x y])

3:33 clojurebot: ([3 3] [3 4] [3 5] [4 3] [4 4] ...)

3:34 l3dx: oh, yes. that looks good

3:34 thanks

3:34 AimHere: Then you can squirt it into a map with zipmap or reduce or something

4:34 fifosine: ,(for [x (range 3 6) y (range 3 6)] [x y])

4:34 clojurebot: ([3 3] [3 4] [3 5] [4 3] [4 4] ...)

5:49 ajking: (+ 2 40)

5:49 clojurebot: *suffusion of yellow*

5:50 jjl`: 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

5:56 muhuk: is autodoc out of question for lein2 users? http://pastebin.com/bSMWJiiG

6:59 justin_s`: jjl`: "use ring-server over ring-jetty-adaptor" is kind of like "get a vehicle instead of an automobile"

7:00 the point of ring-server is you can pick the backend, ring-jetty-adaptor is one of them

7:02 jjl`: ah right, gotcha

7:03 and there's obviously less fiddling with java objects too

7:04 muhuk: codox'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&search=clojure.core/delay ?

7:05 (I didn't mean to wikipediaze the link)

7:05 I suppose the only way to do that is to use a custom reader. (Especially since clojure doesn't use codox for documentation.

8:44 catern: whenever I type something in Java in the CIDER repl, it spams me with minibuffer queries for "Method name: "

8:45 any ideas what the problem is?

9:32 muhuk: catern: I'm not an emacs user, but why should repl accept java?

9:44 catern: muhuk: of course I mean something like (.someMethod something)

9:45 muhuk: catern: I see. Could it be about aot compilation?

9:46 catern: nah, you're not creating types, it's existing java classes

9:46 catern: since you have an instance, you don't need to import anything as well

9:47 catern: did you check `something` is really an instance of the class you think it is?

9:47 catern:

9:47 catern: (type something)

9:48 catern: yeah

9:51 I'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:18 Lajjla: felixflores,

11:18 what is your opinion on the objective-who

11:31 justin_smith: catern: this is part of the cider auto-doc stuff I think

11:32 catern: 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:35 catern: well, at least it's a known issue, so i can assume it will be fixed eventually

12:00 justin_smith: catern: 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:01 (but gtrack is getting on their case about that at least)

12:33 catern: oh, I thought it was the standard software that everyone uses

12:33 Clojure For The Brave And True led me to believe that, I suppose it has lied to me ;_;

12:40 technomancy: catern: it's the most common tool, sure, but the maintainer has some very peculiar ideas about stability

12:41 luckily with the name change people who don't want to ride the bleeding edge can stick with nrepl.el

12:42 shep-home: Has anyone successfully interacted with the Clojure JIRA installation programmatically?

12:45 rlb: should a :configurator setting in project.clj :ring work?

12:45 Lajjla: technomancy, do you know where Chousuke is at?

12:56 l3vel: I'm looking to learn clojure from a Java, Python and JavaScript background. Are there any recommended resources for this?

12:59 noncom|2: l3vel: http://www.clojurebook.com/

13:00 considered to be *the* book

13:00 and surely find a good ide

13:00 l3vel: Thank you, looks like exactly what I was looking for.

13:00 noncom|2: if you're coming from java, try Eclipse + CounterClockWise

13:01 or there are plugins for Idea and Netbeans too afail

13:01 *afaik :)

13:01 and of course, ask here should any irresolvable questions arise

13:01 l3vel: Thanks

13:03 rlb: doesn'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:04 (this is for a toy server, fwiw)

13:08 catern: what'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:08 noncom|2: does 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:08 whaley: i'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:09 noncom|2: whaley: absolutely, just go on

13:10 catern: oho

13:10 take-nth

13:10 clojurebot: No entiendo

13:11 catern: silly clojurebot

13:42 justin_smith: ,(vals (group-by even? (range 1 9))) ; catern

13:42 clojurebot: ([1 3 5 7] [2 4 6 8])

13:42 justin_smith: whaley: yeah, it is a kind of literacy

13:43 whaley: eventually it is actually easier to read lisp - fewer special cases can mean more quickly figuring things out

13:43 whaley: justin_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:43 justin_smith: yeah, lisps don't try to use the conventions inherited from math history (for better and worse), most other languages do

13:43 *most of the conventions

13:56 tolstoy: I was kinda shocked that with Clojure (anyway), hitting the "source" button was often times actually helpful.

13:56 dbasch: another way is

13:56 ,((juxt filter remove) even? (range 1 9))

13:56 clojurebot: [(2 4 6 8) (1 3 5 7)]

13:57 dbasch: ,((juxt remove filter) even? (range 1 9))

13:57 clojurebot: [(1 3 5 7) (2 4 6 8)]

14:06 bbloom: (inc Raynes)

14:06 lazybot: ⇒ 46

14:06 bbloom: Raynes: for your fs utils lib, thanks

14:06 Raynes: What did I do?

14:06 Oh

14:06 You're welcome sir

14:30 bbloom: i am *done* with lein plugins... never again

14:34 dbasch: bbloom: why?

14:34 bbloom: b/c i can never debug what they do at all

14:34 it's just a giant mystery to me

14:35 i'd rather 10 lines of clear code than 3 config entries

14:35 getting cljsbuild to do what i want is a nightmare

14:35 calling the build function from the cljs.closure namespace worked on the first try

14:36 and 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:36 i'd rather just call a (start) function

14:36 passing {:join? false} to run-jetty made that problem go away

14:37 i don't want anything that adds tasks to lein either

14:37 tolstoy: bbloom: the lein ring plugin puts me off. Seems easier to have a main that starts up a jetty or httpkit adapter.

14:37 bbloom: i pretty much only ever use `lein repl`

14:37 i don't want lein to do anything else but set the classpath & run main

14:38 tolstoy: yeah, that's what i'm saying

14:38 tolstoy: lein = build project, repl, that's it! :)

14:38 dbasch: that’s one of the things I like from python’s philosphy

14:38 “There should be one-- and preferably only one --obvious way to do it.”

14:38 tolstoy: My interaction with cljsbuild is to not want what it can't do.

14:39 bbloom: i don't even want it for build project, since most of my build tasks don't require starting the jvm

14:39 so if lein gets itself involved in the build project, it jsut slows down every command

14:39 tolstoy: Maybe we need a new system, lean-again.

14:40 kenrestivo: dbasch: that was, as i recall, a rebellion against the perl way, where there was deliberately a multitude of ways to do it

14:42 dbasch: kenrestivo: yes, I remember. perl even had an acronym for that

14:43 cljs on the other hand is not the most welcoming environment at this point

14:43 kenrestivo: cljs is built on javascript. nuff said.

14:43 dbasch: you need to be involved with the java world as well as the js world

14:43 kenrestivo: right, that too

14:43 bbloom: dbasch: i've made some non-trivial contributions to the cljs compiler

14:43 i have no idea how people manage to use cljs for day to day work

14:43 blows my mind

14:44 maybe it's less terrible from emacs

14:44 dbasch: bbloom: it’s significantly better than it was when I first encountered

14:44 bbloom: but the browser repl situtation is unworkable from my perspective

14:44 kenrestivo: naw, if you're used to javascript, cljs is heaven

14:44 i use weasel and love it

14:44 tolstoy: bbloom: I found a cljsbuild config that works, then just use "auto". Works fine.

14:44 cbp```: i've heard good things about weasel

14:44 bbloom: tolstoy: i don't want auto

14:44 i *hate* auto

14:44 dbasch: bbloom: I remember a bug that made auto build crash with an exception when your program didn’t compile

14:44 kenrestivo: i could not get austin or the built in brepl to work without nightmares. weasel just does what i want, along with nrepl.el.

14:44 bbloom: sometimes, i change stuff.. but i don't want to compile it instantly

14:45 sometimes, i write 3 things down and want to evaluate ONE of them

14:45 sometimes i want to evaluate a particular file

14:45 sometimes i want to rebuild the file

14:45 or the project

14:45 but never always rebuild the project

14:45 unless you're going to also auto-reload the page for me

14:45 ... destroying my repl env

14:45 kenrestivo: the workflow in javascript is refresh the page, right?

14:45 bbloom: yeah, and if i wanted that workflow, i'd use coffeescript

14:45 i want a better workflow, i want a lisp workflow

14:46 kenrestivo: i got pretty close to that with weasel, but when using om i found myself reloading pages

14:46 bbloom: this may be why i keep shouting "the browser repl situtation is broken"

14:47 and lots of folks are like "works for me"

14:47 kenrestivo: doesn't lighttable address that? been a while since i looked at it

14:47 tolstoy: With om, it's difficult to trigger a re-render when your component local state is kinda hidden.

14:47 dbasch: bbloom: if you do a kickstarter to fix it I’ll pitch in

14:47 bbloom: if you're using cljsbuild auto, you're doing it wrong, imo

14:48 dbasch: bbloom: cljsbuild auto works well when you’re trying to fix relatively minor things and retry often

14:48 technomancy: yeah, I don't get the auto stuff either

14:48 seems like it's just for people who haven't bothered to set up a more fine-grained setup yet

14:49 tolstoy: auto is just a kind of Control-C, up-arrow, return thing.

14:50 A 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:50 bbloom: but the compilation unit is your project, i want the compilation unit to be an expression

14:50 tolstoy: why are you refreshing a page?

14:51 even 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:51 tolstoy: When working with OM and, say, forms, and you re-compile a component, it won't change until the "state" is tickled.

14:51 bbloom: it'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:51 tolstoy: But the state is enclosed.

14:52 bbloom: tolstoy: i intend to solve that problem if i ever get a working environment

14:53 dbasch: tolstoy: you could have a “debug” component just to change state at will from the browser

14:53 tolstoy: Heh. 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:54 dbasch: Yep. There are solutions. One of which is "refresh the page". That hasn't been painful enough yet.

14:57 bbloom: ok w/ the fully manual approach + weasel, i'm getting something that's not-terrible-enough for a while

14:57 argh.

14:58 amalloy: not terrible enough, huh? i bet we can make it more terrible for you

14:58 actually it sound like you may have beaten us to it

14:59 bbloom: i know you know what i meant, but for the sake of clarity:

14:59 i 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:01 cbp: crystal clear

15:01 dbasch: I’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:02 I hate js with the fire of ten thousand suns

15:02 although that’s less than I used to

15:23 tolstoy: Oy. Tinyproxy.

15:24 duck1123: Hey 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:20 mi6x3m: hey clojure, are :.test :#test special keywords in some way?

16:32 cshell: mi6x3m: i dont thnk so

17:01 cbp: no

18:47 PinkPrincess: How would I go about typing (using core.typed) the use of .readLine on a java.net.Socket?

18:47 It seems I can't just (ann .readLine [...]).

18:48 hiredman: PinkPrincess: if you type hint the call site it will figure it out

18:48 PinkPrincess: Ah. :)

18:48 I'll try that.

18:48 hiredman: there is no readline method on Socket, fyi

18:48 PinkPrincess: Well, that might be the first of my issues, then.

18:48 hiredman: so if you try and type hint it, it will just error out

18:49 PinkPrincess: Yeah, it's called on (clojure.java.io/reader ...)

18:49 So that's, what, a BufferedReader?

18:49 hiredman: most likely

18:53 PinkPrincess: So is ann-form inside my function the way to go for annotating the use of .readLine?

18:55 hiredman: no, if everything is type hinted correctly so no reflection is being used, core.typed will figure it out

18:56 PinkPrincess: what makes you think it isn't working?

18:56 PinkPrincess: "Type Error (clojirc/core.clj:37:3) Unresolved host interop: readLine

18:56 Add type hints to resolve the host call."

18:56 I suppose that's exactly what you're also telling me to do.

18:56 hiredman: the 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:57 PinkPrincess: ah yes, exactly

18:58 https://github.com/clojure/clojure/blob/master/src/clj/clojure/java/io.clj#L86 reader is type hinted just for Reader not BufferedReader

18:58 PinkPrincess: Ah.

19:01 If I don't explicitly annotate it, I seem to get "Type Error Unannotated var clojure.java.io/reader".

19:28 hiredman, what's the easiest way to add, say, (HMap :mandatory {:a SomeType}) as the type of the argument to a function?

19:29 I have a lot of cases where I'd like to add such argument typing to my defn's.

19:30 My question is specifically about how I can accomplish it, being completely new to core.typed.

19:32 rhg135: PinkPrincess, i've been using schema for this as c.t is compile time checking and is useless for inputs from runtime

19:33 but for non-user input it's very useful

19:36 PinkPrincess: I 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:36 rhg135: i assume this is user input because maps usually are

19:37 PinkPrincess: I have enough knowledge about the "network" map to really narrow down the type of (:listeners network).

19:37 But I have no idea how to tell core.typed this.

19:37 rhg135: ah ic

19:37 sorry but i don't know exactly

19:38 PinkPrincess: Basically I picked up core.typed minutes ago because it sounded cool, and now I'm trying to type an existing project.

19:39 The 'Arguments' part is looking rather daunting.

19:39 rhg135: it's a goal of mine to use c.t and schema on a project to eliminate typish bugs

19:40 PinkPrincess: It seems like it'll be excellent at just that.

19:40 Have you found some good literature on the matter?

19:40 rhg135: c.t for xompile-time and schema for runtime

19:41 now about dem logic bugs...

19:41 about which matter PinkPrincess

19:41 PinkPrincess: I 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:41 Which is really what I want.

19:42 rhg135: hmm

19:43 i doubt i'll write it lol

19:43 i haven't used c.t

19:46 seancorfield: PinkPrincess: there's a #typed-clojure channel that might be more helpful...

19:49 PinkPrincess: That would probably be really helpful, yeah.

19:51 seancorfield: It's quieter than this channel and it's where most active core.typed users hang out

19:56 PinkPrincess: I'll give it a try.

20:10 tolstoy: Wow. Dealing with a compojure app under "context" and "non-context" scenarios: not so easy.

20:21 pdk: you just gotta...

20:21 keep your compojure

20:25 rhg135: pdk, so much pun

20:54 Frozenlo`: Ugh.. so before getting violently disconnected, I was asking this:

20:54 How can I capture the ns where a function was defined? Say (defn foo [] ...) ----> (foo) --> "Foo was defined in namespace my-lib.core"

20:54 I naively used *ns*, but of course it only tells you the current namespace :-/

20:56 akhudek: Frozenlo`: what about the namespace function?

20:57 Frozenlo`: How would you get the namespace? By using a local keyword?

20:57 ,(namespace ::a)

20:57 clojurebot: "sandbox"

20:58 dbasch: ,#’namespace

20:58 clojurebot: #<ArrayIndexOutOfBoundsException java.lang.ArrayIndexOutOfBoundsException: 8217>

20:58 dbasch: &#’namespace

20:58 lazybot: java.lang.ArrayIndexOutOfBoundsException: 8217

20:58 dbasch: ,#'reduce

20:58 clojurebot: #'clojure.core/reduce

20:59 dbasch: Frozenlo`: just look at the fully qualified variable name

21:00 AWizzArd: just resolve it

21:01 ,(resolve '+)

21:01 clojurebot: #'clojure.core/+

21:02 Frozenlo`: But how would you translate that into a function? (defn foo [] (str "was defined in: "(resolve ?)))

21:03 AWizzArd: ,(ns-name (:ns (meta (resolve '+))))

21:03 clojurebot: clojure.core

21:03 AWizzArd: ,(meta (resolve '+))

21:03 clojurebot: {: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:03 AWizzArd: ,(:ns (meta (resolve '+)))

21:03 clojurebot: #<Namespace clojure.core>

21:03 Frozenlo`: (:ns (meta #()))

21:03 ,(:ns (meta #()))

21:03 clojurebot: nil

21:04 dbasch: ,(defn foo [] (resolve foo))

21:04 clojurebot: #'sandbox/foo

21:05 AWizzArd: Frozenlo`: you want to find the namespace of an anonymous FN?

21:06 You can resolve functions that were defn’ed somewhere.

21:06 There it actually makes sense.

21:10 Frozenlock: There, I think this represents well want I'm trying to do: https://www.refheap.com/86153

21:10 AWizzArd: Probably `add-ns` was supposed to have a parameter vector.

21:11 Frozenlock: pfff, no..... :-p

21:11 AWizzArd: hmmmmmmm ^^

21:12 Frozenlock: https://www.refheap.com/86154

21:12 AWizzArd: Frozenlock: so, wherever you call (add-this-ns) you want its current NS to be stored?

21:12 Frozenlock: well, in that case you will need a macro.

21:13 Or you do it with a function which would be a leaky abstraction, cause you will manually have to pass the *ns*

21:13 ,(ns-name *ns*)

21:13 clojurebot: sandbox

21:14 Frozenlock: *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:15 dbasch: Frozenlock: but you are defining add-ns in my-ns, so you might as well just create a function that prints my-ns

21:15 I don’t understand

21:16 and you’re importing my-ns so you can call add-ns which will tell you that it comes from my-ns

21:16 Frozenlock: dbasch: https://github.com/Frozenlock/doevery#pool-notes

21:16 I thought everything was working, until *ns* blew in my face.

21:17 AWizzArd: Frozenlock: 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:17 Whenever one of those functions gets called you want to record/track the namespace it was defined in?

21:17 dbasch: why are you using namespaces as your storage of running things?

21:19 AWizzArd: Frozenlock: just expand the ns during macroexpansion time then.

21:19 Frozenlock: dbasch: Why wouldn't I?

21:19 AWizzArd: So (defmacro add-current-ns [] `(add-ns ~(ns-name *ns*)))

21:19 dbasch: Frozenlock: because you’re creating unnecessary complication for yourself

21:20 AWizzArd: with the tilde, so it will record not yet-another-namespace but instead the one `foo` was defined in.

21:20 Frozenlock: dbasch: How you would store the pools, if not by namespace?

21:20 AWizzArd: I'll give it a try

21:20 dbasch: Frozenlock: any data structure

21:20 Frozenlock: The data structure I'm using is a map

21:20 The namespace is the key

21:21 dbasch: why does the namespace need to be the key?

21:21 AWizzArd: Btw, 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:21 Frozenlock: Because I need a key. If I don't use the namespace, I'll have to provide a key manually.

21:22 rhg135: vectors are associative

21:22 dbasch: Frozenlock: no, you can generate one automatically

21:22 rhg135: or use gensyms as keys

21:22 Frozenlock: dbasch: how?

21:22 dbasch: what rhg135 said

21:22 AWizzArd: ,(gensym)

21:22 clojurebot: G__51

21:23 dbasch: that’s what gensym is for

21:23 Frozenlock: No, yes, I know

21:23 :-p

21:23 rhg135: ,(keyword (gensym))

21:23 clojurebot: :G__76

21:23 rhg135: if you like kws

21:23 Frozenlock: I know what's gensym. If I use gensym, I won't be able to group multiple things in the same pool

21:23 dbasch: ,(gensym “pool”)

21:23 AWizzArd: rhg135: why should anyone *not* like them? ;)

21:23 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: “pool” in this context, compiling:(NO_SOURCE_PATH:0:0)>

21:23 AWizzArd: dbasch: Neo keyboard layout?

21:24 rhg135: AWizzArd, idk masochism?

21:24 Frozenlock: The -whole point- was to have an easy way to store together things that are most probably related, thus the namespace.

21:24 AWizzArd: Frozenlock: then use the macro from above or a similar one and add a `ns` parameter to your `add-ns` function.

21:25 Frozenlock: AWizzArd: yes, I'm trying it

21:25 rhg135: ,(get [1] 0)

21:25 dat lag

21:25 clojurebot: 1

21:25 AWizzArd: rhg135: that’s actually much slower than using „nth” (:

21:26 rhg135: AWizzArd, ik just showing it

21:26 AWizzArd: ,([1] 0)

21:26 clojurebot: 1

21:26 rhg135: nicer

21:26 but NPE prone if not literal

21:26 AWizzArd: Actually I find the version with get or nth nicer.

21:27 Also, if it is not a critical section in code I would always use (contains? my-set element) instead of (my-set element).

21:27 rhg135: yes!

21:27 down with NPEs

21:28 AWizzArd: I find it also is a nice documentation of the code.

21:28 rhg135: unless the set is named xxx?

21:29 it's bad on external input though

21:30 AWizzArd: rhg135: what did Morpheus say? “Welcome to the real world.”

21:31 rhg135: mhm

21:31 the abundance of NPEs frighten me

21:31 AWizzArd: rhg135: core.typed is your friend.

21:32 rhg135: c.t and core.async aren't very nice together

21:32 and i like async more

21:32 AWizzArd: Btw, is that in principle, or is this just the current situation and will likely change over the next monthyears?

21:33 rhg135: prob just temporary

21:33 Frozenlock: AWizzArd: Macro worked, thanks

21:33 AWizzArd: rhg135: and what do you use async for?

21:33 rhg135: AWizzArd, asynchronous http requests

21:34 and async io

21:34 AWizzArd: rhg135: can’t clj-http do async requests?

21:35 rhg135: i use http-kit AWizzArd and the problem is managing them without 'callback hell'

21:36 duck1123: So, 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:40 tolstoy: duck1123: A total guess on my part (hobbiest): add an explicit "Connection: close" header to the response?

21:41 duck1123: Or the request (with curl).

21:41 duck1123: when I curl the url, it responds quickly and exits, but says that the connection is left open

21:42 any idea how I can add a header to the resource handler?

21:42 tolstoy: A middleware of some sort.

21:43 Is it just the jars themselves?

21:44 (wrap-test-close [handler] (fn [request] (if (.endsWith (:uri "request") ".jar") ..... )

21:44 (assoc (handler request) update-in [:headers] "Connection" "close")

21:44 duck1123: it serves static resources out of META-INF/resources/webjars/ not the jars themselves

21:44 tolstoy: something like that?

21:45 duck1123: I have this as a route: (route/resources "/webjars/" {:root "META-INF/resources/webjars/"})

21:45 tolstoy: If using curl doesn't cause the problem, it doesn't seem like it's a compojure issue.

21:46 Could you pprint the request and see what's different between the fast curl version and the other version?

21:47 I just remember having odd issues depending on whether or not the app was proxied, etc, but that's about all I remember.

21:47 duck1123: sure, let me try that

21:47 well, I'm also running this via aleph behind nginx

21:49 tolstoy: I 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:49 -H "Connection: close" was probably it. ;)

21:55 I have a name "notes.local" in /etc/hosts (osx), and curl takes a LONG time to connect to nginx. Strange!

22:07 duck1123: The 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:08 I can check in the network tab, all the data gets sent, but the request doesn't end until after 1.1 minutes

22:09 tolstoy: Same with other browsers? Hm.

22:09 duck1123: even after adding in middleware to add a connection close header to those requests.

22:09 http://renfer.name/webjars/jquery/2.1.1/jquery.min.js

22:09 tolstoy: Yeah, that was just a wild guess.

22:13 If hitting the java process itself with Chrome is fine, then it's nginx, no?

22:14 duck1123: no, if i hit java directly, same issue. (just tried)

22:15 tolstoy: Swap out to jetty adapter? (Scraping the bottom now. ;))

22:16 duck1123: yeah, 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:17 I think this whole webjars thing might get put back on the backburner for a couple months again.

22:20 tolstoy: You might try back here when more knowledgeable people show up.

22:29 duck1123: ok, including the resource call into the example compojure app works like a charm. Time to continue hunting

22:35 dbasch: duck1123: what does your response look like?

22:36 duck1123: https://gist.github.com/duck1123/bcaa6bb15d88275c1ca1

22:37 dbasch: duck1123: and does it look the same on the browser side?

22:40 duck1123: it 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:42 dbasch: duck1123: are you using nginx? you can disable keep-alive

22:42 what are you using for proxying?

22:42 duck1123: I am. I can give that a try

22:43 nginx, but it happens even without

22:44 dbasch: so you may have a wrapper that’s altering your response

22:44 what do your routes look like?

22:45 duck1123: https://github.com/duck1123/jiksnu/blob/master/src/jiksnu/modules/web/routes.clj

22:46 currently, very minimal

22:49 dbasch: duck1123: I suspect it’s aleph

22:50 duck1123: yeah, that's currently my suspicion as well. my compojure test worked fine

22:55 dbasch: btw, what’s the timeout on keep-alive?

22:56 duck1123: How would I check that? I can already telly you that it's probably 1 min. (something is set to 1 min)

22:57 dbasch: doesn’t the header in the browser say?

22:59 duck1123: not that I'm seeing

22:59 I see a 65 in nginx

23:06 dbasch: keepalive_timeout?

23:07 so if aleph is removing your close, the connection should remain open for that many seconds

23:22 catern: is there a way not to have symbols go to their fully-qualified versions when using `?

23:23 i just want to be able to replace some vars with their values..

23:23 akhudek: `’blah

23:23 or rather ~’blah

23:24 catern: what quote is that?

23:24 doesn't look like '..

23:25 duck1123: back tick. (shares with ~)

23:25 amalloy: catern: 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:26 catern: duck1123: no, the second one

23:26 duck1123: oh wow. i didn't see that. odd

23:26 catern: amalloy: yeah. I want some unqualified symbols alongside my replaced symbols

23:27 and, the unquote then regular quote doesn't work. I have something like '(foo bar), and I want to replace bar but not foo

23:28 if I do `~'(foo bar) I don't know a way to replace bar

23:28 akhudek: ‘test

23:28 wat

23:28 guess my irc client is playing with quotes

23:29 duck1123: using Microsoft Word for irc?

23:29 akhudek: colloquy

23:30 catern: how "helpful" of it to use smart quotes...

23:30 :)

23:31 duck1123: aww, you missed the chance for the ironic smart quotes

23:31 akhudek: ‘I’ can do it

Logging service provided by n01se.net