2015-11-04
| 02:54 | jonathanj | are there i18n libraries for clojure that anyone can recommend? |
| 02:59 | ju5tu5 | anyone who has done cluster computing using clojure please post back |
| 03:13 | vijaykiran | ju5tu5: what's your question ? |
| 04:01 | owlbird | how to use profiles while deploying a war file. |
| 04:01 | owlbird | lein with-profile dev ring server - OK |
| 04:02 | owlbird | lein with-profile beta ring uberwar, and then deploy the target/xxx.war to tomcat, config is NULL |
| 04:26 | tdammers | huh, nasty surprise |
| 04:26 | tdammers | tagging an object with metadata can change its type, apparently |
| 04:27 | vijaykiran | tdammers: huh ... do you have handy example ? |
| 04:27 | tdammers | nothing concise |
| 04:28 | tdammers | what I have here is a library I wrote that uses deftypes and protocols |
| 04:28 | tdammers | in a nutshell, it's a parser and an AST, and every possible AST node type has its own deftype |
| 04:28 | tdammers | but now I want to tag those nodes with the original source position, so I thought I'd use metadata for that |
| 04:29 | lezacy | hello, there are any plans to add clojure to sdkman ??? |
| 04:30 | tdammers | on closer inspection, it doesn't seem to change the type, it blows up with a ClassCastException: TextNode cannot be cast to clojure.lang.IObj |
| 05:23 | Leonidas | how can I specify --no-sign to leiningen? |
| 05:23 | Leonidas | lein vcs tag --no-sign |
| 05:23 | Leonidas | error: unknown option `no-sign0.14.5-SNAPSHOT' |
| 05:26 | jonathanj | is anyone using yada in a serious fashion? |
| 05:27 | Leonidas | oh, updating to 2.5.3 made that work. |
| 05:28 | vijaykiran | Leonidas: which version of lein are you using ? |
| 05:28 | vijaykiran | Leonidas: ah - just saw that upgrade fixed :) |
| 05:35 | marshzor | does anyone have any good articles or resources on how to organize clojure namespaces? I have a single page reagent application and it's just one huge 'core' namespace, I'd like to refactor it to be more organized... |
| 05:44 | kungi | marshzor: So whats keeping you from refactoring it? |
| 05:44 | kungi | Just found https://github.com/venantius/ultra ... This looks really nice |
| 05:45 | marshzor | kungi: nothing, just looking for something to read about how and why to organize namespaces, common pitfalls, best practices, etc |
| 05:48 | kungi | marshzor: Hmm I don't know of any such tutorial. |
| 05:48 | marshzor | okay well ty anyway kungi |
| 05:54 | vijaykiran | marshzor: start with the "single-responsibility" guideline |
| 05:56 | marshzor | ty vijaykiran |
| 06:48 | sameerynho | does any one used AVOUT before ? |
| 07:11 | mpenet | the DailyMail used to, but not anymore (outstanding bugs & inactivity if I recall) |
| 08:55 | stain | what is the best way in Clojure to receive from a Java parse() method that takes a callback interface? I am looking to make a lazy sequence or something (transducers?) as I only need to process the stream once. |
| 08:55 | stain | (interface: https://jena.apache.org/documentation/javadoc/arq/org/apache/jena/riot/system/StreamRDF.html sent to https://jena.apache.org/documentation/javadoc/arq/org/apache/jena/riot/RDFDataMgr.html#parse-org.apache.jena.riot.system.StreamRDF-java.lang.String- ) |
| 08:56 | stain | it sounds like a queue.. or would the clojure.core.async be more appropriate? |
| 09:03 | Monalisa | Hi... I just came across this so I have no clue about Clojure. But Id like to know... what kind of apps is it used for?, is it compiled or interpreted?, can I use it without any knowledge of Java?, any role in web development? |
| 09:03 | Monalisa | thank you |
| 09:03 | stain | I would need to start the read() in a new thread as it would be blocking to do all the parsing (and thus all the callback calls) |
| 09:04 | stain | Monalisa: anything you like, but used particularly for web applications (even frontend with ClojureScript) |
| 09:05 | stain | Monalisa: on the JVM Clojure methods are compiled to JVM bytecode in the background. However you can also run it interpreted.. as it happens on the REPL shell (try lein repl) |
| 09:05 | Monalisa | so its both, compiled (Clojure) and interpreted (ClojureScript), a little like VB? |
| 09:05 | stain | you can force compilation if you need to make class files to use back from Java code |
| 09:06 | stain | ClojureScript is also compiled, but to Javascript |
| 09:06 | stain | so you won't have access to Java objects (e.g. java.lang.String) from ClojureScript |
| 09:06 | Monalisa | OK, I understand. Thank you very much. |
| 09:07 | stain | but you should not normally need to worry too much about compilation or not :) |
| 09:08 | stain | if you write a clever algorithm in Clojure, it will likely run just as fast (or even faster) than the Java equivalent - as Clojure-style of functional programming can mean much less object allocations than in Java-style OO programming |
| 09:09 | mpenet | well "faster" is very unusual |
| 09:09 | stain | but most people using Clojure I think are either doing: a) Some modern web app, interfacing to say CouchDB. Clojure libraries for web are refreshingly simple to use. b) Data analysis, using various libraries for clojure and Java in unison to make some kind of report or derived data |
| 09:10 | snowell | Not to mention clojure code is roughly 1/10 the size of equivalent Java code |
| 09:10 | Monalisa | yes... I'm in Web Development and I came across Light Table. I read it supports Clojure but I literally have no clue about it so I was curious about the language and its applications... this is very useful, thanks again. |
| 09:11 | stain | mpenet: yeah, it's tricky to get it into faster as the Java compiler is so good.. you would have to pump your algorithm full of type hints and use basic types. |
| 09:11 | mpenet | Even then, I can't think of a single example. Unless you mean with lazyness, but it doesn't count in my book. |
| 09:12 | mpenet | same about allocs, but that said clojure performance is very decent |
| 09:13 | stain | why doesn't lazyness count? That is (until Java 8) quite awkward to do in Java |
| 09:13 | mpenet | because you can't compare something that does a computation vs something that doesn't |
| 09:14 | mpenet | and say it's more performant |
| 09:14 | mpenet | imho |
| 09:14 | stain | :) |
| 09:17 | qsys | true, you can't compare apples with oranges, but the final result is: if I do the same in idiomatic Java - hu, does it exist? - or in idiomatic clojure, performance in clojure is pretty much similar or better in clojure. |
| 09:18 | stain | thanks, qsys, that was my point.. that if you just go about your business as things happen in that language, then you don't need to be too concerned about Clojure performance |
| 09:18 | stain | (startup time is still bad though!) |
| 09:36 | jonathanj | i found https://github.com/danielsz/system but it seems like i have to manually run (reset) to have it reload my code? |
| 09:36 | jonathanj | while ring-server will reload code as it changes, which is a lot smoother |
| 09:39 | jonathanj | seems like that feature is only available when using system and boot... why? |
| 09:41 | visof | hi guys |
| 09:42 | jonathanj | why would i use boot over lein? |
| 10:01 | marshzor | can anyone recommend a clojure linter? |
| 10:02 | Bronsa | there's eastwood |
| 10:02 | marshzor | that's the only one I've found so far, I'll give it a shot I guess |
| 10:26 | ambrosebs | Bronsa: should this just be [a] ? https://gist.github.com/frenchy64/1894dc532577833931f5 |
| 10:26 | ambrosebs | seeing as it's a :const node |
| 10:44 | Bronsa | ambrosebs: I need to look into this, tbh I don't think the semantics of :val are clear |
| 10:44 | ucb | is there any way to report which test is being run via lein test? (these are clojure.test tests) |
| 10:45 | justin_smith | ucb: it will report on failure, but you can always add printlns |
| 10:45 | ucb | I was hoping I could have a scrolling list of tests being run |
| 10:45 | justin_smith | if you use "testing" this can add more context around a group of is calls |
| 10:46 | ucb | mostly because I have some tests that might hang indefinitely (I know, it's bad) and I'd like to know when they do |
| 10:46 | ambrosebs | Bronsa: I have pretty much no idea what "quote" means in various contexts. Seems to just come and go randomly. |
| 10:46 | justin_smith | yeah, you would need printlns for that |
| 10:46 | ucb | so the solution is to add a println at the beginning of the test? |
| 10:46 | justin_smith | or a fixture that prints before running each test I guess |
| 10:47 | Bronsa | ambrosebs: |
| 10:47 | ucb | yeah, but I can't really print anything meaningful there, can I? |
| 10:47 | Bronsa | ambrosebs: the issue is that it's not really clear when something should be a :quote->:const vs when it should just be a :const |
| 10:47 | justin_smith | ucb: no, since it is passed the function and not the var, and the function doesn't really give a readable result when printed |
| 10:48 | ambrosebs | Bronsa: ok |
| 10:48 | Bronsa | Compiler.java only has ConstExpr but that has its own issues aswell |
| 10:48 | justin_smith | ucb: I could see making a "print,test,print" macro |
| 10:48 | Bronsa | ATM I don't think anything in :const is strictly wrong as much as it's inconsistent |
| 10:49 | Bronsa | i.e. in some occasions we get a :quote+:const with no 'quote in :val and sometimes we get :const with 'quote in val |
| 10:51 | ambrosebs | Bronsa: ok, the new :const behaviour makes more sense |
| 10:52 | Bronsa | yeah well, the *old* :const behaviour was wrong :) |
| 10:53 | ambrosebs | Bronsa: right. It did break my recursive type inference tho. |
| 10:53 | ambrosebs | ['a] suddenly is of type (HVec [(List* 'quote 'a)]) |
| 10:53 | ambrosebs | :) |
| 10:54 | Bronsa | IIRC the old behaviour would just blindly drop *all* quotes no matter how nested |
| 10:54 | Bronsa | so '['['a]] would -> [[a]] |
| 10:54 | Bronsa | or something like that |
| 10:55 | Bronsa | which is fine if all the elements inside a const are anything but symbols and lists |
| 10:55 | ambrosebs | or sprinkle in a :quote or something. |
| 10:55 | ambrosebs | but I think you're right. |
| 10:55 | Bronsa | but if they are either symbols or lists, then evaluation changes |
| 10:56 | Bronsa | ambrosebs: pattern matching AST nodes is hard :) lots of potential ways to represent the same node |
| 10:57 | jjttjj | anyone familiar with incanter 1.9, specifically incanter-zoo? having trouble with the zoo function returning only one row: https://www.refheap.com/111377 |
| 10:57 | Bronsa | tools.analyzer tries to be as self-consistent as possible in the way nodes are repsented but sometimes it's impossible |
| 10:57 | ambrosebs | https://www.irccloud.com/pastebin/fzettnFC/ |
| 10:58 | Bronsa | ambrosebs: yeah |
| 10:59 | Bronsa | ambrosebs: I guess what contributes to the confusion is the use of []. if we were comparing '('a) with ''(a) then suddently the difference would make more sense |
| 11:29 | ambrosebs | Bronsa: is the type of a :quote node just the type of aits :expr? |
| 11:29 | ambrosebs | so far that's worked |
| 11:30 | ucb | justin_smith: right, gotcha, thanks. |
| 11:55 | gfredericks | I have a test.check API design conundrum |
| 11:55 | gfredericks | I want to add a generator for doubles; and it should probably be configurable in a few ways |
| 11:55 | justin_smith | a conundrum! |
| 11:55 | gfredericks | which implies you could call (gen/double {...opts...}) |
| 11:56 | gfredericks | but if you want default behavior, users would expect to be able to use `gen-double` the same way they use `gen/int`, but making it a function means they have to use `(gen/double)` instead |
| 11:57 | gfredericks | could also have two different generators so you can have both APIs, but that also feels weird |
| 11:58 | gfredericks | what would you, dearest IRC user, expect to find? |
| 12:02 | justin_smith | gfredericks: clearly this would be easier in ruby where access and invocation are blurred |
| 12:03 | justin_smith | gfredericks: it's difficult, for uniformity everything would have to become an invocation (or maybe deref?), but I see a clear advantage of things that are more static |
| 12:03 | gfredericks2 | yeah I thought of that. let's all switch to ruby real quick |
| 12:03 | justin_smith | heh |
| 12:04 | justin_smith | how many options will gen/double accept? enough so that you couldn't reify each option as its own variant? |
| 12:04 | Bronsa | ambrosebs: yeah |
| 12:04 | gfredericks2 | yeah, you want to control at least min, max, infinities, NaN |
| 12:05 | justin_smith | gfredericks: which means you define gen/double00 gen/double01 ... gen/double15 |
| 12:05 | TMA | gfredericks2: I would go with gen/double that is used the same as gen/int and provide the optionful variant as gen/double* |
| 12:06 | gfredericks | TMA: yeah I was just thinking of that exact naming convention |
| 12:06 | gfredericks | and the gen/double docstring would mention gen/double* |
| 12:07 | gfredericks | okay I think this isn't terrible |
| 12:07 | justin_smith | gfredericks: definitely do not do it via a global or thread-bound var that controls the behavior of gen/double |
| 12:08 | gfredericks | justin_smith: the evilest thing I thought of was an object that's both a generator and a function that returns a generator |
| 12:08 | justin_smith | oh, wow |
| 12:09 | gfredericks | that might require low-level changes actually; generators are currently defrecords, andy ou can't override a defrecord's IFn behavior |
| 12:10 | TMA | if it would be posible to use (def my-gen-double (gen/double* ...) and then use my-gen-double it would be a great bonus |
| 12:10 | justin_smith | gfredericks: I'm totally going to make a webcomic with a character named andy ou and bad kerning |
| 12:10 | gfredericks | TMA: that's how things normally work |
| 12:11 | gfredericks | justin_smith: is that two characters? |
| 12:11 | gfredericks | or the comic text would have pervasive bad kerning? |
| 12:11 | justin_smith | gfredericks: with bad kerning you can never tell |
| 12:11 | justin_smith | whether it's two characters in question, or just one |
| 12:11 | gfredericks | perfect |
| 12:12 | gfredericks | so my next conundrum is about generating large integers in a portable way |
| 12:13 | justin_smith | clj / cljs ? |
| 12:13 | gfredericks | the problem statement is that all test.check's normal integer functions only generate things in the range -200 -> +200, which is good for certain uses but horrendous in others |
| 12:13 | gfredericks | yeah |
| 12:13 | gfredericks | so it'd be nice to have a way to generate integers and get big stuff too |
| 12:13 | gfredericks | I feel like in clj that means generating longs and BigInts |
| 12:13 | gfredericks | so you could e.g. get 300 digit numbers sometimes |
| 12:13 | gfredericks | but in cljs the best you can do is -2^53 - +2^53 |
| 12:14 | gfredericks | give or take |
| 12:14 | gfredericks | I guess another option to be a bit more equitable is to have the clj version only generate Longs |
| 12:14 | gfredericks | and then have a special clj-only generator that gets Even Bigger |
| 12:14 | justin_smith | gfredericks: intuitively it makes sense to me that you would have more distinctions between integral types than the host platform does |
| 12:14 | gfredericks | gen/large-int being the portable version, and gen/really-large-int being clj-only |
| 12:14 | justin_smith | rather than fewer |
| 12:15 | gfredericks | you could even extend gen/really-large-int to cljs via goog.math.Integer |
| 12:17 | gfredericks | okay well I think this is looking promising |
| 12:18 | gfredericks | only other thing I have to do is bite the bullet and create gen/let |
| 13:52 | kungi | Is there a linter for clojure which finds unused functions in my codebase? |
| 13:56 | justin_smith | kungi: I think you can ask eastwood to warn about unused functions |
| 13:58 | justin_smith | kungi: actually no, looks like eastwood does not currently check for that - maybe it could be easily added though, given the kind of data eastwood already collects |
| 13:59 | kungi | justin_smith: thank you |
| 14:00 | justin_smith | it will warn for unused namespaces though... (by default that warning is off) |
| 14:21 | pndpo | Hello! |
| 14:37 | jonathanj | does anyone have personal experience using boot and why one would choose it over lein? |
| 15:17 | WorldsEndless | Basic question: how can I produce a SINGLE map from a (for) that produces keys and values? I keep getting a {{:map "of"}{:more "maps"}} |
| 15:19 | ucb | WorldsEndless: assuming your for looks like (for [a-map some-maps] ...) you could just (apply merge some-maps) |
| 15:19 | ucb | or even (reduce merge some-maps) |
| 15:19 | ucb | that'll give you a map with all the k/vs from the maps |
| 15:19 | ucb | keep in mind you'll get k/v pairs overwritten if they clash |
| 15:24 | WorldsEndless | In my case the for is looping over a vector of javascript objects, extracting the keword and value from them |
| 15:24 | amalloy | you cannot possibly produce a map from a for comprehension: it always produces a sequence. rather, you take the sequence it produces and then make a map from that |
| 15:25 | gfredericks | also see plumbing.core/for-map |
| 15:25 | WorldsEndless | amalloy: Right. I've been trying variations of "into", "merge", "reduce" but can't seem to get the dual results to be bare |
| 15:26 | WorldsEndless | Seems like I need to destructure the product of (for) somehow |
| 15:27 | WorldsEndless | Right now it's just this: |
| 15:27 | WorldsEndless | (for [i form-seq] (if (not-empty (.-name i)) {(keyword (.-name i)) (.-value i)})) |
| 15:27 | WorldsEndless | Which gives me a map of maps |
| 15:27 | WorldsEndless | Rather, a sequence of maps |
| 15:28 | justin_smith | ,(into {} (for [[k v] [[:a 0] [:b 1]]] [k (* v v)])) |
| 15:28 | clojurebot | {:a 0, :b 1} |
| 15:28 | justin_smith | haha, bad numbers to use in that example |
| 15:28 | justin_smith | ,(into {} (for [[k v] [[:a 10] [:b 11]]] [k (* v v)])) |
| 15:28 | clojurebot | {:a 100, :b 121} |
| 15:28 | WorldsEndless | I'm going to have to stare at that for a second... |
| 15:29 | justin_smith | WorldsEndless: into takes [k v] vectors and makes a map |
| 15:29 | justin_smith | ,(into {} [[:a 0] [:b 1]]) ; so just return a vector with two elements at each step |
| 15:29 | clojurebot | {:a 0, :b 1} |
| 15:31 | justin_smith | well into with a map does - you can use into with other types too |
| 15:32 | WorldsEndless | I use into with for a lot; but something must have been wrong in my syntax previously. Wrapping the pairs in a vector, it's working now |
| 15:33 | WorldsEndless | Thanks, justin_smith |
| 15:35 | gfredericks | generating a double in an elegant way takes a lot of concentration |
| 16:10 | hiredman | |
| 16:36 | patchwork | I am getting a StackOverflowError when using enlive to parse html... and I have a try/catch around it but it doesn't seem to catch it |
| 16:36 | patchwork | Is there something special about stack overflows that make them uncatchable? |
| 16:36 | justin_smith | are you catching Exception or Error? |
| 16:36 | justin_smith | because Error is not a subclass of Exception |
| 16:36 | patchwork | ??? Oh man |
| 16:36 | patchwork | I'm sure there is a good reason for that.... |
| 16:37 | luma | errors are not meant to be caught |
| 16:37 | mavbozo | error means can't continue, exception means can or might continue. i think i read that somewhere from a clojure book |
| 16:38 | luma | "An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch. Most such errors are abnormal conditions." |
| 16:38 | patchwork | By the way, stackoverflow.com has ruined all searches for issues with actual stack overflows |
| 16:38 | justin_smith | lol |
| 16:39 | patchwork | So, really this is a parse error in the html and I want to just continue if it fails... will I have problems with that? |
| 16:39 | patchwork | Likely it is a bug in enlive if it can produce stack overflow errors |
| 16:42 | patchwork | Ah, I see I cannot even catch a StackOverflowError |
| 16:52 | noncom|3 | i need to make a button that would download a html file generated by reagent as a doc file, how can i do this? is this possible to somehow do this from a web page? |
| 16:53 | noncom|3 | ideally i have a piece of page that is generated by reagent. i would like to call the function that generates the piece, have reagent render the html, and download the text file, assigning a custom name to it, like "report.doc" |
| 16:54 | justin_smith | noncom|3: yeah, you can absolutely make a button that does that with some cljs - if you look up examples for "generating a file for download" or similar I think there are examples out there |
| 16:54 | noncom|3 | okay, sounds good |
| 16:54 | justin_smith | I did it with my app via some interop |
| 17:16 | justin_smith | haha, clojure.lang.Util.sneakyThrow |
| 17:21 | cfleming | Ok, JDK6 is making me crazy. |
| 17:22 | cfleming | I can't compile my Clojure code under JDK6, because I get the "Insufficient permissions to access window server" error. |
| 17:22 | cfleming | Setting java.awt.headless=true doesn't help. |
| 17:22 | cfleming | So now I have this ridiculous frankenbuild where I have to shell out to JDK7 to compile my Clojure. |
| 17:23 | justin_smith | because you need to support jdk6? |
| 17:23 | cfleming | Now when I'm trying to run under JDK6, I need the jsr166y jar for the reducers ns. |
| 17:23 | cfleming | justin_smith: Yeah, it's still the best option for IntelliJ on the Max |
| 17:23 | cfleming | Mac |
| 17:24 | cfleming | Unfortunately, although the jsr166 page says the jar is usable with JDK6, jsr166y/ForkJoinPool has a major.minor of 51.0 (JDK 7) |
| 17:26 | cfleming | Which makes no sense, since IIRC ForkJoin came in JDK 7 |
| 17:27 | Glenjamin | ,(-> 1 (+ 1) (doto prn) (+ 1)) ; anyone know of a nice shorthand equivalent to this, but which works with ->> ? |
| 17:27 | clojurebot | eval service is offline |
| 17:33 | rhg135 | ~clojurebot |
| 17:33 | clojurebot | clojurebot will become skynet |
| 17:33 | rhg135 | I see |
| 17:36 | noncom|3 | Glenjamin: equivalent to doto in such a situation? |
| 17:44 | justin_smith | ,(->> 1 (+ 1) (#(doto % prn)) (+ 1)) |
| 17:44 | clojurebot | eval service is offline |
| 17:44 | justin_smith | :P |
| 17:44 | justin_smith | Glenjamin: I don't know if that is "nice", but at least it's correct in behavior |
| 17:47 | noncom|3 | justin_smith: what would be the best reagent function to render html to a string? |
| 17:48 | noncom|3 | render-to-string? |
| 17:48 | justin_smith | I'm not sure actually - but that sounds promising |
| 17:48 | noncom|3 | :D |
| 18:24 | Schrostfutz | How do I append two strings to each other? |
| 18:24 | justin_smith | Schrostfutz: str |
| 18:24 | justin_smith | this won't change either string, it will create a new one |
| 18:25 | Schrostfutz | justin_smith: thanks |
| 19:41 | xeqi | is there a protocol I can use in c.j.jdbc to define how to act like a db-spec? Wanting to use something like https://github.com/weavejester/duct-hikaricp-component without forcing other system pieces to reach into the :spec key |
| 19:47 | gfredericks | anybody think there's a way to reverse the bits in a 52-bit JS integer in less than 52 steps? |
| 19:49 | TEttinger | gfredericks: maybe. http://graphics.stanford.edu/~seander/bithacks.html#ReverseParallel |
| 19:50 | gfredericks | oh geez |
| 19:50 | gfredericks | that'd be hella weird to try to adapt to 52 bits |
| 19:50 | gfredericks | ~52 is not a power of 2 |
| 19:50 | clojurebot | You don't have to tell me twice. |
| 19:50 | TEttinger | you're not the only one doing hella weird low-level code |
| 19:51 | amalloy | gfredericks: i don't think it's that hard to adapt for not being a power of 2. just round down every time you divide by 2, and leave the middle bit in the middle |
| 19:52 | justin_smith | middle bit? |
| 19:52 | justin_smith | ah, in a nibble, right |
| 19:52 | gfredericks | amalloy: man I dunno there's gonna be some complimications |
| 19:53 | amalloy | complimications left as an exercise for the reader |
| 19:53 | arrdem | that's called cheating amalloy |
| 19:53 | gfredericks | ~complimications |left| as an exercise for the reader |
| 19:53 | clojurebot | Ok. |
| 19:53 | arrdem | Would someone with better elisp-foo than me please review https://github.com/gstamp/align-cljlet/pull/10 ? |
| 19:53 | arrdem | hacked that out b/c it's been driving me up the wall, but my elisp is uh poor at best. |
| 19:53 | gfredericks | ~protip is <reply> Don't complimicate -- simplificafy. |
| 19:53 | clojurebot | Ok. |
| 19:56 | TEttinger | gfredericks: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators |
| 19:57 | TEttinger | anything bitwise uses 32 bits only in js |
| 19:57 | gfredericks | yeah |
| 19:57 | gfredericks | could do it in two steps if there was a 32 reverser though |
| 19:57 | TEttinger | sure |
| 19:58 | gfredericks | bitwise ops on signed ints are enough of a headache; why not do bitwise ops on integers embedded in doubles WHY NOT IT WILL BE GREAT |
| 19:58 | gfredericks | I think they're also signed |
| 19:59 | TEttinger | they are |
| 20:17 | TEttinger | gfredericks: got it |
| 20:17 | TEttinger | ,(let [b 15] (unchecked-byte (bit-shift-right (unchecked-multiply-int (bit-or (bit-and (unchecked-multiply-int b 0x0802) 0x22110) (bit-and (unchecked-multiply-int b 0x8020) 0x88440)) 0x10101) 16))) |
| 20:17 | clojurebot | eval service is offline |
| 20:18 | TEttinger | man... |
| 20:18 | TEttinger | b = ((b * 0x0802LU & 0x22110LU) | (b * 0x8020LU & 0x88440LU)) * 0x10101LU >> 16; |
| 20:18 | TEttinger | this only uses 32-bit operations |
| 20:18 | TEttinger | that works on one byte |
| 20:21 | gfredericks | what's going on here |
| 20:21 | gfredericks | is this supposed to be a 52-bit reverser that works in cljs? |
| 20:21 | gfredericks | or an 8-bit? |
| 20:22 | TEttinger | byte reverser in 7 ops, uses only 32 bit operations |
| 20:22 | TEttinger | hm |
| 20:23 | TEttinger | but then you'd need to get each byte in palce |
| 20:23 | TEttinger | place |
| 20:26 | TEttinger | I don't even know how you'd access the higher 20 bits |
| 20:43 | Niac | ,(+ 152 8 3 3 2 2 4) |
| 20:43 | clojurebot | eval service is offline |
| 20:43 | Niac | ,(+ 152 8 3 3 2 2 4) |
| 20:43 | clojurebot | eval service is offline |
| 20:43 | arrdem | ,1 |
| 20:43 | clojurebot | eval service is offline |
| 20:43 | arrdem | what are you good for clojurebot |
| 20:44 | rhg135 | ~this |
| 20:44 | clojurebot | this has been another episode of gfredericks in wonderland |
| 20:45 | rhg135 | how fitting xD |
| 20:45 | arrdem | heh |
| 20:53 | gfredericks | TEttinger: the high bits you get via division |
| 20:54 | arrdem | gfredericks: the fuck |
| 20:54 | gfredericks | arrdem: hiya |
| 20:55 | amalloy | gfredericks gets high via bit division |
| 20:55 | arrdem | heh |
| 20:56 | arrdem | oh got it so the bit shift ops will do silly things, but div still works |
| 20:56 | gfredericks | ain't that the truth |
| 20:56 | gfredericks | arrdem: right |
| 20:56 | gfredericks | I sure hope it does |
| 20:56 | arrdem | hah |
| 20:57 | gfredericks | ~you |never can tell| with javascript |
| 20:57 | clojurebot | You don't have to tell me twice. |
| 20:58 | rhg135 | ~you |
| 20:59 | clojurebot | you are http://images2.fanpop.com/images/photos/3000000/Arrowed-teen-girl-squad-3099521-570-420.jpg |
| 21:00 | rhg135 | I'm done |
| 21:00 | gfredericks | ~this |
| 21:00 | clojurebot | this is very easy to do with loop |
| 21:00 | gfredericks | ~this |
| 21:00 | clojurebot | this is not allegro |
| 21:00 | rhg135 | ~bots |
| 21:00 | clojurebot | bots are annoying, except for clojurebot |
| 21:01 | rhg135 | so clojurebot killed lazybot |
| 21:02 | arrdem | a vile deed |
| 21:27 | puredanger | gfredericks: HA HA HA IN MY OWN PERSONAL MAVEN HELL |
| 21:28 | TEttinger | puredanger: I know the feeling |
| 21:28 | puredanger | gfredericks: I am still working on yer test.check build. it's a whole ball of dependency nastiness in the various maven and hudson bits |
| 21:28 | TEttinger | is it encoding stuff that's causing trouble, by any chance? |
| 21:28 | puredanger | nah, this is old old problems |
| 21:29 | puredanger | with maven 3 and hudson compatibility |
| 21:29 | gfredericks | oh man oh man |
| 21:30 | puredanger | test.check uses cljc, which requires latest clojure-maven-plugin, which has dependencies that require maven 3, which the minor version of hudson we're using did not (yet) support well |
| 21:30 | puredanger | everything builds fine for me locally, it's just in the ci box that there are problems |
| 21:30 | puredanger | I will likely have to update hudson which probably no one has done in years |
| 21:31 | arrdem | 0_0 |
| 22:22 | gfredericks | omg I think I did it |
| 22:23 | gfredericks | I wrote a generator for doubles in test.check, got it to generate this list (https://www.refheap.com/111386), and it generated the exact same set of numbers in cljs |
| 22:27 | gfredericks | it's harder than it sounds because of the extra particular way I'm generating them, using lots of stupid Math/Double methods that aren't available in JS |
| 22:45 | TimMc | You got doubles math to be consistent between JVM and JS? |
| 22:45 | owlbird | which jdbc library is better? I got clojure.jdbc, clojure.java.jdbc |
| 22:50 | gfredericks | TimMc: right; I mean it shouldn't be too surprising since presumably they're targeting the same spec; but doing something non-trivial in the face of the different APIs is a mess |
| 22:50 | gfredericks | owlbird: I've never heard of clojure.jdbc |
| 22:52 | TimMc | gfredericks: I'm impressed anyway. |
| 22:53 | gfredericks | things from the jvm I had to implement raw: Long/reverse, Math/getExponent, and Math/scalb |
| 22:54 | gfredericks | now to measure how embarrassingly slow the cljs version is |
| 22:56 | gfredericks | only 9x slower; that's fine I guess |
| 23:12 | gfredericks | okay so my double generator has four options: :infinite?, :NaN?, :min, and :max |
| 23:12 | gfredericks | by default infinities and NaNs are on |
| 23:13 | gfredericks | does it make sense to say if you supply a :max, the positive infinity gets disabled, and similar for min/negative? |
| 23:13 | gfredericks | but the NaN stays on? |
| 23:46 | TEttinger | holy crap gfredericks |
| 23:46 | TEttinger | the stuff you're doing for tests is amazing |
| 23:47 | TEttinger | gfredericks: I think unless the min is greater than 0.0 or the max is less than 0.0, then NaN should be possible |
| 23:47 | TEttinger | but I think you can only generate NaN by dividing 0.0 by 0.0, or requesting it specifically |
| 23:47 | TEttinger | and if you can specifically request NaN, then you don't have a max or min |
| 23:49 | rhg135 | Is NaN even a good idea, for the next language I implement |
| 23:50 | gfredericks | I've never associated NaN with 0.0 |
| 23:50 | gfredericks | I think you can get it a variety of ways |
| 23:50 | gfredericks | e.g. |
| 23:50 | gfredericks | ,(+ Double/POSITIVE_INFINITY Double/NEGATIVE_INFINITY) |
| 23:50 | clojurebot | eval service is offline |
| 23:50 | gfredericks | &(+ Double/POSITIVE_INFINITY Double/NEGATIVE_INFINITY) |
| 23:51 | gfredericks | you'll have to take my word for it |
| 23:52 | amalloy | there are indeed a few ways |
| 23:53 | amalloy | rhg135: if you support IEEE floating point you have no choice, and if you don't support it then i don't see a reason to include nan |
| 23:54 | gfredericks | I'm of the strong opinion that floating point should be syntactically second class in all new languages going forward |
| 23:55 | gfredericks | I'll shout loudly at anybody who says otherwise |
| 23:55 | rhg135 | Hmm, it's an alternative to throwing, and I don't think anyone should use any language I make, so no amalloy |
| 23:57 | gfredericks | welp there went my whole day https://twitter.com/gfredericks_/status/662131518098309120 |
| 23:58 | rhg135 | But, gfredericks, few men can say that |