2014-12-12
| 00:35 | gastove | Evening, all. I've just done a brew update/upgrade, and now `lein` is choking trying to import defrecords from other projects -- throws a class not found exception. |
| 00:35 | gastove | Has anybody else.... run in to this? Have any sage advice? |
| 00:37 | gastove | For instance, I'm using Adam Wynne's `twitter-api`, and `(import '[twitter.callbacks.protocols AsyncStreamingCallback])` (which worked earlier today) now throws a class not found exception. |
| 00:37 | gastove | Bizarre but true: the project still lein-compiles perfectly. |
| 00:41 | justin_smith | a lein version change shouldn't even be able to effect that |
| 00:41 | rritoch | gastove: I have a similar problem with protocols/lein. I compiled clojure itself with leiningen and now the protocols aren't loading, they're throwing class not found exceptions. A class not found exception means the applied classloader can't find the class. When it comes to protocols I suspect it means the protocol was compiled into a classloader that isn't in the current classloader or ancestor |
| 00:41 | rritoch | I can get a REPL from the uberjar, but I get class not found errors when trying to use this new build as a dependency. |
| 00:43 | gastove | justin_smith: agreed. And yet; this was all working this morning, and now is totally hosed, and I am running real low on theories. |
| 00:43 | justin_smith | gastove: it is easy to change your lein version |
| 00:43 | justin_smith | "lein upgrade [v] |
| 00:43 | justin_smith | " |
| 00:44 | gastove | justin_smith: heh. Point. I might try that, see if anything changes. But your point is a good one -- it *shouldn't* do a damn thing. |
| 00:44 | justin_smith | gastove: one more thing - have you run lein clean? |
| 00:44 | gastove | justin_smith: yep. Hasn't helped. |
| 00:48 | gastove | Oh, and rritoch: the word 'protocol' in what I'm trying to import is a bit of a confusing choice -- it doesn't refer to a Clojure `protocol.` |
| 00:49 | rritoch | gastove: Ok, in my case it is clojure protocols, or more specifically, the extend-protocol generated classes that aren't showing up. |
| 00:49 | gastove | *nods* |
| 00:49 | gastove | Yeah, in this case it's all `defrecords`. |
| 00:50 | gastove | Just.... which I knew what the hell is going on :/ |
| 00:50 | gastove | *wish |
| 00:51 | rritoch | gastove: defrecords are implemented by deftype so your problem is probably occuring with deftype also. |
| 00:51 | gastove | rritoch: oh good. -__- |
| 00:53 | rritoch | gastove: I would suggest you create a java class with a static initializer block that prints out debug messages identifying what classloader the class was loaded with, and then extend the java class you created, compare the hash to the hash of the currently applied classloader, usually the baseLoader. |
| 00:54 | gastove | rritoch: that's.... pretty clever. Well played. |
| 00:54 | rritoch | gastove: If you don't get any output, that would indicate the class never loaded, otherwise you can track down why the classloader tree isn't what you need it to be. |
| 00:59 | rritoch | gastove: That is probably what I need to do, but I'll need to manipulate the extend-protocol to automatically apply my classloader logging base class. |
| 00:59 | rritoch | gastove: My issue is more system wide, I think I broke everything :) |
| 00:59 | gastove | It's using the URI Classloader, which seems... fine. And the jar is getting on the classpath... |
| 01:00 | gastove | rritoch: I mean, this is affecting every project on this computer. Sooooo good? |
| 01:02 | rritoch | gastove: I really don't know any more about the issue right now. I just know the paths I plan on taking to solve my similar issue. I'm going to check the original clojure vs the uberjar now though |
| 01:02 | gastove | Good luck! |
| 01:03 | rritoch | gastove: Ok this is what I found, in the ant compiled clojure the protocols I'm missing were AOT compiled. |
| 01:04 | rritoch | gastove: Specifically I'm misising clojure.core.protocols* |
| 01:04 | gastove | ....huh. |
| 01:05 | rritoch | gastove: What I'm suggesting is look into your target ... classes folder |
| 01:05 | rritoch | gastove: If your using AOT compilation |
| 01:06 | rritoch | gastove: The problem may be that leiningen isn't compiling the class you need. At least that appears to be what my problem is. |
| 01:06 | gastove | Yeah -- just did. But: no AOT compilation, in my project or in the 3rd-party I'm having trouble importing. |
| 01:06 | justin_smith | gastove: I assume your require the namespace before trying to import the classes? |
| 01:09 | rritoch | gastove: Ok, I found something worthy of note, the clojure.core package contains two clojure files, protocols.clj and reducers.clj, in my case only reducers was compiled but reducers isn't compiled by the ant system since it's in alpha state |
| 01:10 | rhg135 | I'm starting to question the validity of my choice to port lazybot to use datomic |
| 01:10 | TEttinger | rhg135, there are kinda a lot of uses of mongo in there huh |
| 01:10 | rritoch | gastove: I'm going to comment out the reducers and see if that fixes my problem. If it does than that means there is a bug where leiningen is only compiling certain things from one file in a package, possibly indicating something went wrong without throwing an exception. |
| 01:11 | gastove | justin_smith: actually, I haven't been, and it's been working fine... |
| 01:11 | gastove | But, uh. |
| 01:11 | gastove | I just added that. |
| 01:11 | gastove | And now it's working great. |
| 01:11 | gastove | So, uh.... |
| 01:11 | gastove | Well done! |
| 01:12 | gastove | Way to be better at clojure than, um, I am. |
| 01:12 | rhg135 | TEttinger: not much but it's heavily entwined with mongo |
| 01:12 | rhg135 | And schemaless db in general |
| 01:12 | justin_smith | gastove: there is no magic in "import" that causes clj files to be loaded |
| 01:13 | justin_smith | gastove: so if clojure is generating the class you need, you need something to load that clojure code. |
| 01:13 | gastove | justin_smith: so I am reading right now. Now what I'm wondering is, how the *fuck* has this been working so far? |
| 01:13 | gastove | Welp. |
| 01:13 | justin_smith | gastove: I think lein may have changed its policy about :aot |
| 01:14 | justin_smith | where it does so less often than it had in the past |
| 01:14 | rhg135 | But I have gotten the fortune plugin working |
| 01:14 | gastove | justin_smith: it reassures me to think that there might be an explanation here in which I'm not just an idiot. |
| 01:14 | justin_smith | :aot causes the files to be loaded, you see |
| 01:14 | justin_smith | haha |
| 01:14 | gastove | justin_smith: ah, gotcha. |
| 01:14 | gastove | justin_smith: well, thanks for learning me a thing! |
| 01:14 | rritoch | justin_smith: Lol, I bet that is my problem also. Maby the REPL doesn't require onto these protocols since clojure has them precompiled, but since this custom build didn't precompile them the project depending on this custom builds REPL is crashing. |
| 01:15 | justin_smith | no idea |
| 01:15 | justin_smith | you could try explicitly requiring the namespaces I guess |
| 01:17 | rritoch | Do you think technomancy would accept such a trivial change to lein? The code would be more correct, technically, but it is unnessisary code with the current versions of clojure. |
| 01:17 | rritoch | As much as possible I'm trying to do things without modifying leiningen. |
| 01:22 | rritoch | Anyhow, commenting out reducers didn't do anything to help. It removed all the reducers class files but didn't cause the protocols classes to be generated. |
| 01:24 | rritoch | Actually, every time I type lein compile, clojure.core.protocols is on the list of files that need to be recompiled, even without any modifications |
| 01:25 | rritoch | If I can figure out what all these files have in common, maybe I can resolve the issue. |
| 01:31 | rritoch | The only thing I can see is they have some variant of extending a class, proxy, defmethod, and/or extend-protocol |
| 01:33 | rritoch | Two are using :refer-clojure :exclude, one of which uses :refer-clojure :exclude and doesn't actually extend any classes. |
| 01:42 | rritoch | Lol |
| 01:42 | rritoch | I found the solution. |
| 01:42 | rritoch | The problem was that I was using the master branch to compile with instead of a release branch |
| 01:43 | rritoch | I switched to use 1.7.0-alpha4 as the compiler clojure version and all the files compiled |
| 01:47 | rritoch | Anyhow, the leiningen compiled clojure is now functional :) |
| 01:53 | rhg135 | rritoch: I hate those moments |
| 02:00 | rritoch | rhg135: heh, well I still have a long ways to go before this is really viable. The produced version can't compile clojure, and the tests won't run. Anyhow this is just a proof of concept fork. I don't expect to use this in production environments. |
| 02:02 | rhg135 | rritoch: as Rich said tests are guard rail programming but not compiling clojure is probably a bad sign lol |
| 02:03 | rritoch | rhg135: Well the tests are facing a chicken and egg problem |
| 02:03 | rritoch | rhg135: Exception in thread "main" java.lang.ClassNotFoundException: clojure.test_clojure.genclass.examples.ExampleClass, compiling:(clojure/test_clojure/genclass.clj:1:1) |
| 02:04 | rhg135 | I'm not acquainted with the ball of complexity that is the low level implementation of clojure |
| 02:05 | rritoch | rhg135: As for not being able to compile clojure I suspect this issue was inherited from the master branch as I haven't done anything to the compilation system. |
| 02:06 | rritoch | rhg135: I haven't really yet hit the low level. I consider the clojure.asm branch the low-level, I'm just toying with the clojure.lang level. |
| 02:07 | rritoch | rhg135: My big mistake was branching from the master branch (hot) instead of branching from a release. |
| 02:07 | rhg135 | For me clojure.asm is 'I give' |
| 02:10 | rhg135 | If I have to mess with it I'd have to rethink what my goal is |
| 02:11 | justin_smith | rhg135: clojure.asm is just the java asm lib copy-pasted into the clojure source, none of us wrote it |
| 02:12 | rhg135 | justin_smith: I know that just proves you shouldn't need to change it |
| 02:12 | rritoch | justin_smith: Really, that being the case it is really too bad there is so much resistance to my custom numeric types |
| 02:12 | andyf | rritoch: Current Clojure master is same as 1.7.0-alpha4, which builds just fine. |
| 02:13 | rritoch | justin_smith: The reason I needed unsigned types is that I'm trying to make a persistent ClassFile type, similar to clojure persistent types accept instead of manipulating map properties, your manipulating classfiles. |
| 02:14 | andyf | rritoch: I don?t understand why you think you are getting resistance to your proposed numerics changes? |
| 02:16 | andyf | Or rather, I think it is fair to say that any significant changes proposed have to go through a fair amount of work and time to get in. |
| 02:17 | andyf | Even when there is interest in adding them. |
| 02:17 | rritoch | andyf: Maybe I misinterpreted the situation |
| 02:18 | andyf | I have no say in the matter of whether those changes will be made to Clojure, but I don't recall in the last 3 years seeing any significant proposed changes where the Clojure maintainers dropped everything and said, "Oh, yeah, that has got to get in this week." |
| 02:19 | rritoch | andyf: Well there were some comments made in this room against it, mostly related to the results of programmers abusing the feature. |
| 02:20 | andyf | I see. I haven't read those comments, so perhaps I'm misinterpreting the situation. |
| 02:20 | rritoch | andyf: I also have my own "issues" with the feature that I haven't yet resolved, Primarily dealing with precidence. |
| 02:21 | rritoch | andyf: Industry standard seems to be that double stays at the top of the food chain. |
| 02:21 | rhg135 | rritoch: it's a learned fear of overloading |
| 02:21 | rritoch | andyf: Clojure follows that also, which is good |
| 02:21 | rhg135 | But I think we're responsible |
| 02:22 | rritoch | andyf: It seems it is possible with this feature to get around that issue by wrapping doubles in an INumber, but there's no consistency in precidence with my changes. |
| 02:22 | rritoch | andyf: Currently it runs under the rule of "left object gets total control" |
| 02:23 | rritoch | andyf: But I don't think that is truly how it should work. I would think the left side should have a "vote" on the return type, and the right side should get final say, such as by adding an "identity" function to the numeric types which gets called on the right side if the right side is an INumber. |
| 02:23 | andyf | I've got other fish to fry for now -- no special interest in whether there are significant numerics changes or not. |
| 02:24 | andyf | IIRC, the current built-in numerics have symmetric rules for determining the type of arithmetic results. |
| 02:29 | rritoch | andyf: Yes, and establishing symmetric rules when applying method applies is a non-trivial problem, that I haven't yet solved, until that is solved, and I have a complete persistent classfile object, moving forward on these custom numeric types right now doesn't make sense. |
| 02:30 | andyf | rritoch: When you say you did this to create unsigned types, do you mean of any magnitude, like Java BigInteger, or you mean fixed-size 32-bit or 64-bit unsigned values? |
| 02:31 | rritoch | andyf: Fixed sizes, but only going up to U32 |
| 02:32 | rritoch | andyf: The custom types I made each contain a method to read their value from an inputstream, which breaks up the incoming classfile into the proper structure with little effort |
| 02:32 | andyf | I guess you realize that except for comparison ops like < <= etc., the arithmetic ops like + - * inc etc. all have identical bitwise results for 2's complement signed values and unsigned values? |
| 02:37 | rritoch | andyf: I believe I've seen something like that in SHA256 algorithms, but it really isn't how I'm implementing these. Most new machines are 64 bit so I'm internally storing the values as long's and bytearrays in these custom values so I always have a cache of the long value and the byte array. |
| 02:39 | andyf | In terms of non-comparison ops and storage space, a Java 32-bit signed int is perfectly big enough for an unsigned 32-bit int |
| 02:39 | rritoch | Java classfiles only use up to U4 so without a need for U8 I can use longs for everything |
| 02:42 | rritoch | andyf: I know it's possible, but storage space isn't really a critical concern. A lot of compilers are memory hogs, I see no reason not to stick with the trend. |
| 02:42 | akurilin | question: does clojure have anything to sanitize user input from things like xss? |
| 02:43 | rritoch | andyf: These classfile objects are useless before and after being injected into a classloader, or saved as a file in most cases. I can't think of a situation where these objects would have a long lifetime. |
| 02:43 | akurilin | in my case it's specifically for a json api |
| 02:44 | andyf | sounds like you are keeping tradeoffs in mind, so good. I just have habits of an embedded coder where often bits are precious. |
| 02:49 | rritoch | andyf: Yes, I am cutting a lot of corners. There are some parts of java classfiles that allow U4's as indexes of arrays, though java only supports indexes up to int's max (about half that). I could support it by maintaining 2 internal lists in the List types, but instead I'm just not supporting them (for now). |
| 02:52 | rritoch | andyf: For that tradeoff, all index operations of java's Lisp interface use int's so either I'd have to allow negative indexes, or I'd need to extend the list interface to take long indexes instead of int indexes, neither solution is good. |
| 02:53 | andyf | Java's Lisp interface? |
| 02:58 | rritoch | err, Lisp => List |
| 02:58 | rritoch | Sorry, Brainfart |
| 02:59 | rritoch | I've been programming since I was about 6 years old on a commodore 64, now that I'm getting older my fingers seem to have their own mind, I think one thing and type another somtimes. |
| 03:00 | rritoch | Technically, computer languages were my first language. I misspell many english words, but rarely ever misspell computer commands. It is the result of learning computers before learning english. |
| 03:01 | andyf | no spoken language learned before age 6? |
| 03:01 | andyf | that would be unusual |
| 03:01 | rritoch | andyf: Lol, no. Of course I could speak and comprehend english, I just couldn't write much at 6. |
| 03:03 | rritoch | andyf: Back then my programming was pure dictation, I'd take some code, and then make small changes until it would run. It was a bit like an improved application of the infinite monkey theorem. |
| 03:04 | andyf | That is a good way to start to learn to write natural language, too. Have to walk before you can run |
| 03:04 | rritoch | andyf: I wasn't able to really write programs from scratch until I was about 11. |
| 03:05 | TEttinger | rritoch: a commodore? I'm surprised it wasn't an IBM machine since you mentioned your dad worked there |
| 03:11 | _rritoch | TEttinger: I didn't start working with intel based computers until I was old enough to buy my own. |
| 03:11 | _rritoch | Amazing I can remember any of this at all. |
| 03:15 | _rritoch | TEttinger: Anyhow, my computer conversations with him when he was already retired, so I have no current contacts with IBM, but my conversations with him are what brought me to try linux. |
| 03:16 | _rritoch | TEttinger: Back then he said linux was IBM's future, but as far as I can tell IBM has mostly stopped producing software, so I'm not sure what ever came of it. |
| 03:17 | TEttinger | they make X10, which is certainly interesting. |
| 04:29 | jonathanj | can anyone suggest a good (but not necessarily) complex scheduler? i need to expire database entries at a certain point in time (which is stored in the database) |
| 04:33 | _tim__ | is it possible to get lein to generate debug symbols in java classes, similar to what javac -g does? |
| 04:45 | clgv | _tim__: specify :javac-options in your project.clj |
| 04:46 | _tim__ | thanks, i'll give it a go... |
| 04:51 | shriphani | hi. has anyone here used monger? I was confused about forming a query to check if an array contained an element. in mongodb, the find query {x: "y"} checks if x contains a "y" but the equivalent monger expression doesn't. Can anyone help ? |
| 05:04 | noncom | shriphani: i used monger, but did not have a similar task |
| 05:04 | clgv | it's not equivalent then ;) maybe you should post your monger expression as well, so that the monger users might help you |
| 05:04 | shriphani | fair enough :) one sec. |
| 05:05 | shriphani | (mc/find-maps db "stuff" {} {:x "y"}) |
| 05:05 | noncom | shriphani: maybe https://github.com/michaelklishin/monger/blob/master/src/clojure/monger/operators.clj#L65 |
| 05:05 | noncom | ? |
| 05:06 | noncom | what is depicted on this picture? http://maven.apache.org/images/maven-logo-2.gif |
| 05:07 | shriphani | noncom, I tried the operator but couldn't figure out how to get a parseable query |
| 05:08 | shriphani | (mc/find-maps db "stuff" {} {:x {$elemMatch "y"}}) |
| 05:08 | shriphani | it refuses to parse it |
| 05:10 | shriphani | is there a way to force-issue a raw mongodb query ? |
| 05:10 | shriphani | that would solve my problem and I can go to sleep |
| 05:10 | noncom | shriphani: try ctrl+f "elemmatch" here http://clojuremongodb.info/articles/querying.html |
| 05:11 | shriphani | yeah I see the examples, I am not sure how to translate them to my case |
| 05:11 | shriphani | because they seem to be querying: {:x [{:y y}...]} |
| 05:11 | noncom | give your exact case |
| 05:11 | shriphani | and I am querying {:x [y1 y2 y3]} |
| 05:11 | shriphani | and I want to check if x contains y1 |
| 05:12 | noncom | (mc/find db coll {:your-array {$elemMatch "y"}}) |
| 05:12 | noncom | should be this |
| 05:13 | shriphani | MongoException Can't canonicalize query: BadValue elemMatch: Invalid argument, object required. com.mongodb.QueryResultIterator.throwOnQueryFailure (QueryResultIterator.java:214) |
| 05:14 | shriphani | so yeah idk wtf is going on |
| 05:14 | noncom | ah, wait i wil try |
| 05:19 | noncom | shriphani: hmmm.. yes, there is some problem.. |
| 05:20 | noncom | i will try to find out, wait |
| 05:20 | shriphani | yeah this is pissing me off atm lol. |
| 05:22 | noncom | shriphani: http://stackoverflow.com/questions/23754249/elemmatch-not-working-in-mongodb |
| 05:22 | shriphani | hm. well that is cool |
| 05:22 | shriphani | but I can issue a query without elemmatch from the mongodb prompt |
| 05:23 | shriphani | so I wonder what the dsl is doing to fuck that up |
| 05:25 | noncom | heh.. |
| 05:25 | noncom | well.. |
| 05:26 | noncom | shriphani: i assume it does nothing |
| 05:26 | noncom | shriphani: (type $elemMatch) gives string |
| 05:28 | yogsototh | Hi, could someone help me understand what this really means? https://github.com/metosin/compojure-api#request--response-formats |
| 05:29 | yogsototh | I would like to serve csv |
| 05:29 | yogsototh | but I don't really understand how I should declare it |
| 05:30 | yogsototh | more precisely, I don't really understand what they call a request as it doesn't appear to be a "ring request" |
| 05:31 | shriphani | noncom, that is expected since I presume it just replaces the operator with a string in the final query. |
| 05:31 | noncom | shriphani: heeeeey! |
| 05:31 | shriphani | sup ? |
| 05:31 | noncom | shriphani: try (mc/find-maps @database "test" {:x {mops/$elemMatch {mops/$exists "y1"}}}) |
| 05:31 | shriphani | hm and that works ? |
| 05:31 | noncom | yes |
| 05:31 | noncom | or.. |
| 05:31 | noncom | well.. |
| 05:32 | noncom | shriphani: i just assume you have to use some other operator in conjunction with elemmatch for simple values |
| 05:32 | shriphani | yup that did it. |
| 05:32 | shriphani | fuck this. |
| 05:32 | noncom | nono |
| 05:32 | noncom | try the values that dont match |
| 05:33 | noncom | it still gives them.. |
| 05:33 | noncom | i guess it is not the full solution |
| 05:33 | noncom | but closer to it |
| 05:33 | shriphani | hm so I should still report it right ? |
| 05:34 | shriphani | also I think I fucked up |
| 05:34 | shriphani | noncom, the dsl works fine |
| 05:34 | shriphani | I stuck the find query in the second arg not the first. |
| 05:35 | shriphani | so I guess I just wasted your time. sorry about that. |
| 05:35 | noncom | shtiphani: maybe.. i thuink that there should be some operator to work in conjunction with elemmatch but which gives mongo objects for strings. since it works perfectly with maps |
| 05:35 | noncom | nono that was interesting |
| 05:35 | noncom | i am also into great works with mongo soon |
| 05:35 | ikitommi_ | yogsototh I can check that, the csv |
| 05:35 | noncom | actually thanks for the trip :D |
| 05:38 | noncom | shriphani: elemmatch only accepts {}. so there must be something inside that {} |
| 05:39 | noncom | i guess something like {$identity "y1"} |
| 05:39 | noncom | but there is no $identity... |
| 05:39 | noncom | so elmmatch only accepts expressions |
| 05:39 | noncom | not simple values |
| 05:40 | noncom | shriphani: heeey! |
| 05:40 | noncom | shriphani: now i definetely foud it out! |
| 05:40 | noncom | => (mc/find-maps @database "test" {:x {mops/$elemMatch {mops/$in ["y1"]}}}) |
| 05:40 | noncom | ({:_id #<ObjectId 548ac08535fed696b170bf04>, :x ["y1" "y2" "y3"]}) |
| 05:40 | noncom | => (mc/find-maps @database "test" {:x {mops/$elemMatch {mops/$in ["y7"]}}}) |
| 05:40 | noncom | () |
| 05:45 | noncom | yogsototh: i believe they mean ring requests really.. why not? |
| 05:46 | yogsototh | noncom I tried in fact, I also tried to read the code. In fact this is in the declaration of the docs of the api |
| 05:47 | yogsototh | but I don't understand how to add this metadata nor how can I handle the csv format with a middleware without breaking the actual multi-format system |
| 05:52 | ikitommi_ | it is a ring-request, just with extra meta-data to publish the serialization capabilities for docs |
| 05:53 | yogsototh | ikitommi_ ok so just a (assoc-in request [:meta :produces] ["csv"]) ? |
| 05:54 | ikitommi_ | ok, the docs really suck on that, will write an example of that. |
| 05:54 | yogsototh | ikitommi_ that would be just great! Thank you very much. |
| 05:55 | ikitommi_ | yes, but that's only for the documentation part -> that would translate "can now produce csv". [:meta :consumes] for the other way |
| 05:59 | ikitommi_ | do you have the encoder already implemented? |
| 06:01 | yogsototh | ikitommi_ not yet |
| 06:03 | ikitommi_ | does anyone btw. know the maintainers of https://github.com/ngrunwald/ring-middleware-format? |
| 06:04 | ikitommi_ | related to https://github.com/ngrunwald/ring-middleware-format/pull/26 & https://github.com/ngrunwald/ring-middleware-format/issues/36 |
| 06:05 | yogsototh | btw, my friend and I made a small informal presentation on compojure-api. You could see them here: http://yogsototh.github.io/keynote-compojure-api/#/title |
| 06:08 | ikitommi_ | awesome! |
| 06:13 | ikitommi_ | I'll write a intro/sample how to add own (ring-middleware-format) serializers to compojure-api, most probably have time to do on weekend |
| 06:13 | ikitommi_ | and the swagger 1.2 => 2.0 post is almost ready too. |
| 06:16 | yogsototh | ikitommi_ that sounds great! |
| 06:16 | yogsototh | ikitommi_ and thanks for your time! |
| 06:25 | kungi | yogsototh: Is there a way to use compojure-api with the reloaded workflow? I tried it once and failed because of some state in compojure-api. |
| 06:25 | yogsototh | yes |
| 06:26 | yogsototh | add (wrap-if (env :dev) wrap-reload) |
| 06:26 | yogsototh | in your middlewares |
| 06:26 | yogsototh | with wrap-reload from ring.middleware.reload :refer [wrap-reload]] |
| 06:27 | yogsototh | and [environ.core :refer [env]] for env |
| 06:27 | kungi | yogsototh: thanks :-) |
| 06:27 | yogsototh | Works with both jetty and http-kit |
| 06:28 | ikitommi_ | https://gist.github.com/Deraen/9d65f447593859dd07ae <-- how to integrate Component nicely with compojure-api |
| 06:29 | kungi | ikitommi_: \o/ |
| 06:30 | kungi | ikitommi_: I very much enjoyed your talk at euroclojure this year btw. |
| 06:31 | ikitommi_ | good to hear, thanks kungi! |
| 06:36 | clgv | wouldn't (::components `+compojure-api-request+) suffice instead of `(::components ~'+compojure-api-request+) ? |
| 06:37 | clgv | ,(read-string "`(::components ~'+compojure-api-request+)") |
| 06:37 | clojurebot | (clojure.core/seq (clojure.core/concat (clojure.core/list :sandbox/components) (clojure.core/list (quote +compojure-api-request+)))) |
| 06:37 | clgv | ,(read-string "(::components `+compojure-api-request+)") |
| 06:37 | clojurebot | (:sandbox/components (quote sandbox/+compojure-api-request+)) |
| 06:37 | clgv | ah no. |
| 06:38 | clgv | humm I dont get the benefit of that expression ^^ |
| 06:40 | ikitommi_ | benefit? it's generating code to read the value of ::components from ring-request into a plumbing letk assignment |
| 06:41 | ikitommi_ | so you can destructure the components like this: https://gist.github.com/Deraen/9d65f447593859dd07ae#file-handler-clj-L20 |
| 06:43 | dagda1_ | can I prepend to a map, the opposite of assoc |
| 06:43 | ikitommi_ | instead of saying (let [db (get-in request [::components :db :db])] ... in every handler. |
| 06:45 | ffwacom | dagda1_: maps arn't sorted |
| 06:46 | dagda1_ | ffwacom: meaning that I can not guarantee the order of the keys? |
| 06:46 | ffwacom | not as far as I know, however they fit into the trie is how they end up |
| 06:56 | _rritoch | dagda1: You can accomplish the indended result by maintaining an array of the keys in the map, but as ffwacom stated, they're not sorted, ex ##(list (assoc {:a 0 :c 2} :a 1) (assoc {:a 0 :c 2} :b 1)) |
| 06:56 | lazybot | ⇒ ({:c 2, :a 1} {:b 1, :c 2, :a 0}) |
| 07:25 | clgv | ikitommi_: I only ment that particular expression |
| 07:26 | clgv | meant |
| 07:26 | clgv | the syntax-quote seems superfluous there |
| 07:43 | kungi | (inc ikitommi_) |
| 07:43 | lazybot | ⇒ 1 |
| 07:43 | kungi | ikitommi_: Thank's for the example it works perfectly. |
| 08:03 | dnolen_ | Bronsa: ping |
| 08:04 | Bronsa | dnolen_: pong |
| 08:05 | dnolen_ | Bronsa: back on fixing recur detection in core.match, looking for the simplest way to do this |
| 08:05 | dnolen_ | Ideally I just want to catch a mismatched recur exception |
| 08:06 | dnolen_ | I don't care about unknown locals, globals anything else at all |
| 08:06 | dnolen_ | possible? |
| 08:08 | Bronsa | dnolen_: so you have something like (loop [x 1] (match foo whatever (recur ..))) and need to know that that recur expression refers to the outer loop? |
| 08:09 | dnolen_ | Bronsa: I just want to know that recur is present at all, if it is we need to use a different compilation strategy |
| 08:09 | dnolen_ | all that stuff is already in place |
| 08:10 | dnolen_ | but the recur detection logic is bad, picks up 'recur |
| 08:12 | Bronsa | dnolen_: gotcha. so you need to analyze the match body setting up the local env + using (keys &env), look in the core.async source for how to do that |
| 08:13 | Bronsa | dnolen_: then you need to assign a loop-id + loop-locals in the env using Compiler/LOOP_LOCALS https://github.com/clojure/tools.analyzer/blob/master/src/main/clojure/clojure/tools/analyzer.clj#L517-L518 to inform t.a that it can recur |
| 08:14 | Bronsa | dnolen_: finally using a prewalk on the AST, you can look for the loop-id you generated in the :loops set of :recur nodes, :loops is added by the annotate-loops pass |
| 08:16 | dnolen_ | Bronsa: aren't loop locals just locals? |
| 08:16 | dnolen_ | Bronsa: I mean understand the special purpose of loop locals - asking about how to derive them. |
| 08:17 | Bronsa | dnolen_: from the macro, just bind :loop-locals to (count @Compiler/LOOP_LOCALS) |
| 08:17 | Bronsa | dnolen_: if LOOP_LOCALS is unbound there's no outer loop and you can skip the recur check alltoghether I believe |
| 08:17 | michaelr525 | hey |
| 08:18 | michaelr525 | any way in cursive to enable printing of the whole stack trace in repl? |
| 08:18 | michaelr525 | it just prints one line for some reason |
| 08:19 | Bronsa | dnolen_: you'll also need to manually perform the annotate-loops initialization in the root AST node https://github.com/clojure/tools.analyzer.jvm/blob/master/src/main/clojure/clojure/tools/analyzer/passes/jvm/annotate_loops.clj#L79-L82 |
| 08:20 | dnolen_ | Bronsa: I don't suppose I can share logic for Clojure(Script) analysis here, make-env, analyze, get-loop-locals sounds like a copy and pate affair |
| 08:20 | Bronsa | dnolen_: I'm kinda busy now but if don't figure it out I can sketch it for you ~Monday |
| 08:21 | Bronsa | dnolen_: yeah |
| 08:22 | dnolen_ | Bronsa: ok, don't mind digging into this, would be nice to get familiar w/ the analyzers - thanks for the pointers, I think I understand |
| 08:23 | Bronsa | dnolen_: I might move the recur validation logic in a pass rather than embed it in the core analyzer so all this will be unnecessary. But for now you'll need to setup it this way |
| 09:37 | CookedGryphon | this is a long shot... but i don't suppose there's any way to dynamically access the version number in a leiningen project file without factoring out the version at the top |
| 09:37 | CookedGryphon | I want to pass it through as an option to a leiningen plugin without having to tweak the plugin |
| 09:37 | CookedGryphon | just to concatenate the version on the end of the app title property |
| 09:42 | stuartsierra | Don't plugins have access to the full project map? |
| 09:42 | jonathanj | is it possible to pass parameters to yesql queries by name? |
| 09:43 | jonathanj | i mean, i have to name parameters in the query anyway, why can't i pass them by name from clojure? |
| 09:44 | jonathanj | seems like there's an issue filed for this |
| 10:00 | atyz | Has anyone noticed that Emacs seems to format strangely when using certain functions like cond. Is there a way to get it to align the functions correctly? https://www.refheap.com/94798 |
| 10:03 | CookedGryphon | atyz: depends what you mean by correctly, those look more or less correct to me |
| 10:03 | CookedGryphon | if you wanted it aligned past the end of the cond, you wouldn't have put the newline right after teh cond |
| 10:10 | atyz | CookedGryphon: not at the end of the cond. Its one space vs 2 spaces |
| 10:10 | atyz | Erm 0 spaces vs 2 spaces |
| 10:10 | atyz | The first one looks like a collection of things. whereas the 2nd one makes it easier to see that its a fn call |
| 10:13 | CookedGryphon | I think that's standard for anything that doesn't have bindings or something on the first line... |
| 10:16 | atyz | Do you not think the 2nd on is easier to read? |
| 10:22 | CookedGryphon | not particularly, but then I'm used to the emacs behaviour |
| 10:35 | mgaare | Can someone help me with an aleph/gloss/manifold problem? I seem to be having a stupid - http://pastebin.com/LuVnFcga |
| 10:42 | jonathanj | hrm, how do i do update-in for multiple (unnested) keys? |
| 10:43 | justin_smith | ,(-> {:a 0 :b 1} (update-in [:a] inc) (update-in [:b] dec)) |
| 10:43 | clojurebot | {:b 0, :a 1} |
| 10:44 | justin_smith | if you need the keys to depend on each other in some way, then you want something other than update-in though |
| 10:45 | jonathanj | justin_smith: no, that's what i want, thank you |
| 10:50 | jonathanj | justin_smith: hrm, how about only perform both update-ins on the condition that the map is not empty? |
| 10:50 | jonathanj | is it possible to retain the use of the threading macro? |
| 10:58 | justin_smith | ,(some-> {:a 0 :b 1} (update-in [:a] inc) (update-in [:b] dec)) |
| 10:58 | clojurebot | {:b 0, :a 1} |
| 10:58 | justin_smith | ,(some-> {} (update-in [:a] inc) (update-in [:b] dec)) |
| 10:58 | clojurebot | #<NullPointerException java.lang.NullPointerException> |
| 10:58 | justin_smith | err |
| 10:58 | justin_smith | ,(some-> {} not-empty (update-in [:a] inc) (update-in [:b] dec)) |
| 10:58 | clojurebot | nil |
| 10:58 | justin_smith | there we go |
| 10:59 | Glenjamin | ,(some-> {:a 0 :b 1} not-empty (update-in [:a] inc) (update-in [:b] dec)) |
| 10:59 | clojurebot | {:b 0, :a 1} |
| 10:59 | Glenjamin | ah, didn't realise not-empty returned coll |
| 10:59 | justin_smith | that's pretty much why not-empty exists - otherwise you could use seq |
| 11:07 | mmg | hi, I’m using core.async and calling a 3rd party library. I noticed that the library is periodically killing my thread (I filed a bug report with them) but I need a work around… is there a way to have a worker pool in core.async ? like this go-loop has 5 workers at all times? And preferrably some kind of way to ensure there are always X workers? Alternatively if someone has a better idea for a work around I’d love to hear it |
| 11:08 | justin_smith | mmg: core.async already has a thread pool - perhaps you need a way to add threads back to the pool if the client is killing them? or only use the client outside of go blocks. |
| 11:09 | justin_smith | s/client/3rd party lib/ |
| 11:10 | mmg | um… I think it’s specifically the go-loop abstraction is staying on one thread, so maybe if I just manually started like 5 of those ? |
| 11:10 | mmg | also without a ref to the Thread object I’m not sure how to determine if it’s still alive or just taking a long time |
| 11:10 | justin_smith | that's not what go loops do. There is a pool for core.async, it runs those go blocks that are available for running. |
| 11:11 | justin_smith | you could check the core.async thread pool, and verify whether all its threads are alive and present |
| 11:11 | justin_smith | there is also ##(Thread/currentThread) |
| 11:11 | lazybot | ⇒ #<Thread Thread[Thread-5426,5,sandbox]> |
| 11:11 | justin_smith | which you can store and check in the future etc. |
| 11:11 | mmg | yeah that’s a good point |
| 11:11 | mmg | thanks |
| 11:13 | triss | hey all. if I've got a list of items and want to call a function on each pair of them what would be the simplest means? |
| 11:13 | triss | am I looking at using reduce or something? |
| 11:13 | justin_smith | ,(map #(apply + %) (partition 2 (range))) |
| 11:13 | clojurebot | (1 5 9 13 17 ...) |
| 11:13 | justin_smith | that's 0+1, 2+3, 4+5, 6+7, 8+9, etc. |
| 11:14 | justin_smith | or do you want to step by only one item? |
| 11:14 | justin_smith | ,(map #(apply + %) (partition 2 1 (range))) |
| 11:14 | clojurebot | (1 3 5 7 9 ...) |
| 11:14 | justin_smith | that's 0+1, 1+2, 2+3, 3+4 ... |
| 11:18 | triss | wicked thanks justin_smith |
| 11:35 | ppppaul | why doesn't pprint work in clojurescript? |
| 11:45 | dnolen_ | ppppaul: hasn't been ported |
| 11:46 | dnolen_ | ppppaul: I started copying some things over but it's going to be bit of a project. |
| 11:48 | noncom|3 | what is the most idiomatic way to know if a {} is a subset of another {} ? |
| 11:49 | noncom|3 | i want to create a predicate for a filter that filters a set of {}s on subject of containing a complete predicate {} ? |
| 11:49 | stuartsierra | noncom|3: clojure.set/subset? |
| 11:49 | noncom|3 | stuartsierra: does it work for nested maps ? |
| 11:49 | noncom|3 | i will check now.. |
| 11:50 | stuartsierra | Oh, you mean if one map has a subset of keys in another map? |
| 11:51 | noncom|3 | stuartsierra: yes, keys and values and everything |
| 11:51 | noncom|3 | stuartsierra: actually, i would word it as "is a {} fully contained inside another {}? " |
| 11:52 | noncom|3 | i know i can write a function for that.. but what is the most idiomatic way? |
| 11:52 | noncom|3 | * a recursive function |
| 11:53 | awkorama | what is non idiomatic about writing a function? |
| 11:55 | stuartsierra | noncom|3: Maybe something like (every? (fn [k] (= (get map-a k) (get map-b k ::not-found))) (keys map-a)) |
| 11:56 | noncom|3 | awkorama: indeed it is idiomatic, i am just not sure how well i can write it so that it be the most idiomatic clojure :) |
| 11:58 | awkorama | noncom|3: are you considering maps as keys as well ? |
| 11:58 | justin_smith | ,(let [a {:a 0 :b 1}] (= a (select-keys {:a 0 :b 1 :c 2}) (keys a))) ; noncom|3 |
| 11:58 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: core/select-keys> |
| 11:58 | justin_smith | err |
| 11:58 | justin_smith | ,(let [a {:a 0 :b 1}] (= a (select-keys {:a 0 :b 1 :c 2} (keys a)))) ; noncom|3 |
| 11:58 | clojurebot | true |
| 11:59 | awkorama | i mean, would your fn return true for following {{foo bar a b} {x y}} and {{foo bar} {x y}} ? |
| 12:00 | justin_smith | stuartsierra 's method may be faster, but I think that version is pretty clear |
| 12:00 | noncom|3 | stuartsierra, justin_smith: these two work! thank you, gonna learn the aesthetics! |
| 12:00 | noncom|3 | awkorama: yes, keys too should match |
| 12:00 | awkorama | should match or should a subset? |
| 12:00 | awkorama | should be** |
| 12:01 | justin_smith | awkorama: oh, so you are suggesting a recursive version? |
| 12:01 | awkorama | cause i think that becomes a non trivial problem |
| 12:01 | noncom|3 | the pred {} must contain all keys of a {} and all the keys should have the same values as in the {} being trialed |
| 12:01 | justin_smith | yeah, the recursive version is harder - but I can't think of a use case for it either |
| 12:01 | justin_smith | and it isn't what noncom|3 is talking about iether |
| 12:02 | noncom|3 | my use case: i have to find json subobjects that match a certain criteria (contain certain kv pairs) |
| 12:02 | awkorama | yeah, but jsons are trees (nested maps) |
| 12:03 | awkorama | nesting in the values only though |
| 12:03 | justin_smith | noncom|3: another more sophisticated approach would be to define schema's with prismatic/schema and check if an object matches that schema. But if select-keys works it makes sense to just use that. |
| 12:03 | justin_smith | awkorama: can json have a map as a key even? |
| 12:03 | awkorama | justin_smith: no, but clojure can i think |
| 12:03 | justin_smith | yes, it definitely can |
| 12:04 | awkorama | but then it becomes a very interesting problem, i mean if even theoretical |
| 12:04 | justin_smith | you could implement select-superset-keys |
| 12:04 | noncom|3 | http://www.refheap.com/94806 |
| 12:04 | justin_smith | then recurse |
| 12:04 | noncom|3 | see, the subobjects are stored under uuids |
| 12:05 | justin_smith | noncom|3: yeah, you can totally use select-keys to test which kind you are getting |
| 12:05 | noncom|3 | so i have to find the particular subobjects that have certain "isa" and "name" kvs |
| 12:05 | noncom|3 | oh, fine! :) |
| 12:05 | awkorama | noncom|3: i don't think i am helping you know, i just generalised your problem to become a more interesting one, not practical though |
| 12:05 | justin_smith | noncom|3: but for something more sophisticated you still may want to try prismatic/schema |
| 12:06 | noncom|3 | so in the end, i have to get their uuids |
| 12:06 | justin_smith | if you ever need that |
| 12:06 | noncom|3 | oh, the prismatic wizardry... |
| 12:07 | justin_smith | so I am playing with datomic and data.csv to load a bunch of campaign contribution info for querying (public good project) - clojure populates the db so much faster than emacs can print out the contents, it's kind of sad |
| 12:08 | justin_smith | this is even with emacs scrolling so fast you can't read anything |
| 12:08 | noncom|3 | justin_smith: about prismatic schema: so, all i have to do with it is just (s/validate data pred) ??? |
| 12:08 | lazybot | noncom|3: Oh, absolutely. |
| 12:08 | noncom|3 | that simple? |
| 12:09 | ppppaul | is there a function that will let me do a (distinct) but on a key? |
| 12:09 | ppppaul | https://gist.github.com/boxxxie/7bbe149d1bfa481dcb57 |
| 12:09 | ppppaul | i made this that does what i want, but it uses set 2 times |
| 12:14 | justin_smith | ppppaul: maybe you want group-by |
| 12:15 | ppppaul | i thought of that... but i would have to map over that as well |
| 12:15 | justin_smith | ,(group-by :sha [{:sha "a" :id 1} {:sha "a" :id 2} {:sha "b" :id 3}]) |
| 12:15 | clojurebot | {"a" [{:id 1, :sha "a"} {:id 2, :sha "a"}], "b" [{:id 3, :sha "b"}]} |
| 12:16 | justin_smith | I think it would still lead to a simpler answer though |
| 12:16 | ppppaul | my output is a set of 1 element |
| 12:16 | ppppaul | in my example |
| 12:18 | justin_smith | (->> data (group-by :sha) (map #(update-in % [1] first)) vals) |
| 12:19 | justin_smith | actually (->> data (group-by :sha) (map (comp first second))) |
| 12:19 | justin_smith | then make it a set if you like, but either way the sha1 will only occur once each |
| 12:20 | ppppaul | thanks |
| 12:21 | noncom|3 | justim_smith: sadly but schema only checks for types, not values... |
| 12:22 | justin_smith | ppppaul: or you could use sorted-set-by - dunno if this is abusing it though ##(sorted-set-by #(compare (:sha %) (:sha %2)) {:sha "a" :v 1} {:sha "b" :v 1} {:sha "a" :v 2}) |
| 12:22 | lazybot | ⇒ #{{:v 1, :sha "a"} {:v 1, :sha "b"}} |
| 12:23 | justin_smith | you just conj things on, it will only end up having one item with a given :sha key |
| 12:24 | justin_smith | noncom|3: I think it could be done by defining a set of values allowed. But probably you just want select-keys and = |
| 12:24 | noncom|3 | yeah |
| 12:25 | noncom|3 | just researched the schema thing |
| 12:33 | justin_smith | schema is generally pretty great though |
| 12:34 | justin_smith | even as a kind of enforcable documentation of my own code |
| 12:38 | EvanR | is there a common syntax trick to type in date(time) literals |
| 12:38 | EvanR | like there is with regex |
| 12:39 | justin_smith | &#inst "2001-1-1" |
| 12:39 | lazybot | java.lang.RuntimeException: Unrecognized date/time syntax: 2001-1-1 |
| 12:40 | justin_smith | err |
| 12:40 | justin_smith | &#inst "2001-01-01" |
| 12:40 | lazybot | ⇒ #inst "2001-01-01T00:00:00.000-00:00" |
| 12:40 | justin_smith | the rest of the numbers are the time, and the timezone offset |
| 12:40 | justin_smith | ,(java.util.Date.) |
| 12:40 | clojurebot | #inst "2014-12-12T17:38:21.228-00:00" |
| 12:41 | EvanR | ah inst |
| 12:41 | EvanR | (though, the offset does not survive the conversion to java.util.Date |
| 12:41 | EvanR | ) |
| 12:42 | justin_smith | right, but you could convert to a Calendar instead |
| 12:42 | justin_smith | or whatever |
| 12:42 | justin_smith | or separately grab the tz offset |
| 12:42 | EvanR | with #inst ? |
| 12:42 | justin_smith | ,(type #inst "0000-00-00") |
| 12:42 | clojurebot | #<RuntimeException java.lang.RuntimeException: failed: (<= 1 months 12)> |
| 12:42 | justin_smith | ,(type #inst "0000-01-01") |
| 12:42 | clojurebot | #<SecurityException java.lang.SecurityException: denied> |
| 12:42 | justin_smith | hrmph |
| 12:43 | justin_smith | &(type #inst "0000-01-01") |
| 12:43 | lazybot | ⇒ java.util.Date |
| 12:43 | justin_smith | yeah, that's too bad |
| 12:47 | justin_smith | EvanR: actually no, the timezone is part of the Date ##(.getTimezoneOffset #inst "0000-01-01T00:00:00.000-07:00") |
| 12:47 | lazybot | ⇒ 0 |
| 12:47 | justin_smith | err.... |
| 12:48 | EvanR | no |
| 12:48 | justin_smith | yeah, I dont' know where it is getting the .getTimezoneOffset from, but clearly not from the object, sorry |
| 12:48 | justin_smith | ,(bean (java.util.Date.)) |
| 12:48 | clojurebot | {:day 5, :date 12, :time 1418406382786, :month 11, :seconds 22, ...} |
| 12:49 | justin_smith | ,(:timeZoneOffset (bean (java.util.Date.))) |
| 12:49 | clojurebot | nil |
| 12:49 | justin_smith | ,(:timezoneOffset (bean (java.util.Date.))) |
| 12:49 | clojurebot | 0 |
| 12:49 | kryft | I'm writing a web backend in clojure, and I'd basically want to return something like {:status 500 :body "sql exception"} from any handler that accesses the db and gets an exception from jdbc. Do I need a macro for that? |
| 12:49 | kryft | If I want to minimize boilerplate, that is |
| 12:50 | justin_smith | kryft: (defn wrap-db-error [handler] (fn [request] (try (handler request) (catch some.jdbcException e {:status 500 :body (.getMessage e)})))) |
| 12:50 | justin_smith | as a middleware |
| 12:51 | justin_smith | just figure out which exception(s) you want to be catching |
| 12:51 | kryft | justin_smith: Ah, right, of course |
| 12:52 | kryft | Thanks! |
| 12:53 | justin_smith | in fact, at least in dev mode, you can catch all Exception thrown that way - you may want to get the string from the stack trace too (string/join "\n" (map str (.getStackTrace e))) |
| 12:55 | kryft | justin_smith: Right, the app is simple enough that I could just catch everything; it's not like I can do anything smarter than signal "server error" in any case |
| 12:55 | justin_smith | actually (string/join "\n" (.getStackTrace e)) suffices |
| 12:56 | EvanR | justin_smith: i think timezoneoffset in Date is some marginally useless thing related to its also confusing and i *think* mostly useless hidden internal Calendar |
| 12:56 | EvanR | Date is really a epoch / utc timestamp |
| 12:56 | justin_smith | yeah, nothing about the Date object itself seems to influence the timezonOffset, I was misled |
| 12:56 | upwardindex | Is there a more idiomatic way of writing (zipmaps keys (map fun keys)) ? |
| 12:57 | upwardindex | s/zipmaps/zipmap/ |
| 12:58 | justin_smith | ,(into {} (map (fn [k] [k (.toUpperCase k)]) ["a" "b" "c"])) |
| 12:58 | clojurebot | {"a" "A", "b" "B", "c" "C"} |
| 12:58 | justin_smith | don't know about more idiomatic, but at least it only walks the sequence ocne instead of twice |
| 12:58 | justin_smith | *once |
| 13:01 | dnolen_ | core.match 0.3.0-alpha1 released, feedback welcome |
| 13:01 | dnolen_ | https://github.com/clojure/core.match |
| 13:04 | devll | dnolen_: why there is no issues for core.match? |
| 13:04 | annelies | JIRA |
| 13:04 | annelies | http://dev.clojure.org/jira/browse/MATCH |
| 13:04 | annelies | devll: ^ |
| 13:05 | devll | oh,I see. thanks. |
| 13:05 | dnolen_ | devll: Clojure contrib library issues are tracked in JIRA |
| 13:18 | DiffEngr | I have some clojure style questions. Would this be an OK place to ask about them? |
| 13:18 | dnolen_ | DiffEngr: yes |
| 13:20 | DiffEngr | style question 1: I have taken to using ... multifunctions/arity to have a version of a fn that destructures a map, and then another more "bare" version of that function that takes the raw arguments |
| 13:21 | DiffEngr | and then the destructuring version calls the raw version with the destructured values |
| 13:22 | dnolen_ | DiffEngr: seems a bit odd to me anyway, I would just have all arities take the map |
| 13:26 | DiffEngr | the in use form might be (draw-thing complex-map), but the, um, testing form might be (draw-thing [0 0] [100 100]) |
| 13:27 | DiffEngr | I guess I consider the map-form as a convenience, and the non-map as the "pure" form |
| 13:27 | oskarkv | DiffEngr after you have destructured the map it seems pointless to call the other-arity function. And perhaps you need the different arities later |
| 13:29 | DiffEngr | oskarkv: The point, for me, is an easily tested/comprehensible form. That's probably b/c I'm a beginner. |
| 13:29 | oskarkv | DiffEngr isn't it easy to just make a map when testing? (draw-thing {:a [0 0] :b [100 100]}) |
| 13:30 | DiffEngr | oskarkv: the map might be deeper than that |
| 13:30 | noonian | DiffEngr: if its just for testing in the repl, i might make a custom user ns with (defn test [a b] (draw-thing :a a :b b)) or w/e |
| 13:30 | noonian | (draw-thing {:a a, :b b}) |
| 13:31 | oskarkv | ok ;) anyway i think most people don't use arities in that way |
| 13:31 | DiffEngr | noonian: cool, I'll try that. Thanks for the input gang. |
| 13:34 | kryft | Hmm, in what namespace is SQLException defined? (If I want to catch SQLException specifically) |
| 13:38 | noonian | kryft: probably java.sql.SQLException https://docs.oracle.com/javase/7/docs/api/java/sql/SQLException.html |
| 13:40 | kryft | noonian: Yes, (:import java.sql.SQLException) seems to do the trick; thanks |
| 13:40 | noonian | np |
| 13:41 | kryft | Could I have found that out somehow? I didn't see it in (say) the jdbc API docs, although they refer to SQLException |
| 13:42 | noonian | i just googled "java SQLException" and found the class from the javadocs for the exception |
| 13:43 | kryft | Ah, right, because it has nothing to do with clojure as such |
| 13:43 | noonian | yup |
| 13:43 | kryft | I have practically zero java background, and it shows sometimes :) |
| 13:44 | noonian | yeah, a lot of people come to clojure with no experience with java or the jvm |
| 13:50 | awkorama | what is usually these people's background then? |
| 13:50 | awkorama | other lisps ? |
| 13:53 | noonian | some people come from java, some from lisp, some from ruby/python backgrounds, and maybe a few js devs interested in clojurescript |
| 13:57 | crash_ep | refuge is granted to all |
| 14:07 | DiffEngr | or Objective-C! |
| 14:08 | jarjar_prime | yay for objective-c :-P |
| 14:17 | SparkySparkyBoom | i came from scala :D |
| 14:17 | SparkySparkyBoom | havent really given up on scala though |
| 14:20 | uris77_ | im coming from java/groovy and javascript (mostly javascript these days) |
| 14:27 | justin_smith | awkorama: I came from scheme / ocaml / common lisp, but clojure could more easily be deployed to a corporate stack |
| 14:29 | EvanR | hahahaha |
| 14:30 | dottedmag | "I have imported this handy Java library" (c) |
| 14:33 | awkorama | well i think clojureCLR will become a main target in some time, because of the new Microsoft's "we love you all" policy |
| 14:34 | uris77_ | hmm, I think it is more likely that more ppl adopt F# because of that |
| 14:34 | uris77_ | instead of more ppl flocking to clojure |
| 14:34 | dottedmag | I think IT guys from that bank will print T-shorts with a slogan "We embedded Lisp in your Java when it was not yet a mainstream" |
| 14:36 | noonian | if you're looking for a lisp though F# isn't really in the running |
| 14:37 | awkorama | i was just thinking why RH chose JVM as his primary target. I reckon it was because it was good enough virtual machine that is multiplatform and (semi)open |
| 14:38 | awkorama | when CLR becomes more open and multiplatform, there is no reason to stay in jvm as primary target, i think |
| 14:40 | uris77_ | there is still the matter of learning the tools for CLR, it won't be so straightforward |
| 14:40 | awkorama | uris77_: you mean the ecosystem? |
| 14:41 | noonian | jvm will still be stable, performant, and have tons of libs so there's no reason to abandon it |
| 14:42 | noonian | i think its great that we can target both platforms with clojure though |
| 14:42 | justin_smith | some people are targetting node too (ie. for the lower startup time since closure compiler gives us tree shaking and you don't deploy the compiler) |
| 14:43 | kryft | Heh, "tree shaking", I like it. :) (I had never heard the term before, but the meaning was immediately obvious) |
| 14:44 | justin_smith | kryft: it's a nice term of the art |
| 14:45 | awkorama | justin_smith: can you repl to the running node/clojure application if you don't have the compiler ? |
| 14:45 | justin_smith | awkorama: I don't think so, it can't eval anything after all |
| 14:45 | justin_smith | you need the jvm for the eval part |
| 14:46 | justin_smith | rEpl |
| 14:46 | arrdem | justin_smith: correct. |
| 14:46 | awkorama | i don't know much about clojurescript |
| 14:46 | awkorama | so in clojurescript one can not do (eval "(+ 3 4)") ? |
| 14:47 | awkorama | or i mean (eval '(+ 3 4)) |
| 14:47 | uris77_ | awkorama: yeah, I mean the ecosystem and knowledge transfer. |
| 14:47 | Bronsa | awkorama: right, you can't. cljs doesn't have a resident compiler |
| 14:47 | uris77_ | for example, I would love to work with F#, but it means I have to get very familiar with the tools for managing an application in the CLR |
| 14:48 | uris77_ | the PaaS services I can use, nevermind having to use windows and invest in tooling there. |
| 14:48 | awkorama | well managing an application written in clojure on jvm is a difficult task as well, mainly for modern java programmer using spring-boot and the like |
| 14:48 | awkorama | uris77_: that is all about to change, microsoft wants to run server side .net on linux |
| 14:49 | uris77_ | yeah, running on linux is one thing, tooling is something else. For example, I know how to deploy netty/jetty tomcat, etc. jmx ... |
| 14:50 | uris77_ | don't know the CLR equivalent, plus having to maybe use azure (instead of heroku, cloudfoundry or aws or dropbox) |
| 14:50 | awkorama | why azure? |
| 14:50 | awkorama | i mean, linux can be run on all of the clouds that are IaaS, right? |
| 14:50 | uris77_ | because I'm asuming that the deployment story for CLR is better in azure. |
| 14:50 | awkorama | regarding PaaS, it's just a matter of time till it runs .net |
| 14:51 | awkorama | uris77_: it's pretty bad in azure as well, microsoft is trying to change it, once they do, it will be good on all IaaS providers |
| 14:51 | uris77_ | yeah, I hope so. Would love to write some F# apps |
| 14:51 | uris77_ | yeah, we tried azure 2 years ago and had to switch |
| 14:51 | uris77_ | it was terrible |
| 14:52 | awkorama | also CLR might actually be better for clojure since it was made to support multiple languages from the start |
| 14:52 | uris77_ | i still don't think the clojure apps will be portable across hosts. Will be similar story we have with clojurescript |
| 14:52 | uris77_ | because clojure doesn't hide the host from you |
| 14:53 | awkorama | uris77_: sure and that's a good thing |
| 14:53 | tbaldridge | awkorama: I wouldn't be so sure about that. On average ClojureCLR runs about 50% slower than Clojure on the JVM |
| 14:54 | awkorama | tbaldridge: well it wasn't a target for much optimization in the past |
| 14:54 | tbaldridge | the whole "portable" bit of the CLR is a bit of a mis-nomer |
| 14:55 | tbaldridge | awkorama: it's a bit more than that the platform itself is much slower, lacking a profiling JIT, being more statically typed than the JVM, etc. |
| 14:56 | awkorama | tbaldridge: Well I might be wrong, I just think that microsoft is trying to open .net more than oracle does with java, that does bring in community and community usually solves most of the problems that you described. |
| 14:56 | justin_smith | awkorama: jvm clojure relies on the vm for most of its optimization, the parts that aren't optimized by the vm itself should be portable improvements that also increase the performance on CLR |
| 14:58 | tbaldridge | awkorama: perhaps, but I see no word form MS about the CLR gaining a profiling JIT, and something like that is really a must for Clojure to perform decently. |
| 14:58 | awkorama | tbaldridge: :) i am not saying that it will be tomorrow |
| 15:00 | awkorama | https://github.com/Microsoft/dotnet/commits/master |
| 15:01 | awkorama | they open sourced the platform not a month ago and they already accept pull requests, try that with oracle |
| 15:02 | noonian | but whats wrong with the jvm? i don't think clojure needs it to change at all really (although TCO would be nice) |
| 15:03 | awkorama | there are many platforms that are not wrong and clojure does not target it as primary |
| 15:03 | tbaldridge | awkorama: ummm that repo only contains docs, no code. |
| 15:05 | awkorama | ah, sorry |
| 15:06 | awkorama | https://github.com/dotnet/corefx/commits/master |
| 15:06 | awkorama | this one then |
| 15:08 | tbaldridge | awkorama: I guess what I'm saying is this: .NET has always had a one-shot JIT. it's the way it's always been and recent efforts have focused around AOT not gaining amore performant JIT. I don't see that happening anytime soon. And getting a more advanced JIT is exactly what Clojure on the CLR would need. |
| 15:09 | awkorama | tbaldridge: what other languages (or types of languages) would benefit from better jit on clr ? |
| 15:09 | tbaldridge | Dynamic languages, the very type that MS has ignored for years. |
| 15:10 | tbaldridge | See typescript, C#, F#, etc. MS hasn't pushed a dynamic language in years (ever?). |
| 15:10 | hiredman | well, in typical microsoft fashion ignoring the means releasing a product, hyping it, then dumping it |
| 15:10 | hiredman | http://en.wikipedia.org/wiki/Dynamic_Language_Runtime |
| 15:10 | tbaldridge | naw...they'd never do that ;-) |
| 15:12 | tbaldridge | DLR still exists in the form of dynamic, but yeah, that's more akin to invokeDynamic then something like Hotspot. |
| 15:17 | akurilin | question: do you guys have a recommendation for xss-sanitizing user input in my clojure json api? |
| 15:18 | akurilin | is there a lib out there that'd make it reasonably straightforward? |
| 15:34 | cfleming | $mail michaelr525 There's a button on the toolbar you can use to print the whole stack trace - by default nREPL only sends back a summary. |
| 15:34 | lazybot | Message saved. |
| 15:57 | abaranosky | could anyone here give me a little quick help with the Cheshtnut library for Clojurescript? (https://github.com/plexus/chestnut) |
| 15:57 | micrypt | abaranosky: What's the matter? |
| 15:58 | abaranosky | I'm relatively new to CLJS, and thought I could connect to the Weasel repl directly from Emacs |
| 15:58 | CRM114 | SLIME? |
| 15:58 | abaranosky | M-x cider Host: 127.0.0.1 Port: 9001 |
| 16:03 | micrypt | abaranosky: M-x cider-jack-in. Then `(run)(browser-repl)` … IIRC. |
| 16:06 | abaranosky | micrypt: after doing that, how do I connect to the weasel repl so I can evaluate code form cljs? |
| 16:06 | abaranosky | or am I missing something fundamentally here ? |
| 16:07 | micrypt | abaranosky: Haven't looked at this in a while, but I vaguely remember that you ought to already be connected. |
| 16:07 | abaranosky | micrypt: .... investigating.... |
| 16:11 | abaranosky | micrypt: thx, I got it working. You're the man :) |
| 16:14 | brucehauman | dnolen_: well the warnings are gone in 2202. But things seem to be really robust in 2411. |
| 16:14 | brucehauman | dnolen_: that is just a feeling |
| 16:15 | shriphani | hey everyone. I don't follow clojure on jira so frequently so this might be a n00b question. Is clojure 1.8 going to come with a speedup |
| 16:17 | dnolen_ | shriphani: what kind of speedup? |
| 16:18 | shriphani | program startup |
| 16:18 | shriphani | dnolen_ ^ |
| 16:18 | shriphani | repl launches still take a lot of time compared to say python. |
| 16:20 | dnolen_ | shriphani: launching a regular Clojure REPL doesn't take very long - like a second on my machine |
| 16:20 | shriphani | I am presuming you're doing this with lein repl ? |
| 16:21 | dnolen_ | shriphani: that's not a *regular* Clojure REPL |
| 16:21 | shriphani | ah. |
| 16:21 | EvanR | lein repl, takes about 10-20 seconds for me |
| 16:21 | shriphani | so I am presuming this is a question about how to make a lein repl launch faster |
| 16:22 | TEttinger | shriphani, there have been some good experiments done there. grenchman, drip |
| 16:22 | dnolen_ | shriphani: there's whole lein github wiki page about it that |
| 16:23 | justin_smith | there is a beautiful flow one can achieve in clojure, where you step by step transform the shape of the data into the shapes needed. It feels like juggling, if I were good at it. |
| 16:24 | SagiCZ1 | justin_smith: do you think all problems can be described as shaping data? |
| 16:24 | justin_smith | SagiCZ1: hmm... I am not 100% sure if that is always *useful*, but I am sure it is always possible |
| 16:25 | justin_smith | but I enjoy the flow and discovery of solving the problem domain when I model my task that way |
| 16:25 | justin_smith | and watch the data structures I produce achieve the shape I need |
| 16:25 | SagiCZ1 | i really like you can easily shape collections using apply filter map etc.. end write it as (-> coll foo1 foo2 ... ) it really looks great and is super readible |
| 16:25 | justin_smith | (and as a final stage I of course have the imperative thingy that takes that data structure and does the io or transaction or whatever) |
| 16:26 | justin_smith | SagiCZ1: yes, and has a nice developer workflow for incrementally reaching a solution |
| 16:26 | EvanR | -> a b c d is also known as (comp b c d) a if the arguments were in another order |
| 16:26 | SagiCZ1 | yup.. i would love to apply similar solutions to more problems than i already do |
| 16:26 | SagiCZ1 | EvanR: not as readible to me.. |
| 16:27 | justin_smith | SagiCZ1: so far it seems like one of the most imporant tricks is starting with an imperative stage that has no logic, then building the data structure that I know that stage should receive |
| 16:27 | EvanR | SagiCZ1: well, what i was suggesting is the way unix pipe programs look |
| 16:28 | EvanR | just making sure those arent readable either |
| 16:28 | SagiCZ1 | justin_smith: what do you mean by imperative stage without logic? |
| 16:28 | SagiCZ1 | EvanR: i guess.. i have no experience with unix pipes sadly |
| 16:28 | EvanR | an as some aside biggotry, i cant stand any syntax that begins with a right arrow with nothing on the left |
| 16:29 | EvanR | looking at ruby |
| 16:29 | EvanR | and coffee |
| 16:29 | SagiCZ1 | oh |
| 16:29 | SagiCZ1 | ok maybe it was not a good example.. sorry |
| 16:29 | justin_smith | SagiCZ1: as in (perform-transaction data) |
| 16:29 | justin_smith | SagiCZ1: and that is the only place where a side effect occurs |
| 16:29 | justin_smith | so everywhere else I can just construct the data structure that drives the transaction, without thinking about ordering etc. |
| 16:30 | SagiCZ1 | yeah.. so basicaly isolating the places where side effects happen |
| 16:30 | EvanR | justin_smith: in which case, youd probably describe it as the main effect, the point of that part of the program |
| 16:30 | justin_smith | like a breandead monad |
| 16:30 | justin_smith | sure |
| 16:30 | justin_smith | *braindead |
| 16:32 | SagiCZ1 | i was a little bit dissapointed with clojure lately.. when i write code that looks really nice and is functional.. only to find out later that it is unusebly slow, because by abstracting the data manipulations my algorithms end up for example O(n^2) or worse.. so then i have to go back, optimize and the result is usually uglier |
| 16:32 | EvanR | and you can use mutation to implement a function and still keep it pure as far as an observer can tell, if it would make it faster or more readable |
| 16:33 | amalloy | that's a fairly unusual occurrence, SagiCZ1: clojure encourages you to use appropriate data structures, with the easily-available maps, vectors, sets, and so on. what did you accidentally write inefficiently? |
| 16:33 | turbofail | seriously i've never had that problem |
| 16:33 | SagiCZ1 | amalloy: its totally posible i am actually NOT writing a good clojure code.. and i am just writing a bad clojure code which is .. well bad |
| 16:33 | turbofail | i've had problems where the constants were larger than i'd like, but never a problem with orders of growth |
| 16:34 | edw | SagiCZ1: Do you have an example? I have trouble imagining where writing pure, elegant code would result in raising the exponent of the time or space complexity of a solution. |
| 16:34 | edw | (What turbofail said.) |
| 16:34 | justin_smith | I think you do have to develop a "nose" for things which increase your complexity-order |
| 16:34 | shriphani | edw, linear algebra ? |
| 16:34 | SagiCZ1 | it was an algorithm which would find two closest points in a collection of points |
| 16:35 | justin_smith | yeah, doing that in an 'intuitive' way could easily blow up |
| 16:35 | stuartsierra | I think this is true of imperative programming too: for any algorithm, there is frequently a solution which is simple, obvious, and slow. |
| 16:35 | shriphani | SagiCZ1, I would floyd warshall that. |
| 16:35 | shriphani | or nvm. |
| 16:35 | SagiCZ1 | justin_smith: yep.. maybe it is just a coincidence, but i remembered that occasion |
| 16:35 | edw | shriphani: Naive, un-special-cased matrix code is always going to be molasses-slow. That's not a functional vs imperative issue. |
| 16:36 | turbofail | yeah the simple way of doing that problem is going to be n^2 in imperative code as well |
| 16:37 | SagiCZ1 | also i have a very hard time imagining how much space in memory clojure collection can actually take up.. do you guys calculate it some way? |
| 16:38 | stuartsierra | SagiCZ1: Estimating memory usage for *anything* in a managed runtime like the JVM is hard. |
| 16:39 | TEttinger | strings in particular use different backing structures at different sizes, IIRC. when profiling string heavy code you often see com.sun packages being used |
| 17:44 | devn | hrm, single page clojurescript app + friend-oauth2, the solution i have working is a total hack.b |
| 18:12 | andyf | technomancy: I have a recollection of someone, perhaps you, expressing wishes that Clojure complained about keywords other than :use :require :import and a few other documented ones. Was it you? |
| 18:15 | andyf | e.g. a warning or error if someone did something like this, which Clojure happily turns into a call to the println function: (ns my.ns (:println ?Hello ns form!?)) |
| 18:16 | andyf | which would be syntactically correct if I could figure out a way to get my IRC client to avoid using smart quotes by default whenever I start it up again. |
| 18:16 | andyf | Anyway, in case you do read this, I am working on an Eastwood linter that will warn about various wrong and/or suspicious things about ns forms, and am looking for ideas. |
| 18:26 | stuartsierra | andyf: I've often wished the `ns` macro were stricter, because I had to try to work around all the different variations in syntax for tools.namespace. |
| 18:27 | andyf | stuartsierra: To be clear, I am not here proposing to create a ticket to make changes to Clojure's ns form -- only to warn about things that look wrong or suspicious in Eastwood. |
| 18:27 | stuartsierra | andyf: I know. But that would still help. :) |
| 18:27 | andyf | Top of my list is to warn about references in vectors, i.e. http://dev.clojure.org/jira/browse/TNS-21 |
| 18:28 | andyf | warning about keywords other than :require :use :import and the few other documented ones is also easy. |
| 18:29 | andyf | Someone suggested the following in an Eastwood issue, but I haven't investigated it enough to see whether it is even a correct suggestion: https://github.com/jonase/eastwood/issues/98 |
| 18:31 | andyf | Basically, if someone ever had a wrong ns form that took them a while to figure out a problem with it, and it can be detected "syntactically", I'm interested. |
| 18:31 | stuartsierra | andyf: That looks correct (#98). `:only` doesn't mean anything in `:require`, and the example is missing a vector around the libspec. |
| 18:33 | stuartsierra | andyf: If you're interested in all the forms that tools.namespace understands (which is a subset of what Clojure allows) see https://github.com/clojure/tools.namespace/blob/5b0944994b12f1a18b4c5763ce2a5d7ab5b49085/src/main/clojure/clojure/tools/namespace/parse.clj |
| 18:34 | andyf | I'll dig more, but you mean you think it should start with (:require [some.lib] instead of (:require some.lib ? I thought Clojure handled it with the bare lib spec. |
| 18:35 | Caffeine | https://clojars.org/core.logic is super duper confusing. It says to use [core.logic "0.6.1-SNAPSHOT"] for lein, but it doesn't work, you have to use [org.clojure/core.logic "0.8.8"]. I where to report this issue, or if it's even one (or if I'm confused)... |
| 18:35 | andyf | Yep, I have been looking at that namespace and using pieces of it. May use more. |
| 18:35 | stuartsierra | andyf: a bare lib name is OK, but that example has `(:require some.lib as lib)` which doesn't work. |
| 18:35 | stuartsierra | That is, `(:require some.lib :as lib)` instead of `(:require [some.lib :as lib])` |
| 18:36 | Caffeine | s/I where/I don't know where/ |
| 18:36 | andyf | got it. I don't have the allowed syntax memorized yet, but probably will by the time this linter is done. |
| 18:37 | stuartsierra | andyf: The docstrings for `ns`, `require`, and `use` are also quite specific about what the syntax is supposed to be. |
| 18:38 | stuartsierra | Caffeine: clojars.org is not a definitive reference for anything. The README at https://github.com/clojure/core.logic shows the current release version. |
| 18:39 | stuartsierra | Also, everything under github.com/clojure/ is published by default to the Maven Central Repository <http://search.maven.org/> not Clojars. |
| 18:39 | andyf | I agree clojars.org isn't definitive for Clojure contrib libraries like core.logic, but surely it is definitive for libraries only deployed there? |
| 18:39 | hiredman | what does definitive mean? |
| 18:40 | andyf | one dictionary defn: "the most authoritative of its kind: e.g. the definitive biography of Harry Truman" |
| 18:42 | hiredman | the definitive most up to date version in a maven repo? |
| 18:43 | mjoanis | ok, that's weird... I guess the page should be taken down... outdated enough |
| 18:44 | hiredman | some day, a kademlia federated maven repo |
| 19:21 | SpikeMaster | hi clojure |
| 19:22 | andyf | howdy |
| 19:22 | SpikeMaster | what's the best tooling for clojure? (advanced users). IDE? |
| 19:23 | Bronsa | (inc andyf) ;; thanks for the sanity check on CLJ-979 |
| 19:23 | lazybot | ⇒ 11 |
| 19:23 | SpikeMaster | (inc andyf) |
| 19:23 | lazybot | ⇒ 12 |
| 19:24 | SpikeMaster | whoah. wanted to see if that was real |
| 19:24 | andyf | opinions vary. Cursive is shaping up to look impressive. Eclipse+Counterclockwise is used by some. Vim+Fireplace and Emacs+CIDER are perhaps the most common. |
| 19:25 | Bronsa | SpikeMaster: even if I personaly use emacs, if I had to start from scratch now I'd go with Cursive Clojure 100% |
| 19:25 | arrdem | Agreed. Cursive is pretty awesome and is easier to pick up. |
| 19:25 | arrdem | Emacs... can be an investment. |
| 19:26 | andyf | You can get a rough idea of what fraction of people use what under the "What is your *primary* Clojure/Script/CLR dev environment?" question here: https://cognitect.wufoo.com/reports/state-of-clojure-2014-results/ |
| 19:26 | SpikeMaster | lets say you are a master of Eclicpse, Vim, and Emacs. A true master that understands the tools at the source code level. Which would you go with? |
| 19:27 | noonian | emacs |
| 19:27 | andyf | SpikeMaster: If you find someone who understands all of those tools at the source code level, let us know :) |
| 19:29 | arrdem | hehe |
| 19:29 | arrdem | Bronsa: oi got a minute |
| 19:30 | sg2002 | SpikeMaster: I'd say it all depends on your project. Whehter you need a debugger. Whether you need java interop. Emacs is terrible for java for example. There are many things to consider. |
| 19:30 | Bronsa | arrdem: yeah |
| 19:31 | SpikeMaster | emacs is awesome for C# with omnisharp. Shame it sucks for java. |
| 19:31 | SpikeMaster | i am actually adept at all 3 tools. Vim, Emacs, and Eclipse. |
| 19:31 | arrdem | Bronsa: https://www.refheap.com/94814 <- Clojure grammar. Namespace qualified symbols are hitting a parser conflict. mind taking a look. |
| 19:32 | Bronsa | arrdem: I said I got a minute, not sure about the brain power :P |
| 19:32 | Bronsa | I'll take a look |
| 19:32 | arrdem | Bronsa: lol thanks. |
| 19:34 | arrdem | Bronsa: I'm expecting that the string "foo/bar" will be ... |
| 19:34 | andyf | arrdem: What parser tool are you using? |
| 19:34 | arrdem | son of a gun I found it |
| 19:34 | arrdem | Bronsa: I'm good. thanks. |
| 19:34 | Bronsa | cool. |
| 19:34 | arrdem | andyf: antlr4 |
| 19:34 | arrdem | andyf: via aphyr's clj-antlr4 |
| 19:34 | arrdem | not what I'd call... user friendly |
| 19:34 | andyf | tools.reader doesn't do what you want? |
| 19:35 | arrdem | andyf: Oxlang stuff. Trying to stand free of Clojure infrastructure :P |
| 19:39 | Bronsa | I'm really biased because I like to see my name on a commit but if CLJ-979 gets in 1.7.0 it'll be really good for the AOT story in clojure |
| 19:41 | arrdem | nice. keywords and symbols working now. |
| 19:41 | andyf | Bronsa: You've certainly been working at that one hard enough :-) Thanks. |
| 19:41 | arrdem | justin_smith: lazybot plugin to generate CLJ-XXXX links? |
| 19:42 | Bronsa | andyf: I now know much more about jvm classloaders than I'd ever wished I did |
| 19:43 | arrdem | Bronsa: gross problem. nice patch. |
| 19:43 | justin_smith | arrdem: yeah, that would actually be pretty cool. you can make an issue for that feature on my lazybot fork if you like |
| 19:43 | arrdem | justin_smith: willco |
| 19:43 | justin_smith | arrdem: speaking of features, I should do some more work on hint-hint |
| 19:43 | arrdem | justin_smith: dude you have issued turned off |
| 19:43 | arrdem | justin_smith: you're not a contrib |
| 19:43 | arrdem | justin_smith: the fuck man |
| 19:44 | justin_smith | weird? I'll turn them on |
| 19:44 | Bronsa | justin_smith: damn I totally forgot about hint-hint. I really need to contribute to that when I have some time |
| 19:44 | justin_smith | arrdem: are you looking at noisesmith/lazybot? |
| 19:44 | arrdem | justin_smith: yep |
| 19:44 | arrdem | should build an emacs translation table from IRC handles to github URLs at some point.. |
| 19:45 | justin_smith | are they on now? |
| 19:45 | Bronsa | or just ban from the internet whoever has more than one nick. |
| 19:45 | arrdem | justin_smith: yep |
| 19:45 | Bronsa | starting from justin_smith |
| 19:45 | arrdem | Bronsa: yeah but then some really cool ppl like bbloom and dnolen don't get to stick around :C |
| 19:46 | justin_smith | on the upside I would have so much more free time |
| 19:46 | Bronsa | some losses are necessary for the cause |
| 19:49 | andyf | * checks sane list. That was quick. |
| 19:50 | arrdem | You must be this crazy to compile Clojure code |
| 20:03 | justin_smith | let me just say, committee is a terrible word |
| 20:04 | justin_smith | doing a datomic project with campaign finance data... so many fucking keywords with "committee" in the name, so many chances to spell committee wrong in a keyword... |
| 20:22 | andyf | justin_smith: Eastwood's keyword-typos linter might be useful to you: https://github.com/jonase/eastwood#keyword-typos |
| 20:22 | andyf | It must be enabled explicitly to see its output, since it can be fairly noisy. |
| 20:23 | andyf | Also, if you use emacs, dynamic-abbrev is cool |
| 20:23 | justin_smith | andyf: luckily datomic is pretty strict about schemas, but I just keep catching myself with the same typos |
| 20:23 | justin_smith | andyf: yeah, I need to remember to use M-/ more often |
| 20:24 | andyf | Cursive will probably have symbol/keyword/whatever completion with AI |
| 21:30 | weavejes_ | justin_smith: I have an indent-or-complete function that I map to tab |
| 21:31 | justin_smith | weavejester: that's a good idea. |
| 21:33 | weavejester | justin_smith: https://gist.github.com/weavejester/569a6eb40d28f9edbd2c if you're interested. |
| 21:34 | justin_smith | what's that looking-at expression do? |
| 21:35 | weavejester | justin_smith: It's emacs regex syntax for "end of word" |
| 21:36 | weavejester | justin_smith: Uh, actually, end of symbol |
| 21:48 | arrdem | weavejester: have you seen aggressive-indent-mode? |
| 21:49 | weavejester | arrdem: No, what's that? |
| 21:49 | weavejester | Just googled it |
| 21:49 | weavejester | Huh, interesting... |
| 21:49 | arrdem | I like it a _lot_ |
| 21:50 | arrdem | gets a little... janky when you don't keep everything balanced |
| 21:50 | arrdem | whole file is indented 6 or 8 levels and then unindented. |
| 21:50 | weavejester | Hm, maybe I'll make sure it's only loaded when paredit is loaded. |
| 21:51 | arrdem | it works fine without paredit, you just get agressive about using commas for whitespace you want to round trip :P |
| 21:53 | weavejester | btw, on the subject of emacs, the only advantage I've heard of smartparens over paredit is that sp can handle XML/HTML |
| 21:53 | weavejester | Is there any other advantage? |
| 21:53 | justin_smith | interesting |
| 21:54 | arrdem | weavejester: I'm a filthy non-paredit user, sorry I can't help more. |
| 21:54 | arrdem | my brain just... isn't there yet |
| 21:54 | weavejester | Doesn't smartparens also have a non-strict mode? |
| 21:55 | arrdem | yeah I think that's what I run it in. |
| 22:00 | arrdem | has anyone here used a hexadecimal float in anger? I can't imagine. |
| 22:03 | kristof | Oh, arrdem |
| 22:03 | kristof | How's your compiler coming along? Or subset, or whatever it was. |
| 22:05 | arrdem | kristof: http://arrdem.com/2014/12/11/oxcart_going_forwards/ |
| 22:05 | arrdem | kristof: dead until I feel like hard forking Clojure |
| 22:05 | kristof | Oh, ha, that was released yesterday |
| 22:05 | arrdem | yarp |
| 22:05 | kristof | Excellent timing for me to ask, I suppose, considering I haven't spoken to you in at least half a year |
| 22:06 | arrdem | kristof: if you check out the github repo there are some kickass demos that totally work, but it's far from "done". the blog post says it all. |
| 22:16 | kristof | arrdem: I'm sorry to hear that. |
| 22:16 | kristof | arrdem: Read your post, and I still think the idea is worth picking up again in the future for people who want a statically linked, optimized lisp |
| 22:17 | kristof | The only really popular language right now that supports full metaprogramming is Rust :( |
| 22:17 | arrdem | yeah :C |
| 22:17 | kristof | arrdem: That said, I got distracted and started reading your syscalls post |
| 22:17 | arrdem | I hope that Oxcart comes back to life, or Kiss or Oxlang actually go somewhere |
| 22:17 | kristof | which is even more interesting than I thought |
| 22:18 | arrdem | kristof: lol I can't take credit for that, that's really a mate's idea. check out the LispM post. That's my best right now |
| 22:18 | kristof | I didn't like that one :P |
| 22:18 | kristof | Saw it in my planet clojure feed |
| 22:19 | arrdem | lol |
| 22:20 | arrdem | you're welcome to disagree with me, I just want someone to show me wrong. I got some "corrections" from old LispM hackers, but they were details not flaws in the argument. |
| 22:22 | kristof | Well, the sections on the historical lisp machine and the contrast to modern hardware are fine, I learned a fair bit |
| 22:23 | kristof | arrdem: I was just referring to your concluding section. I think language homogeneous environments are kind of worthless |
| 22:23 | Wild_Cat | what's the matter with Rust? It looks really good. |
| 22:24 | kristof | Wild_Cat: not garbage collected |
| 22:24 | arrdem | kristof: yeah... that's a something I need to really sit and have a think on. I don't see a fundimental reason why a well designed homogenous language system is fundimentally a problem given the strict functional equivalence of modern languages. |
| 22:24 | arrdem | kristof: hey man they have some kickass escape analysis :P |
| 22:24 | Wild_Cat | kristof: Rust's memory management really seems to make a lot of sense to me. |
| 22:24 | Wild_Cat | it's almost like compile-time GC. |
| 22:24 | arrdem | Wild_Cat: that was the idea :P |
| 22:25 | kristof | It's fancy RAII |
| 22:25 | kristof | waiting on that full fledged gc library |
| 22:25 | kristof | anyway, that's beside the point |
| 22:25 | kristof | arrdem: I don't see a fundamental reason why we need a well designed homogenous langauge system. |
| 22:25 | Wild_Cat | and their super-powerful type system means that full GC can probably be added after the fact |
| 22:26 | kristof | arrdem: Ok, question: does everything run on a single garbage collector? |
| 22:26 | arrdem | kristof: what where when why? |
| 22:27 | kristof | arrdem: The old lisp machines worked by loading lisp programs into a single lisp image, right? |
| 22:27 | arrdem | kristof: yep. |
| 22:27 | kristof | So garbage collection happened at the operating system level |
| 22:27 | kristof | But that pauses EVERY running program. |
| 22:27 | arrdem | sorta kinda |
| 22:28 | kristof | Still a fair point, minus nuances |
| 22:28 | justin_smith | luckily today we have concurrent GC. Well some of us do. |
| 22:28 | kristof | justin_smith: On Azul, maybe |
| 22:28 | kristof | Is hotspot pauseless? |
| 22:29 | justin_smith | since 1.4 |
| 22:29 | arrdem | (inc justin_smith) |
| 22:29 | lazybot | ⇒ 158 |
| 22:29 | arrdem | good lord. you could beat alan at this rate |
| 22:30 | kristof | Hrm. |
| 22:30 | arrdem | kristof: so the reason for wanting a "single language" machine is that communicating between threads and breaking things into services becomes a _lot_ easier. |
| 22:30 | justin_smith | we'll see. I don't have his wit and insight. |
| 22:30 | justin_smith | arrdem: do you have an opinion on mirage? |
| 22:30 | arrdem | kristof: you no longer have the Unix problem of "everyone's writing parsers and printers" |
| 22:31 | arrdem | kristof: instead you can have OS/VM level constructs for moving raw data... or in Clojure's case just sharing a pointer :D |
| 22:31 | kristof | arrdem: Sure, but that's assuming the host language is perfect. Inevitably someone wants something else and doesn't want to have to wait for the language developer to implement it. |
| 22:31 | justin_smith | http://www.openmirage.org/ |
| 22:31 | arrdem | kristof: some people are just silly :P |
| 22:31 | justin_smith | kristof: that never got in the way of C |
| 22:32 | kristof | arrdem: Well, you can't write realtime applications in Java. Or at least, I don't think that's the language of choice, is it? |
| 22:32 | arrdem | justin_smith: I don't know enough about it but I can throw it on my reading list if you're really serious |
| 22:32 | arrdem | kristof: dont != couldn't. |
| 22:32 | justin_smith | arrdem: it's ocaml instead of an OS running on a vm |
| 22:32 | justin_smith | arrdem: single language runtime |
| 22:32 | arrdem | justin_smith: oh. nice! |
| 22:32 | justin_smith | arrdem: which seems relevant to this discussion |
| 22:33 | kristof | Hrm. Okay. |
| 22:33 | arrdem | kristof: so here's my 0.02 |
| 22:33 | kristof | arrdem: What about low level programming? |
| 22:33 | arrdem | I've heard the argument made that Clojure needs a strong GC due to all the structural sharing stuff. |
| 22:33 | justin_smith | arrdem: oh, and it is also self-hosting |
| 22:33 | kristof | arrdem: High level languages that provide safe environments don't allow you to do the kind of bit mangling that's necessary for certain domains. |
| 22:34 | justin_smith | kristof: the fact that ocaml self-hosts mirage would be an argument against that |
| 22:34 | arrdem | kristof: sure, which is why you have an assembler in $HIGH_LEVEL_LANG and an escape hatch so if you really need to you can run asm |
| 22:34 | justin_smith | not that every high level lang lets you do that stuff easily of course |
| 22:34 | kristof | arrdem: Like Rust's unsafe keyword. Okay. |
| 22:34 | arrdem | kristof: I explicitly mentioned having that as a vehicle towards becomming self hosting. |
| 22:34 | kristof | justin_smith: Does ocaml have something similar to above? |
| 22:35 | justin_smith | it compiles down to machine code, and you can use arbitrary machine code via ffi |
| 22:35 | kristof | Was aware of the former, not the latter |
| 22:35 | justin_smith | (I mean to self-host targeting a bare VM you kind of have to be able to do that) |
| 22:36 | arrdem | Okay. Still working with Antlr. Do I care about performance enough to hammer out a listener client to speed this crap up. |
| 22:36 | arrdem | or do I just do a tree walk in Clojure because I'm a lazy sod |
| 22:36 | kristof | arrdem: Maybe I'm convinced now. |
| 22:36 | kristof | Not that it matters, I'm not important. |
| 22:36 | arrdem | lol |
| 22:36 | arrdem | I doubt anyone here fits that description |
| 22:36 | kristof | But I've argued about this in #lisp enough times to have thought that I had my position solidified on the matter |
| 22:37 | arrdem | the thing that's tough with this is nobody knows how it'll perform until someone goes and friggin does it |
| 22:38 | arrdem | so it's all moot unless there's a luntatic out there who chooses to do so |
| 22:39 | justin_smith | arrdem: so if you remember I posted that tweet because I saw a Tandy 102 on twitter while I was doing something with my own |
| 22:40 | justin_smith | I went and ordered a non-working one, with the idea that I can connect a beagle-bone's IO ports to its keyboard and LCD |
| 22:40 | justin_smith | there is more than enough room for a beagle-bone on the inside... |
| 22:40 | justin_smith | the keyboards on those things are actually very nice |
| 22:42 | arrdem | justin_smith: oh nice! |
| 22:45 | arrdem | okay... lambda expressions parsing.. |
| 22:50 | arrdem | dispatch & discard working |
| 22:50 | arrdem | ballin |