#clojure log - Nov 12 2014

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

0:15 virmundi: Hello. I'm getting a puzzeling compile issue. The error is saying that the problem is at line 89 in a file. This is the function around that line.(defn by-condition-skiplist "This will find all documents matching a given condition, using the specified skiplist index." [ctx] (call-simple ctx "/simple/by-condition-skiplist"))

0:16 The declaration for call-simple is (defn call-simple "Helper function to coordinate mapping task." [ctx resource] (map-response-keys (call-arango :put (derive-resource ctx resource) (map-payload-keys ctx))))

0:16 call-simple has a vector list. I don't know what's tripping the compiler up.

0:17 The file in question is https://github.com/deusdat/travesedo/blob/master/src/travesedo/query.clj

0:17 Can anyone help?

0:17 TEttinger: what's the error? http://refheap.com might be handy

0:17 virmundi: Here's the error, Error refreshing environment: java.lang.IllegalArgumentException: Parameter declaration call-simple should be a vector, compiling:(travesedo/query.clj:89:53) Finished at 00:12:49.989 (run time: 0.122s)

0:18 Refheap: https://www.refheap.com/93197

0:19 TEttinger: got it

0:19 virmundi: https://github.com/deusdat/travesedo/blob/master/src/travesedo/query.clj#L94

0:19 you're missing an arg vector earlier

0:19 so everything gets moved around from where it expects it

0:20 virmundi: Thanks. How did you find that?

0:20 Just sight?

0:21 That did correct it. My tests are now failing for the proper reason. Thanks.

0:24 jebberjeb: exit

0:24 ahhhh!

1:10 godd2: So if do something like (with-open [] (first (line-seq (clojure.java.io/reader filename))))) will that only try to read the first line of the file?

1:12 pdk: if line-seq is lazy then yes

1:13 godd2: alright cool. The docs say it "Returns the lines of text from rdr as a lazy sequence of strings."

1:13 nonuby: is there a cljs/clj library (either) to give me moment.js like "3 days ago" "2 hrs ago" "1 minute ago" from (now - ts)?

1:20 dbasch: nonuby: in clj, clj-time which is a wrapper around joda time

1:21 nonuby: i dont believe it has a human friendly output for time periods?

1:22 dbasch: nonuby: joda time does, not sure if clj-time exposes it

1:22 you can always use joda time directly of course

1:22 nonuby: cool, thanks!

2:16 akurilin: Do you guys generally end up with lots of "data access" files for basically interacting with whatever data storage you have for each table you got?

2:17 so basically lots of fns that do some sort of select or some sort of insert on a specific table or selects that perform joins and all that?

2:18 curious if people managed to get away with it

2:18 or with not doing it

2:18 (assuming you don't use korma)

2:36 seancorfield: akurilin: we have several "reporting" and "analytics" namespaces, but mostly our files match domain concepts

2:59 akurilin: seancorfield: so if I'm understanding correctly you probably have several namespaces that are basically just sql wrappers for interacting with the db through either straight sql or whatever's output from honeysql

3:00 and also I imagine you have namespaces that contain pure logic that deals with processing those entities somehow?

3:04 seancorfield: Yes akurilin we have a lot of our code separated out into DB-accessing reporting stuff and logic and persistence of domain entities. Three areas. Although the last two are often blurred.

3:06 akurilin: From just a design standpoint I've always tried to figure out the best way to separate and modularize these things

3:07 seancorfield: so "db-accessing reporting stuff" is mostly reads and "persistence of domain entities" is mostly writes?

3:07 seancorfield: Yes

3:10 akurilin: interesting, never thought of separating that into different nses

3:12 seancorfield: Bedtime here. Laters.

3:13 akurilin: seancorfield: cheers! thanks for the tips!

3:22 kenrestivo: these little clojars slugs in github repos are neat, but the bummer is you can't copy/paste them into a lein project.clj :-P

3:55 mercwithamouth: is it me or are more people starting to use vim-fireplace opposed to emacs for clojure dev?

4:02 elfenlaid: mercwithamouth: it's hard to say, but here's some stat https://cognitect.wufoo.com/reports/state-of-clojure-2014-results/

4:07 mercwithamouth: elfenlaid: checking

4:07 heh..emacs still by a landslide. so be it

4:08 i'm familiar with both editors though emacs feels solid

4:21 has anyone purchased clojure for the brave and true? love the posts on the website. is that the entirety of what's in the book so far or does the book contain more information?

4:33 cfleming: mercwithamouth: Note that comparing those survey results year on year, vim + fireplace is up and Emacs is down a bit on last year, although Emacs is still the most popular by far.

4:34 mercwithamouth: So you're right, there are more people using vim-fireplace, both in absolute numbers and in percentage of the community.

4:36 mercwithamouth: i find that interesting...i'll have to take a look at vim-fireplace....god why do i flip flop between editors =P

4:36 clgv: cfleming: short question, is there an intro writeup on cursive for people that never used IntelliJ? I wanted to try it out the other day but most of it felt alien

4:37 technomancy: the user "connix" just started spamming

4:38 cfleming: clgv: Not really at the moment unfortunately. Have you seen the user guide? https://cursiveclojure.com/userguide - that's about as good as it gets at the moment.

4:38 clgv: It's a little out of date unfortunately, although it should help getting started.

4:38 clgv: I'm planning to make some screencasts at some point, and update the doc, but haven't had time yet.

4:39 clgv: cfleming: the steps to get a repl where kinda confusing compared to what I'd have to do in CCW, just hit "Run as Clojure application"

4:40 cfleming: clgv: Yeah, if you're not used to IntelliJ that can be strange. I'm planning to create a run config by default for lein projects, so then it will be just hit Run.

4:40 clgv: cfleming: at some point I couldnt even select "Run with Leiningen"

4:40 cfleming: clgv: Hmm, how did you create your project? Did you import a lein project?

4:41 clgv: cfleming: yes I did import a lein project.

4:41 cfleming: guess I'll try it out again next year ;)

4:41 cfleming: clgv: Ok, the most common problem there is that sometimes Cursive or IntelliJ (not sure which yet) forgets that bit of the config, so Cursive no longer thinks it's a lein project. The workaround is right click on project.clj and "Add as lein project"

4:42 clgv: Hehe, no problem, we'll be waiting :)

4:42 clgv: I'll be brushing off some of the sharp edges before a 1.0 release.

4:43 SagiCZ1: cfleming: hi, have you thought more about the licencing yet?

4:43 cfleming: SagiCZ1: What aspect of it? How it will work, or how much it will cost?

4:43 clgv: cfleming: CCW currently has some problems with leiningen deps in custom repositories. I hope that gets resolved soon

4:44 SagiCZ1: cfleming: the latter i guess

4:44 cfleming: SagiCZ1: It'll cost something similar to RubyMine or PyCharm - probably $100 for an individual dev and $200 for a company licence.

4:44 SagiCZ1: cfleming: sounds good, thanks

4:45 that will be well worth it

4:45 cfleming: clgv: Yeah, those can be tricky - Cursive has some issues with those as well, although it mostly works ok I think. I need to add better profile support.

4:46 SagiCZ1: Cool, good to hear

4:47 tuft: are automatic completion of symbols not required yet supposed to work in cursive?

4:48 i can't get it to add things to my ns macro's :require for me

4:49 .. but maybe that's not supposed to work yet =)

4:49 cfleming: tuft: Depends on the case. What will work is if you complete something like str/tr and you don't have clojure.string required as str yet. It'll offer to complete it and you'll see (clojure.string :as str) in the namespace in the completion dropdown.

4:49 tuft: hmm let me try

4:49 cfleming: tuft: But that will only work if you have that namespace required with that alias somewhere in your project - Cursive needs one example to index to know you like to refer to that ns by that alias.

4:50 tuft: ah ok, hrm

4:50 cfleming: tuft: So currently the effect is you have to add one by hand, then the rest will work.

4:50 tuft: what about refering symbols i've defined in other namespaces within the same project automatically?

4:50 cfleming: tuft: I'm going to add some matching so Cursive will suggest some likely-looking alternatives, but that doesn't work yet.

4:51 tuft: You mean adding a :require :refer form?

4:51 tuft: cool, the trick you just described works great

4:51 cfleming: yes

4:51 cfleming: tuft: Great.

4:52 tuft: So the problem with that is that would give you a massive list of completions.

4:52 tuft: hmm

4:52 sure but if i keep typing what i want it will narrow, no?

4:52 cfleming: tuft: I'm thinking about some ways around that. One option would be to use the double-complete that IntelliJ uses for Java.

4:52 tuft: Yes, it would, but you'd start out with all symbols in your project - in a big project, that's a lot of symbols.

4:53 tuft: in pycharm they make you hit the completion chord twice to get the huge list -- once just gives you imported symbols

4:53 cfleming: tuft: Right, that's what I mean. I'll probably do that.

4:53 tuft: ah yes, same for java it sounds like

4:53 cfleming: tuft: But that doesn't work yet, no

4:53 tuft: ok gtk, thanks =)

4:53 cfleming: tuft: No worries

4:54 tuft: aliasing namespaces is probably better hygene anyway

4:54 martinklepsch: ,(def x [1 2 3])

4:54 clojurebot: #'sandbox/x

4:54 martinklepsch: ,(resolve x)

4:54 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to clojure.lang.Symbol>

4:54 martinklepsch: ,(resolve 'x)

4:54 clojurebot: #'sandbox/x

4:55 martinklepsch: ,(eval x)

4:55 clojurebot: [1 2 3]

4:57 tuft: cfleming: with huge lists the fuzzy matching is quite helpful. maybe for cursive it could include the namespace as well. e.g. type "httpget" and see clj-http.client/get as an option

4:58 (i'm referring to the symbol search)

4:59 mercwithamouth: hmm i suppose vim-fireplace isn't so bad

5:00 clgv: martinklepsch: you want the value without `eval` ?

5:00 ,(some-> x' resolve var-get)

5:00 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x' in this context, compiling:(NO_SOURCE_PATH:0:0)>

5:00 clgv: ,(some-> 'x resolve var-get)

5:00 clojurebot: [1 2 3]

5:00 sm0ke: is it possible to make methods of protocol private?

5:01 clgv: sm0ke: nope. with this question you are back in OOP land

5:01 cfleming: tuft: yeah, aliasing namespaces is definitely encouraged - I'll be adding more support for that long before adding support for :refer, which is gently frowned on in general.

5:01 sm0ke: clgv: its just for better user api!

5:01 cfleming: tuft: And yeah, I'd include the ns in the completion lists so you could do that.

5:01 clgv: sm0ke: why does the user api get better via private methods?

5:02 sm0ke: it does not appear in docs or suggestions!

5:02 thus uncluttering the options

5:02 clgv: sm0ke: the docs exclusion can be done via meta data

5:02 sm0ke: what about suggestions?

5:02 clgv: what do you mean by "suggestions"?

5:03 sm0ke: IDE

5:03 martinklepsch: clgv: actually I'm not sure what I want yet, haha

5:03 basically there's this: https://gist.github.com/alandipert/64a598b9e26eb0a0ac96 — which I'd like to get working in a similar manner as described in the comment

5:04 clgv: martinklepsch: you get the value as suggested via (some-> 'x resolve var-get)

5:05 martinklepsch: ok then you need `resolve` for globals and a method to get the value of local bindings

5:06 martinklepsch: you can get the local bindings from the &env of the macro

5:06 martinklepsch: clgv: which macro?

5:07 clgv: martinklepsch: ah right `deterpolate` would need to be a macro then

5:08 the macro part just needs to capture a locals map and can then call a function similar to the current `deterpolate` to do the actual work

5:21 mercwithamouth: darn it...back to vim i go

5:22 clgv: mercwithamouth: vim -> emacs trial -> vim ?

5:29 mercwithamouth: clgv: to a degree

5:29 i've spent a considerable amount of time with emacs...very comfortble with it

5:30 *comfortable but i'm also really comfortable with vim

5:31 vim may very well run smoother as far as clojure dev goes... i'm running my mouth, i haven't really made a final decision as of yet

5:33 martinklepsch: clgv: thanks for the advice I'll gonna try this

5:54 CookedGryphon: With protocols, do you need to type hint the this parameter? or does it know that implicitly

5:58 SagiCZ1: ,(re-find #"lo" "hello")

5:58 ,(re-find #"lo" "helloxxx")

5:58 clojurebot: "lo"

5:58 "lo"

5:58 SagiCZ1: what if i dont want the second to get matched

5:58 i want to specify that the string has to end with the pattern

5:58 perplexa: you use a different regex :P

5:59 SagiCZ1: how different?

5:59 perplexa: #"lo\b" or #"lo$" or #"lo(?!x)"

6:00 SagiCZ1: perplexa: thank you, perfect

6:00 (inc perplexa)

6:00 lazybot: ⇒ 0

6:00 perplexa: ty ;p

6:00 finally no more -1 :D

6:00 SagiCZ1: haha

6:00 Glenjamin: (dec no-one)

6:00 lazybot: ⇒ -1

6:00 Glenjamin: oh right, didn't realise there was a dec

6:01 perplexa: i got dec'd in my first hour here ;x

6:02 SagiCZ1: the \b is a word boundary, so it matches anything that is not \w when there was \w before and vice versa, $ in the second example indicates the line end and the (?!x) in the third one is a negative lookahead, which triggers your match only if it's not followed by "x"

6:10 dysfun: could someone please explain what causes this? i've fixed it by following the suggestion, but i'd like to understand what the problem was http://paste.scsys.co.uk/439284

6:15 clgv: dysfun: the cgrand libs used a version range which is a bad idea if you want repeatable builds

6:16 to be more specific it is an open range from 1.2.0 to whatever there might be released in the future

6:17 dysfun: oh right, so the suggestion is leiningen telling me to ignore its dep metadata for clojure?

6:18 hyPiRion: dysfun: yes

6:18 clgv: dysfun: yes.

6:18 dysfun: for some java libs that specify optional dependencies that you do not necessary need to use the lib, this is also handy

6:22 dysfun: sweet :)

6:23 * dysfun had been meaning to ask about exclusions

6:23 dysfun: i notice log4j is a common one, heh

6:26 clgv: dysfun: the downside of :exclusions is that you need to be sure that the version of the lib you prefer by adding the exclusion to a dependency still works with that dependency

6:30 dysfun: *nod*, but that's one-time at least

6:31 clgv: dysfun: one time per version of the dependency you use

6:31 dysfun: *nod*

6:57 justin_smith: $mail sm0ke the role of a protocol is to act as an interface, and privacy and interfaces don't often make sense together

6:57 lazybot: Message saved.

6:58 justin_smith: (inc lazybot)

6:58 lazybot: ⇒ 35

7:11 CookedGryphon: Does anyone know if type hinting a protocol's this parameter has any effect?

7:11 justin_smith: CookedGryphon: wouldn't the compiler already know what you are extending it onto?

7:12 CookedGryphon: that's sort of what I'd assume

7:12 justin_smith: I mean that was my assumption at least

7:12 yeah

7:12 CookedGryphon: but my colleague has type hinted some

7:12 and I don't know for certain

7:12 justin_smith: CookedGryphon: I bet some deft use of no.disassemble would sort it out for us

7:12 Bronsa: CookedGryphon: it has no value, no

7:13 CookedGryphon: and I've been caught out by what I thought would be sensible with type hinting before and it's turned out that in fact a type hint *was* needed, or was actually doing harm by being there!

7:13 Bronsa: both deftype/extend automatically type hint "this"

7:13 justin_smith: yeah, even for reading, the reader should know what's being extended as well

7:14 CookedGryphon: aha, that makes sense. Are there any docs of that which I can paste a link to in the code review?

7:14 justin_smith: CookedGryphon: *warn-on-reflection* / the "lein check" task really help with this

7:15 Bronsa: uhm wait

7:15 extend-type and extend-protocol *do* type hint this

7:15 extend actually cannot

7:15 so if you use extend you do have to manually type hint it

7:16 CookedGryphon: for extend-type/extend-protocol it's documented in the docstring for extend-type and extend-protocol is implemented in terms of extend-type (mentioned in the docstring)

7:17 CookedGryphon: Bronsa: found it, thanks

7:17 Bronsa: CookedGryphon: for defrecord/deftype, "If not supplied, they will be inferred, so type they will be inferred, so type

7:17 hints should be reserved for disambiguation."

7:19 justin_smith: Bronsa: so I guess there is no way for extend to create a hinted version of a function inside its mmap

7:19 Bronsa: justin_smith: right, because it's a function

7:20 justin_smith: I just hadn't considered that, lacking the knowledge of the internals

7:20 (one could imagine a compiler that had that power)

7:20 Bronsa: i mean you can even do (def impl {..}) (extend type proto impl)

7:21 justin_smith: right

7:21 Bronsa: impl is just a regular map that knows nothing about its relation with the protocol

7:22 justin_smith: Bronsa: but I had (erroneously) imagined the ability to add the type specific annotation as a modification or metadata to the already compiled function.

7:22 Bronsa: ah no -- there's no way to do that

7:22 CookedGryphon: okay, new type hinting question. Does the following to anything useful: (let [^String a (.toString thing)] ...)

7:22 Bronsa: no

7:22 CookedGryphon: didn't think so (same code review)

7:23 Bronsa: CookedGryphon: clojure has a (limited) local type inference, it can easily infer return types

7:24 CookedGryphon: cool, thanks

7:26 justin_smith: CookedGryphon: one possibility is to take out a type annotation and see if that adds a warning in "lein check" that was not there previously. Numeric / unboxed args excluded.

7:27 Bronsa: CookedGryphon: also eastwood 1.5 has a "wrong-tag" linter

7:27 CookedGryphon: ooh, sounds interesting

7:28 Bronsa: CookedGryphon: it doesn't warn you about excessive uses of type hints but will warn you if you have an erroneous tag

7:28 like (defn ^long x [^long a] a) instead of (defn x ^long [^long a] a)

7:28 which is a common mistake

7:28 CookedGryphon: is excessive harmless to all but readability?

7:29 Bronsa: yes

7:29 CookedGryphon: I know wrong type hints can actually cause problems/slowness in some cases

7:29 Bronsa: well

7:29 yeah it might cause unexpected behaviours I guess, like unnecessary boxing or something

7:30 if your type hint is less specific than the one the compiler can infer, it might actually casue unnecessary reflection too

7:31 as a rule of thumb, the less type hints the better. Only use them when you are *sure* they are needed

7:31 and as justin_smith was suggesting, *warn-on-reflection* + lein check are your friends there

7:36 justin_smith: having *warn-on-reflection* turned on in a repl is pretty useful

7:39 CookedGryphon: Yeah, it would be nice if it displayed a warning summary at the end of the compilation

7:39 I have so many namespaces that the warnings scroll off the top of my terminal

7:39 and it's easy to miss them

7:40 would be nice if there was a "8 reflection warnings, 1 boxed math warning" summary at the end

7:40 prompting me to scroll back up

7:41 clgv: CookedGryphon: 2>&1 lein check | grep warning

7:46 justin_smith: also, it would be nice to segregate warnings in one's own code from warnings in 3rd party code

7:50 CookedGryphon: it would be even nicer if third party libraries came without warnings

7:51 one that has been kicking around and worrying me for a while is the clojure.core.memoize reference to field cache can't be resolved

7:51 sounds like exactly the sort of place you wouldn't want a reflection warning :P

7:52 clgv: right

7:55 CookedGryphon: in this case, the users are lucky that only the `snapshot` function suffers from that ;)

7:57 CookedGryphon: ah, is that the case? That's okay then

7:57 it would still be nice if it wasn't there in my warnings list though

7:57 potentially making me blind to other warnings popping up

7:57 clgv: it is in the current master branch. no idea what is in the latest release

7:58 CookedGryphon: 1 warning from none is easily noticeable, 6 instead of 5, much harder to notice

7:58 yeah, it seems to have been fixed for ages in master but there's not been a release

7:58 clgv: CookedGryphon: this should help: 2>&1 lein check | grep warning | grep my.awesome.project

7:58 CookedGryphon: clgv: I sort of want to know about reflection warnings in stuff I'm using though

7:59 clgv: CookedGryphon: yeah, I meant for only finiding the ones in your project ;)

7:59 CookedGryphon: to either push for it to be fixed, or inform my decision not to use that project!

7:59 clgv: sure

8:09 CookedGryphon: is core.memoize being actively maintained? There seem to be a lot of people submitting patches and talking to one another on JIRA, but nothing being accepted or merged, and the last release was over a year ago

8:14 clgv: CookedGryphon: I guess this answers the question

8:14 CookedGryphon: I think fogus used to maintain it.

8:17 CookedGryphon: what does one do in this situation?

8:17 I mean it's a clojure core project... I could just fork it and apply the fixes I want, but that's not really solving the problem

8:19 godd2: Au contraire, sounds to me like a solution to your problem

8:20 you can always submit a pull request for anyone else to see if they also want your changes

8:20 then if your PR gets accepted you can brag to your friends how you contributed to Clojure :)

8:21 CookedGryphon: solves *my* problem, but core.memoize doesn't accept pull requests, and what I really want is an official release with the current master, plus perhaps one of the dependencies updating from a SNAPSHOT to the actual released version

8:21 Bronsa: godd2: clojure contrib projects don't take PR

8:21 CookedGryphon: and then everyone else who's talking on jira still has the same problem

8:21 godd2: oh well that's dumb.

8:21 but to each their own

8:21 Bronsa: the problem is that I don't think fogus has time anymore to maintain it and nobody stepped up yet to take it over

8:22 CookedGryphon: It should probably have a request for maintainers at the top of the README if that's the case

8:23 I'd be happy to do a bit of admin and put an updated release out the door, but I'm not sure I'd be the right person to review some of the tickets/patches that have been submitted

8:24 godd2: no harm in dippin your toes in the water. No one is an expert out the door.

8:25 CookedGryphon: there is harm, if I don't think I would have the time to dedicate to maintaining it, it would end up in exactly the same state as it's in now in a month's time

8:28 godd2: well sure, only make commitments you think you have time to follow through on, but even if you address one issue a week or less, that's better than the status quo, no?

8:28 and worse case is someone else steps up

8:32 sm0ke: $google holmsand reagent

8:32 lazybot: [Reagent: Minimalistic React for ClojureScript - GitHub Pages] http://holmsand.github.io/reagent/

8:44 martinklepsch: I'm passing a bunch of vars to map and would like to keywordize those in the map fn, if I use (keyword 'map-var) I get :map-var... how can I make that return the name of the actual var?

8:44 justin_smith: name

8:44 ,(name #'+)

8:44 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Var cannot be cast to clojure.lang.Named>

8:44 justin_smith: err

8:45 joegallo: ,(keyword (:name (meta #'inc)))

8:45 clojurebot: :inc

8:45 joegallo: weeeeeeeeeee

8:45 justin_smith: ahh, it's in the meta

8:46 martinklepsch: ,(let [a 1 b 2 c 3] (map (fn [e] (keyword (:name (meta #'e)))) [a b c]))

8:46 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve var: e in this context, compiling:(NO_SOURCE_PATH:0:0)>

8:46 joegallo: those are not vars

8:47 martinklepsch: oh, sorry for the confusion then. what's the correct name?

8:47 Bronsa: martinklepsch: you can't do that

8:47 martinklepsch: locals

8:47 martinklepsch: think I confused that more than a few times in the last days

8:47 sm0ke: Bronsa: using macros you can?

8:48 or may be not hmm

8:48 Bronsa: sm0ke: kinda sorta but no

8:48 justin_smith: ,(.sym #'+)

8:48 clojurebot: +

8:49 sm0ke: justin_smith: ##(let [a +] (.sym #'a))

8:49 lazybot: java.lang.RuntimeException: Unable to resolve var: a in this context

8:49 justin_smith: sm0ke: I wasn't saying that would work

8:49 just saying it's a way to get the name of the var

8:49 sm0ke: no there is not

8:49 he meant var name `as is`

8:49 justin_smith: a is not a var!

8:49 sm0ke: no resolve it

8:49 justin_smith: so what's your point?

8:50 sm0ke: not*

8:50 cant be done as Bronsa said

8:50 justin_smith: a isn't a var

8:50 I wasn't talking about a, I was talking about a var

8:50 sm0ke: :P

8:50 may be you want to use b

8:51 martinklepsch: is something like this possible then? (mapify a b c); => {:a a :b b :c c}

8:51 justin_smith: sm0ke: I was sharing an interesting result to my research into the tangential question of "how one gets the name of a var" which turns out to be irrelevant to what martinklepsch actually wanted

8:51 clgv: martinklepsch: only if mapify is a macro

8:52 dysfun: https://github.com/metosin/ring-http-response/blob/master/src/ring/util/http_response.clj possibly the best use of camel-snake-kebab i've seen to date

8:52 clgv: martinklepsch: otherwise it has no access to the binding names of the parameters

8:52 sm0ke: martinklepsch: yes but it would be ugly

8:53 Bronsa: martinklepsch: (defmacro mapify [& syms] (zipmap (map keywrod syms) syms))

8:53 (defmacro mapify [& syms] (list 'quote (zipmap (map keyword syms) syms))) rather

8:53 ,(defmacro mapify [& syms] (list 'quote (zipmap (map keyword syms) syms)))

8:53 clojurebot: #'sandbox/mapify

8:53 sm0ke: , (defmacro mapify [& syms] (list 'quote (zipmap (map keyword syms) syms)))

8:53 clojurebot: #'sandbox/mapify

8:53 Bronsa: ,(mapify a b c)

8:54 clojurebot: {:c c, :b b, :a a}

8:54 sm0ke: sorry

8:54 martinklepsch: cool!

8:54 sm0ke: i was right indeed

8:54 martinklepsch: I really should learn more about macors

8:55 puredanger: CookedGryphon: hey, I saw your need re core.memoize on back chat. I'll get fogus to take a look or if he doesn't have time, I will

8:55 Bronsa: martinklepsch: remove the quote if you want to get {:c <value-of-c> ..}{ instead

8:55 (inc puredanger)

8:55 lazybot: ⇒ 21

8:55 martinklepsch: I'm solving the problem at hand differently now but that's very interesting still

8:55 clgv: martinklepsch: you want to capture the values right? so you need (defmacro mapify [& args] (zipmap (map (fn [a] `(quote ~a)) args) args))

8:56 ,(defmacro mapify [& args] (zipmap (map (fn [a] `(quote ~a)) args) args))

8:56 clojurebot: #'sandbox/mapify

8:56 clgv: ,(let [a 1 b 2 c 3] (mapify a b c))

8:56 clojurebot: {c 3, b 2, a 1}

8:56 clgv: oops keyword instead ;)

8:57 ,(defmacro mapify [& args] (zipmap (map keyword args) args))

8:57 clojurebot: #'sandbox/mapify

8:57 clgv: ,(let [a 1 b 2 c 3] (mapify a b c))

8:57 clojurebot: {:c 3, :b 2, :a 1}

8:59 Bronsa: I just realized how nice it would be to have a quote function implemented like (defn quote [x] (list 'quote x))

9:00 piranha: Bronsa: why?

9:00 Bronsa: that way we could write (map quote foo) instead of (map (fn [x] (list 'quote x)) foo)

9:00 piranha: oh

9:00 Bronsa: it wouldn't mess with the quote special form because it would only be used as a first-order value

9:01 piranha: right

9:02 clgv: Bronsa: indeed

9:02 stuartsierra: So (defn q [x] (list 'quote x))

9:02 Bronsa: stuartsierra: why q? quote is perfectly fine

9:02 stuartsierra: To avoid confusion with the special form.

9:03 Bronsa: stuartsierra: there would be no confusion IMHO, (quote foo) is always the special op (.. quote ..) is always the function

9:03 clgv: Bronsa: shortcut statement for "Bring your own function" ;)

9:03 stuartsierra: And it's shorter than (defn gee-wouldn't-it-be-nice-to-have ...)

9:04 Bronsa: stuartsierra: if I have to define that myself I'll just inline (fn [x] (list 'quote x)) when I need it. It'd have value only by being provided in c.c

9:05 stuartsierra: Why?

9:05 clojurebot: http://clojure.org/rationale

9:05 stuartsierra: clojurebot: Quiet, you.

9:05 clojurebot: excusez-moi

9:07 Bronsa: stuartsierra: because I'd have to define it in every lib I need to use that pattern -- or depend on a utils lib. not worth it when I can just type #(list 'quote %)

9:07 stuartsierra: but if it was available by default, I would be happy to use that instead

9:09 puredanger: btw if you get to mess with c.memo, bumping the c.cache dep would be nice :P

9:10 puredanger: master is almost right isn't it? just needs non-snapshot ref?

9:10 c.cache 0.6.4?

9:11 Bronsa: puredanger: yup

9:13 Glenjamin: i had some really weird core.cache/core.memoize dependency blowup yesterday - very confusing :(

9:13 of the 5 computers using the same project.clj, it only happened on one

9:14 stuartsierra: Clearly you need to burn that computer.

9:14 Bronsa: puredanger: one thing I've never understood -- are other contrib authors allowed to push on contrib repos? I think not but we have push permissions for all contribs

9:14 Glenjamin: this one: http://dev.clojure.org/jira/browse/CMEMOIZE-14

9:14 didn't figure out why it was happening :(

9:14 puredanger: Bronsa: you should not push on contrib repos where you are not a maintainer. but for simplicity, many of the projects use the same "contrib" team

9:15 Bronsa: puredanger: gotcha

9:15 puredanger: I actually don't have visibility into that stuff as I'm not an org admin

9:16 Bronsa: puredanger: and suppose I want to help out with a contrib, is it just a matter of asking the maintainer or do I have to go through the whole mailing list asking for permission thing?

9:16 puredanger: not sure what the official policy is on that

9:17 as a contrib maintainer you obviously have a CA and know the drill so that (to me) is the important part

9:17 if the maintainer is ok with it, I don't see any reason why that would not be ok

9:19 Bronsa: ok, thanks

9:19 puredanger: Glenjamin (or whomever) - is the existing core.memoize 0.5.6 depending on the wrong version of core.cache? Is this addressed by simply bumping the dep?

9:20 Bronsa: puredanger: no the issue should be with lein.

9:20 Glenjamin: i tried putting them in the top-level of project.clj, but still got the error - lein deps seemed to indicate correct versions, but the program wouldn't run

9:20 it was very annoying

9:20 Bronsa: puredanger: lein depends on stencil which used to depend on core.cache < 0.6.something

9:20 puredanger: oh, so it's another similar dependency via lein

9:20 Glenjamin: was on latest lein as far as i could see

9:20 Bronsa: puredanger: yeah, nothing that can be done on the contrib side

9:21 puredanger: so CMEMOIZE-14 is really a lein problem?

9:21 Bronsa: yes

9:21 Glenjamin: the dep tree looked right, but didn't load correctly - couldn't pin down what was actually broken

9:21 i also got an NPE doing `lein deps :tree` so something was definitely up at the lein end

9:21 Bronsa: also cmemoize-13 is a dupe of cmemoize-16

9:22 Glenjamin: it might be a solved problem in lein master, you should ask technomancy on this though

9:27 martinklepsch: I'm trying to transform some maps but I'm stuck here: https://gist.github.com/martinklepsch/f44829fb12ddd1cb822a

9:29 puredanger: Bronsa: yeah, I've taken care of -13 and -16

9:29 joegallo: martinklepsch: are you familiar with group-by?

9:30 martinklepsch: joegallo: yes

9:30 joegallo: i'd probably approach the problem by transforming the maps until they make a good input to group-by, and then working on transforming the output from group-by into the desired result

9:30 also, can you post your non-working code so far?

9:35 martinklepsch: joegallo: I added some code I stopped trying to make work as a comment

9:35 CookedGryphon: puredanger: sorry, was afk. That would be much appreciated!

9:36 puredanger: CookedGryphon: I've applied a few simple fixes and dep bumps in core.memoize.

9:37 CookedGryphon: there are a few bugs in the issue tracker that should probably be resolved or looked at before a release but I will try to get enough time to take care of those and get a version out by end of week

9:37 martinklepsch: joegallo: that code uses some other vars though

9:37 err, locals

9:38 joegallo: added a comment on your gist

9:38 group-by and a for gets you quite close...

9:38 CookedGryphon: puredanger: perfect, thanks

9:38 joegallo: perhaps you can figure it out from here?

9:38 CookedGryphon: (inc puredanger)

9:38 lazybot: ⇒ 22

9:38 iamdusta1: I’m having an issue using tentacles (https://github.com/Raynes/tentacles)

9:38 justin_smith: martinklepsch: here is one approach, I fixed what I assume is an error in your input data (map of images to images, rather than vector of images) https://www.refheap.com/93217

9:39 iamdusta1: where only tentacles.core, orgs, repos, and issues are accessible. Trying to access tentacles.pulls is failing me.

9:39 https://github.com/Raynes/tentacles/blob/master/src/tentacles/pulls.clj

9:39 justin_smith: iamdusta1: does that namespace occur in the version your are getting from clojars?

9:40 agarman: something like (for [[k v] input, x v] [(:cid x) k (dissoc x :cid)])

9:40 iamdusta1: justin_smith: yes. https://gist.github.com/iamdustan/64a3a56825e47a6c3a8c

9:40 that’s in .m2/repository/tentacles/tentacles/0.2.7/tentacles-0.2.7.jar

9:40 justin_smith: iamdusta1: and how are you accessing tentacles.pulls?

9:41 iamdusta1: Currently just trying to open up my project repl with `lein repl`

9:41 and typing (tentacles.pulls ...

9:41 justin_smith: you need to require it

9:42 (require '[tentacles.pulls :as pulls])

9:42 clojure is not eager about loading potentially loadable namespaces, someone has to request that they be found and loaded

9:44 iamdusta1: ah! I didn’t even realize I had required the 3 others already.

9:44 A thousand thanks justin_smith!

9:44 justin_smith: np

9:44 iamdusta1: (inc justin_smith) I believe

9:44 (inc justin_smith)

9:44 lazybot: ⇒ 129

9:44 iamdusta1: killing it

9:44 justin_smith: iamdusta1: the requires are transitive, so if you required anything that required one of those, it goes through and resolves it all

9:45 but it's best to explicitly require any namespace that you refer to rather than counting on that

9:49 iamdusta1: thanks for the advice!

9:54 martinklepsch: joegallo: your solution is really nice

9:55 joegallo, justin_smith what do you think of the other one I put in there as a comment?

9:55 (written by a coworker)

9:58 ag0rex: do you guys know any reference for java profiling and tuning? e.g. some book that suggests techniques that are commonly used?

10:02 joegallo: martinklepsch: that reduce may be extractable as a (into {} ...) combined with a few other functions

10:02 it's not that there's anything wrong with reduce, but sometimes the other things might be more readable

10:05 tavyy: hi! Does anybody know some good books or documentation about JVM optimization?

10:05 Does anybody know some good books or documentation about JVM optimization?

10:08 clgv: ag0rex: available profiler are for example jvisualvm (free) and yourkit java profiler (affordable, academic version)

10:08 clojurebot: No entiendo

10:12 ehiggs: Hi all. Does anyone have a workaround in Fedora 20 for this bug: https://bugzilla.redhat.com/show_bug.cgi?id=1008699

10:14 ag0rex: clgv: thank you!

10:14 clgv: ehiggs: install leiningen manually since this consists only of (1) downloading the lein bash script, (2) placing it on the path and (3) run any lein command, e.g. "lein repl"

10:16 ehiggs: http://leiningen.org/

10:16 tavyy: Hi all! Does anybody know some good books or documentation about JVM optimization? Thank you!

10:17 clgv: tavyy: there are plenty, if I remember correctly one is called "Java Performance Tuning"

10:17 tavyy: though that is a bit old now ;)

10:20 tavyy: clgv: tahnk you for your answer

10:20 I know that book

10:21 but I'm looking something more specific for Java 8

10:21 because in Java 8 the Memory space was changed

10:21 in adition to this new GC implementation was added

10:22 clgv: tavyy: and you experience performance problems due to that?

10:22 tavyy: no I didn't until now

10:23 clgv: is that a "maybe"?

10:23 tavyy: but I want to read about this because I'm interested in this subject

10:23 clgv: ok

10:24 the folks on the ##java channel have probably memorized corresponding books ;)

10:24 Glenjamin: there's a decent article on G1GC somewhere

10:24 tavyy: ok thanks for your advice

10:24 dysfun: there are several good articles on G1

10:25 you might also find the jclarity mailing list interesting

10:25 a lot of stuff about GC on there

10:25 tavyy: dysfun: do you know some URL's?

10:25 dysfun: not off the top of my head

10:25 tavyy: ok I will search

10:27 dysfun: thank you for your suggestion :)

10:28 dysfun: yw

10:36 ehiggs: clgv: thanks.

10:38 Bronsa: ,^{:foo (println "foo")} ()

10:38 clojurebot: foo\n()

10:38 Bronsa: ,^{:foo (println "foo")} (identity ())

10:38 clojurebot: ()

10:38 Bronsa: ,'^{:foo (println "foo")} ()

10:38 clojurebot: ()

10:41 clgv: O_o

10:41 hyPiRion: hm

10:42 Barley: would someone have pointers how to get the inserted row's id from the rowid that ojdbc returns? Using yesql

10:42 hyPiRion: ,^{:foo (System/exit 0)} () ; worth a try, I guess

10:42 clojurebot: #<SecurityException java.lang.SecurityException: denied>

10:42 hyPiRion: alright, also inspects metadata. That's good.

10:44 egli: Barley: I don't think there is a standard was. Usually inserts return a map where one of the values is the new id

10:45 Barley: the ojdbc driver just returns a oracle.sql.rowid object, can't really figure out how that's handled

10:45 (yes, googled a plenty)

10:50 clgv: hyPiRion: well it is not inspecting the metadata but the security manager denies the shutdown

10:51 hyPiRion: clojail usually tells you what was forbidden on the clojure level

10:51 &(def a 1)

10:51 lazybot: java.lang.SecurityException: You tripped the alarm! def is bad!

10:51 clgv: &(System/exit 0)

10:51 lazybot: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "exitVM.0")

10:52 clgv: humm or maybe it was the inspection as well

10:52 ,(System/exit 0)

10:52 clojurebot: #<SecurityException java.lang.SecurityException: denied>

10:53 borkdude_: soooooo, what are the implications for ClojureCLR now that .NET is being open sources? nothing?

10:54 and why the heck do I have an underscore in my name

10:57 andyf: Bronsa: Usually in t.a(.j) asts the value of the :raw-forms key is nil or a list of forms, where typically each form has their own parens around it. I guess it is an expected special case for :raw-forms to be (clojure.lang.Compiler/LOADER) when the final expanded form is (. clojure.lang.Compiler -LOADER) ?

10:57 clgv: borkdude_: it is?

10:57 borkdude_: clgv yes, they just announced

10:58 egli: Barley: I'm just reading http://clojure-doc.org/articles/ecosystem/java_jdbc/using_sql.html#inserting-a-row where it says that "you will get back the generated keys for each row (assuming the database has that capability)"

10:58 clgv: borkdude_: my it new site didn't forward that one yet

10:58 *news

10:59 jjmojojjmojo: borkdude_, (wrt the underscore) ghosting? logged in from multiple places? are you registered with nickserv?

10:59 borkdude_: I am registered, it must be because I logged in with two laptops yesterday I guess

10:59 Bronsa: andyf: yes

10:59 Barley: egli: yes, they probably do come back but in a proprietary format which I can't figure out in this case

10:59 Bronsa: ,(macroexpand-1 '(clojure.lang.Compiler/LOADER))

10:59 clojurebot: (. clojure.lang.Compiler LOADER)

11:00 Bronsa: andyf: ^ the original form is a symbol, the macroexpanded form is a seq

11:00 andyf: btw remember that bug you reported last week in t.a that turned out to be a bug in tools.reader?

11:00 andyf: Bronsa: Makes sense. It just exposed a wrong assumption I was making to detect macroexpansions from looking at :raw-forms.

11:00 Bronsa: andyf: turns out it's a clojure compiler bug.

11:00 egli: Barley: maybe a problem with the oracle jdbc driver?

11:01 Barley: maybe

11:01 Bronsa: andyf: http://dev.clojure.org/jira/browse/CLJ-1586

11:02 andyf: Bronsa: Glad you tracked it back all the way to the source.

11:03 puredanger: I thought metadata was only preserved on collections not on seqs? am I saying something dumb?

11:03 (that was my inner monologue there at the end)

11:04 Bronsa: puredanger: in this case compile-time metadata is lost

11:04 puredanger: e.g. (.foo ^class (a b)), if (a b) is a lazyseq, the type hint is lost

11:06 puredanger: this affected tools.reader because t.r includes the fix for CLJ-1444 -- sequence might return a lazyseq as opposed to always returning an ASeq as seq does

11:07 puredanger: Bronsa: I'm on a call right now, stepping away (but still interested!)

11:08 Bronsa: puredanger: np, I added a comment on CLJ-1444 saying that CLJ-1586

11:09 that it depends on CLJ-1586*

11:16 EvanR: im writing unit tests

11:16 with clojure.test

11:21 martinklepsch: what's the best way to thread a map through multiple update-ins ?

11:21 EvanR: you can use the -> macro

11:21 Bronsa: ,(-> {:a 1 :b 2} (update-in [:a] inc) (update-in [:b] dec))

11:21 clojurebot: {:b 1, :a 2}

11:23 martinklepsch: reading the docs on -> I don't quite understand how that works? isn't the map supposed to be a seq when it arrives in the update-in form?

11:23 Bronsa: why would you believe that?

11:25 SagiCZ1: So Philae made it! I hope you guys follow it!

11:27 http://xkcd1446.org/img/r_16-25-00_MZ7aAUNWN5.png

11:28 hyPiRion: followed the livestream, really exciting

11:29 SagiCZ1: so cool

11:31 CookedGryphon: woop! I love that XKCD's coverage was far more useful for the casual observer than any of the news/official channels

11:33 p_l: the official channels were swamped with traffic

11:33 martinklepsch: Bronsa: "making a list of it if it is not a list already"

11:34 SagiCZ1: CookedGryphon: not really.. my browser's cache was keeping the last image so i didnt know what the news are

11:34 dbasch: martinklepsch: it’s talking about the form

11:34 Bronsa: martinklepsch: that means that (-> 1 inc) will be treated as (-> 1 (inc))

11:34 martinklepsch: ohhhh

11:34 :D

11:35 ok

11:35 Bronsa: yeah the wording might be better but that's the meaning of it

11:35 martinklepsch: ok, thanks for clearing that up :)

11:39 EvanR: what is this weird notation [foo.ClassName

11:40 array of ?

11:40 how do i use this with instance?

11:40 Bronsa: ,(Class/forName "[String")

11:40 clojurebot: #<ClassNotFoundException java.lang.ClassNotFoundException: [String>

11:40 Bronsa: ,(Class/forName "[java.lang.String")

11:40 clojurebot: #<ClassNotFoundException java.lang.ClassNotFoundException: [java/lang/String>

11:40 Bronsa: ,(Class/forName "[java.lang.String;")

11:40 clojurebot: #<ClassNotFoundException java.lang.ClassNotFoundException: [java/lang/String;>

11:40 Bronsa: bah

11:41 ,(Class/forName "[Ljava.lang.String;")

11:41 clojurebot: [Ljava.lang.String;

11:41 EvanR: does it even make sense to ask this in java?

11:41 Bronsa: there.

11:43 gfredericks: ,(instance? (Class/forName "[Ljava.lang.String;") (into-array ["hey" "ho"])))

11:43 clojurebot: true

11:43 gfredericks: ,(instance? (Class/forName "[Ljava.lang.String;") (into-array Object ["hey" "ho"])))

11:43 clojurebot: false

11:44 EvanR: array of string is a well defined class?

11:44 clgv: ,(.getCanonicalName (Class/forName "[Ljava.lang.String;"))

11:44 clojurebot: "java.lang.String[]"

11:44 clgv: ,(.getCanonicalName (Class/forName "[J"))

11:44 clojurebot: "long[]"

11:44 EvanR: what about array of array of string

11:45 gfredericks: ,(Class/forName "[[Ljava.lang.String;")

11:45 clojurebot: [[Ljava.lang.String;

11:45 gfredericks: ,(Class/forName "[[[[[[Ljava.lang.String;")

11:45 clojurebot: [[[[[[Ljava.lang.String;

11:45 gfredericks: ^ that last one is array of array of array of array of array of array of String

11:45 EvanR: and i was thinking ; needed to be balanced ;)

11:45 gfredericks: ,(Class/forName "[[[[[[Ljava.lang.String;;")

11:45 clojurebot: #<ClassNotFoundException java.lang.ClassNotFoundException: [[[[[[Ljava/lang/String;;>

11:59 samflores: is there some leiningen plugin (or some other incantation) to show all functions missing documentation in my project?

12:00 justin_smith: $(->> 'clojure.core ns-publics (map (comp meta second)) (remove :doc) (map :name)) ; samflores

12:01 lazybot: ping

12:01 lazybot: justin_smith: Ping completed in 0 seconds.

12:01 Bronsa: justin_smith: it's &

12:01 justin_smith: &(->> 'clojure.core ns-publics (map (comp meta second)) (remove :doc) (map :name)) ; samflores

12:01 lazybot: java.lang.SecurityException: You tripped the alarm! ns-publics is bad!

12:01 justin_smith: d'oh, I should know that :)

12:01 ,(->> 'clojure.core ns-publics (map (comp meta second)) (remove :doc) (map :name)) ; samflores

12:01 clojurebot: (primitives-classnames chunk-first print-method chunk *source-path* ...)

12:02 justin_smith: I wanted lazybot to do it because lazybot creates a refheap link with the full result

12:02 but that should demonstrate the concept, you can just plug in your namespaces

12:02 maybe there is a convenient way to list all namespaces under a certain lein project?

12:02 samflores: (inc justin_smith)

12:02 lazybot: ⇒ 130

12:02 technomancy: justin_smith: you need bultitude for that

12:03 justin_smith: technomancy: good to know it is at least possible

12:04 samflores: one gotcha to doing it that way, is that a doc string of "" would not get caught that way

12:04 but easy enough to catch things like that too

12:05 samflores: that one I thing I can handle :p thanks

12:05 justin_smith: samflores: next, some nlp to detect crappy docstrings!

12:16 Glenjamin: doesn't eastwood have a doc-missing check?

12:16 ah, doesn't seem to

12:17 EvanR: ,(= '(1 2) [1 2])

12:17 clojurebot: true

12:17 EvanR: oO

12:18 Glenjamin: ,(== '(1 2) [1 2])

12:18 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to java.lang.Number>

12:18 Glenjamin: oh, right

12:18 basically collections are compared structurally

12:19 EvanR: that might work, but in my case i am comparing [3 4 5 6 9] and [#<XAD XAD[564 SPRING ST^^NEEDHAM^MA^02494^US]>] and getting true, in a test

12:19 the latter being a java array of some java type

12:20 or my comparison is just not happening at all

12:21 justin_smith: EvanR: did you forget to call is in the test?

12:22 (that's a problem I have sometimes)

12:22 EvanR: i moved the (is (== into a let bound function

12:22 justin_smith: well == is guaranteed to blow up

12:22 EvanR: and its never failing now

12:22 so its not even getting called

12:22 justin_smith: right, == will throw an exception on anything that isn't a Number

12:23 EvanR: ok

12:25 i had (is (= foo) bar) rather than (is (= foo bar))

12:25 andyf: EvanR: often a good idea when writing new tests to make a small change that should definitely make it fail, and verify it does fail

12:25 EvanR: obscured by some traces

12:25 Bronsa: EvanR: eastwood can warn you about that!

12:25 EvanR: andyf: yes

12:27 that would ensure that the test is not incorrect passing, which is probably really easy to set up

12:27 incorrectly passing

12:29 justin_smith: yeah, never trust a test that hasn't failed

12:33 EvanR: writing these tests, i realize that my working code is "randomly" switching between [] and () for sequences of values

12:33 unsettling

12:33 Glenjamin: depends if you care about the concrete sequence type i guess

12:33 EvanR: i certainly wouldnt if it was always the same

12:34 now i might wouldnt

12:34 noonian: EvanR: it is probably the same type but has just been cast to a seq

12:34 EvanR: if they were liskov substitutable that would be one thing

12:35 but even then, why

12:35 Glenjamin: EvanR: they are if you care about List

12:35 as in, the interface List

12:35 or Seq

12:35 EvanR: ,(seq? [])

12:35 clojurebot: false

12:35 Glenjamin: ,(seqable? [])

12:35 EvanR: interesting

12:35 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: seqable? in this context, compiling:(NO_SOURCE_PATH:0:0)>

12:36 Glenjamin: erm

12:36 noonian: ,(seq [])

12:36 clojurebot: nil

12:36 noonian: ,(set [1])

12:36 clojurebot: #{1}

12:36 Glenjamin: ,(sequential? [])

12:36 clojurebot: true

12:36 noonian: ,(seq [1])

12:36 clojurebot: (1)

12:36 Glenjamin: there we go

12:36 noonian: ,(type (seq [1]))

12:36 clojurebot: clojure.lang.PersistentVector$ChunkedSeq

12:36 EvanR: mk

12:36 Glenjamin: (source sequential?)

12:36 $source sequential?

12:36 lazybot: sequential? is http://is.gd/jk87hH

12:36 andyf: EvanR: This may be overly splitting hairs on what you said, but neither lists nor vectors are subtypes of the other.

12:37 EvanR: not lists, i was talking specifically about lazy seq

12:37 i dont think i have any lists anywhere

12:37 and i wouldnt assume they were subtypes

12:37 which is the rub

12:38 Glenjamin: hrm, the docs talk about "seqable" things, but the closest matching predicate i can see is (sequential?)

12:38 noonian: ,(doc sequential?)

12:38 clojurebot: "([coll]); Returns true if coll implements Sequential"

12:38 noonian: ,(doc seq?)

12:38 clojurebot: "([x]); Return true if x implements ISeq"

12:38 Bronsa: ,clojure.lang.ISeqable

12:38 clojurebot: #<CompilerException java.lang.ClassNotFoundException: clojure.lang.ISeqable, compiling:(NO_SOURCE_PATH:0:0)>

12:38 andyf: I was reading up on a definition of liskov substitution principle, and at least in its original form it only applies to two types where one is a subtype of the other. But agreed on the general idea that seqs and vectors do not behave identically in all contexts, and so having them be = can be confusing.

12:38 EvanR: and then theres sequable

12:38 Bronsa: ,clojure.lang.Seqable

12:39 clojurebot: clojure.lang.Seqable

12:39 noonian: ,(sequential? {:x 1})

12:39 clojurebot: false

12:39 noonian: ,(seq? {:x 1})

12:39 clojurebot: false

12:39 EvanR: andyf: i dont have any specific examples of where they are different but that is essentially what bothers me

12:39 what you said

12:39 Bronsa: Glenjamin: seqable means that they implement c.l.Seqable, this guarantess that calling `seq` on that value will succed and return an ISeq

12:40 hyPiRion: ,(instance? clojure.lang.Seqable {:x 1})

12:40 clojurebot: true

12:40 andyf: They behave differently with conj, is the example that several people have pointed out before.

12:40 Glenjamin: Bronsa: right, but there doesn't seem to be a core predicate for that concept, despite the concept cropping up in docstrings a lot

12:40 EvanR: Bronsa: well, unless they implement the interface by returning a null

12:40 unless nl is an seq

12:40 Glenjamin: ,(seq nil)

12:40 clojurebot: nil

12:40 Glenjamin: dunno if that counts

12:41 Bronsa: Glenjamin: there's a seqable? preidcate in core.incubator

12:41 EvanR: conj a lazy seq?

12:41 hyPiRion: ,(seq? nil)

12:41 clojurebot: false

12:41 hyPiRion: ^

12:41 Bronsa: IIRC

12:41 noonian: http://www.brainonfire.net/files/seqs-and-colls/main.html

12:41 Glenjamin: ,(seq? []) ; hyPiRion

12:41 clojurebot: false

12:41 Bronsa: Glenjamin: https://github.com/clojure/core.incubator/blob/master/src/main/clojure/clojure/core/incubator.clj#L83

12:41 EvanR: well im glad we cleared things up

12:41 Glenjamin: aha, perhaps that should be hatched

12:41 or maybe it doesn't come up very often

12:42 andyf: ,(= [1 2] (seq [1 2]))

12:42 clojurebot: true

12:42 justin_smith: Glenjamin: I have copy pasted that code into at least one project

12:42 hyPiRion: Glenjamin: I feel it comes up rather frequently

12:42 andyf: ,(conj [1 2] 3)

12:42 clojurebot: [1 2 3]

12:42 andyf: ,(conj (seq [1 2]) 3)

12:42 clojurebot: (3 1 2)

12:42 Glenjamin: how does one hatch an incubator function then?

12:42 EvanR: ,(type (conj (seq [1 2]) 3))

12:42 clojurebot: clojure.lang.Cons

12:42 andyf: EvanR: ^ that is the behavior that some find very surprising

12:42 Bronsa: the original intention of core.incubator was to host functions that might eventually be incorporated in clojure.core, but that seems hardly the case now

12:43 EvanR: ,(type (rest (conj (seq [1 2]) 3)))

12:43 clojurebot: clojure.lang.PersistentVector$ChunkedSeq

12:43 EvanR: matrioska

12:43 Bronsa: it's more like the "official and unmaintained clojure utils library"

12:43 llasram: The main place for that now is rhickey's head

12:43 amiright eh

12:43 Glenjamin: clojure seems duck/structurally typed rather than nominally typed, so prediates seem preferrable to me than checking (type)

12:44 EvanR: andyf: i didnt find the structure of the result surprising, but the class/type of the result is surprisin

12:44 andyf: There are unofficial and more-often-maintained utils libraries on Github: Medley, Plumbing, useful

12:44 EvanR: ,(type (conj [1 2] 3))

12:44 clojurebot: clojure.lang.PersistentVector

12:44 EvanR: makes more sense

12:45 Bronsa: I guess it's not fair to say core.incubator is not maintained, all that's there works fine. It's just mostly useless for the purpose it was intended to

12:45 EvanR: conj essentially has the type signature a -> b -> c for some dynamic types a b and c

12:46 Glenjamin: EvanR: you could say it has type a -> b -> a, but for lists/seqs the type of a is Seq

12:46 andyf: more-often-added-to, then :)

12:46 EvanR: Glenjamin: thats not correct, as i just demonstrated

12:46 Glenjamin: or ISeq i guess

12:46 "type" vs "interface"

12:46 concrete type is an implementation detail

12:47 ambrosebs: the real type for conj uses higher-kinds and depends on the first argument.

12:47 Bronsa: is it though? a sorted-map is a quite different ds than a hash-map

12:47 ambrosebs: *higher-kinded types

12:47 Bronsa: ambrosebs: it's not guaranteed to be the same of the first arg though

12:47 Glenjamin: aha, type expert

12:47 Bronsa: ,(let [a ()] [(class (conj a 1)) (class a)])

12:47 EvanR: yeah if it was expressible in terms of the interfaces that would be ok

12:47 clojurebot: [clojure.lang.PersistentList clojure.lang.PersistentList$EmptyList]

12:47 ambrosebs: no but I think you can build it in a way that's consistent

12:48 Glenjamin: $source conj

12:48 lazybot: conj is http://is.gd/Xbm7SK

12:48 ambrosebs: each class can encode what it "conj's" to in the type

12:48 Bronsa: ,(let [a {1 1 2 2 3 3 4 4 5 5 6 6 7 7}] [(class (conj a [8 8])) (class a)])

12:48 clojurebot: [clojure.lang.PersistentArrayMap clojure.lang.PersistentArrayMap]

12:48 EvanR: but it seems like the result of the conj is just "a whatever"

12:48 ambrosebs: but I haven't done this to be clear

12:48 Bronsa: ,(let [a {1 1 2 2 3 3 4 4 5 5 6 6 7 7 9 9}] [(class (conj a [8 8])) (class a)])

12:48 clojurebot: [clojure.lang.PersistentArrayMap clojure.lang.PersistentArrayMap]

12:48 ambrosebs: I've tried.

12:48 Bronsa: well.

12:48 whatever the threshold is.

12:48 ,(let [a {0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 9 9}] [(class (conj a [8 8])) (class a)])

12:48 clojurebot: [clojure.lang.PersistentHashMap clojure.lang.PersistentHashMap]

12:48 Bronsa: there

12:48 hyPiRion: 8.

12:48 Bronsa: no.

12:48 now I'm confused

12:49 Glenjamin: both sides satisfy (map?) at least

12:49 EvanR: arraymap becomes a hashmap after like 16

12:49 and lazyseq is not lazy except after like 32

12:50 important

12:50 Glenjamin: https://github.com/clojure/clojure/blob/clojure-1.7.0-alpha1/src/jvm/clojure/lang/RT.java#L602

12:50 IPersistentCollection -> Object -> IPersistentCollection

12:50 ambrosebs: something like (All [x kret karg] [(IPersistentCollection x kret karg) (karg x) * -> (kret x)])

12:50 Glenjamin: not that that is especially informative

12:50 EvanR: right

12:50 thats why it seems like dynamictype1 -> dynamictype2 -> dynamictype3

12:50 ambrosebs: and each type can fill in its own karg and kret

12:51 EvanR: the middle being basically the same concept

12:51 the other two have some other restrictions, PersistentCollection

12:51 ambrosebs: conj is polymorphic in its argument and its return type, which the type above captures

12:52 EvanR: rather than say polymorphic, i would call it a dynamic type, like its second argument

12:52 Bronsa: ,(class (assoc {0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7} 8 8))

12:52 clojurebot: clojure.lang.PersistentArrayMap

12:52 hyPiRion: ,(map count (partition-by (partial = clojure.lang.PersistentArrayMap) (map class (reductions #(assoc %1 %2 %2) {} (range 20)))))

12:52 clojurebot: (10 11)

12:52 Bronsa: ,(class {0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8})

12:52 clojurebot: clojure.lang.PersistentHashMap

12:52 Bronsa: ,(class {0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7})

12:52 clojurebot: clojure.lang.PersistentArrayMap

12:52 EvanR: dispatch mechanism isnt what i would ascribe to jargon polymorphic

12:52 Bronsa: what the hell is going on there?

12:52 Glenjamin: the creation threshold is different from the promotion threshold?

12:52 Bronsa: looks like creation vs assoc has a different threshold

12:53 maybe it's an issue of < vs <=

12:53 ambrosebs: EvanR: I mean its polymorphic in its 2nd+ arguments plus return type, and the 1st argument dictates *exactly* how both behave

12:53 Glenjamin: i guess promotion is costly vs append

12:53 Bronsa: Glenjamin: no I'd say that's a bug

12:54 Glenjamin: https://github.com/clojure/clojure/blob/clojure-1.7.0-alpha1/src/jvm/clojure/lang/PersistentArrayMap.java#L32

12:54 ambrosebs: I'm trying to give the most precise type possible

12:54 EvanR: ambrosebs: ... the type of the first argument IPersistentCollection doesnt, but the implementation does

12:54 essentially little more than a dynamically typed function of two arguments

12:55 Bronsa: yup, line 200

12:55 has a >

12:55 ambrosebs: I disagree. it can be precisely captured with higher-kinded types.

12:55 Bronsa: RT.map compares with a <=

12:55 Glenjamin: aha

12:55 ambrosebs: I disagree in the "little more" claim

12:55 EvanR: i think we have different ideas of what were able to / want to express in the type signature

12:56 and what isnt being expressed

12:56 Glenjamin: well one of you is writing a clojure type system :)

12:56 ambrosebs: that doesn't mean much, I'm often wrong.

12:56 clgv: :D :P

12:56 hyPiRion: Glenjamin: just fyi, the HT threshold is k + v count, not entries

12:57 Glenjamin: yeah, array length check

12:57 it's the < vs <= that was confusing

12:57 andyf: Bronsa: IIRC, one can create even larger PersistentArrayMap's using transients to get there.

12:58 Bronsa: andyf: no I just tried

12:58 Glenjamin: seems like the "should i use a persistentarraymap?" check should be static on persistentarraymap, to improve the locality of related logic and make that sort of inconsistency less likely

12:58 ambrosebs: I only disagree with EvanR implying conj doesn't have a more precise type than dyn dyn -> dyn

12:58 Bronsa: andyf: the only way to created a larger array-map is to use the constructor

12:58 Glenjamin: interface {}

12:58 EvanR: ambrosebs: yeah, its more precise. the first and return type need to implement IPersistentCollection

12:58 they dont need to be the same, as is evident in the lazy seq implementation

12:59 Glenjamin: EvanR: if the type of the first argument is known by the system, the type of the return value can be known

12:59 EvanR: how?

12:59 clojurebot: with style and grace

12:59 EvanR: clojurebot: can it

12:59 clojurebot: Titim gan éirí ort.

13:00 EvanR: is this because IPersistentCollection implementation must be java code?

13:00 hyPiRion: ,(let [t (transient {})] (dotimes [i 100] (assoc! t i i)) (persistent! t)) ; pretty sure this is 8

13:00 clojurebot: {0 0, 1 1, 2 2, 3 3, 4 4, ...}

13:00 ambrosebs: ok I'm saying you can have a more precise type than IPC dyn -> IPC

13:00 but cool

13:00 hyPiRion: well dangit clojurebot.

13:00 EvanR: im sure you can but im not sure we do

13:00 hyPiRion: ,(count (let [t (transient {})] (dotimes [i 100] (assoc! t i i)) (persistent! t)))

13:00 clojurebot: 8

13:01 hyPiRion: (This is the obvious way to show how to NOT use transients btw.)

13:01 ambrosebs: EvanR: after a lot of thought I think we do. but I only have drafts to show for it, so I need to revisit it.

13:02 fwiw I spent a lot of time thinking about this during my thesis

13:02 EvanR: well i dont know enough about the system interfaces

13:02 ;source IPersistentCollection

13:02 ambrosebs: I hope to explain it better some time

13:02 CookedGryphon: Is there a way to feed multiple vectors into a transducer, same way as you can with map?

13:03 or should I just do that as my first step to produce a lazy sequence and feed it into the transducer

13:03 Bronsa: Glenjamin: hyPiRion http://dev.clojure.org/jira/browse/CLJ-1587

13:03 llasram: CookedGryphon: bingo

13:04 EvanR: ambrosebs: yeah, from what ive seen in clojure, if you have an interface like IPC, which defines something like IPC cons(Object), then there is nothing you can say about the return type of cons with respect to implementing class. its a dynamic type known to also implement ipc

13:05 also in java

13:05 you are free to return anything (even null, though im trying to ignore that)

13:05 hyPiRion: Bronsa: inc'd

13:05 can do it here too actually

13:05 (inc Bronsa)

13:05 lazybot: ⇒ 70

13:06 EvanR: tells the whole story

13:15 zanes: Is there anything other than slamhound for clearing up unused dependencies?

13:21 engblom: Is there any tweak that could be done in order to load repl faster? On my laptop with Intel i3 it takes 10s for "lein repl" for the most simple projects even.

13:21 How is it with java garbage collector? Can it be tweaked to get faster load times?

13:22 zanes: engblom: The typical usage pattern is to open a REPL when you begin working, then leave it open over the course of your session.

13:22 postpunkjustin: engblom: most of the startup time comes from loading all of clojure.core, and there's no way around that (yet)

13:22 engblom: zanes: Besides the editors and ides directly communicating through nrepl, is there a way to reload a saved file?

13:23 EvanR: yeah, rerequire it

13:24 zanes: engblom: You may want to look at clojure.tools.namespace.repl/refresh.

13:25 engblom: clojure.tools.namespace.repl/refresh seem to not exist.

13:26 andyf: Bronsa: I can get asts with :op in #{:static-field :static-call :instance-call} but for an expression like (.x pt1) instead of :instance-field I get :host-interop Expected?

13:26 justin_smith: there is also stuartsierra's component, for when c.t.n/refresh does not suffice

13:26 noonian: you need to add clojure.tools.namespace to your project dependencies first and restart the jvm

13:28 justin_smith: https://github.com/clojure/tools.namespace

13:28 mi6x3m: hey clojure, what is a good object type with a literal to use for testing meta stuff

13:28 justin_smith: engblom: zanes: to be clear, there is no "repl" in that namespace, it's clojure.tools.namespace/refresh

13:29 mi6x3m: () ?

13:29 I mean, what is at least resource intensive

13:29 Bronsa: andyf: yes, :host-interop means "I can't figure out if it's an instance-call or an instance-field"

13:29 zanes: justin_smith: False? http://clojure.github.io/tools.namespace/#clojure.tools.namespace.repl/refresh

13:29 EvanR: the fastest literal

13:30 andyf: thx

13:30 justin_smith: zanes: mea culpa, it must have moved, or I misremembered

13:30 Bronsa: andyf: in hindsight :instance-interop might have been a better name but I don't feel like changing it now

13:31 andyf: I get this excitement at the beginning of creating a new linter of: Wow, t.a(.j) and current Eastwood infra makes creating a linter a snap! And then I start testing it on the crucible and finding all of the corner cases I didn't know about at the beginning :)

13:31 Bronsa: heh

13:31 andyf: It is a snap to make a linter no one wants to pay attention to.

13:32 EvanR: the best kind!

13:32 dnolen_: engblom: lein is great, but the fastest repl setups I know are using a raw REPL (via Emacs inferior lisp) or Cursive (IntelliJ)

13:32 Bronsa: andyf: have you seen the numbers of downloads for eastwood 1.4 on clojars? I'd say a lot of folks care

13:32 andyf: Well, I am kinda hoping they are useful enough that people will find it valuable to look at the results.

13:33 dnolen_: postpunkjustin: this is not true, lein adds a lot of overhead plain and simple (a tradeoff for all the things that it can do)

13:33 technomancy: engblom: some notes here https://github.com/technomancy/leiningen/wiki/Faster

13:33 andyf: Bronsa: I'm not discouraged. I just get re-reminded of the testing required to refine these things.

13:33 dnolen_: postpunkjustin: a raw REPL on my work desktop is like half a second

13:33 hiredman: eastwood is fantastic

13:33 dnolen_: to start

13:34 Bronsa: postpunkjustin: java -jar clojure.jar clojure.core takes 0.6s in my laptop

13:34 postpunkjustin: compared to ~5s for lein repl

13:34 postpunkjustin: Ok, fair enough.

13:34 hiredman: I just wish I could use it in projects that use java.jdbc

13:35 Bronsa: hiredman: what prevents that?

13:35 hiredman: lots of arity warnings because java.jdbc fiddles with the arglist metadata

13:35 Bronsa: ah it still does that? I thought they changed it :|

13:36 dnolen_: engblom: there's also a new tool called boot - maybe it's faster haven't tried it yet https://github.com/tailrecursion/boot

13:36 hiredman: maybe they did, we do not update very quickly

13:36 justin_smith: Bronsa: dnolen_: how useful would it be to cache the result of lein classpath, and then use that as args to java?

13:37 of course one must then remember to update the classpath if you change opts

13:37 technomancy: justin_smith: export LEIN_FAST_TRAMPOLINE=y

13:37 will do that for you

13:37 Bronsa: justin_smith: I do java -cp `lein cp` all the time

13:37 justin_smith: technomancy: interesting

13:37 michaniskin_: it takes > 2s for clojure's core to compile and load on my macbook air

13:38 Bronsa: michaniskin_: clojure is distributed AOT compiled

13:38 michaniskin_: well it needs to populate vars and whatnot

13:38 justin_smith: Bronsa: my idea being lein cp > cp; then repeated instances of java -cp $(cat cp) until I change project.clj

13:38 hiredman: Bronsa: nah, it still warns with the latest java.jdbc

13:38 Bronsa: justin_smith: ah, gotcha

13:39 michaniskin_: in boot we have pods in which we run clojure runtimes, i've done a lot of profiling of it

13:39 technomancy: justin_smith: fast trampoline basically memoizes all the lein overhead and invalidates the cache when the inputs change

13:39 justin_smith: technomancy: very cool!

13:39 hiredman: the really annoying thing is the java.jdbc functiosn it warns about are in the new api, which we don't use at all

13:39 michaniskin_: getting a repl server started takes ~4s from a warm clojure runtime

13:39 Bronsa: bah. I need to make a patch adding an internal :arglists so that I can at least feel I've done my part

13:39 engblom: This seem to reload stuff (in this case bmi.core): (use 'bmi.core :reload-all)

13:40 justin_smith: engblom: yeah, if you don't have any stateful things like servers to restart, that works pretty good, until you eliminate a definition but refer to it elsewhere

13:40 michaniskin_: in boot you'll get a repl in ~8s or so

13:40 justin_smith: the :reload-all does not erase a def :)

13:44 andyf: hiredman: catching up -- you can disable whole types of warnings if they are useless to you. Not as good as having a more precise way to handle the java.jdbc issue, but maybe good enough.

13:45 hiredman: :exclude-linters [:wrong-arity]

13:45 hiredman: yeah, I know, but then I don't get that linter for other things :/

13:45 andyf: hiredman: Sure. I don't have an answer for that yet. Not sure when, if ever.

13:45 technomancy: what's it doing with arglists? sounds sketchy

13:46 hiredman: technomancy: it compares calls to arglists and warns if it looks like the wrong arity

13:46 andyf: technomancy: :arglists are commonly assigned values useful for (doc ...) output that do not match actual number of args passed

13:46 technomancy: hiredman: yeah, I mean are you using undocumented arities or something?

13:46 andyf: I shouldn't say "commonly" -- a few macros do that.

13:47 technomancy: that seems like a legitimate thing to warn about

13:47 hiredman: technomancy: no, like andyf says, some libraries fiddle with arglists so they aren't real

13:47 andyf: I should probably create a JIRA ticket proposing the addition of :doc-arglists, if I haven't already. Can't remember.

13:47 hiredman: technomancy: http://clojure.github.io/java.jdbc/#clojure.java.jdbc/execute!

13:47 technomancy: hiredman: hm. I've never seen :arglists refer to non-existent arities. that sounds insane.

13:47 hiredman: that arglist is "fake"

13:48 technomancy: trimming :arglists to exclude internal arities is reasonable. adding ones is not.

13:48 andyf: Example: https://github.com/clojure/java.jdbc/blob/master/src/main/clojure/clojure/java/jdbc.clj#L664-L665

13:49 clgv: andyf: +1 for :doc-arglists

13:49 technomancy: oh man... optional args that aren't at the end... boo

13:50 (dec mid-arglist-optional-args)

13:50 lazybot: ⇒ -1

13:50 andyf: clojure.core set the first example here, e.g. defmulti, defn, ...

13:50 justin_smith: technomancy: check it, I made sure this would work:

13:50 (dec mid arglist optional args)

13:50 lazybot: ⇒ -1

13:50 justin_smith: $karma mid arglist optional args

13:50 lazybot: mid arglist optional args has karma -1.

13:50 technomancy: justin_smith: but, but ... my precious illusion of actual clojure syntax

13:50 andyf: It isn't "wrong", it just means that there are some macros out there that their :arglists isn't useful for automated lint-checking like this.

13:51 hiredman: technomancy: yet another misguided attempt to be friendly that bites power users in the ass

13:51 technomancy: hiredman: yeap

13:51 justin_smith: user-obsequious design strikes again

13:52 technomancy: hiredman: if it's just one or two defns I'd be tempted to alter the meta away to fix it

14:00 TimMc: technomancy: Like repeat?

14:00 Oh, specifically the fake arities.

14:01 bbloom_: i'm looking for a function i know either 1) exists 2) has a name 3) can be expressed with a simple idiom....

14:02 let's say i have a sequence of sets, i want something like (for [x x-set, y y-set] [x y]) but where there are 0 to N sets

14:02 ztellman: is there still a contrib.combinatoric?

14:03 or combinatorial or whatever

14:03 bbloom_: there is https://github.com/clojure/math.combinatorics but i'm not sure what i want from there, if anything

14:03 dbasch: ztellman: you mean https://github.com/clojure/math.combinatorics ?

14:03 andyf: bbloom_: Not sure about implementations, and hopefully I'm not stating the obvious, but that is called a cross product in mathematics.

14:03 ztellman: dbasch: that's the one

14:03 puredanger: I've used that for lazy permutations I think

14:03 TimMc: bbloom_: reduce?

14:04 andyf: Ah, cartesian-product, also

14:04 justin_smith: technomancy: so I decided to compare the timing of using a cached classpath for startup vs. FAST_TRAMPOLINE=y https://www.refheap.com/93231

14:04 bbloom_: i avoided saying cartesian product, b/c i wasn't sure that's what i wanted....

14:04 justin_smith: not a totally 1:1 comparison, clearly nrepl vs. native clojure repl are apples and oranges

14:05 technomancy: justin_smith: is this a fresh trampoline?

14:05 the first run will be slow

14:05 bbloom_: andyf: ztellman: but i think it is, thanks

14:06 justin_smith: technomancy: not fresh, this is after running it a couple of times

14:06 TimMc: ,(reduce #(for [x % y %2] (conj x y)) [[]] [#{1 2} #{30 40 50} #{600 700}]) ;; bbloom_

14:06 clojurebot: ([1 50 600] [1 50 700] [1 40 600] [1 40 700] [1 30 600] ...)

14:06 technomancy: justin_smith: oh, you're doing lein repl

14:06 justin_smith: try lein trampoline repl

14:06 bbloom_: TimMc: yeah, but i actually need a variadic / non-macro version

14:07 justin_smith: technomancy: oh, silly me, I'll check it

14:07 TimMc: bbloom_: I don't understand. Are you saying that [x y] is metasyntactic here?

14:08 justin_smith: technomancy: takes 5s longer with the trampoline option

14:09 (after repeated runs)

14:09 bbloom_: TimMc: note that https://github.com/clojure/math.combinatorics/blob/master/src/main/clojure/clojure/math/combinatorics.clj#L117 is variadic. i'm pretty sure that's what i want

14:10 csd_: Is this proper usage: (:use [land-of-lisp.ch7 :only [ugraph->png]])? Clojure is complaining that a the same variable name is used in the remote and local ns

14:10 TimMc: bbloom_: (fn [& seqs] (reduce #(for [x % y %2] (conj x y)) [[]] seqs))

14:10 technomancy: justin_smith: longer with trampoline than without or longer than raw repl?

14:11 justin_smith: also, can you clear out your user profile while testing?

14:11 justin_smith: technomancy: longer with the trampoline option

14:11 TimMc: bbloom_: That function takes N colls and gives you back all the combinations of one-from-each, right? I don't see what you want different.

14:11 bbloom_: TimMc: oh, i misread your first code

14:11 justin_smith: technomancy: absolutely

14:11 yeah, some of my plugins may be messing with it for sure

14:11 bbloom_: TimMc: sorry / thanks

14:11 TimMc: bbloom_: not to say that my code is necessarily the best; I don't know what happens with larger numbers of seqs...

14:12 llasram: bbloom_: I haven't had a chance to put it into a library yet, may be of interest: https://gist.github.com/llasram/025e98d459ad48d71178#file-permutron-core-clj-L142-L154

14:12 TEttinger: csd_: :require not :use

14:12 TimMc: ,(reduce #(for [x % y %2] (conj x y)) [[]] [#{1 2} #{30 40 50} #{} #{600 700}]) ;; just checking

14:12 technomancy: justin_smith: plus possibly injections, etc

14:12 clojurebot: ()

14:12 TimMc: ,(reduce #(for [x % y %2] (conj x y)) [[]] [#{}]) ;; just checking

14:12 clojurebot: ()

14:13 justin_smith: technomancy: no injections in this project I don't think, but I will double check for sure

14:13 TimMc: ,(reduce #(for [x % y %2] (conj x y)) [[]] [#{1}]) ;; just checking

14:13 clojurebot: ([1])

14:13 bbloom_: ,(reduce #(for [x % y %2] (conj x y)) [[]] []) ;; no good

14:13 clojurebot: [[]]

14:13 TimMc: hah, yep

14:14 csd_: TEttinger: it complains when using require too

14:14 llasram: bbloom_: A fully lazy, index-able, seq-able, reduce-able collection of the cartesian product of a collection of (index-able) collections

14:14 TEttinger: csd_: is this in the repl?

14:14 TimMc: bbloom_: You'd have to wrap it in a check that you have at least one coll.

14:14 bbloom_: llasram: TimMc: that fn from combinatorics seems to do the trick

14:14 csd_: TEttinger: trying to load into repl with C-x C-k in cider

14:14 bbloom_: thanks all

14:14 llasram: kk

14:15 justin_smith: LOL "-lazybot- lazybot is available, 2 hours and 4 minutes after your ping." wonder what I broke about that plugin...

14:15 technomancy: justin_smith: you can look in target/trampolines to see the exact command that gets run

14:15 justin_smith: cool, will do

14:16 technomancy: weird, why wouldn't I see target/trampolines - am I using the wrong env var?

14:16 TEttinger: (require '[land-of-lisp.ch7 :only [ugraph->png]]) ; this is the syntax to use when you aren't in an ns at the start of a file

14:16 csd_: TEttinger: i mean i'm trying to load the entire clj file into the repl

14:16 technomancy: justin_smith: also you can time against lein trampoline run -m clojure.main to remove the nrepl overhead

14:16 csd_: it's not scratch work

14:17 justin_smith: technomancy: will it be like <hash-code>-init.clj?

14:17 technomancy: justin_smith: one file for the shell command, one file for the clojure

14:17 csd_: TEttinger: is there any way to clear out the ns stuff in cider?

14:17 justin_smith: yeah, I misspelled the var as FAST_TRAMPOLINE=y instead of LEIN_FAST_TRAMPOLINE=y at first

14:18 technomancy: aha

14:18 I haven't actually tried this in a while, so you had me worried there

14:18 justin_smith: I even added env to the command line so it would be super explicit!

14:18 TEttinger: I am not an emacs user, so I can't help there. I'm pretty sure someone here can answer

14:18 perhaps amalloy.

14:19 csd_: ok thanks

14:19 technomancy: justin_smith: on this project the nrepl overhead is huuuuuge

14:19 justin_smith: technomancy: that ~halved the startup time to 10s, I'll try the -m in a few

14:19 technomancy: justin_smith: nrepl is 5x clojure.main for me

14:20 sdegutis: Hi.

14:20 technomancy: justin_smith: and I'm not registering a difference between a raw repl and a fast-trampolined lein run -m clojure.main

14:20 the more you know!

14:21 actually lein is consistently a few hundred ms faster

14:21 mearnsh: can someone explain the rationale for this implementation (why the multiple arities) https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L609

14:21 tuft: gfredericks: vcr is working great. i did find one odd bug seeming to involve the interaction of clj-http, gzipped responses, vcr input stream serialization and necessary-evil -- i'll file with repro later

14:21 technomancy: s/consistently //

14:22 losing jline and tab completion is kinda rubbish though

14:22 dnolen_: mearnsh: performance - note it's not a pattern you should adopt in your own code

14:22 justin_smith: technomancy: https://www.refheap.com/93231 updated on the bottom, only a 1 second difference now, very nice

14:22 technomancy: I guess if you put it in an inferior-lisp it's not so bad

14:22 justin_smith: I had no idea nrepl was so heavy

14:22 mearnsh: dnolen_: thanks

14:23 technomancy: justin_smith: wow, how the deuce is my machine faster than yours; wtf

14:23 I have a 2009 core 2 duo

14:23 sdegutis: clojars.org used to let me press [tab] in Chrome and enter into a search-mode in the address bar, but no longer.

14:23 technomancy: justin_smith: https://www.refheap.com/93234

14:24 oops, misread the numbers

14:24 never mind

14:24 I have gotten a repl up in under a second, but that was with more tuning

14:24 sdegutis: Also PLEASE put change logs in your repos somewhere. Everyone, please.

14:24 I am upgrading from environ 0.4.0 to 1.0.0 and I have NO idea what's different, I have to go through the commit history.

14:25 technomancy: justin_smith: time echo "(System/exit 0)" | lein update-in : assoc :bootclasspath true -- trampoline run -m clojure.main

14:25 ^ cuts another 30%

14:25 justin_smith: oh, interesting

14:26 aperiodic: technomancy: could you explain what :eval-in :classloader does?

14:27 technomancy: aperiodic: it runs project code in the same JVM as lein, attempting to isolate the project in its own classloader.

14:27 it has some problems

14:27 the bootclasspath tricks lein plays to boot itself more quickly don't play nicely with classloader isolation, basically

14:28 sdegutis: Also it makes it harder to change Clojure versions afaik.

14:29 Your code then runs in whatever version Leiningen is using, and that's that.

14:29 technomancy: yep

14:29 sdegutis: I had to update speclj to account for that at one point.

14:29 aperiodic: technomancy: does that cause the sort of weird, impossible-seeming issues that make you think you're going insane?

14:30 technomancy: aperiodic: well... contact your healthcare professional, but yes

14:31 sdegutis: iirc that was even worse; it used eval-in :leiningen which doesn't even try to isolate anything

14:33 sdegutis: Ah right.

14:33 razum2um: is there any browser-js clients to nrepl besides of gorilla-repl out there?

14:33 sdegutis: I am going to try to use React.

14:35 Glenjamin: razum2um: as in you type in the browser, and it runs some clojure?

14:36 razum2um: yes, but I need more than tryclj

14:36 I really like gorilla's graph abilities

14:36 Glenjamin: ah, i only know of ways to type in a terminal, and it runs in a browser

14:37 razum2um: currently I need to analyse geo-data which would be *really* simplier if it will be in browser on google maps, than in terminal

14:37 postpunkjustin: razum2um: there's also Session

14:37 https://github.com/kovasb/session

14:38 Glenjamin: lighttable might work?

14:38 editor pane + browser pane

14:39 razum2um: postpunkjustin: nice, thanks

14:42 Glenjamin: hm, probably it's not what I mean. I have structures with lats and lngs and ideally I'd like to write some fn for constructing a json for js-map-engine to be rendered. Think about it as if it's a .toString but for geo data, that's why terminal sucks with it's abilities

14:44 justin_smith: razum2um: if you make it output a url, many terminals can make that clickable

14:44 razum2um: actually I think it's a general problem - take graphs, timeseries, trees - all of them are easily to render and read from browser, but we still using terminals

14:44 justin_smith: razum2um: if I understand what you are doing...

14:44 dbasch: razum2um: could you use geohashes?

14:44 justin_smith: razum2um: have you looked at gorilla-repl?

14:44 gorilla-repl renders all of those things inline

14:44 razum2um: justin_smith: yes, mentioned it earlier

14:45 justin_smith: sorry, I have not read the full scrollback

14:45 razum2um: and ithink it's a good approach, but as I said, it's very specialized to be a notebook for methematicians

14:45 *for doing math notebooks

14:47 secondly, I really haven't seen yet such a cool client-server arch for repls in any dynamic language, what's why I love clojure again :)

14:49 justin_smith: (inc technomancy)

14:49 lazybot: ⇒ 156

14:49 Glenjamin: if you're after a tool to help you build the visualisation, i think lighttable is fairly close

14:49 justin_smith: for walking me through making my lein boot super-fast

14:49 Glenjamin: you can connect a cljs repl to a browser pretty easily, but it's still 2 panes next to each other

14:49 so not quite integrated

14:50 technomancy: justin_smith: adding the raw repl tips to the wiki

14:50 justin_smith: cool

14:51 technomancy: justin_smith: feels like maybe the wiki page needs more google juice or something

14:51 justin_smith: technomancy: yeah, got a link? my results when google that suck

14:51 never mind, found it

14:55 technomancy: https://github.com/technomancy/leiningen/wiki/Faster/_compare/6263b19%5E...6263b19

15:05 SagiCZ1: ,(read)

15:06 clojurebot: eval service is offline

15:06 SagiCZ1: can i control program flow from the repl console? when i use read, and enter a string, it wont read it until i interrupt the current repl execution

15:06 sdegutis: ,3

15:06 clojurebot: 3

15:06 SagiCZ1: ,(read)

15:07 ,5

15:07 clojurebot: eval service is offline

15:07 5

15:07 sdegutis: ,2 + 3

15:07 clojurebot: 2

15:07 sdegutis: Oh wow it returned 5.

15:07 ,1 + 0

15:07 clojurebot: 1

15:07 sdegutis: Nice!

15:07 ,*clojure-version*

15:07 clojurebot: {:interim true, :major 1, :minor 7, :incremental 0, :qualifier "master"}

15:07 SagiCZ1: sdegutis: seriously?

15:08 that five was mine

15:08 justin_smith: SagiCZ1: it may make more sense to define a function that calls read, performans some other actions, maybe recurs

15:08 amalloy: SagiCZ1: sdegutis is an artful troll

15:08 justin_smith: SagiCZ1: then if you run that function, it should work until you return control to the repl

15:08 amalloy: SagiCZ1: trying to read from *in* while connected over swank or nrepl, like to cider or to lein repl, has historically had problems

15:09 maybe the state of the art is that someone's finally figured it out

15:09 SagiCZ1: amalloy: i would like it to read it when i hit enter.. that doesnt happen

15:11 justin_smith: SagiCZ1: works for me in a bare terminal

15:11 tools have trouble with this stuff though

15:11 SagiCZ1: ok it seems to be my repl's issue

15:11 sdegutis: amalloy: :P

15:12 amalloy: that's the closest to a compliment that I've ever gotten, so I'll take it :)

15:12 SagiCZ1: i just need to control my script a little bit.. i guess i will throw some quick seesaw for this purpose

15:16 justin_smith: SagiCZ1: if its a script you should be running lein run anyway

15:16 sdegutis: Updating dependencies in project.clj is always a little nerve-racking.

15:20 SagiCZ1: justin_smith: why is that?

15:24 justin_smith: SagiCZ1: to me a script means something you launch from the command line, as opposed to an interactive repl-oriented function

15:24 maybe that's just me though

15:24 SagiCZ1: justin_smith: yeah that would make sense

16:07 EvanR: is there a conventional exception class to use if you detected that someone used your function with the wrong type at runtime

16:07 bbloom_: EvanR: assert is fine

16:08 EvanR: ,(assert false)

16:08 clojurebot: #<AssertionError java.lang.AssertionError: Assert failed: false>

16:08 EvanR: AssertionError, k

16:08 ill use this in my tests

16:08 bbloom_: if you don't expect anyone to catch it, the exception class really doesn't matter

16:08 EvanR: ok so theres a "should thrown some exception" test

16:09 bbloom_: generally, those are useless b/c any failure gets caught

16:09 test a regex against the exception message, ignore the class

16:09 EvanR: im trying to write a test to make sure my function does crash on common bogus inputs, rather than not crash

16:10 "test failed, should have crashed"

16:11 amalloy: EvanR: (is (thrown? Throwable (blow-up)))

16:12 EvanR: ok

16:15 {blake}: I'm trying to figure out a path problem with hiccup/compojure. If I specify a relative path for a css-- (p/include-css "bootstrap/css/bootstrap.css") -- it works locally but not when deployed as a WAR on JBoss. If I specify the app-name -- (p/include-css "/app/bootstrap/css/bootstrap.css") -- it works in JBOSS but not locally (of course, because locally it's not deployed under anything).

16:16 With the exception under JBOSS being, if I go to "/app/" instead of "/app", it does work.

16:16 So maybe I just need to route "/app" to "/app/"?

16:17 mgaare: {blake}: the guys in #immutant probably know more about what's going on there

16:18 m1dnight: is there a defacto style guide for clojure? Perhaps one that Rich Hickey accepts?

16:18 {blake}: mgaare: Tx.

16:19 m1dnight: I always thought it was "whatever Emacs does".

16:19 justin_smith: m1dnight: probably something very close to bbatsov's guide, it's on github

16:19 m1dnight: Okay, I saw that one and many many many others

16:19 justin_smith: some disagree with him regarding when

16:19 m1dnight: so that's my reason for asking

16:19 justin_smith: otherwise pretty accepted

16:20 technomancy: bbatsov's guide, plus reading the list of issues people have opened with it =)

16:23 EvanR: i heard that its possible deactivate asserts for production to increase performance

16:24 amalloy: most of the stuff in bbatsov's guide is good advice, but some of it is just his personal preferences that others disagree with and there's no good way to know which is which

16:24 hiredman: I still can't believe that jerk closed my pr

16:24 https://github.com/bbatsov/clojure-style-guide/pull/31

16:27 sdegutis: hiredman: :/

16:27 TimMc: hiredman: haha

16:27 sdegutis: hiredman: he's probably just new to open source and doesn't understand the culture

16:28 hfaafb: :-)

16:30 aaelony: I prefer "whatever helps me understand this code in a better manner" as a style guide, rather than 4 spaces or other silly rules.

16:30 EvanR: 4 spaces? is that the rule?

16:31 aaelony: sorry, 2 spaces (https://github.com/bbatsov/clojure-style-guide)

16:34 TimMc: "whatever notepad.exe does"

16:35 amalloy: TimMc:  U+FEFF

16:35 mandatory before all ns clauses

16:36 sdegutis: What is this (io!) macro all about?

16:36 I've never heard of it before.

16:36 amalloy: sdegutis: nobody uses it

16:37 you're "supposed" to use it anytime you do io, just in case somebody calls your function from inside a dosync; it will then throw an exception and save them from themselves

16:37 in practice that's absurd

16:37 sdegutis: So let's use it?

16:38 amalloy: not least because dosync is a lot rarer now than it was in like clojure 0.x when atoms didn't exist yet

16:39 TimMc: amalloy_: Good point! I wonder what happens.

16:39 EvanR: intriguing

16:43 bja: any marceline users here that have tried to use a ClojureSpout as a trident spout using t/new-stream?

16:44 EvanR: ,(io! 'launchMissiles)

16:44 clojurebot: launchMissiles

16:44 justin_smith: bja: I think sorenmacbeth may have some input on marceline

16:46 TimMc: amalloy_: "Exception in thread "main" java.lang.RuntimeException: Unable to resolve symbol:  in this context, compiling:"

16:55 jcrossley3: {blake}: re

16:56 {blake}: re relative paths, if you're going to mount your app at different contexts, you can prepend the :context from the request map to the path

16:56 if you want to mount at the root when deployed to wildfly, there's an option to do that. drop in #immutant if you need more details.

16:58 {blake}: and if you're not using immutant, nevermind :)

16:59 {blake}: jcrossley3: I've toyed with Immutant but I didn't see what I needed it for at this stage in my development. Is it...overkillish to include just for this one :context?

17:00 jcrossley3: {blake}: if you're just pulling in org.immutant/web, it's no more overkillish than any other web server

17:01 {blake}: and :context should be available to you without immutant if deployed as an uberwar.

17:03 {blake}: (p/include-css (str (:context request) "/your/file.css"))

17:06 {blake}: jcrossley3: Thanks. I'm using lein-ring. I started down the Immutant path but I'm currently working with JBoss 7, not WildFly (though I hope to get that upgraded).

17:08 jcrossley3: {blake}: cool

17:28 {blake}: Just as a general purpose question, can I put a value into the dev dependencies section of my project CLJ, if I wanted to handle the difference in location that way?

17:30 TimMc: What do you mean "a value"?

17:30 amalloy_: {blake}: in general you cannot know the contents of project.clj at runtime

17:31 {blake}: A text value containing the target url, "/" for dev, "/app/" for prod.

17:32 bja: I would probably handle that via environ and then use lein-environ if I wanted to manage the setting via project.clj

17:32 technomancy: bja: or by nginx config in production

17:32 rewrite rules etc

17:32 {blake}: Well, I'm targeting JBoss with a WAR...

17:33 technomancy: I'm sure it's got an analogous config

17:33 bja: environ can pull stuff out of properties. you could even skip environ and just read the properties directly

17:33 amalloy_: it's not a super-amazing approach, but like three years ago i solved this problem in 4clojure by including a config.clj file in the jar (which you can differ based on profile), and reading that at startup

17:33 technomancy: imo that's not an application-level concern

17:34 {blake}: I feel like I'm doing this wrong.

17:34 technomancy: yes!

17:36 jcrossley3: {blake}: did you try prepending the :context? that should work in either environment since it'll be nil for dev

17:37 {blake}: jcrossley3: No because I'm not using Immutant yet.

17:38 jcrossley3: {blake}: i already said it's not an immutant feature. it's a ring-servlet feature. it's an old and well-understood problem that ring has already solved for you.

17:38 {blake}: jcrossley3: Ahhh. I missed the "out" after your "with" earlier.

17:44 Seems like all the paths should be wrapped in context, which is (I think) part of Compojure?

17:48 bbloom_: is it just me or does github change (for the worse) their clojure syntax highlighting on a weekly basis?

17:49 mdrogalis: bbloom_: Yup D:

17:54 amalloy: bbloom_: i think they just source the highlighting from some other project

17:54 hfaafb: is it fun to make CRUD web apps in clojure

17:54 amalloy: i thought it used to be pygments, but it doesn't seem to be anymore

17:54 bbloom_: isn't it their "linguist" library?

17:55 bja: hfaafb: define fun?

17:55 bbloom_: https://github.com/github/linguist

17:55 bja: I don't find it fun to make CRUD web apps in any language

17:56 amalloy: bbloom_: linguist doesn't contain any rules for clojure that i can find

17:56 it seems to just import stuff from ace

17:56 bbloom_: ah, it probably relies on ace for highlighting

17:56 amalloy: https://github.com/ajaxorg/ace/blob/3b85ddfa051527f8feafd29a25f0fda9e95fc406/lib/ace/mode/clojure_highlight_rules.js

17:57 bbloom_: linguist does the language detection

17:57 amalloy: hasn't changed since april

17:57 bbloom_: well, i dunno when it changed

17:57 but their color scheme is ugly lately for clojure

17:58 amalloy: oh ew. the styling, not the highlighting logic

17:58 yes, that is awful

17:58 and new

17:58 bbloom_: it's like a rainbow of ugly

17:59 amalloy: i don't think it changes *often*, but the latest change really is grotesque

17:59 like just a day or two ago it looked fine

17:59 * TimMc doesn't really mind it

17:59 dbasch: is it just clojure? I’m looking at some java code and it looks uglier too

17:59 TimMc: It's a little odd I guess.

18:00 amalloy: dbasch: right, they use the same css for every language

18:00 bbloom_: heh, apparently lots of folks on twitter also think it is ugly

18:00 amalloy: bbloom_: in fairness, every time github changes something everyone complains loudly and then grows to like it

18:00 i recognize myself as one of those people

18:01 bbloom_: amalloy: yeah, that's true of most things

18:01 but the color scheme has changed several times over the past few weeks

18:01 hiredman: eastwood needs a linter for bad preconditions

18:01 bbloom_: i want it to 1) stop changing with high frequency

18:01 amalloy: this change though...i really hate the loss of bolded text and the drastically reduced contrast

18:01 bbloom_: and 2) to settle on a relatively non-neon theme

18:01 hiredman: (defn f [...] ...) (defn g [...] {:pre [f]} ...)

18:02 amalloy: bbloom_: one sec while i send you a screenshot of my beautiful neon emacs. you will hate it

18:04 http://i.imgur.com/EsCZdfI.png

18:04 bbloom_: barf.

18:04 i find black backgrounds basically unreadable in any lighting conditions

18:04 amalloy: bbloom_: for sure it's not *pretty*. but the high contrast really helps me read stuff

18:05 i wouldn't force this theme on anyone else

18:05 bja: do you enjoy this theme?

18:06 bbloom_: unrelated to themes, i made a thing: https://github.com/brandonbloom/ambiparse

18:06 amalloy: bja: are you asking me if i like the color scheme i picked for my own use?

18:07 bbloom_: it was surprisingly stressful to implement b/c matt might's racket code that i ported was totally above my head

18:07 TimMc: amalloy: That doesn't have enough colors.

18:08 amalloy: TimMc: idea: add variety to a color theme by gradually changing it as you scroll through the document

18:09 byte zero of theme' is colored the same as if you used just theme. byte one of theme' has 0x00000004 added to the value for theme; byte two adds 0x00000008, and so on

18:11 {blake}: amalloy: I like that. Easy to read.

18:12 amalloy: sadly the red will flicker like mad, and the green will stay the same except in a particularly long file

18:12 annelies: byebye

18:13 aperiodic: amalloy: do it in HSV

18:13 oh then it's all black, huh

18:14 amalloy: $mail annelies on irc you don't need to announce your arrival and departure; unless you're in the middle of a discussion, it's generally more polite to just leave silently

18:14 lazybot: Message saved.

18:15 TimMc: Dear Alan,

18:15 Thank you for your kind advice.

18:15 Sincerely,

18:15 Tim

18:15 (The grandmother of a friend used IM that way.)

18:15 amalloy: heck i generally just take off in the middle of a discussion too, but i thought that would be too radical a suggestion

18:15 postpunkjustin: $mail TimMc it's more fun to use lazybot

18:15 lazybot: Message saved.

18:17 amalloy: speaking of $mail, did you guys know that $unmail is a thing?

18:17 i bet justin_smith knows

18:17 TimMc: whoa

18:18 justin_smith: amalloy: I somehow missed it

18:18 hyPiRion: amalloy: I do too, but that's because I usually never know when a discussion actually ends

18:18 TimMc: $unmail amalloy

18:18 lazybot: Deleted unread messages from TimMc to amalloy

18:18 TimMc: $unmail 

18:18 lazybot: Deleted unread messages from TimMc to 

18:19 TimMc: I bet it even works in PM!

18:19 justin_smith: $unmail justin_smith

18:19 lazybot: Deleted unread messages from justin_smith to justin_smith

18:19 justin_smith: $unmail unmail

18:19 lazybot: Deleted unread messages from justin_smith to unmail

18:33 l1x: hi guys

18:33 has anybody solved this problem in clojure? /msg NickServ identify

18:33 not that one

18:33 bja: l1x, which problem?

18:34 l1x: http://www.mitbbs.com/article_t/JobHunting/32772891.html

18:34 this

18:59 dbasch: l1x: I think this works https://www.refheap.com/93254

19:12 l1x: actually https://www.refheap.com/93255

19:44 andyf: hiredman: Please add any comments you have, especially complete examples you would like to see warnings for, to Eastwood issue #89

19:47 amalloy: Raynes: does the issue-linking lazybot plugin not work anymore? i expected "jonase/eastwood#89" to prompt a link to that issue, but it doesn't seem to

19:47 lazybot: Warn about bad pre/postconditions -- https://github.com/jonase/eastwood/issues/89 is open

19:47 amalloy: dangit, it totally does, but not in PM?

19:48 Raynes: I think you're answering your own questions right now.

19:48 amalloy: Raynes: i hope you die soon in a mysterious way that doesn't implicate me at all

19:48 Raynes: ily2bb

19:48 andyf: Sorry, I get lazy about pasting links when doing irc via iPhone

19:49 amalloy: seriously though i sent lazybot a PM with that text and he didn't respond to me with a link. what a jerk

19:49 Raynes: He's a big meanie

19:49 It should probably respond to pms

19:49 amalloy: andyf: no worries. i figured having a link would be easier for hiredman or whoever else, so i added one

19:50 i see. in PM he doesn't respond to any of the :privmsg hooks, only to commands. is that a regression?

19:50 cc justin_smith

19:52 yeah, it must be a regression. you can't PM him clojure eval requests anymore, even

19:53 justin_smith: amalloy: hmm - could be an incompatibility between irclj versions that needs adapting

19:53 amalloy: I didn't change privmsg handling specifically

19:54 amalloy: that sucks - working on some client stuff right now but I will check that out

19:58 amalloy: thanks, justin_smith. i did a quick lookover, but it's been ages since i touched this stuff and nothing leaps out at me

19:59 justin_smith: amalloy: right, my suspicion is it is something that would have been semi-automatic before but now needs to be more explicitly set up

19:59 this has been the pattern for each part of updating for the new irclj

20:00 the funny thing is both channel content and /msg show up for the :privmsg hook - so really clojurebot should be responding to both the same way...

20:01 AHAHA

20:01 somewhere he is using his own nick where he should be using the user's

20:01 look for instances of :nick outside the plugins, one of those needs to be :user-nick...

20:01 or I will do it, of course

20:02 he is getting your &eval commands, he is then sending the result to himself

20:02 kenrestivo: so, if i need to pass just an unsigned int, to a jna function, what's the least complected way to turn a java/clojure int, into something in the correct byte order for passing to a jna function?

20:03 justin_smith: kenrestivo: the glorious thing about 2's compliment is that it just works

20:03 kenrestivo: until the number is larger than the max val for signed, then it's a little weird

20:03 kenrestivo: it doesn't, in my experience. the byte order is flipped.

20:03 justin_smith: are you sure?

20:03 http://en.wikipedia.org/wiki/Two's_complement

20:03 kenrestivo: not 100%, could run some more tests, but that's what it looks like

20:04 justin_smith: kenrestivo: are both sides the same endianness?

20:04 kenrestivo: i'm looking into it. it might want network order, i'm on a little-endian platform

20:04 justin_smith: "In two's-complement representation, positive numbers are simply represented as themselves, and negative numbers are represented by the two's complement of their absolute value"

20:05 hiredman: well, java doesn't have unsigned ints, so that is a wrinkle, you'll need to use a long and mask off the upper 32bits

20:05 justin_smith: hiredman: if you want to pass things larger than the max size for signed, sure

20:05 but for lower, it works

20:06 amalloy: justin_smith: so is it supposed to be user-nick and nick? i see in registry/try-handle, it refers to nick and bot-nick

20:06 kenrestivo: ah, ok. i've done that trick with ints to get bytes. suppose i could use it with longs to get ints.

20:06 justin_smith: amalloy: that would be it, yeah... my bad

20:06 hiredman: I am not sure how that is going to interact with jna though

20:07 justin_smith: amalloy: no, actually

20:07 kenrestivo: hiredman: yeah, there's a lot of moving parts here

20:07 justin_smith: amalloy: I set it up as :bot-nick (for the bot's own name) and nick

20:07 amalloy: in irc.clj

20:07 benzap: Hello peeps

20:07 how is everyone doing?

20:24 amalloy: dsantiago: do you know if there's something like clojure-hbase that works with [org.apache.hbase/hbase-client "0.98.1-cdh5.1.0"]? i tried [clojure-hbase "0.92.4"], but it doesn't work: whichever way i resolve the hbase version conflict, either clojure-hbase or hbase-client fails to compile

20:31 or if anyone else happens to know, of course i'm happy to hear about it

20:36 l1x: dbasch: thanks man!

20:38 dbasch: i think it does not cover certain edge cases but i try to understand and make it work

20:39 dbasch: l1x: do you have test cases?

20:39 l1x: (println (coins [1 1 1 1 0]))

20:39 or 111111 or 000000

20:42 dbasch: l1x: yeah, it’s easy to fix

20:43 l1x: well i don't understand your code yet :)

20:47 dbasch: l1x: partition-all instead of partition, and a check that cc is not empty

20:47 I mean c is not empty

20:48 the idea is: split the list into runs of 0s or 1s, examine them in windows of (at most) three consecutive groups

20:49 if the middle group is of length 1, that’s what you flip

20:49 and add up the lengths of the three groups

20:50 if not, you keep the longest side and flip one of the middle group

20:53 kenrestivo: gawd i love debugging tools. i'm doing (ioctl fd 0x70 0x20), and the kernel driver is is receiving cmd=0xa92ea8cc, arg=0x70

20:53 so there's a ghost pointer arg being sent by someone, somewhere. time to spelunk through clojure-jna source...

20:55 l1x: dbasch: thanks i try that and also try to understand

20:58 kenrestivo: gah, jna is broken. (jna/invoke Integer c/printf "Umm, number: %d\n" 5) prints "Umm, number: -1464804696"

21:04 aand... it's platform-specific :-(

21:06 amalloy: &(format "%x" -1464804696)

21:06 lazybot: ⇒ "ffffffffa8b0daa8"

21:07 kenrestivo: hmm, that same pointer

21:07 amalloy: &(format "%x" (int -1464804696))

21:07 lazybot: ⇒ "a8b0daa8"

21:07 kenrestivo: similar address area anyway

21:07 amalloy: kenrestivo: are you sure you want Integer, and not like Integer/TYPE? i don't know much about clojure jna

21:08 kenrestivo: following the docs pretty closely there, but i'll try that

21:08 amalloy: oh, i see you are using the example from the readme

21:08 kenrestivo: that kind of error is very familiar to me from c-land. it's the sign of someone passing a pointer where they shoudl be passing something else

21:08 amalloy: right

21:09 kenrestivo: seems like something (clojure-jna? jna?) is stuffing a pointer into the list of args passed

21:09 l1x: dbasch: it seems it returns incorrect answers

21:09 danielcompton: I've been working on upgrading Factual/skuld from 1.5.1 to 1.6 and hit a bug at https://github.com/Factual/skuld/blob/master/test/skuld/net_test.clj#L14

21:09 kenrestivo: what's baffling to me is why it works on x86-64 but not on arm

21:10 dbasch: l1x: example?

21:10 danielcompton: It seems that the hash-set values have changed

21:10 l1x: (println (coins [0 1 0]))

21:10 danielcompton: https://github.com/Factual/skuld/blob/master/test/skuld/net_test.clj#L14

21:10 l1x: the adjacency is 0 for this if you flip 1 bit it becomes 2

21:10 dbasch: l1x: my version prints 3

21:10 danielcompton: I know that there were changes to the hashing algorithm, but I wouldn't expect it to affect set equality?

21:10 l1x: but you return 3

21:11 dbasch: l1x: [ 0 0 0] = 3

21:11 l1x: well the original task was about adjacency for the neighbors

21:11 (0 0) (0 0)

21:12 so it should be 2

21:12 at least this is my understanding

21:12 hiredman: generally the way that upgrade ends up breaking things is places where people depended on ordering of items in sets or maps

21:12 dbasch: l1x: no, otherwise the example wouldn’t be 4

21:13 l1x: oh, maybe you’re right

21:13 hiredman: danielcompton: you've printed out the sets you expect to be equal?

21:14 l1x: dbasch: i think, but this is a f'ed up task for an interview

21:14 danielcompton: hiredman: https://www.refheap.com/93260

21:15 justin_smith: amalloy: the crux of it is where thunk-timeout #((respond n-bmap) n-bmap) is called in registry/try-handle - :channel should be bound to (:nick (:event com-m)) if query? is true, but that code is too much of a mess for my exhausted brain right now

21:15 hiredman: using map to print like that is hard to read

21:16 and you can't map over sets like that, they are unordered collections

21:17 you are taking items from each set and comparing them, but the sets are giving you things in different orders

21:17 dbasch: l1x: in any case, with that understanding it’s easier (almost the same code)

21:18 hiredman: it looks like in one of the sets you have something that is a java.util.HashSet and in the other it is a clojure set, I am not sure what = does in that case

21:19 ,(= (doto (java.util.HashSet.) (.add :a)) #{:a})

21:19 amalloy: hiredman: i think it actually works: if either one of them is a persistentcollection then = calls pcequiv

21:19 clojurebot: true

21:19 danielcompton: hiredman: I know I can't map over the sets, I was just trying to print each element individually

21:19 hiredman: danielcompton: you are doing an equality comparison too in that pastebin

21:20 danielcompton: hiredman: that was just for sanity debugging

21:20 hiredman: the failing test is at https://github.com/Factual/skuld/blob/master/test/skuld/net_test.clj#L26

21:21 hiredman: danielcompton: have you changed anything else? e.g. changed the fressian dependency?

21:22 likely fressian is deserializing things differently for whatever reason

21:22 danielcompton: hiredman: the tests all pass with all of the other dependencies upgraded, leaving clojure at 1.5.1

21:22 hiredman: not sure how that is mucking with whatever

21:23 danielcompton: so when you run the tests with a prn there for both of those sets, what does it print?

21:23 amalloy: 1.6 did change how things hash, didn't it?

21:24 hiredman: yes

21:24 danielcompton: amalloy: https://github.com/clojure/clojure/blob/master/changes.md#24-hashing

21:27 hiredman: I would be tempted to guess some kind of race condition in the test, but I am not familiar enough with skuld

21:27 danielcompton: hiredman: now I think about it, I'm pretty sure that the serialisation has been changed in 1.6

21:27 hiredman: the test is comparing a list of messages, with the same messages sent through the HTTP interface and reserialised

21:27 andyf: Order of deftest execution can change with 1.6 due to hash changes , iirc

21:28 hiredman: danielcompton: which? I mean I would expect the fressian serialization to depend on the version of the fressian library, not the version of clojure

21:28 andyf: oof, I had forgotten about that, what a pain

21:29 danielcompton: andyf: do you mean ordering of each atomic test? Surely test contents don't get reordered?

21:29 hiredman: danielcompton: have you printed out the contents of the sets when running the test?

21:29 andyf: Reply I got was: yeah, sounds normal. Deftest were never guaranteed to run in any particular order

21:29 danielcompton: hiredman: I wouldn't rule out a race condition but https://github.com/Factual/skuld/blob/master/test/skuld/net_test.clj#L21 should be preventing it

21:29 amalloy: danielcompton: i'm with hiredman, you want to print out the entire set contents, not just each item

21:29 i bet one of them has more elements than the other

21:29 andyf: Within a deftest, you get order. Between them, no guarantee .

21:30 hiredman: danielcompton: well, if the essages are handled in a different order, and done happens early for whatever reason

21:30 amalloy: eg, (= #{1} #{1 2}) is false, but (map = #{1} #{1 2}) returns '(true), so it looks equal

21:30 danielcompton: #{{:x "foo"} {:x 1} {:vec [1/2 yo], :set #{"foo" :a}} {:x {:hi 2}} {:done? true}}

21:30 #{{:vec [1/2 yo], :set #{"foo" :a}} {:x "foo"} {:x 1} {:x {:hi 2}} {:done? true}}

21:32 amalloy: and those two don't compare as equal?

21:33 danielcompton: amalloy: nope

21:33 andyf: They compare equal in my 1.6.0 repl if I quote the yo's ...

21:34 amalloy: well, start narrowing down the problem. try sorting each set into a list and then comparing them pairwise: is there a pair of elements which don't compare equal even though they should? if so, the problem is now smaller

21:34 dsantiago: amalloy: Sorry, I have no idea.

21:34 amalloy: if not, you get to figure out why two sets with contents which are equal don't compare as equal

21:38 danielcompton: amalloy: I think I've got it. The serialised message is of type java.util.HashSet, where the original one is clojure.lang.PersistentHashSet

21:39 these two had the same hash codes in 1.5.1, but Clojure's sets changed how they hashed in 1.6 so it no longer is the same as a java.util.HashSet

21:39 amalloy: right, i thought that was obvious from your first paste. but that doesn't explain why they don't compare as equal

21:39 andyf: Clj-1372

21:40 amalloy: because they do indeed hash the same for me in 1.7, at least

21:40 andyf: Not sure if that is the cause yet

21:41 amalloy: and also in 1.6

21:41 oh, but if you call hash instead they don't

21:43 danielcompton: amalloy: what's doubly weird is that they are equal if you compare the original vector, but when they're turned into sets they are no longer equal

21:44 andyf: Not sure if that ticket is considered a bug yet: Rich says "all bets should be off for hasheq/equiv of non-values" where Java collections obviously fall into the class of "non-values"

21:46 danielcompton: Changing received values to persistent sets before comparison may be a good idea

21:46 Unless that means more global changes to your code, in which case more thought is in order

21:59 OK, an example consequence of Clojure 1.6.0 hashing enhancements, combined with CLJ-1372 behavior, that seems relevant to your case:

21:59 ,(= (set [1000 2000]) (HashSet. [1000 2000]))

22:00 clojurebot: #<CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: HashSet, compiling:(NO_SOURCE_PATH:0:0)>

22:00 andyf: ,(import ?(java.util HashSet))

22:00 clojurebot: #<ClassNotFoundException java.lang.ClassNotFoundException: ?>

22:00 andyf: (import '(java.util HashSet))

22:00 ,(import '(java.util HashSet))

22:00 clojurebot: java.util.HashSet

22:00 andyf: ,(= (set [1000 2000]) (HashSet. [1000 2000]))

22:00 clojurebot: true

22:01 andyf: ,(= (set [(set [1000 2000]) {:a 1}]) (set [(HashSet. [1000 2000]) {:a 1}]))

22:01 clojurebot: false

22:01 andyf: finally

22:01 The different hash values for persistent vs. Java HashSet causes set membership checks to fail in PersistentHashSets.

22:02 TEttinger: aaaaaa my brain

22:03 andyf: ,(contains? (set [(set [1000 2000]) {:a 1}]) (set [1000 2000]))

22:03 clojurebot: true

22:03 andyf: ,(contains? (set [(set [1000 2000]) {:a 1}]) (HashSet. [1000 2000]))

22:03 clojurebot: false

22:06 danielcompton: andyf: Clojure printing HashSets and PersistentSets as #{} makes it trickier to spot

22:06 andyf: danielcompton: violent agreement

22:08 I don't know how that ticket will come out, but I have heard Alex Miller say that they are interested in real-world problems caused by tickets much more than theoretical possibilities.

22:10 danielcompton: andyf: I'll put down my example. hopefully because it's using fressian it'll be an example close enough to home

22:10 andyf: Might be worth throwing in your 2 cents as a comment on the ticket if this leads to issues in deep parts of your code. No guarantees it will change the answer.

22:12 danielcompton: andyf: I'm kinda thinking it's more an issue with fressian serialising persistent sets as hash sets

22:12 (dec hash)

22:12 lazybot: ⇒ -1

22:15 andyf: I encourage you to go for it, by all means. I just don't want you to think I have any say in the outcome :)

22:17 I see Lang Martin is speaking at Clojure meetup in San Francisco tomorrow evening. Are they involved with skuld by any chance?

22:21 danielcompton: andyf: not sure but I don't think so

22:52 I have no idea what a class world is and I don't really want to know

Logging service provided by n01se.net