#clojure logs

2014-11-12

00:15virmundiHello. 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"))
00:16virmundiThe 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))))
00:16virmundicall-simple has a vector list. I don't know what's tripping the compiler up.
00:17virmundiThe file in question is https://github.com/deusdat/travesedo/blob/master/src/travesedo/query.clj
00:17virmundiCan anyone help?
00:17TEttingerwhat's the error? http://refheap.com might be handy
00:17virmundiHere'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)
00:18virmundiRefheap: https://www.refheap.com/93197
00:19TEttingergot it
00:19TEttingervirmundi: https://github.com/deusdat/travesedo/blob/master/src/travesedo/query.clj#L94
00:19TEttingeryou're missing an arg vector earlier
00:19TEttingerso everything gets moved around from where it expects it
00:20virmundiThanks. How did you find that?
00:20virmundiJust sight?
00:21virmundiThat did correct it. My tests are now failing for the proper reason. Thanks.
00:24jebberjebexit
00:24jebberjebahhhh!
01:10godd2So 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?
01:12pdkif line-seq is lazy then yes
01:13godd2alright cool. The docs say it "Returns the lines of text from rdr as a lazy sequence of strings."
01:13nonubyis there a cljs/clj library (either) to give me moment.js like "3 days ago" "2 hrs ago" "1 minute ago" from (now - ts)?
01:20dbaschnonuby: in clj, clj-time which is a wrapper around joda time
01:21nonubyi dont believe it has a human friendly output for time periods?
01:22dbaschnonuby: joda time does, not sure if clj-time exposes it
01:22dbaschyou can always use joda time directly of course
01:22nonubycool, thanks!
02:16akurilinDo 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?
02:17akurilinso 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?
02:18akurilincurious if people managed to get away with it
02:18akurilinor with not doing it
02:18akurilin(assuming you don't use korma)
02:36seancorfieldakurilin: we have several "reporting" and "analytics" namespaces, but mostly our files match domain concepts
02:59akurilinseancorfield: 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
03:00akurilinand also I imagine you have namespaces that contain pure logic that deals with processing those entities somehow?
03:04seancorfieldYes 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.
03:06akurilinFrom just a design standpoint I've always tried to figure out the best way to separate and modularize these things
03:07akurilinseancorfield: so "db-accessing reporting stuff" is mostly reads and "persistence of domain entities" is mostly writes?
03:07seancorfieldYes
03:10akurilininteresting, never thought of separating that into different nses
03:12seancorfieldBedtime here. Laters.
03:13akurilinseancorfield: cheers! thanks for the tips!
03:22kenrestivothese little clojars slugs in github repos are neat, but the bummer is you can't copy/paste them into a lein project.clj :-P
03:55mercwithamouthis it me or are more people starting to use vim-fireplace opposed to emacs for clojure dev?
04:02elfenlaidmercwithamouth: it's hard to say, but here's some stat https://cognitect.wufoo.com/reports/state-of-clojure-2014-results/
04:07mercwithamouthelfenlaid: checking
04:07mercwithamouthheh..emacs still by a landslide. so be it
04:08mercwithamouthi'm familiar with both editors though emacs feels solid
04:21mercwithamouthhas 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?
04:33cflemingmercwithamouth: 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.
04:34cflemingmercwithamouth: So you're right, there are more people using vim-fireplace, both in absolute numbers and in percentage of the community.
04:36mercwithamouthi find that interesting...i'll have to take a look at vim-fireplace....god why do i flip flop between editors =P
04:36clgvcfleming: 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
04:37clgvtechnomancy: the user "connix" just started spamming
04:38cflemingclgv: 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.
04:38cflemingclgv: It's a little out of date unfortunately, although it should help getting started.
04:38cflemingclgv: I'm planning to make some screencasts at some point, and update the doc, but haven't had time yet.
04:39clgvcfleming: 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"
04:40cflemingclgv: 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.
04:40clgvcfleming: at some point I couldnt even select "Run with Leiningen"
04:40cflemingclgv: Hmm, how did you create your project? Did you import a lein project?
04:41clgvcfleming: yes I did import a lein project.
04:41clgvcfleming: guess I'll try it out again next year ;)
04:41cflemingclgv: 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"
04:42cflemingclgv: Hehe, no problem, we'll be waiting :)
04:42cflemingclgv: I'll be brushing off some of the sharp edges before a 1.0 release.
04:43SagiCZ1cfleming: hi, have you thought more about the licencing yet?
04:43cflemingSagiCZ1: What aspect of it? How it will work, or how much it will cost?
04:43clgvcfleming: CCW currently has some problems with leiningen deps in custom repositories. I hope that gets resolved soon
04:44SagiCZ1cfleming: the latter i guess
04:44cflemingSagiCZ1: It'll cost something similar to RubyMine or PyCharm - probably $100 for an individual dev and $200 for a company licence.
04:44SagiCZ1cfleming: sounds good, thanks
04:45SagiCZ1that will be well worth it
04:45cflemingclgv: 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.
04:46cflemingSagiCZ1: Cool, good to hear
04:47tuftare automatic completion of symbols not required yet supposed to work in cursive?
04:48tufti can't get it to add things to my ns macro's :require for me
04:49tuft.. but maybe that's not supposed to work yet =)
04:49cflemingtuft: 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.
04:49tufthmm let me try
04:49cflemingtuft: 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.
04:50tuftah ok, hrm
04:50cflemingtuft: So currently the effect is you have to add one by hand, then the rest will work.
04:50tuftwhat about refering symbols i've defined in other namespaces within the same project automatically?
04:50cflemingtuft: I'm going to add some matching so Cursive will suggest some likely-looking alternatives, but that doesn't work yet.
04:51cflemingtuft: You mean adding a :require :refer form?
04:51tuftcool, the trick you just described works great
04:51tuftcfleming: yes
04:51cflemingtuft: Great.
04:52cflemingtuft: So the problem with that is that would give you a massive list of completions.
04:52tufthmm
04:52tuftsure but if i keep typing what i want it will narrow, no?
04:52cflemingtuft: I'm thinking about some ways around that. One option would be to use the double-complete that IntelliJ uses for Java.
04:52cflemingtuft: Yes, it would, but you'd start out with all symbols in your project - in a big project, that's a lot of symbols.
04:53tuftin pycharm they make you hit the completion chord twice to get the huge list -- once just gives you imported symbols
04:53cflemingtuft: Right, that's what I mean. I'll probably do that.
04:53tuftah yes, same for java it sounds like
04:53cflemingtuft: But that doesn't work yet, no
04:53tuftok gtk, thanks =)
04:53cflemingtuft: No worries
04:54tuftaliasing namespaces is probably better hygene anyway
04:54martinklepsch,(def x [1 2 3])
04:54clojurebot#'sandbox/x
04:54martinklepsch,(resolve x)
04:54clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to clojure.lang.Symbol>
04:54martinklepsch,(resolve 'x)
04:54clojurebot#'sandbox/x
04:55martinklepsch,(eval x)
04:55clojurebot[1 2 3]
04:57tuftcfleming: 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
04:58tuft(i'm referring to the symbol search)
04:59mercwithamouthhmm i suppose vim-fireplace isn't so bad
05:00clgvmartinklepsch: you want the value without `eval` ?
05:00clgv,(some-> x' resolve var-get)
05:00clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x' in this context, compiling:(NO_SOURCE_PATH:0:0)>
05:00clgv,(some-> 'x resolve var-get)
05:00clojurebot[1 2 3]
05:00sm0keis it possible to make methods of protocol private?
05:01clgvsm0ke: nope. with this question you are back in OOP land
05:01cflemingtuft: 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.
05:01sm0keclgv: its just for better user api!
05:01cflemingtuft: And yeah, I'd include the ns in the completion lists so you could do that.
05:01clgvsm0ke: why does the user api get better via private methods?
05:02sm0keit does not appear in docs or suggestions!
05:02sm0kethus uncluttering the options
05:02clgvsm0ke: the docs exclusion can be done via meta data
05:02sm0kewhat about suggestions?
05:02clgvwhat do you mean by "suggestions"?
05:03sm0keIDE
05:03martinklepschclgv: actually I'm not sure what I want yet, haha
05:03martinklepschbasically 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
05:04clgvmartinklepsch: you get the value as suggested via (some-> 'x resolve var-get)
05:05clgvmartinklepsch: ok then you need `resolve` for globals and a method to get the value of local bindings
05:06clgvmartinklepsch: you can get the local bindings from the &env of the macro
05:06martinklepschclgv: which macro?
05:07clgvmartinklepsch: ah right `deterpolate` would need to be a macro then
05:08clgvthe 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
05:21mercwithamouthdarn it...back to vim i go
05:22clgvmercwithamouth: vim -> emacs trial -> vim ?
05:29mercwithamouthclgv: to a degree
05:29mercwithamouthi've spent a considerable amount of time with emacs...very comfortble with it
05:30mercwithamouth*comfortable but i'm also really comfortable with vim
05:31mercwithamouthvim 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
05:33martinklepschclgv: thanks for the advice I'll gonna try this
05:54CookedGryphonWith protocols, do you need to type hint the this parameter? or does it know that implicitly
05:58SagiCZ1,(re-find #"lo" "hello")
05:58SagiCZ1,(re-find #"lo" "helloxxx")
05:58clojurebot"lo"
05:58clojurebot"lo"
05:58SagiCZ1what if i dont want the second to get matched
05:58SagiCZ1i want to specify that the string has to end with the pattern
05:58perplexayou use a different regex :P
05:59SagiCZ1how different?
05:59perplexa#"lo\b" or #"lo$" or #"lo(?!x)"
06:00SagiCZ1perplexa: thank you, perfect
06:00SagiCZ1(inc perplexa)
06:00lazybot⇒ 0
06:00perplexaty ;p
06:00perplexafinally no more -1 :D
06:00SagiCZ1haha
06:00Glenjamin(dec no-one)
06:00lazybot⇒ -1
06:00Glenjaminoh right, didn't realise there was a dec
06:01perplexai got dec'd in my first hour here ;x
06:02perplexaSagiCZ1: 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"
06:10dysfuncould 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
06:15clgvdysfun: the cgrand libs used a version range which is a bad idea if you want repeatable builds
06:16clgvto be more specific it is an open range from 1.2.0 to whatever there might be released in the future
06:17dysfunoh right, so the suggestion is leiningen telling me to ignore its dep metadata for clojure?
06:18hyPiRiondysfun: yes
06:18clgvdysfun: yes.
06:18clgvdysfun: for some java libs that specify optional dependencies that you do not necessary need to use the lib, this is also handy
06:22dysfunsweet :)
06:23dysfuni notice log4j is a common one, heh
06:26clgvdysfun: 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
06:30dysfun*nod*, but that's one-time at least
06:31clgvdysfun: one time per version of the dependency you use
06:31dysfun*nod*
06:57justin_smith$mail sm0ke the role of a protocol is to act as an interface, and privacy and interfaces don't often make sense together
06:57lazybotMessage saved.
06:58justin_smith(inc lazybot)
06:58lazybot⇒ 35
07:11CookedGryphonDoes anyone know if type hinting a protocol's this parameter has any effect?
07:11justin_smithCookedGryphon: wouldn't the compiler already know what you are extending it onto?
07:12CookedGryphonthat's sort of what I'd assume
07:12justin_smithI mean that was my assumption at least
07:12justin_smithyeah
07:12CookedGryphonbut my colleague has type hinted some
07:12CookedGryphonand I don't know for certain
07:12justin_smithCookedGryphon: I bet some deft use of no.disassemble would sort it out for us
07:12BronsaCookedGryphon: it has no value, no
07:13CookedGryphonand 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!
07:13Bronsaboth deftype/extend automatically type hint "this"
07:13justin_smithyeah, even for reading, the reader should know what's being extended as well
07:14CookedGryphonaha, that makes sense. Are there any docs of that which I can paste a link to in the code review?
07:14justin_smithCookedGryphon: *warn-on-reflection* / the "lein check" task really help with this
07:15Bronsauhm wait
07:15Bronsaextend-type and extend-protocol *do* type hint this
07:15Bronsaextend actually cannot
07:15Bronsaso if you use extend you do have to manually type hint it
07:16BronsaCookedGryphon: 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)
07:17CookedGryphonBronsa: found it, thanks
07:17BronsaCookedGryphon: for defrecord/deftype, "If not supplied, they will be inferred, so type they will be inferred, so type
07:17Bronsa hints should be reserved for disambiguation."
07:19justin_smithBronsa: so I guess there is no way for extend to create a hinted version of a function inside its mmap
07:19Bronsajustin_smith: right, because it's a function
07:20justin_smithI just hadn't considered that, lacking the knowledge of the internals
07:20justin_smith(one could imagine a compiler that had that power)
07:20Bronsai mean you can even do (def impl {..}) (extend type proto impl)
07:21justin_smithright
07:21Bronsaimpl is just a regular map that knows nothing about its relation with the protocol
07:22justin_smithBronsa: but I had (erroneously) imagined the ability to add the type specific annotation as a modification or metadata to the already compiled function.
07:22Bronsaah no -- there's no way to do that
07:22CookedGryphonokay, new type hinting question. Does the following to anything useful: (let [^String a (.toString thing)] ...)
07:22Bronsano
07:22CookedGryphondidn't think so (same code review)
07:23BronsaCookedGryphon: clojure has a (limited) local type inference, it can easily infer return types
07:24CookedGryphoncool, thanks
07:26justin_smithCookedGryphon: 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.
07:27BronsaCookedGryphon: also eastwood 1.5 has a "wrong-tag" linter
07:27CookedGryphonooh, sounds interesting
07:28BronsaCookedGryphon: it doesn't warn you about excessive uses of type hints but will warn you if you have an erroneous tag
07:28Bronsalike (defn ^long x [^long a] a) instead of (defn x ^long [^long a] a)
07:28Bronsawhich is a common mistake
07:28CookedGryphonis excessive harmless to all but readability?
07:29Bronsayes
07:29CookedGryphonI know wrong type hints can actually cause problems/slowness in some cases
07:29Bronsawell
07:29Bronsayeah it might cause unexpected behaviours I guess, like unnecessary boxing or something
07:30Bronsaif your type hint is less specific than the one the compiler can infer, it might actually casue unnecessary reflection too
07:31Bronsaas a rule of thumb, the less type hints the better. Only use them when you are *sure* they are needed
07:31Bronsaand as justin_smith was suggesting, *warn-on-reflection* + lein check are your friends there
07:36justin_smithhaving *warn-on-reflection* turned on in a repl is pretty useful
07:39CookedGryphonYeah, it would be nice if it displayed a warning summary at the end of the compilation
07:39CookedGryphonI have so many namespaces that the warnings scroll off the top of my terminal
07:39CookedGryphonand it's easy to miss them
07:40CookedGryphonwould be nice if there was a "8 reflection warnings, 1 boxed math warning" summary at the end
07:40CookedGryphonprompting me to scroll back up
07:41clgvCookedGryphon: 2>&1 lein check | grep warning
07:46justin_smithalso, it would be nice to segregate warnings in one's own code from warnings in 3rd party code
07:50CookedGryphonit would be even nicer if third party libraries came without warnings
07:51CookedGryphonone that has been kicking around and worrying me for a while is the clojure.core.memoize reference to field cache can't be resolved
07:51CookedGryphonsounds like exactly the sort of place you wouldn't want a reflection warning :P
07:52clgvright
07:55clgvCookedGryphon: in this case, the users are lucky that only the `snapshot` function suffers from that ;)
07:57CookedGryphonah, is that the case? That's okay then
07:57CookedGryphonit would still be nice if it wasn't there in my warnings list though
07:57CookedGryphonpotentially making me blind to other warnings popping up
07:57clgvit is in the current master branch. no idea what is in the latest release
07:58CookedGryphon1 warning from none is easily noticeable, 6 instead of 5, much harder to notice
07:58CookedGryphonyeah, it seems to have been fixed for ages in master but there's not been a release
07:58clgvCookedGryphon: this should help: 2>&1 lein check | grep warning | grep my.awesome.project
07:58CookedGryphonclgv: I sort of want to know about reflection warnings in stuff I'm using though
07:59clgvCookedGryphon: yeah, I meant for only finiding the ones in your project ;)
07:59CookedGryphonto either push for it to be fixed, or inform my decision not to use that project!
07:59clgvsure
08:09CookedGryphonis 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
08:14clgvCookedGryphon: I guess this answers the question
08:14clgvCookedGryphon: I think fogus used to maintain it.
08:17CookedGryphonwhat does one do in this situation?
08:17CookedGryphonI 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
08:19godd2Au contraire, sounds to me like a solution to your problem
08:20godd2you can always submit a pull request for anyone else to see if they also want your changes
08:20godd2then if your PR gets accepted you can brag to your friends how you contributed to Clojure :)
08:21CookedGryphonsolves *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
08:21Bronsagodd2: clojure contrib projects don't take PR
08:21CookedGryphonand then everyone else who's talking on jira still has the same problem
08:21godd2oh well that's dumb.
08:21godd2but to each their own
08:21Bronsathe problem is that I don't think fogus has time anymore to maintain it and nobody stepped up yet to take it over
08:22CookedGryphonIt should probably have a request for maintainers at the top of the README if that's the case
08:23CookedGryphonI'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
08:24godd2no harm in dippin your toes in the water. No one is an expert out the door.
08:25CookedGryphonthere 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
08:28godd2well 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?
08:28godd2and worse case is someone else steps up
08:32sm0ke$google holmsand reagent
08:32lazybot[Reagent: Minimalistic React for ClojureScript - GitHub Pages] http://holmsand.github.io/reagent/
08:44martinklepschI'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?
08:44justin_smithname
08:44justin_smith,(name #'+)
08:44clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Var cannot be cast to clojure.lang.Named>
08:44justin_smitherr
08:45joegallo,(keyword (:name (meta #'inc)))
08:45clojurebot:inc
08:45joegalloweeeeeeeeeee
08:45justin_smithahh, it's in the meta
08:46martinklepsch,(let [a 1 b 2 c 3] (map (fn [e] (keyword (:name (meta #'e)))) [a b c]))
08:46clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve var: e in this context, compiling:(NO_SOURCE_PATH:0:0)>
08:46joegallothose are not vars
08:47martinklepschoh, sorry for the confusion then. what's the correct name?
08:47Bronsamartinklepsch: you can't do that
08:47Bronsamartinklepsch: locals
08:47martinklepschthink I confused that more than a few times in the last days
08:47sm0keBronsa: using macros you can?
08:48sm0keor may be not hmm
08:48Bronsasm0ke: kinda sorta but no
08:48justin_smith,(.sym #'+)
08:48clojurebot+
08:49sm0kejustin_smith: ##(let [a +] (.sym #'a))
08:49lazybotjava.lang.RuntimeException: Unable to resolve var: a in this context
08:49justin_smithsm0ke: I wasn't saying that would work
08:49justin_smithjust saying it's a way to get the name of the var
08:49sm0keno there is not
08:49sm0kehe meant var name `as is`
08:49justin_smitha is not a var!
08:49sm0keno resolve it
08:49justin_smithso what's your point?
08:50sm0kenot*
08:50sm0kecant be done as Bronsa said
08:50justin_smitha isn't a var
08:50justin_smithI wasn't talking about a, I was talking about a var
08:50sm0ke:P
08:50sm0kemay be you want to use b
08:51martinklepschis something like this possible then? (mapify a b c); => {:a a :b b :c c}
08:51justin_smithsm0ke: 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
08:51clgvmartinklepsch: only if mapify is a macro
08:52dysfunhttps://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
08:52clgvmartinklepsch: otherwise it has no access to the binding names of the parameters
08:52sm0kemartinklepsch: yes but it would be ugly
08:53Bronsamartinklepsch: (defmacro mapify [& syms] (zipmap (map keywrod syms) syms))
08:53Bronsa (defmacro mapify [& syms] (list 'quote (zipmap (map keyword syms) syms))) rather
08:53Bronsa,(defmacro mapify [& syms] (list 'quote (zipmap (map keyword syms) syms)))
08:53clojurebot#'sandbox/mapify
08:53sm0ke, (defmacro mapify [& syms] (list 'quote (zipmap (map keyword syms) syms)))
08:53clojurebot#'sandbox/mapify
08:53Bronsa,(mapify a b c)
08:54clojurebot{:c c, :b b, :a a}
08:54sm0kesorry
08:54martinklepschcool!
08:54sm0kei was right indeed
08:54martinklepschI really should learn more about macors
08:55puredangerCookedGryphon: 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
08:55Bronsamartinklepsch: remove the quote if you want to get {:c <value-of-c> ..}{ instead
08:55Bronsa(inc puredanger)
08:55lazybot⇒ 21
08:55martinklepschI'm solving the problem at hand differently now but that's very interesting still
08:55clgvmartinklepsch: you want to capture the values right? so you need (defmacro mapify [& args] (zipmap (map (fn [a] `(quote ~a)) args) args))
08:56clgv,(defmacro mapify [& args] (zipmap (map (fn [a] `(quote ~a)) args) args))
08:56clojurebot#'sandbox/mapify
08:56clgv,(let [a 1 b 2 c 3] (mapify a b c))
08:56clojurebot{c 3, b 2, a 1}
08:56clgvoops keyword instead ;)
08:57clgv,(defmacro mapify [& args] (zipmap (map keyword args) args))
08:57clojurebot#'sandbox/mapify
08:57clgv,(let [a 1 b 2 c 3] (mapify a b c))
08:57clojurebot{:c 3, :b 2, :a 1}
08:59BronsaI just realized how nice it would be to have a quote function implemented like (defn quote [x] (list 'quote x))
09:00piranhaBronsa: why?
09:00Bronsathat way we could write (map quote foo) instead of (map (fn [x] (list 'quote x)) foo)
09:00piranhaoh
09:00Bronsait wouldn't mess with the quote special form because it would only be used as a first-order value
09:01piranharight
09:02clgvBronsa: indeed
09:02stuartsierraSo (defn q [x] (list 'quote x))
09:02Bronsastuartsierra: why q? quote is perfectly fine
09:02stuartsierraTo avoid confusion with the special form.
09:03Bronsastuartsierra: there would be no confusion IMHO, (quote foo) is always the special op (.. quote ..) is always the function
09:03clgvBronsa: shortcut statement for "Bring your own function" ;)
09:03stuartsierraAnd it's shorter than (defn gee-wouldn't-it-be-nice-to-have ...)
09:04Bronsastuartsierra: 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
09:05stuartsierraWhy?
09:05clojurebothttp://clojure.org/rationale
09:05stuartsierraclojurebot: Quiet, you.
09:05clojurebotexcusez-moi
09:07Bronsastuartsierra: 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 %)
09:07Bronsastuartsierra: but if it was available by default, I would be happy to use that instead
09:09Bronsapuredanger: btw if you get to mess with c.memo, bumping the c.cache dep would be nice :P
09:10puredangermaster is almost right isn't it? just needs non-snapshot ref?
09:10puredangerc.cache 0.6.4?
09:11Bronsapuredanger: yup
09:13Glenjamini had some really weird core.cache/core.memoize dependency blowup yesterday - very confusing :(
09:13Glenjaminof the 5 computers using the same project.clj, it only happened on one
09:14stuartsierraClearly you need to burn that computer.
09:14Bronsapuredanger: 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
09:14Glenjaminthis one: http://dev.clojure.org/jira/browse/CMEMOIZE-14
09:14Glenjamindidn't figure out why it was happening :(
09:14puredangerBronsa: 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
09:15Bronsapuredanger: gotcha
09:15puredangerI actually don't have visibility into that stuff as I'm not an org admin
09:16Bronsapuredanger: 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?
09:16puredangernot sure what the official policy is on that
09:17puredangeras a contrib maintainer you obviously have a CA and know the drill so that (to me) is the important part
09:17puredangerif the maintainer is ok with it, I don't see any reason why that would not be ok
09:19Bronsaok, thanks
09:19puredangerGlenjamin (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?
09:20Bronsapuredanger: no the issue should be with lein.
09:20Glenjamini 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
09:20Glenjaminit was very annoying
09:20Bronsapuredanger: lein depends on stencil which used to depend on core.cache < 0.6.something
09:20puredangeroh, so it's another similar dependency via lein
09:20Glenjaminwas on latest lein as far as i could see
09:20Bronsapuredanger: yeah, nothing that can be done on the contrib side
09:21puredangerso CMEMOIZE-14 is really a lein problem?
09:21Bronsayes
09:21Glenjaminthe dep tree looked right, but didn't load correctly - couldn't pin down what was actually broken
09:21Glenjamini also got an NPE doing `lein deps :tree` so something was definitely up at the lein end
09:21Bronsaalso cmemoize-13 is a dupe of cmemoize-16
09:22BronsaGlenjamin: it might be a solved problem in lein master, you should ask technomancy on this though
09:27martinklepschI'm trying to transform some maps but I'm stuck here: https://gist.github.com/martinklepsch/f44829fb12ddd1cb822a
09:29puredangerBronsa: yeah, I've taken care of -13 and -16
09:29joegallomartinklepsch: are you familiar with group-by?
09:30martinklepschjoegallo: yes
09:30joegalloi'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
09:30joegalloalso, can you post your non-working code so far?
09:35martinklepschjoegallo: I added some code I stopped trying to make work as a comment
09:35CookedGryphonpuredanger: sorry, was afk. That would be much appreciated!
09:36puredangerCookedGryphon: I've applied a few simple fixes and dep bumps in core.memoize.
09:37puredangerCookedGryphon: 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
09:37martinklepschjoegallo: that code uses some other vars though
09:37martinklepscherr, locals
09:38joegalloadded a comment on your gist
09:38joegallogroup-by and a for gets you quite close...
09:38CookedGryphonpuredanger: perfect, thanks
09:38joegalloperhaps you can figure it out from here?
09:38CookedGryphon(inc puredanger)
09:38lazybot⇒ 22
09:38iamdusta1I’m having an issue using tentacles (https://github.com/Raynes/tentacles)
09:38justin_smithmartinklepsch: 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
09:39iamdusta1where only tentacles.core, orgs, repos, and issues are accessible. Trying to access tentacles.pulls is failing me.
09:39iamdusta1https://github.com/Raynes/tentacles/blob/master/src/tentacles/pulls.clj
09:39justin_smithiamdusta1: does that namespace occur in the version your are getting from clojars?
09:40agarmansomething like (for [[k v] input, x v] [(:cid x) k (dissoc x :cid)])
09:40iamdusta1justin_smith: yes. https://gist.github.com/iamdustan/64a3a56825e47a6c3a8c
09:40iamdusta1that’s in .m2/repository/tentacles/tentacles/0.2.7/tentacles-0.2.7.jar
09:40justin_smithiamdusta1: and how are you accessing tentacles.pulls?
09:41iamdusta1Currently just trying to open up my project repl with `lein repl`
09:41iamdusta1and typing (tentacles.pulls ...
09:41justin_smithyou need to require it
09:42justin_smith(require '[tentacles.pulls :as pulls])
09:42justin_smithclojure is not eager about loading potentially loadable namespaces, someone has to request that they be found and loaded
09:44iamdusta1ah! I didn’t even realize I had required the 3 others already.
09:44iamdusta1A thousand thanks justin_smith!
09:44justin_smithnp
09:44iamdusta1(inc justin_smith) I believe
09:44iamdusta1(inc justin_smith)
09:44lazybot⇒ 129
09:44iamdusta1killing it
09:44justin_smithiamdusta1: the requires are transitive, so if you required anything that required one of those, it goes through and resolves it all
09:45justin_smithbut it's best to explicitly require any namespace that you refer to rather than counting on that
09:49iamdusta1thanks for the advice!
09:54martinklepschjoegallo: your solution is really nice
09:55martinklepschjoegallo, justin_smith what do you think of the other one I put in there as a comment?
09:55martinklepsch(written by a coworker)
09:58ag0rexdo you guys know any reference for java profiling and tuning? e.g. some book that suggests techniques that are commonly used?
10:02joegallomartinklepsch: that reduce may be extractable as a (into {} ...) combined with a few other functions
10:02joegalloit's not that there's anything wrong with reduce, but sometimes the other things might be more readable
10:05tavyyhi! Does anybody know some good books or documentation about JVM optimization?
10:05tavyyDoes anybody know some good books or documentation about JVM optimization?
10:08clgvag0rex: available profiler are for example jvisualvm (free) and yourkit java profiler (affordable, academic version)
10:08clojurebotNo entiendo
10:12ehiggsHi all. Does anyone have a workaround in Fedora 20 for this bug: https://bugzilla.redhat.com/show_bug.cgi?id=1008699
10:14ag0rexclgv: thank you!
10:14clgvehiggs: 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:16clgvehiggs: http://leiningen.org/
10:16tavyyHi all! Does anybody know some good books or documentation about JVM optimization? Thank you!
10:17clgvtavyy: there are plenty, if I remember correctly one is called "Java Performance Tuning"
10:17clgvtavyy: though that is a bit old now ;)
10:20tavyyclgv: tahnk you for your answer
10:20tavyyI know that book
10:21tavyybut I'm looking something more specific for Java 8
10:21tavyybecause in Java 8 the Memory space was changed
10:21tavyyin adition to this new GC implementation was added
10:22clgvtavyy: and you experience performance problems due to that?
10:22tavyyno I didn't until now
10:23clgvis that a "maybe"?
10:23tavyybut I want to read about this because I'm interested in this subject
10:23clgvok
10:24clgvthe folks on the ##java channel have probably memorized corresponding books ;)
10:24Glenjaminthere's a decent article on G1GC somewhere
10:24tavyyok thanks for your advice
10:24dysfunthere are several good articles on G1
10:25dysfunyou might also find the jclarity mailing list interesting
10:25dysfuna lot of stuff about GC on there
10:25tavyydysfun: do you know some URL's?
10:25dysfunnot off the top of my head
10:25tavyyok I will search
10:27tavyydysfun: thank you for your suggestion :)
10:28dysfunyw
10:36ehiggsclgv: thanks.
10:38Bronsa,^{:foo (println "foo")} ()
10:38clojurebotfoo\n()
10:38Bronsa,^{:foo (println "foo")} (identity ())
10:38clojurebot()
10:38Bronsa,'^{:foo (println "foo")} ()
10:38clojurebot()
10:41clgvO_o
10:41hyPiRionhm
10:42Barleywould someone have pointers how to get the inserted row's id from the rowid that ojdbc returns? Using yesql
10:42hyPiRion,^{:foo (System/exit 0)} () ; worth a try, I guess
10:42clojurebot#<SecurityException java.lang.SecurityException: denied>
10:42hyPiRionalright, also inspects metadata. That's good.
10:44egliBarley: I don't think there is a standard was. Usually inserts return a map where one of the values is the new id
10:45Barleythe ojdbc driver just returns a oracle.sql.rowid object, can't really figure out how that's handled
10:45Barley(yes, googled a plenty)
10:50clgvhyPiRion: well it is not inspecting the metadata but the security manager denies the shutdown
10:51clgvhyPiRion: clojail usually tells you what was forbidden on the clojure level
10:51clgv&(def a 1)
10:51lazybotjava.lang.SecurityException: You tripped the alarm! def is bad!
10:51clgv&(System/exit 0)
10:51lazybotjava.security.AccessControlException: access denied ("java.lang.RuntimePermission" "exitVM.0")
10:52clgvhumm or maybe it was the inspection as well
10:52clgv,(System/exit 0)
10:52clojurebot#<SecurityException java.lang.SecurityException: denied>
10:53borkdude_soooooo, what are the implications for ClojureCLR now that .NET is being open sources? nothing?
10:54borkdude_and why the heck do I have an underscore in my name
10:57andyfBronsa: 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:57clgvborkdude_: it is?
10:57borkdude_clgv yes, they just announced
10:58egliBarley: 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:58clgvborkdude_: my it new site didn't forward that one yet
10:58clgv*news
10:59jjmojojjmojoborkdude_, (wrt the underscore) ghosting? logged in from multiple places? are you registered with nickserv?
10:59borkdude_I am registered, it must be because I logged in with two laptops yesterday I guess
10:59Bronsaandyf: yes
10:59Barleyegli: yes, they probably do come back but in a proprietary format which I can't figure out in this case
10:59Bronsa,(macroexpand-1 '(clojure.lang.Compiler/LOADER))
10:59clojurebot(. clojure.lang.Compiler LOADER)
11:00Bronsaandyf: ^ the original form is a symbol, the macroexpanded form is a seq
11:00Bronsaandyf: btw remember that bug you reported last week in t.a that turned out to be a bug in tools.reader?
11:00andyfBronsa: Makes sense. It just exposed a wrong assumption I was making to detect macroexpansions from looking at :raw-forms.
11:00Bronsaandyf: turns out it's a clojure compiler bug.
11:00egliBarley: maybe a problem with the oracle jdbc driver?
11:01Barleymaybe
11:01Bronsaandyf: http://dev.clojure.org/jira/browse/CLJ-1586
11:02andyfBronsa: Glad you tracked it back all the way to the source.
11:03puredangerI thought metadata was only preserved on collections not on seqs? am I saying something dumb?
11:03puredanger(that was my inner monologue there at the end)
11:04Bronsapuredanger: in this case compile-time metadata is lost
11:04Bronsapuredanger: e.g. (.foo ^class (a b)), if (a b) is a lazyseq, the type hint is lost
11:06Bronsapuredanger: 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:07puredangerBronsa: I'm on a call right now, stepping away (but still interested!)
11:08Bronsapuredanger: np, I added a comment on CLJ-1444 saying that CLJ-1586
11:09Bronsathat it depends on CLJ-1586*
11:16EvanRim writing unit tests
11:16EvanRwith clojure.test
11:21martinklepschwhat's the best way to thread a map through multiple update-ins ?
11:21EvanRyou can use the -> macro
11:21Bronsa,(-> {:a 1 :b 2} (update-in [:a] inc) (update-in [:b] dec))
11:21clojurebot{:b 1, :a 2}
11:23martinklepschreading 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:23Bronsawhy would you believe that?
11:25SagiCZ1So Philae made it! I hope you guys follow it!
11:27SagiCZ1http://xkcd1446.org/img/r_16-25-00_MZ7aAUNWN5.png
11:28hyPiRionfollowed the livestream, really exciting
11:29SagiCZ1so cool
11:31CookedGryphonwoop! I love that XKCD's coverage was far more useful for the casual observer than any of the news/official channels
11:33p_lthe official channels were swamped with traffic
11:33martinklepschBronsa: "making a list of it if it is not a list already"
11:34SagiCZ1CookedGryphon: not really.. my browser's cache was keeping the last image so i didnt know what the news are
11:34dbaschmartinklepsch: it’s talking about the form
11:34Bronsamartinklepsch: that means that (-> 1 inc) will be treated as (-> 1 (inc))
11:34martinklepschohhhh
11:34martinklepsch:D
11:35martinklepschok
11:35Bronsayeah the wording might be better but that's the meaning of it
11:35martinklepschok, thanks for clearing that up :)
11:39EvanRwhat is this weird notation [foo.ClassName
11:40EvanRarray of ?
11:40EvanRhow do i use this with instance?
11:40Bronsa,(Class/forName "[String")
11:40clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: [String>
11:40Bronsa,(Class/forName "[java.lang.String")
11:40clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: [java/lang/String>
11:40Bronsa,(Class/forName "[java.lang.String;")
11:40clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: [java/lang/String;>
11:40Bronsabah
11:41Bronsa,(Class/forName "[Ljava.lang.String;")
11:41clojurebot[Ljava.lang.String;
11:41EvanRdoes it even make sense to ask this in java?
11:41Bronsathere.
11:43gfredericks,(instance? (Class/forName "[Ljava.lang.String;") (into-array ["hey" "ho"])))
11:43clojurebottrue
11:43gfredericks,(instance? (Class/forName "[Ljava.lang.String;") (into-array Object ["hey" "ho"])))
11:43clojurebotfalse
11:44EvanRarray of string is a well defined class?
11:44clgv,(.getCanonicalName (Class/forName "[Ljava.lang.String;"))
11:44clojurebot"java.lang.String[]"
11:44clgv,(.getCanonicalName (Class/forName "[J"))
11:44clojurebot"long[]"
11:44EvanRwhat about array of array of string
11:45gfredericks,(Class/forName "[[Ljava.lang.String;")
11:45clojurebot[[Ljava.lang.String;
11:45gfredericks,(Class/forName "[[[[[[Ljava.lang.String;")
11:45clojurebot[[[[[[Ljava.lang.String;
11:45gfredericks^ that last one is array of array of array of array of array of array of String
11:45EvanRand i was thinking ; needed to be balanced ;)
11:45gfredericks,(Class/forName "[[[[[[Ljava.lang.String;;")
11:45clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: [[[[[[Ljava/lang/String;;>
11:59samfloresis there some leiningen plugin (or some other incantation) to show all functions missing documentation in my project?
12:00justin_smith$(->> 'clojure.core ns-publics (map (comp meta second)) (remove :doc) (map :name)) ; samflores
12:01justin_smithlazybot: ping
12:01lazybotjustin_smith: Ping completed in 0 seconds.
12:01Bronsajustin_smith: it's &
12:01justin_smith&(->> 'clojure.core ns-publics (map (comp meta second)) (remove :doc) (map :name)) ; samflores
12:01lazybotjava.lang.SecurityException: You tripped the alarm! ns-publics is bad!
12:01justin_smithd'oh, I should know that :)
12:01justin_smith,(->> 'clojure.core ns-publics (map (comp meta second)) (remove :doc) (map :name)) ; samflores
12:01clojurebot(primitives-classnames chunk-first print-method chunk *source-path* ...)
12:02justin_smithI wanted lazybot to do it because lazybot creates a refheap link with the full result
12:02justin_smithbut that should demonstrate the concept, you can just plug in your namespaces
12:02justin_smithmaybe there is a convenient way to list all namespaces under a certain lein project?
12:02samflores(inc justin_smith)
12:02lazybot⇒ 130
12:02technomancyjustin_smith: you need bultitude for that
12:03justin_smithtechnomancy: good to know it is at least possible
12:04justin_smithsamflores: one gotcha to doing it that way, is that a doc string of "" would not get caught that way
12:04justin_smithbut easy enough to catch things like that too
12:05samfloresthat one I thing I can handle :p thanks
12:05justin_smithsamflores: next, some nlp to detect crappy docstrings!
12:16Glenjamindoesn't eastwood have a doc-missing check?
12:16Glenjaminah, doesn't seem to
12:17EvanR,(= '(1 2) [1 2])
12:17clojurebottrue
12:17EvanRoO
12:18Glenjamin,(== '(1 2) [1 2])
12:18clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to java.lang.Number>
12:18Glenjaminoh, right
12:18Glenjaminbasically collections are compared structurally
12:19EvanRthat 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:19EvanRthe latter being a java array of some java type
12:20EvanRor my comparison is just not happening at all
12:21justin_smithEvanR: did you forget to call is in the test?
12:22justin_smith(that's a problem I have sometimes)
12:22EvanRi moved the (is (== into a let bound function
12:22justin_smithwell == is guaranteed to blow up
12:22EvanRand its never failing now
12:22EvanRso its not even getting called
12:22justin_smithright, == will throw an exception on anything that isn't a Number
12:23EvanRok
12:25EvanRi had (is (= foo) bar) rather than (is (= foo bar))
12:25andyfEvanR: 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:25EvanRobscured by some traces
12:25BronsaEvanR: eastwood can warn you about that!
12:25EvanRandyf: yes
12:27EvanRthat would ensure that the test is not incorrect passing, which is probably really easy to set up
12:27EvanRincorrectly passing
12:29justin_smithyeah, never trust a test that hasn't failed
12:33EvanRwriting these tests, i realize that my working code is "randomly" switching between [] and () for sequences of values
12:33EvanRunsettling
12:33Glenjamindepends if you care about the concrete sequence type i guess
12:33EvanRi certainly wouldnt if it was always the same
12:34EvanRnow i might wouldnt
12:34noonianEvanR: it is probably the same type but has just been cast to a seq
12:34EvanRif they were liskov substitutable that would be one thing
12:35EvanRbut even then, why
12:35GlenjaminEvanR: they are if you care about List
12:35Glenjaminas in, the interface List
12:35Glenjaminor Seq
12:35EvanR,(seq? [])
12:35clojurebotfalse
12:35Glenjamin,(seqable? [])
12:35EvanRinteresting
12:35clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: seqable? in this context, compiling:(NO_SOURCE_PATH:0:0)>
12:36Glenjaminerm
12:36noonian,(seq [])
12:36clojurebotnil
12:36noonian,(set [1])
12:36clojurebot#{1}
12:36Glenjamin,(sequential? [])
12:36clojurebottrue
12:36noonian,(seq [1])
12:36clojurebot(1)
12:36Glenjaminthere we go
12:36noonian,(type (seq [1]))
12:36clojurebotclojure.lang.PersistentVector$ChunkedSeq
12:36EvanRmk
12:36Glenjamin(source sequential?)
12:36Glenjamin$source sequential?
12:36lazybotsequential? is http://is.gd/jk87hH
12:36andyfEvanR: This may be overly splitting hairs on what you said, but neither lists nor vectors are subtypes of the other.
12:37EvanRnot lists, i was talking specifically about lazy seq
12:37EvanRi dont think i have any lists anywhere
12:37EvanRand i wouldnt assume they were subtypes
12:37EvanRwhich is the rub
12:38Glenjaminhrm, the docs talk about "seqable" things, but the closest matching predicate i can see is (sequential?)
12:38noonian,(doc sequential?)
12:38clojurebot"([coll]); Returns true if coll implements Sequential"
12:38noonian,(doc seq?)
12:38clojurebot"([x]); Return true if x implements ISeq"
12:38Bronsa,clojure.lang.ISeqable
12:38clojurebot#<CompilerException java.lang.ClassNotFoundException: clojure.lang.ISeqable, compiling:(NO_SOURCE_PATH:0:0)>
12:38andyfI 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:38EvanRand then theres sequable
12:38Bronsa,clojure.lang.Seqable
12:39clojurebotclojure.lang.Seqable
12:39noonian,(sequential? {:x 1})
12:39clojurebotfalse
12:39noonian,(seq? {:x 1})
12:39clojurebotfalse
12:39EvanRandyf: i dont have any specific examples of where they are different but that is essentially what bothers me
12:39EvanRwhat you said
12:39BronsaGlenjamin: seqable means that they implement c.l.Seqable, this guarantess that calling `seq` on that value will succed and return an ISeq
12:40hyPiRion,(instance? clojure.lang.Seqable {:x 1})
12:40clojurebottrue
12:40andyfThey behave differently with conj, is the example that several people have pointed out before.
12:40GlenjaminBronsa: right, but there doesn't seem to be a core predicate for that concept, despite the concept cropping up in docstrings a lot
12:40EvanRBronsa: well, unless they implement the interface by returning a null
12:40EvanRunless nl is an seq
12:40Glenjamin,(seq nil)
12:40clojurebotnil
12:40Glenjamindunno if that counts
12:41BronsaGlenjamin: there's a seqable? preidcate in core.incubator
12:41EvanRconj a lazy seq?
12:41hyPiRion,(seq? nil)
12:41clojurebotfalse
12:41hyPiRion^
12:41BronsaIIRC
12:41noonianhttp://www.brainonfire.net/files/seqs-and-colls/main.html
12:41Glenjamin,(seq? []) ; hyPiRion
12:41clojurebotfalse
12:41BronsaGlenjamin: https://github.com/clojure/core.incubator/blob/master/src/main/clojure/clojure/core/incubator.clj#L83
12:41EvanRwell im glad we cleared things up
12:41Glenjaminaha, perhaps that should be hatched
12:41Glenjaminor maybe it doesn't come up very often
12:42andyf,(= [1 2] (seq [1 2]))
12:42clojurebottrue
12:42justin_smithGlenjamin: I have copy pasted that code into at least one project
12:42hyPiRionGlenjamin: I feel it comes up rather frequently
12:42andyf,(conj [1 2] 3)
12:42clojurebot[1 2 3]
12:42andyf,(conj (seq [1 2]) 3)
12:42clojurebot(3 1 2)
12:42Glenjaminhow does one hatch an incubator function then?
12:42EvanR,(type (conj (seq [1 2]) 3))
12:42clojurebotclojure.lang.Cons
12:42andyfEvanR: ^ that is the behavior that some find very surprising
12:42Bronsathe 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:43EvanR,(type (rest (conj (seq [1 2]) 3)))
12:43clojurebotclojure.lang.PersistentVector$ChunkedSeq
12:43EvanRmatrioska
12:43Bronsait's more like the "official and unmaintained clojure utils library"
12:43llasramThe main place for that now is rhickey's head
12:43llasramamiright eh
12:43Glenjaminclojure seems duck/structurally typed rather than nominally typed, so prediates seem preferrable to me than checking (type)
12:44EvanRandyf: i didnt find the structure of the result surprising, but the class/type of the result is surprisin
12:44andyfThere are unofficial and more-often-maintained utils libraries on Github: Medley, Plumbing, useful
12:44EvanR,(type (conj [1 2] 3))
12:44clojurebotclojure.lang.PersistentVector
12:44EvanRmakes more sense
12:45BronsaI 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:45EvanRconj essentially has the type signature a -> b -> c for some dynamic types a b and c
12:46GlenjaminEvanR: you could say it has type a -> b -> a, but for lists/seqs the type of a is Seq
12:46andyfmore-often-added-to, then :)
12:46EvanRGlenjamin: thats not correct, as i just demonstrated
12:46Glenjaminor ISeq i guess
12:46Glenjamin"type" vs "interface"
12:46Glenjaminconcrete type is an implementation detail
12:47ambrosebsthe real type for conj uses higher-kinds and depends on the first argument.
12:47Bronsais it though? a sorted-map is a quite different ds than a hash-map
12:47ambrosebs*higher-kinded types
12:47Bronsaambrosebs: it's not guaranteed to be the same of the first arg though
12:47Glenjaminaha, type expert
12:47Bronsa,(let [a ()] [(class (conj a 1)) (class a)])
12:47EvanRyeah if it was expressible in terms of the interfaces that would be ok
12:47clojurebot[clojure.lang.PersistentList clojure.lang.PersistentList$EmptyList]
12:47ambrosebsno but I think you can build it in a way that's consistent
12:48Glenjamin$source conj
12:48lazybotconj is http://is.gd/Xbm7SK
12:48ambrosebseach class can encode what it "conj's" to in the type
12:48Bronsa,(let [a {1 1 2 2 3 3 4 4 5 5 6 6 7 7}] [(class (conj a [8 8])) (class a)])
12:48clojurebot[clojure.lang.PersistentArrayMap clojure.lang.PersistentArrayMap]
12:48EvanRbut it seems like the result of the conj is just "a whatever"
12:48ambrosebsbut I haven't done this to be clear
12:48Bronsa,(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:48clojurebot[clojure.lang.PersistentArrayMap clojure.lang.PersistentArrayMap]
12:48ambrosebsI've tried.
12:48Bronsawell.
12:48Bronsawhatever the threshold is.
12:48Bronsa,(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:48clojurebot[clojure.lang.PersistentHashMap clojure.lang.PersistentHashMap]
12:48Bronsathere
12:48hyPiRion8.
12:48Bronsano.
12:48Bronsanow I'm confused
12:49Glenjaminboth sides satisfy (map?) at least
12:49EvanRarraymap becomes a hashmap after like 16
12:49EvanRand lazyseq is not lazy except after like 32
12:50EvanRimportant
12:50Glenjaminhttps://github.com/clojure/clojure/blob/clojure-1.7.0-alpha1/src/jvm/clojure/lang/RT.java#L602
12:50GlenjaminIPersistentCollection -> Object -> IPersistentCollection
12:50ambrosebssomething like (All [x kret karg] [(IPersistentCollection x kret karg) (karg x) * -> (kret x)])
12:50Glenjaminnot that that is especially informative
12:50EvanRright
12:50EvanRthats why it seems like dynamictype1 -> dynamictype2 -> dynamictype3
12:50ambrosebsand each type can fill in its own karg and kret
12:51EvanRthe middle being basically the same concept
12:51EvanRthe other two have some other restrictions, PersistentCollection
12:51ambrosebsconj is polymorphic in its argument and its return type, which the type above captures
12:52EvanRrather than say polymorphic, i would call it a dynamic type, like its second argument
12:52Bronsa,(class (assoc {0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7} 8 8))
12:52clojurebotclojure.lang.PersistentArrayMap
12:52hyPiRion,(map count (partition-by (partial = clojure.lang.PersistentArrayMap) (map class (reductions #(assoc %1 %2 %2) {} (range 20)))))
12:52clojurebot(10 11)
12:52Bronsa,(class {0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8})
12:52clojurebotclojure.lang.PersistentHashMap
12:52Bronsa,(class {0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7})
12:52clojurebotclojure.lang.PersistentArrayMap
12:52EvanRdispatch mechanism isnt what i would ascribe to jargon polymorphic
12:52Bronsawhat the hell is going on there?
12:52Glenjaminthe creation threshold is different from the promotion threshold?
12:52Bronsalooks like creation vs assoc has a different threshold
12:53Bronsamaybe it's an issue of < vs <=
12:53ambrosebsEvanR: I mean its polymorphic in its 2nd+ arguments plus return type, and the 1st argument dictates *exactly* how both behave
12:53Glenjamini guess promotion is costly vs append
12:53BronsaGlenjamin: no I'd say that's a bug
12:54Glenjaminhttps://github.com/clojure/clojure/blob/clojure-1.7.0-alpha1/src/jvm/clojure/lang/PersistentArrayMap.java#L32
12:54ambrosebsI'm trying to give the most precise type possible
12:54EvanRambrosebs: ... the type of the first argument IPersistentCollection doesnt, but the implementation does
12:54EvanRessentially little more than a dynamically typed function of two arguments
12:55Bronsayup, line 200
12:55Bronsahas a >
12:55ambrosebsI disagree. it can be precisely captured with higher-kinded types.
12:55BronsaRT.map compares with a <=
12:55Glenjaminaha
12:55ambrosebsI disagree in the "little more" claim
12:55EvanRi think we have different ideas of what were able to / want to express in the type signature
12:56EvanRand what isnt being expressed
12:56Glenjaminwell one of you is writing a clojure type system :)
12:56ambrosebsthat doesn't mean much, I'm often wrong.
12:56clgv:D :P
12:56hyPiRionGlenjamin: just fyi, the HT threshold is k + v count, not entries
12:57Glenjaminyeah, array length check
12:57Glenjaminit's the < vs <= that was confusing
12:57andyfBronsa: IIRC, one can create even larger PersistentArrayMap's using transients to get there.
12:58Bronsaandyf: no I just tried
12:58Glenjaminseems 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:58ambrosebsI only disagree with EvanR implying conj doesn't have a more precise type than dyn dyn -> dyn
12:58Bronsaandyf: the only way to created a larger array-map is to use the constructor
12:58Glenjamininterface {}
12:58EvanRambrosebs: yeah, its more precise. the first and return type need to implement IPersistentCollection
12:58EvanRthey dont need to be the same, as is evident in the lazy seq implementation
12:59GlenjaminEvanR: if the type of the first argument is known by the system, the type of the return value can be known
12:59EvanRhow?
12:59clojurebotwith style and grace
12:59EvanRclojurebot: can it
12:59clojurebotTitim gan éirí ort.
13:00EvanRis this because IPersistentCollection implementation must be java code?
13:00hyPiRion,(let [t (transient {})] (dotimes [i 100] (assoc! t i i)) (persistent! t)) ; pretty sure this is 8
13:00clojurebot{0 0, 1 1, 2 2, 3 3, 4 4, ...}
13:00ambrosebsok I'm saying you can have a more precise type than IPC dyn -> IPC
13:00ambrosebsbut cool
13:00hyPiRionwell dangit clojurebot.
13:00EvanRim sure you can but im not sure we do
13:00hyPiRion,(count (let [t (transient {})] (dotimes [i 100] (assoc! t i i)) (persistent! t)))
13:00clojurebot8
13:01hyPiRion(This is the obvious way to show how to NOT use transients btw.)
13:01ambrosebsEvanR: 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:02ambrosebsfwiw I spent a lot of time thinking about this during my thesis
13:02EvanRwell i dont know enough about the system interfaces
13:02EvanR;source IPersistentCollection
13:02ambrosebsI hope to explain it better some time
13:02CookedGryphonIs there a way to feed multiple vectors into a transducer, same way as you can with map?
13:03CookedGryphonor should I just do that as my first step to produce a lazy sequence and feed it into the transducer
13:03BronsaGlenjamin: hyPiRion http://dev.clojure.org/jira/browse/CLJ-1587
13:03llasramCookedGryphon: bingo
13:04EvanRambrosebs: 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:05EvanRalso in java
13:05EvanRyou are free to return anything (even null, though im trying to ignore that)
13:05hyPiRionBronsa: inc'd
13:05hyPiRioncan do it here too actually
13:05hyPiRion(inc Bronsa)
13:05lazybot⇒ 70
13:06EvanRtells the whole story
13:15zanesIs there anything other than slamhound for clearing up unused dependencies?
13:21engblomIs 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:21engblomHow is it with java garbage collector? Can it be tweaked to get faster load times?
13:22zanesengblom: The typical usage pattern is to open a REPL when you begin working, then leave it open over the course of your session.
13:22postpunkjustinengblom: most of the startup time comes from loading all of clojure.core, and there's no way around that (yet)
13:22engblomzanes: Besides the editors and ides directly communicating through nrepl, is there a way to reload a saved file?
13:23EvanRyeah, rerequire it
13:24zanesengblom: You may want to look at clojure.tools.namespace.repl/refresh.
13:25engblomclojure.tools.namespace.repl/refresh seem to not exist.
13:26andyfBronsa: 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:26justin_smiththere is also stuartsierra's component, for when c.t.n/refresh does not suffice
13:26noonianyou need to add clojure.tools.namespace to your project dependencies first and restart the jvm
13:28justin_smithhttps://github.com/clojure/tools.namespace
13:28mi6x3mhey clojure, what is a good object type with a literal to use for testing meta stuff
13:28justin_smithengblom: zanes: to be clear, there is no "repl" in that namespace, it's clojure.tools.namespace/refresh
13:29mi6x3m() ?
13:29mi6x3mI mean, what is at least resource intensive
13:29Bronsaandyf: yes, :host-interop means "I can't figure out if it's an instance-call or an instance-field"
13:29zanesjustin_smith: False? http://clojure.github.io/tools.namespace/#clojure.tools.namespace.repl/refresh
13:29EvanRthe fastest literal
13:30andyfthx
13:30justin_smithzanes: mea culpa, it must have moved, or I misremembered
13:30Bronsaandyf: in hindsight :instance-interop might have been a better name but I don't feel like changing it now
13:31andyfI 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:31Bronsaheh
13:31andyfIt is a snap to make a linter no one wants to pay attention to.
13:32EvanRthe best kind!
13:32dnolen_engblom: lein is great, but the fastest repl setups I know are using a raw REPL (via Emacs inferior lisp) or Cursive (IntelliJ)
13:32Bronsaandyf: have you seen the numbers of downloads for eastwood 1.4 on clojars? I'd say a lot of folks care
13:32andyfWell, I am kinda hoping they are useful enough that people will find it valuable to look at the results.
13:33dnolen_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:33technomancyengblom: some notes here https://github.com/technomancy/leiningen/wiki/Faster
13:33andyfBronsa: I'm not discouraged. I just get re-reminded of the testing required to refine these things.
13:33dnolen_postpunkjustin: a raw REPL on my work desktop is like half a second
13:33hiredmaneastwood is fantastic
13:33dnolen_to start
13:34Bronsapostpunkjustin: java -jar clojure.jar clojure.core takes 0.6s in my laptop
13:34Bronsapostpunkjustin: compared to ~5s for lein repl
13:34postpunkjustinOk, fair enough.
13:34hiredmanI just wish I could use it in projects that use java.jdbc
13:35Bronsahiredman: what prevents that?
13:35hiredmanlots of arity warnings because java.jdbc fiddles with the arglist metadata
13:35Bronsaah it still does that? I thought they changed it :|
13:36dnolen_engblom: there's also a new tool called boot - maybe it's faster haven't tried it yet https://github.com/tailrecursion/boot
13:36hiredmanmaybe they did, we do not update very quickly
13:36justin_smithBronsa: dnolen_: how useful would it be to cache the result of lein classpath, and then use that as args to java?
13:37justin_smithof course one must then remember to update the classpath if you change opts
13:37technomancyjustin_smith: export LEIN_FAST_TRAMPOLINE=y
13:37technomancywill do that for you
13:37Bronsajustin_smith: I do java -cp `lein cp` all the time
13:37justin_smithtechnomancy: interesting
13:37michaniskin_it takes > 2s for clojure's core to compile and load on my macbook air
13:38Bronsamichaniskin_: clojure is distributed AOT compiled
13:38michaniskin_well it needs to populate vars and whatnot
13:38justin_smithBronsa: my idea being lein cp > cp; then repeated instances of java -cp $(cat cp) until I change project.clj
13:38hiredmanBronsa: nah, it still warns with the latest java.jdbc
13:38Bronsajustin_smith: ah, gotcha
13:39michaniskin_in boot we have pods in which we run clojure runtimes, i've done a lot of profiling of it
13:39technomancyjustin_smith: fast trampoline basically memoizes all the lein overhead and invalidates the cache when the inputs change
13:39justin_smithtechnomancy: very cool!
13:39hiredmanthe really annoying thing is the java.jdbc functiosn it warns about are in the new api, which we don't use at all
13:39michaniskin_getting a repl server started takes ~4s from a warm clojure runtime
13:39Bronsabah. I need to make a patch adding an internal :arglists so that I can at least feel I've done my part
13:39engblomThis seem to reload stuff (in this case bmi.core): (use 'bmi.core :reload-all)
13:40justin_smithengblom: 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:40michaniskin_in boot you'll get a repl in ~8s or so
13:40justin_smiththe :reload-all does not erase a def :)
13:44andyfhiredman: 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:45andyfhiredman: :exclude-linters [:wrong-arity]
13:45hiredmanyeah, I know, but then I don't get that linter for other things :/
13:45andyfhiredman: Sure. I don't have an answer for that yet. Not sure when, if ever.
13:45technomancywhat's it doing with arglists? sounds sketchy
13:46hiredmantechnomancy: it compares calls to arglists and warns if it looks like the wrong arity
13:46andyftechnomancy: :arglists are commonly assigned values useful for (doc ...) output that do not match actual number of args passed
13:46technomancyhiredman: yeah, I mean are you using undocumented arities or something?
13:46andyfI shouldn't say "commonly" -- a few macros do that.
13:47technomancythat seems like a legitimate thing to warn about
13:47hiredmantechnomancy: no, like andyf says, some libraries fiddle with arglists so they aren't real
13:47andyfI should probably create a JIRA ticket proposing the addition of :doc-arglists, if I haven't already. Can't remember.
13:47hiredmantechnomancy: http://clojure.github.io/java.jdbc/#clojure.java.jdbc/execute!
13:47technomancyhiredman: hm. I've never seen :arglists refer to non-existent arities. that sounds insane.
13:47hiredmanthat arglist is "fake"
13:48technomancytrimming :arglists to exclude internal arities is reasonable. adding ones is not.
13:48andyfExample: https://github.com/clojure/java.jdbc/blob/master/src/main/clojure/clojure/java/jdbc.clj#L664-L665
13:49clgvandyf: +1 for :doc-arglists
13:49technomancyoh man... optional args that aren't at the end... boo
13:50technomancy(dec mid-arglist-optional-args)
13:50lazybot⇒ -1
13:50andyfclojure.core set the first example here, e.g. defmulti, defn, ...
13:50justin_smithtechnomancy: check it, I made sure this would work:
13:50justin_smith(dec mid arglist optional args)
13:50lazybot⇒ -1
13:50justin_smith$karma mid arglist optional args
13:50lazybotmid arglist optional args has karma -1.
13:50technomancyjustin_smith: but, but ... my precious illusion of actual clojure syntax
13:50andyfIt 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:51hiredmantechnomancy: yet another misguided attempt to be friendly that bites power users in the ass
13:51technomancyhiredman: yeap
13:51justin_smithuser-obsequious design strikes again
13:52technomancyhiredman: if it's just one or two defns I'd be tempted to alter the meta away to fix it
14:00TimMctechnomancy: Like repeat?
14:00TimMcOh, specifically the fake arities.
14:01bbloom_i'm looking for a function i know either 1) exists 2) has a name 3) can be expressed with a simple idiom....
14:02bbloom_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:02ztellmanis there still a contrib.combinatoric?
14:03ztellmanor combinatorial or whatever
14:03bbloom_there is https://github.com/clojure/math.combinatorics but i'm not sure what i want from there, if anything
14:03dbaschztellman: you mean https://github.com/clojure/math.combinatorics ?
14:03andyfbbloom_: Not sure about implementations, and hopefully I'm not stating the obvious, but that is called a cross product in mathematics.
14:03ztellmandbasch: that's the one
14:03puredangerI've used that for lazy permutations I think
14:03TimMcbbloom_: reduce?
14:04andyfAh, cartesian-product, also
14:04justin_smithtechnomancy: so I decided to compare the timing of using a cached classpath for startup vs. FAST_TRAMPOLINE=y https://www.refheap.com/93231
14:04bbloom_i avoided saying cartesian product, b/c i wasn't sure that's what i wanted....
14:04justin_smithnot a totally 1:1 comparison, clearly nrepl vs. native clojure repl are apples and oranges
14:05technomancyjustin_smith: is this a fresh trampoline?
14:05technomancythe first run will be slow
14:05bbloom_andyf: ztellman: but i think it is, thanks
14:06justin_smithtechnomancy: not fresh, this is after running it a couple of times
14:06TimMc,(reduce #(for [x % y %2] (conj x y)) [[]] [#{1 2} #{30 40 50} #{600 700}]) ;; bbloom_
14:06clojurebot([1 50 600] [1 50 700] [1 40 600] [1 40 700] [1 30 600] ...)
14:06technomancyjustin_smith: oh, you're doing lein repl
14:06technomancyjustin_smith: try lein trampoline repl
14:06bbloom_TimMc: yeah, but i actually need a variadic / non-macro version
14:07justin_smithtechnomancy: oh, silly me, I'll check it
14:07TimMcbbloom_: I don't understand. Are you saying that [x y] is metasyntactic here?
14:08justin_smithtechnomancy: takes 5s longer with the trampoline option
14:09justin_smith(after repeated runs)
14:09bbloom_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:10csd_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:10TimMcbbloom_: (fn [& seqs] (reduce #(for [x % y %2] (conj x y)) [[]] seqs))
14:10technomancyjustin_smith: longer with trampoline than without or longer than raw repl?
14:11technomancyjustin_smith: also, can you clear out your user profile while testing?
14:11justin_smithtechnomancy: longer with the trampoline option
14:11TimMcbbloom_: 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:11bbloom_TimMc: oh, i misread your first code
14:11justin_smithtechnomancy: absolutely
14:11justin_smithyeah, some of my plugins may be messing with it for sure
14:11bbloom_TimMc: sorry / thanks
14:11TimMcbbloom_: not to say that my code is necessarily the best; I don't know what happens with larger numbers of seqs...
14:12llasrambbloom_: 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:12TEttingercsd_: :require not :use
14:12TimMc,(reduce #(for [x % y %2] (conj x y)) [[]] [#{1 2} #{30 40 50} #{} #{600 700}]) ;; just checking
14:12technomancyjustin_smith: plus possibly injections, etc
14:12clojurebot()
14:12TimMc,(reduce #(for [x % y %2] (conj x y)) [[]] [#{}]) ;; just checking
14:12clojurebot()
14:13justin_smithtechnomancy: no injections in this project I don't think, but I will double check for sure
14:13TimMc,(reduce #(for [x % y %2] (conj x y)) [[]] [#{1}]) ;; just checking
14:13clojurebot([1])
14:13bbloom_,(reduce #(for [x % y %2] (conj x y)) [[]] []) ;; no good
14:13clojurebot[[]]
14:13TimMchah, yep
14:14csd_TEttinger: it complains when using require too
14:14llasrambbloom_: A fully lazy, index-able, seq-able, reduce-able collection of the cartesian product of a collection of (index-able) collections
14:14TEttingercsd_: is this in the repl?
14:14TimMcbbloom_: You'd have to wrap it in a check that you have at least one coll.
14:14bbloom_llasram: TimMc: that fn from combinatorics seems to do the trick
14:14csd_TEttinger: trying to load into repl with C-x C-k in cider
14:14bbloom_thanks all
14:14llasramkk
14:15justin_smithLOL "-lazybot- lazybot is available, 2 hours and 4 minutes after your ping." wonder what I broke about that plugin...
14:15technomancyjustin_smith: you can look in target/trampolines to see the exact command that gets run
14:15justin_smithcool, will do
14:16justin_smithtechnomancy: weird, why wouldn't I see target/trampolines - am I using the wrong env var?
14:16TEttinger(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:16csd_TEttinger: i mean i'm trying to load the entire clj file into the repl
14:16technomancyjustin_smith: also you can time against lein trampoline run -m clojure.main to remove the nrepl overhead
14:16csd_it's not scratch work
14:17justin_smithtechnomancy: will it be like <hash-code>-init.clj?
14:17technomancyjustin_smith: one file for the shell command, one file for the clojure
14:17csd_TEttinger: is there any way to clear out the ns stuff in cider?
14:17justin_smithyeah, I misspelled the var as FAST_TRAMPOLINE=y instead of LEIN_FAST_TRAMPOLINE=y at first
14:18technomancyaha
14:18technomancyI haven't actually tried this in a while, so you had me worried there
14:18justin_smithI even added env to the command line so it would be super explicit!
14:18TEttingerI am not an emacs user, so I can't help there. I'm pretty sure someone here can answer
14:18TEttingerperhaps amalloy.
14:19csd_ok thanks
14:19technomancyjustin_smith: on this project the nrepl overhead is huuuuuge
14:19justin_smithtechnomancy: that ~halved the startup time to 10s, I'll try the -m in a few
14:19technomancyjustin_smith: nrepl is 5x clojure.main for me
14:20sdegutisHi.
14:20technomancyjustin_smith: and I'm not registering a difference between a raw repl and a fast-trampolined lein run -m clojure.main
14:20technomancythe more you know!
14:21technomancyactually lein is consistently a few hundred ms faster
14:21mearnshcan 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:21tuftgfredericks: 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:21technomancys/consistently //
14:22technomancylosing jline and tab completion is kinda rubbish though
14:22dnolen_mearnsh: performance - note it's not a pattern you should adopt in your own code
14:22justin_smithtechnomancy: https://www.refheap.com/93231 updated on the bottom, only a 1 second difference now, very nice
14:22technomancyI guess if you put it in an inferior-lisp it's not so bad
14:22justin_smithI had no idea nrepl was so heavy
14:22mearnshdnolen_: thanks
14:23technomancyjustin_smith: wow, how the deuce is my machine faster than yours; wtf
14:23technomancyI have a 2009 core 2 duo
14:23sdegutisclojars.org used to let me press [tab] in Chrome and enter into a search-mode in the address bar, but no longer.
14:23technomancyjustin_smith: https://www.refheap.com/93234
14:24technomancyoops, misread the numbers
14:24technomancynever mind
14:24technomancyI have gotten a repl up in under a second, but that was with more tuning
14:24sdegutisAlso PLEASE put change logs in your repos somewhere. Everyone, please.
14:24sdegutisI 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:25technomancyjustin_smith: time echo "(System/exit 0)" | lein update-in : assoc :bootclasspath true -- trampoline run -m clojure.main
14:25technomancy^ cuts another 30%
14:25justin_smithoh, interesting
14:26aperiodictechnomancy: could you explain what :eval-in :classloader does?
14:27technomancyaperiodic: it runs project code in the same JVM as lein, attempting to isolate the project in its own classloader.
14:27technomancyit has some problems
14:27technomancythe bootclasspath tricks lein plays to boot itself more quickly don't play nicely with classloader isolation, basically
14:28sdegutisAlso it makes it harder to change Clojure versions afaik.
14:29sdegutisYour code then runs in whatever version Leiningen is using, and that's that.
14:29technomancyyep
14:29sdegutisI had to update speclj to account for that at one point.
14:29aperiodictechnomancy: does that cause the sort of weird, impossible-seeming issues that make you think you're going insane?
14:30technomancyaperiodic: well... contact your healthcare professional, but yes
14:31technomancysdegutis: iirc that was even worse; it used eval-in :leiningen which doesn't even try to isolate anything
14:33sdegutisAh right.
14:33razum2umis there any browser-js clients to nrepl besides of gorilla-repl out there?
14:33sdegutisI am going to try to use React.
14:35Glenjaminrazum2um: as in you type in the browser, and it runs some clojure?
14:36razum2umyes, but I need more than tryclj
14:36razum2umI really like gorilla's graph abilities
14:36Glenjaminah, i only know of ways to type in a terminal, and it runs in a browser
14:37razum2umcurrently I need to analyse geo-data which would be *really* simplier if it will be in browser on google maps, than in terminal
14:37postpunkjustinrazum2um: there's also Session
14:37postpunkjustinhttps://github.com/kovasb/session
14:38Glenjaminlighttable might work?
14:38Glenjamineditor pane + browser pane
14:39razum2umpostpunkjustin: nice, thanks
14:42razum2umGlenjamin: 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:44justin_smithrazum2um: if you make it output a url, many terminals can make that clickable
14:44razum2umactually 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:44justin_smithrazum2um: if I understand what you are doing...
14:44dbaschrazum2um: could you use geohashes?
14:44justin_smithrazum2um: have you looked at gorilla-repl?
14:44justin_smithgorilla-repl renders all of those things inline
14:44razum2umjustin_smith: yes, mentioned it earlier
14:45justin_smithsorry, I have not read the full scrollback
14:45razum2umand ithink it's a good approach, but as I said, it's very specialized to be a notebook for methematicians
14:45razum2um*for doing math notebooks
14:47razum2umsecondly, 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:49justin_smith(inc technomancy)
14:49lazybot⇒ 156
14:49Glenjaminif you're after a tool to help you build the visualisation, i think lighttable is fairly close
14:49justin_smithfor walking me through making my lein boot super-fast
14:49Glenjaminyou can connect a cljs repl to a browser pretty easily, but it's still 2 panes next to each other
14:49Glenjaminso not quite integrated
14:50technomancyjustin_smith: adding the raw repl tips to the wiki
14:50justin_smithcool
14:51technomancyjustin_smith: feels like maybe the wiki page needs more google juice or something
14:51justin_smithtechnomancy: yeah, got a link? my results when google that suck
14:51justin_smithnever mind, found it
14:55technomancyhttps://github.com/technomancy/leiningen/wiki/Faster/_compare/6263b19%5E...6263b19
15:05SagiCZ1,(read)
15:06clojureboteval service is offline
15:06SagiCZ1can 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:06sdegutis,3
15:06clojurebot3
15:06SagiCZ1,(read)
15:07SagiCZ1,5
15:07clojureboteval service is offline
15:07clojurebot5
15:07sdegutis,2 + 3
15:07clojurebot2
15:07sdegutisOh wow it returned 5.
15:07sdegutis,1 + 0
15:07clojurebot1
15:07sdegutisNice!
15:07sdegutis,*clojure-version*
15:07clojurebot{:interim true, :major 1, :minor 7, :incremental 0, :qualifier "master"}
15:07SagiCZ1sdegutis: seriously?
15:08SagiCZ1that five was mine
15:08justin_smithSagiCZ1: it may make more sense to define a function that calls read, performans some other actions, maybe recurs
15:08amalloySagiCZ1: sdegutis is an artful troll
15:08justin_smithSagiCZ1: then if you run that function, it should work until you return control to the repl
15:08amalloySagiCZ1: trying to read from *in* while connected over swank or nrepl, like to cider or to lein repl, has historically had problems
15:09amalloymaybe the state of the art is that someone's finally figured it out
15:09SagiCZ1amalloy: i would like it to read it when i hit enter.. that doesnt happen
15:11justin_smithSagiCZ1: works for me in a bare terminal
15:11justin_smithtools have trouble with this stuff though
15:11SagiCZ1ok it seems to be my repl's issue
15:11sdegutisamalloy: :P
15:12sdegutisamalloy: that's the closest to a compliment that I've ever gotten, so I'll take it :)
15:12SagiCZ1i just need to control my script a little bit.. i guess i will throw some quick seesaw for this purpose
15:16justin_smithSagiCZ1: if its a script you should be running lein run anyway
15:16sdegutisUpdating dependencies in project.clj is always a little nerve-racking.
15:20SagiCZ1justin_smith: why is that?
15:24justin_smithSagiCZ1: to me a script means something you launch from the command line, as opposed to an interactive repl-oriented function
15:24justin_smithmaybe that's just me though
15:24SagiCZ1justin_smith: yeah that would make sense
16:07EvanRis there a conventional exception class to use if you detected that someone used your function with the wrong type at runtime
16:07bbloom_EvanR: assert is fine
16:08EvanR,(assert false)
16:08clojurebot#<AssertionError java.lang.AssertionError: Assert failed: false>
16:08EvanRAssertionError, k
16:08EvanRill use this in my tests
16:08bbloom_if you don't expect anyone to catch it, the exception class really doesn't matter
16:08EvanRok so theres a "should thrown some exception" test
16:09bbloom_generally, those are useless b/c any failure gets caught
16:09bbloom_test a regex against the exception message, ignore the class
16:09EvanRim trying to write a test to make sure my function does crash on common bogus inputs, rather than not crash
16:10EvanR"test failed, should have crashed"
16:11amalloyEvanR: (is (thrown? Throwable (blow-up)))
16:12EvanRok
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{blake}With the exception under JBOSS being, if I go to "/app/" instead of "/app", it does work.
16:16{blake}So maybe I just need to route "/app" to "/app/"?
16:17mgaare{blake}: the guys in #immutant probably know more about what's going on there
16:18m1dnightis there a defacto style guide for clojure? Perhaps one that Rich Hickey accepts?
16:18{blake}mgaare: Tx.
16:19{blake}m1dnight: I always thought it was "whatever Emacs does".
16:19justin_smithm1dnight: probably something very close to bbatsov's guide, it's on github
16:19m1dnightOkay, I saw that one and many many many others
16:19justin_smithsome disagree with him regarding when
16:19m1dnightso that's my reason for asking
16:19justin_smithotherwise pretty accepted
16:20technomancybbatsov's guide, plus reading the list of issues people have opened with it =)
16:23EvanRi heard that its possible deactivate asserts for production to increase performance
16:24amalloymost 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:24hiredmanI still can't believe that jerk closed my pr
16:24hiredmanhttps://github.com/bbatsov/clojure-style-guide/pull/31
16:27sdegutishiredman: :/
16:27TimMchiredman: haha
16:27sdegutishiredman: he's probably just new to open source and doesn't understand the culture
16:28hfaafb:-)
16:30aaelonyI prefer "whatever helps me understand this code in a better manner" as a style guide, rather than 4 spaces or other silly rules.
16:30EvanR4 spaces? is that the rule?
16:31aaelonysorry, 2 spaces (https://github.com/bbatsov/clojure-style-guide)
16:34TimMc"whatever notepad.exe does"
16:35amalloyTimMc:  U+FEFF
16:35amalloymandatory before all ns clauses
16:36sdegutisWhat is this (io!) macro all about?
16:36sdegutisI've never heard of it before.
16:36amalloysdegutis: nobody uses it
16:37amalloyyou'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:37amalloyin practice that's absurd
16:37sdegutisSo let's use it?
16:38amalloynot least because dosync is a lot rarer now than it was in like clojure 0.x when atoms didn't exist yet
16:39TimMcamalloy_: Good point! I wonder what happens.
16:39EvanRintriguing
16:43bjaany marceline users here that have tried to use a ClojureSpout as a trident spout using t/new-stream?
16:44EvanR,(io! 'launchMissiles)
16:44clojurebotlaunchMissiles
16:44justin_smithbja: I think sorenmacbeth may have some input on marceline
16:46TimMcamalloy_: "Exception in thread "main" java.lang.RuntimeException: Unable to resolve symbol:  in this context, compiling:"
16:55jcrossley3{blake}: re
16:56jcrossley3{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:56jcrossley3if 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:58jcrossley3{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:00jcrossley3{blake}: if you're just pulling in org.immutant/web, it's no more overkillish than any other web server
17:01jcrossley3{blake}: and :context should be available to you without immutant if deployed as an uberwar.
17:03jcrossley3{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:08jcrossley3{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:30TimMcWhat do you mean "a value"?
17:30amalloy_{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:32bjaI would probably handle that via environ and then use lein-environ if I wanted to manage the setting via project.clj
17:32technomancybja: or by nginx config in production
17:32technomancyrewrite rules etc
17:32{blake}Well, I'm targeting JBoss with a WAR...
17:33technomancyI'm sure it's got an analogous config
17:33bjaenviron can pull stuff out of properties. you could even skip environ and just read the properties directly
17:33amalloy_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:33technomancyimo that's not an application-level concern
17:34{blake}I feel like I'm doing this wrong.
17:34{blake}technomancy: yes!
17:36jcrossley3{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:38jcrossley3{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{blake}Seems like all the paths should be wrapped in context, which is (I think) part of Compojure?
17:48bbloom_is it just me or does github change (for the worse) their clojure syntax highlighting on a weekly basis?
17:49mdrogalisbbloom_: Yup D:
17:54amalloybbloom_: i think they just source the highlighting from some other project
17:54hfaafbis it fun to make CRUD web apps in clojure
17:54amalloyi thought it used to be pygments, but it doesn't seem to be anymore
17:54bbloom_isn't it their "linguist" library?
17:55bjahfaafb: define fun?
17:55bbloom_https://github.com/github/linguist
17:55bjaI don't find it fun to make CRUD web apps in any language
17:56amalloybbloom_: linguist doesn't contain any rules for clojure that i can find
17:56amalloyit seems to just import stuff from ace
17:56bbloom_ah, it probably relies on ace for highlighting
17:56amalloyhttps://github.com/ajaxorg/ace/blob/3b85ddfa051527f8feafd29a25f0fda9e95fc406/lib/ace/mode/clojure_highlight_rules.js
17:57bbloom_linguist does the language detection
17:57amalloyhasn't changed since april
17:57bbloom_well, i dunno when it changed
17:57bbloom_but their color scheme is ugly lately for clojure
17:58amalloyoh ew. the styling, not the highlighting logic
17:58amalloyyes, that is awful
17:58amalloyand new
17:58bbloom_it's like a rainbow of ugly
17:59amalloyi don't think it changes *often*, but the latest change really is grotesque
17:59amalloylike just a day or two ago it looked fine
17:59dbaschis it just clojure? I’m looking at some java code and it looks uglier too
17:59TimMcIt's a little odd I guess.
18:00amalloydbasch: right, they use the same css for every language
18:00bbloom_heh, apparently lots of folks on twitter also think it is ugly
18:00amalloybbloom_: in fairness, every time github changes something everyone complains loudly and then grows to like it
18:00amalloyi recognize myself as one of those people
18:01bbloom_amalloy: yeah, that's true of most things
18:01bbloom_but the color scheme has changed several times over the past few weeks
18:01hiredmaneastwood needs a linter for bad preconditions
18:01bbloom_i want it to 1) stop changing with high frequency
18:01amalloythis change though...i really hate the loss of bolded text and the drastically reduced contrast
18:01bbloom_and 2) to settle on a relatively non-neon theme
18:01hiredman(defn f [...] ...) (defn g [...] {:pre [f]} ...)
18:02amalloybbloom_: one sec while i send you a screenshot of my beautiful neon emacs. you will hate it
18:04amalloyhttp://i.imgur.com/EsCZdfI.png
18:04bbloom_barf.
18:04bbloom_i find black backgrounds basically unreadable in any lighting conditions
18:04amalloybbloom_: for sure it's not *pretty*. but the high contrast really helps me read stuff
18:05amalloyi wouldn't force this theme on anyone else
18:05bjado you enjoy this theme?
18:06bbloom_unrelated to themes, i made a thing: https://github.com/brandonbloom/ambiparse
18:06amalloybja: are you asking me if i like the color scheme i picked for my own use?
18:07bbloom_it was surprisingly stressful to implement b/c matt might's racket code that i ported was totally above my head
18:07TimMcamalloy: That doesn't have enough colors.
18:08amalloyTimMc: idea: add variety to a color theme by gradually changing it as you scroll through the document
18:09amalloybyte 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:12amalloysadly the red will flicker like mad, and the green will stay the same except in a particularly long file
18:12anneliesbyebye
18:13aperiodicamalloy: do it in HSV
18:13aperiodicoh then it's all black, huh
18:14amalloy$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:14lazybotMessage saved.
18:15TimMcDear Alan,
18:15TimMcThank you for your kind advice.
18:15TimMcSincerely,
18:15TimMcTim
18:15TimMc(The grandmother of a friend used IM that way.)
18:15amalloyheck i generally just take off in the middle of a discussion too, but i thought that would be too radical a suggestion
18:15postpunkjustin$mail TimMc it's more fun to use lazybot
18:15lazybotMessage saved.
18:17amalloyspeaking of $mail, did you guys know that $unmail is a thing?
18:17amalloyi bet justin_smith knows
18:17TimMcwhoa
18:18justin_smithamalloy: I somehow missed it
18:18hyPiRionamalloy: I do too, but that's because I usually never know when a discussion actually ends
18:18TimMc$unmail amalloy
18:18lazybotDeleted unread messages from TimMc to amalloy
18:18TimMc$unmail 
18:18lazybotDeleted unread messages from TimMc to 
18:19TimMcI bet it even works in PM!
18:19justin_smith$unmail justin_smith
18:19lazybotDeleted unread messages from justin_smith to justin_smith
18:19justin_smith$unmail unmail
18:19lazybotDeleted unread messages from justin_smith to unmail
18:33l1xhi guys
18:33l1xhas anybody solved this problem in clojure? /msg NickServ identify
18:33l1xnot that one
18:33bjal1x, which problem?
18:34l1xhttp://www.mitbbs.com/article_t/JobHunting/32772891.html
18:34l1xthis
18:59dbaschl1x: I think this works https://www.refheap.com/93254
19:12dbaschl1x: actually https://www.refheap.com/93255
19:44andyfhiredman: Please add any comments you have, especially complete examples you would like to see warnings for, to Eastwood issue #89
19:47amalloyRaynes: 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:47lazybotWarn about bad pre/postconditions -- https://github.com/jonase/eastwood/issues/89 is open
19:47amalloydangit, it totally does, but not in PM?
19:48RaynesI think you're answering your own questions right now.
19:48amalloyRaynes: i hope you die soon in a mysterious way that doesn't implicate me at all
19:48Raynesily2bb
19:48andyfSorry, I get lazy about pasting links when doing irc via iPhone
19:49amalloyseriously though i sent lazybot a PM with that text and he didn't respond to me with a link. what a jerk
19:49RaynesHe's a big meanie
19:49RaynesIt should probably respond to pms
19:49amalloyandyf: no worries. i figured having a link would be easier for hiredman or whoever else, so i added one
19:50amalloyi see. in PM he doesn't respond to any of the :privmsg hooks, only to commands. is that a regression?
19:50amalloycc justin_smith
19:52amalloyyeah, it must be a regression. you can't PM him clojure eval requests anymore, even
19:53justin_smithamalloy: hmm - could be an incompatibility between irclj versions that needs adapting
19:53justin_smithamalloy: I didn't change privmsg handling specifically
19:54justin_smithamalloy: that sucks - working on some client stuff right now but I will check that out
19:58amalloythanks, justin_smith. i did a quick lookover, but it's been ages since i touched this stuff and nothing leaps out at me
19:59justin_smithamalloy: right, my suspicion is it is something that would have been semi-automatic before but now needs to be more explicitly set up
19:59justin_smiththis has been the pattern for each part of updating for the new irclj
20:00justin_smiththe 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:01justin_smithAHAHA
20:01justin_smithsomewhere he is using his own nick where he should be using the user's
20:01justin_smithlook for instances of :nick outside the plugins, one of those needs to be :user-nick...
20:01justin_smithor I will do it, of course
20:02justin_smithhe is getting your &eval commands, he is then sending the result to himself
20:02kenrestivoso, 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:03justin_smithkenrestivo: the glorious thing about 2's compliment is that it just works
20:03justin_smithkenrestivo: until the number is larger than the max val for signed, then it's a little weird
20:03kenrestivoit doesn't, in my experience. the byte order is flipped.
20:03justin_smithare you sure?
20:03justin_smithhttp://en.wikipedia.org/wiki/Two's_complement
20:03kenrestivonot 100%, could run some more tests, but that's what it looks like
20:04justin_smithkenrestivo: are both sides the same endianness?
20:04kenrestivoi'm looking into it. it might want network order, i'm on a little-endian platform
20:04justin_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:05hiredmanwell, 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:05justin_smithhiredman: if you want to pass things larger than the max size for signed, sure
20:05justin_smithbut for lower, it works
20:06amalloyjustin_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:06kenrestivoah, ok. i've done that trick with ints to get bytes. suppose i could use it with longs to get ints.
20:06justin_smithamalloy: that would be it, yeah... my bad
20:06hiredmanI am not sure how that is going to interact with jna though
20:07justin_smithamalloy: no, actually
20:07kenrestivohiredman: yeah, there's a lot of moving parts here
20:07justin_smithamalloy: I set it up as :bot-nick (for the bot's own name) and nick
20:07justin_smithamalloy: in irc.clj
20:07benzapHello peeps
20:07benzaphow is everyone doing?
20:24amalloydsantiago: 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:31amalloyor if anyone else happens to know, of course i'm happy to hear about it
20:36l1xdbasch: thanks man!
20:38l1xdbasch: i think it does not cover certain edge cases but i try to understand and make it work
20:39dbaschl1x: do you have test cases?
20:39l1x(println (coins [1 1 1 1 0]))
20:39l1xor 111111 or 000000
20:42dbaschl1x: yeah, it’s easy to fix
20:43l1xwell i don't understand your code yet :)
20:47dbaschl1x: partition-all instead of partition, and a check that cc is not empty
20:47dbaschI mean c is not empty
20:48dbaschthe idea is: split the list into runs of 0s or 1s, examine them in windows of (at most) three consecutive groups
20:49dbaschif the middle group is of length 1, that’s what you flip
20:49dbaschand add up the lengths of the three groups
20:50dbaschif not, you keep the longest side and flip one of the middle group
20:53kenrestivogawd i love debugging tools. i'm doing (ioctl fd 0x70 0x20), and the kernel driver is is receiving cmd=0xa92ea8cc, arg=0x70
20:53kenrestivoso there's a ghost pointer arg being sent by someone, somewhere. time to spelunk through clojure-jna source...
20:55l1xdbasch: thanks i try that and also try to understand
20:58kenrestivogah, jna is broken. (jna/invoke Integer c/printf "Umm, number: %d\n" 5) prints "Umm, number: -1464804696"
21:04kenrestivoaand... it's platform-specific :-(
21:06amalloy&(format "%x" -1464804696)
21:06lazybot⇒ "ffffffffa8b0daa8"
21:07kenrestivohmm, that same pointer
21:07amalloy&(format "%x" (int -1464804696))
21:07lazybot⇒ "a8b0daa8"
21:07kenrestivosimilar address area anyway
21:07amalloykenrestivo: are you sure you want Integer, and not like Integer/TYPE? i don't know much about clojure jna
21:08kenrestivofollowing the docs pretty closely there, but i'll try that
21:08amalloyoh, i see you are using the example from the readme
21:08kenrestivothat 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:08amalloyright
21:09kenrestivoseems like something (clojure-jna? jna?) is stuffing a pointer into the list of args passed
21:09l1xdbasch: it seems it returns incorrect answers
21:09danielcomptonI'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:09kenrestivowhat's baffling to me is why it works on x86-64 but not on arm
21:10dbaschl1x: example?
21:10danielcomptonIt seems that the hash-set values have changed
21:10l1x (println (coins [0 1 0]))
21:10danielcomptonhttps://github.com/Factual/skuld/blob/master/test/skuld/net_test.clj#L14
21:10l1xthe adjacency is 0 for this if you flip 1 bit it becomes 2
21:10dbaschl1x: my version prints 3
21:10danielcomptonI know that there were changes to the hashing algorithm, but I wouldn't expect it to affect set equality?
21:10l1xbut you return 3
21:11dbaschl1x: [ 0 0 0] = 3
21:11l1xwell the original task was about adjacency for the neighbors
21:11l1x(0 0) (0 0)
21:12l1xso it should be 2
21:12l1xat least this is my understanding
21:12hiredmangenerally the way that upgrade ends up breaking things is places where people depended on ordering of items in sets or maps
21:12dbaschl1x: no, otherwise the example wouldn’t be 4
21:13dbaschl1x: oh, maybe you’re right
21:13hiredmandanielcompton: you've printed out the sets you expect to be equal?
21:14l1xdbasch: i think, but this is a f'ed up task for an interview
21:14danielcomptonhiredman: https://www.refheap.com/93260
21:15justin_smithamalloy: 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:15hiredmanusing map to print like that is hard to read
21:16hiredmanand you can't map over sets like that, they are unordered collections
21:17hiredmanyou are taking items from each set and comparing them, but the sets are giving you things in different orders
21:17dbaschl1x: in any case, with that understanding it’s easier (almost the same code)
21:18hiredmanit 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:19hiredman,(= (doto (java.util.HashSet.) (.add :a)) #{:a})
21:19amalloyhiredman: i think it actually works: if either one of them is a persistentcollection then = calls pcequiv
21:19clojurebottrue
21:19danielcomptonhiredman: I know I can't map over the sets, I was just trying to print each element individually
21:19hiredmandanielcompton: you are doing an equality comparison too in that pastebin
21:20danielcomptonhiredman: that was just for sanity debugging
21:20danielcomptonhiredman: the failing test is at https://github.com/Factual/skuld/blob/master/test/skuld/net_test.clj#L26
21:21hiredmandanielcompton: have you changed anything else? e.g. changed the fressian dependency?
21:22hiredmanlikely fressian is deserializing things differently for whatever reason
21:22danielcomptonhiredman: the tests all pass with all of the other dependencies upgraded, leaving clojure at 1.5.1
21:22hiredmannot sure how that is mucking with whatever
21:23hiredmandanielcompton: so when you run the tests with a prn there for both of those sets, what does it print?
21:23amalloy1.6 did change how things hash, didn't it?
21:24hiredmanyes
21:24danielcomptonamalloy: https://github.com/clojure/clojure/blob/master/changes.md#24-hashing
21:27hiredmanI would be tempted to guess some kind of race condition in the test, but I am not familiar enough with skuld
21:27danielcomptonhiredman: now I think about it, I'm pretty sure that the serialisation has been changed in 1.6
21:27danielcomptonhiredman: the test is comparing a list of messages, with the same messages sent through the HTTP interface and reserialised
21:27andyfOrder of deftest execution can change with 1.6 due to hash changes , iirc
21:28hiredmandanielcompton: which? I mean I would expect the fressian serialization to depend on the version of the fressian library, not the version of clojure
21:28hiredmanandyf: oof, I had forgotten about that, what a pain
21:29danielcomptonandyf: do you mean ordering of each atomic test? Surely test contents don't get reordered?
21:29hiredmandanielcompton: have you printed out the contents of the sets when running the test?
21:29andyfReply I got was: yeah, sounds normal. Deftest were never guaranteed to run in any particular order
21:29danielcomptonhiredman: 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:29amalloydanielcompton: i'm with hiredman, you want to print out the entire set contents, not just each item
21:29amalloyi bet one of them has more elements than the other
21:29andyfWithin a deftest, you get order. Between them, no guarantee .
21:30hiredmandanielcompton: well, if the essages are handled in a different order, and done happens early for whatever reason
21:30amalloyeg, (= #{1} #{1 2}) is false, but (map = #{1} #{1 2}) returns '(true), so it looks equal
21:30danielcompton#{{:x "foo"} {:x 1} {:vec [1/2 yo], :set #{"foo" :a}} {:x {:hi 2}} {:done? true}}
21:30danielcompton#{{:vec [1/2 yo], :set #{"foo" :a}} {:x "foo"} {:x 1} {:x {:hi 2}} {:done? true}}
21:32amalloyand those two don't compare as equal?
21:33danielcomptonamalloy: nope
21:33andyfThey compare equal in my 1.6.0 repl if I quote the yo's ...
21:34amalloywell, 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:34dsantiagoamalloy: Sorry, I have no idea.
21:34amalloyif not, you get to figure out why two sets with contents which are equal don't compare as equal
21:38danielcomptonamalloy: I think I've got it. The serialised message is of type java.util.HashSet, where the original one is clojure.lang.PersistentHashSet
21:39danielcomptonthese 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:39amalloyright, i thought that was obvious from your first paste. but that doesn't explain why they don't compare as equal
21:39andyfClj-1372
21:40amalloybecause they do indeed hash the same for me in 1.7, at least
21:40andyfNot sure if that is the cause yet
21:41amalloyand also in 1.6
21:41amalloyoh, but if you call hash instead they don't
21:43danielcomptonamalloy: 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:44andyfNot 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:46andyfdanielcompton: Changing received values to persistent sets before comparison may be a good idea
21:46andyfUnless that means more global changes to your code, in which case more thought is in order
21:59andyfOK, an example consequence of Clojure 1.6.0 hashing enhancements, combined with CLJ-1372 behavior, that seems relevant to your case:
21:59andyf,(= (set [1000 2000]) (HashSet. [1000 2000]))
22:00clojurebot#<CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: HashSet, compiling:(NO_SOURCE_PATH:0:0)>
22:00andyf,(import ?(java.util HashSet))
22:00clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: ?>
22:00andyf(import '(java.util HashSet))
22:00andyf,(import '(java.util HashSet))
22:00clojurebotjava.util.HashSet
22:00andyf,(= (set [1000 2000]) (HashSet. [1000 2000]))
22:00clojurebottrue
22:01andyf,(= (set [(set [1000 2000]) {:a 1}]) (set [(HashSet. [1000 2000]) {:a 1}]))
22:01clojurebotfalse
22:01andyffinally
22:01andyfThe different hash values for persistent vs. Java HashSet causes set membership checks to fail in PersistentHashSets.
22:02TEttingeraaaaaa my brain
22:03andyf,(contains? (set [(set [1000 2000]) {:a 1}]) (set [1000 2000]))
22:03clojurebottrue
22:03andyf,(contains? (set [(set [1000 2000]) {:a 1}]) (HashSet. [1000 2000]))
22:03clojurebotfalse
22:06danielcomptonandyf: Clojure printing HashSets and PersistentSets as #{} makes it trickier to spot
22:06andyfdanielcompton: violent agreement
22:08andyfI 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:10danielcomptonandyf: I'll put down my example. hopefully because it's using fressian it'll be an example close enough to home
22:10andyfMight 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:12danielcomptonandyf: I'm kinda thinking it's more an issue with fressian serialising persistent sets as hash sets
22:12danielcompton(dec hash)
22:12lazybot⇒ -1
22:15andyfI 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:17andyfI see Lang Martin is speaking at Clojure meetup in San Francisco tomorrow evening. Are they involved with skuld by any chance?
22:21danielcomptonandyf: not sure but I don't think so
22:52danielcomptonI have no idea what a class world is and I don't really want to know