2015-06-15
| 01:25 | skelternet | this journey with clojurescript, oauth2, google, compojure, ring, friend and transit has been a long hard slog. |
| 01:36 | TEttinger | skelternet: perhaps a journey with toto, scarecrow, lion, and tinman would be more enjoyable. |
| 01:36 | TEttinger | (I think those probably are all libraries too, now that I think about it) |
| 01:39 | skelternet | (shudder) |
| 03:56 | ro_st | for some reason, evaluating #+clj in CIDER gives me "No reader function for tag +clj". how do i verify that the cljx nrepl middleware is loading? |
| 03:58 | TEttinger | ,(defmacro [[x y]] `(+ ~x ~y)) |
| 03:58 | clojurebot | #error {\n :cause "Don't know how to create ISeq from: clojure.lang.Symbol"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol, compiling:(NO_SOURCE_FILE:0:0)"\n :at [clojure.lang.Compiler macroexpand1 "Compiler.java" 6644]}\n {:type java.lang.IllegalArgumentException\n :message "Do... |
| 03:58 | TEttinger | ,(defmacro split+ [[x y]] `(+ ~x ~y)) |
| 03:58 | clojurebot | #'sandbox/split+ |
| 03:58 | TEttinger | ,(split+ [10 5]) |
| 03:58 | clojurebot | 15 |
| 03:59 | TEttinger | nice, destructuring works in macros |
| 04:11 | TEttinger | ,(print (defmacro split+ [[x y]] `(+ ~x ~y))) |
| 04:11 | clojurebot | #'sandbox/split+ |
| 04:54 | jonathanj | do zippers only operate on these tree structures where only the leaf nodes can contain data? |
| 05:39 | dagda1_ | is there anyway I could have used something different other than recursion for the process function in this gist? https://gist.github.com/dagda1/990912b7e62147cedb8b |
| 05:40 | dagda1_ | basically I wanted to use take-while or something until the list is empty? is this possible? |
| 06:11 | borkdude | has anyone by any change made a ring middleware for prerender.io? |
| 06:15 | oddcully | promising, if their own homepage is just a white page without javascript... |
| 06:16 | wasamasa | lol |
| 06:16 | wasamasa | seems as if this progressive enhancement thing is still pretty revolutionary |
| 06:17 | wink | oddcully: they say 'Allow your Javascript website to be crawled perfectly by search engines.' |
| 06:17 | wink | nothing about humans |
| 06:19 | oddcully | ah those pesky humans... always complaining |
| 06:55 | jonathanj | hrm, how can i have a list of (:x m) and (:y m) but only if the values for those keys are not nil? |
| 06:56 | jonathanj | ((juxt :x :y) m) -> [:something nil] |
| 07:10 | J_A_Work | So I’ve got auto-complete and ac-cider installed and working, but my repl completion is terribly broken. |
| 07:13 | J_A_Work | nm, just needed a restart. |
| 07:14 | oddcully | jonathanj: "but only" sounds to me like if or when. and every? could be used to see if all are non-nil |
| 07:16 | jonathanj | i don't actually know what i want |
| 07:16 | jonathanj | i'm trying to figure out how to use zippers with my data structure but i just can't get anywhere |
| 07:18 | jonathanj | all the articles i've managed to find so far use the nested vector style where data is stored only in leaf nodes, surely that can't be a requirement? |
| 07:53 | TimMc | wink++ |
| 07:54 | wink | I pleas not guilty |
| 07:54 | wink | *plead |
| 08:52 | irctc | Question for the group: I'm starting to learn clojure and the language seems terrific. I'd like to know what sorts of applications people have found it to be very useful in and what applications where you might have decided to use another language instead. |
| 08:54 | mmeix | doing it again (building a function and having the feeling, that this could be done easier...): https://www.refheap.com/102574 |
| 08:57 | justin_smith | mmeix: (reduce #(if (apply = %2) (conj %1 (first %2)) (into %1 %2))) |
| 08:57 | justin_smith | mmeix: by avoiding concat it becomes more efficient, and you keep the vector representation |
| 09:00 | mmeix | ah great - I had the same feeling about concat, but the solution didn't want to show itself in my brain ... thanks! (again & again) |
| 09:15 | justin_smith | and of course the apply thing is just to reduce the noise |
| 09:15 | mmeix | yes, understood |
| 09:18 | mmeix | I had - erroneousley - remembered, that "into" reverses the input |
| 09:18 | mmeix | but this isn't the case |
| 09:18 | mmeix | ,(into [1 2] [3 4]) |
| 09:18 | clojurebot | [1 2 3 4] |
| 09:18 | mmeix | ok |
| 09:19 | justin_smith | mmeix: into is like reduce conj |
| 09:19 | mmeix | ok |
| 09:19 | TMA | ,(into '(1 2) '(3 4)) |
| 09:19 | clojurebot | (4 3 1 2) |
| 09:19 | lumafi | it's just (reduce conj to from) |
| 09:19 | justin_smith | it reverses (just like conj does) if the destination is a list |
| 09:19 | mmeix | ah! yes |
| 09:19 | mmeix | that makes it clearer |
| 09:22 | Empperi | cfleming: thank you for the latest cursive update, fixed the debugger for me! <3 |
| 09:23 | Empperi | finally it understands it's evaluating clojure code and provides all the appropriate debugging tools for it |
| 09:30 | justin_smith | a rebus for node.js http://i.imgur.com/dCYJZTC.jpg |
| 09:30 | justin_smith | no, rebus is the wrong term |
| 09:36 | TimMc | justin_smith: "Probably not street legal"? |
| 09:36 | justin_smith | just like node! |
| 10:15 | elvis4526 | Hey guys, how do i use the clj->js macro in clj ? |
| 10:42 | wasamasa | not cljs->js in cljs? |
| 10:52 | justin_smith | elvis4526: I don't think clj->js is implemented in clj |
| 10:53 | cfleming | Empperi: Seriously man, you have the weirdest problems - and solutions! I didn't touch the debugger in the last release. |
| 10:53 | cfleming | Empperi: Not sure what it was, but I'm glad it's working :-) |
| 10:54 | xemdetia | the worst kind of fix |
| 10:55 | oddcully | with intellij it could be also sunflares |
| 11:02 | xemdetia | I double foil my laptop to make sure that doesn't happen |
| 11:02 | xemdetia | unless I need a baked potato more than an ide at the time |
| 11:07 | Empperi | cfleming: lol, well it did fix the debugger for me :) |
| 11:14 | noncom | does anyone actually use aleph for TCP? |
| 11:14 | justin_smith | noncom: I've played with it as a simple http server - or do you mean raw tcp without the http stuff on top? |
| 11:15 | noncom | yeah |
| 11:15 | code-ape | noncom: I've done a little bit of raw TCP stuff. |
| 11:15 | code-ape | with Aleph* |
| 11:15 | noncom | how do you setup a client to be ready to receive a string from a server? |
| 11:16 | Shayanjm | is there a way to suppress certain things from being printed to stdout from other packages/libraries? |
| 11:16 | noncom | i look into the examples on the official papers... the examples are too convoluted |
| 11:16 | Shayanjm | there are some warnings being printed to stdout upon loading a certain package which is an issue since the stdout is piped and reused |
| 11:16 | noncom | it looks like aleph is already leaving our realm and heading toward some higher intelligence... |
| 11:18 | code-ape | noncom: I've actually only used it for the server side, hold on one second and I'll see if I can decipher the docs for you :) |
| 11:18 | justin_smith | Shayanjm: if they are using a logging library you can fix the logging config. If they are using println you can hit them over the head with a board until they stop using println. |
| 11:18 | noncom | code-ape: http://ideolalia.com/aleph/literate.html#aleph.examples.tcp |
| 11:18 | Shayanjm | justin_smith: It's clj-http and the issue is actually from the logging library |
| 11:18 | justin_smith | Shayanjm: with all seriousness, you can also wrap calls in with-out-str which will capture any stdout usage of code inside it |
| 11:18 | Shayanjm | sl4j is throwing warnings, I think because clj-http is missing a jar |
| 11:19 | justin_smith | Shayanjm: yeah, with a logging lib you can make it log to a file |
| 11:19 | justin_smith | or send the messages to a server, or just shut up |
| 11:19 | Shayanjm | How do I do that for a package installed via clojars? |
| 11:19 | Shayanjm | since I don't have access to the configs locally (unless... I do?) |
| 11:19 | justin_smith | Shayanjm: it uses the classpath to find its configs |
| 11:20 | justin_smith | Shayanjm: a well behaved lib will leave things so you have final control of all logging behavior (including in some cases requiring you to provide a logger impl, this may be the case here I think) |
| 11:20 | Shayanjm | I think it might just be easier to wrap my require in with-out-str |
| 11:20 | noncom | code-ape: i would be highly grateful if you explain how i can just setup a channgel i can read from and write to |
| 11:20 | Shayanjm | but that means i'll have to break that line out of the ns :require |
| 11:21 | justin_smith | Shayanjm: I think it's fixable by a) explicitly depending on a sl4j impl that it can find and use and b) configuring sl4j with a properties file so that it never uses stdout |
| 11:21 | code-ape | noncom: So one thing that it nice about ztellman (author of Aleph) but that takes a bit of getting use to is that he creates a ton of libraries that he uses together. |
| 11:21 | Shayanjm | gotcha |
| 11:22 | Shayanjm | justin_smith: so by explicitly depending on a sl4j impl - do you mean installing sl4j in the top level project manually? |
| 11:22 | Shayanjm | let me try that |
| 11:22 | justin_smith | Shayanjm: no, sl4j is an interface |
| 11:22 | Shayanjm | oic |
| 11:22 | Shayanjm | My noob is showing, sorry |
| 11:22 | justin_smith | Shayanjm: so you need some other lib that satisfies that interface |
| 11:22 | noncom | code-ape: and that are rather cryptic in themselves. there are neither docs, nor examples. the sources look like i could spend a couple of days just to understand the whole idea of what happens there |
| 11:22 | justin_smith | no problem, this stuff is weird :) |
| 11:22 | Shayanjm | so like some other logging lib or something? |
| 11:23 | code-ape | noncom: I'm digging up the Manifold docs now, but basically you'll want to chain whatever is piping into or out of the TCP connection using Manifold. |
| 11:23 | noncom | yes, sounds great! :) also it resembles what written in the docs and in my code :) |
| 11:23 | noncom | still i just don't get, what's going on |
| 11:23 | justin_smith | Shayanjm: for example there is a "sl4j-simple" impl that requires no config - all the pom.xml stuff is easy to convert to project.clj, and depending on the stuff "magically" makes things work http://saltnlight5.blogspot.com/2013/08/how-to-configure-slf4j-with-different.html |
| 11:24 | Shayanjm | oh awesome |
| 11:24 | Shayanjm | thanks justin_smith - I'll play with it |
| 11:24 | justin_smith | Shayanjm: to make it not use stdout, you might want the log4j impl |
| 11:24 | justin_smith | there are examples of all the config on that page |
| 11:25 | code-ape | noncom: if you're willing to use Gloss, his example sounds like what you want. |
| 11:25 | noncom | i pretty much replicate what's written in the doc |
| 11:25 | code-ape | noncom: gloss will take bytes from the TCP connection and hand you thing (objects, strings, arrays, etc) |
| 11:25 | noncom | and i am able to send strings |
| 11:25 | noncom | however, i cannot manage getting them in.. |
| 11:25 | Shayanjm | justin_smith: this page clears things up - thanks a lot |
| 11:25 | noncom | ah, alright, i guess the question is to broad |
| 11:26 | code-ape | noncom: gotcha, one sec. |
| 11:26 | justin_smith | Shayanjm: glad I could help |
| 11:28 | noncom | code-ape: in other words, can't receive whats sent back from the server |
| 11:28 | noncom | code-ape: ideally i need to send a string and wait for an answer |
| 11:28 | Shayanjm | justin_smith: adding sl4j-simple was a simple fix, thanks a lot |
| 11:28 | noncom | when the answer comes, i act on it... |
| 11:31 | code-ape | noncom: found it! d/chain is what is limiting you. The creation of the TCP server returns a duplex stream, however when it is called as the first argument in manifold.deferred/chain then it can only emit things. |
| 11:32 | noncom | code-ape: what does all that mean?! |
| 11:32 | code-ape | um, I can code it up, where are we suppose to code stuff here? |
| 11:33 | noncom | code-ape: look : https://www.refheap.com/102581 |
| 11:33 | noncom | code-ape: code examples can be posted on refheap |
| 11:34 | noncom | code-ape: so, about my refheap: my biggest misunderstanding is how d/let-flow breaks the client so that it is not readable anymore |
| 11:34 | noncom | it starts to return that << ... >> always |
| 11:34 | noncom | (server logs are ok, it is just echoing) |
| 11:35 | noncom | code-ape: also, why does it return << ... >> instead of "nothing" when i read on a stream that does not hold a pending value? |
| 11:36 | code-ape | noncom: https://www.refheap.com/102582 |
| 11:38 | code-ape | noncom: that's all the help I can give for the moment, got to get back to work! |
| 12:08 | CookedGryphon | How do I type hint something that takes method(Collection<String> blah) |
| 12:09 | CookedGryphon | there is a second implementation method(String oneblah) |
| 12:09 | CookedGryphon | simply ^Collection still gives me call to static method can't be resolved argument types: unknown |
| 12:11 | justin_smith | CookedGryphon: I assume you imported java.util.Collection? |
| 12:11 | justin_smith | ,java.util.Collection |
| 12:11 | clojurebot | java.util.Collection |
| 12:11 | justin_smith | ,Collection |
| 12:11 | clojurebot | #error {\n :cause "Unable to resolve symbol: Collection in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: Collection in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6543]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: Col... |
| 12:12 | CookedGryphon | I hadn't |
| 12:12 | CookedGryphon | but even when I do, it's the same error |
| 12:12 | justin_smith | oh, that's very weird |
| 12:14 | TimMc | CookedGryphon: What if you fully qualify it in the type hint? |
| 12:14 | CookedGryphon | Same error |
| 12:14 | CookedGryphon | warning* |
| 12:15 | CookedGryphon | If I do the converse, and type hint a String in the same place |
| 12:15 | TimMc | Well, there goes that idea. |
| 12:15 | CookedGryphon | that's fine |
| 12:18 | CookedGryphon | oh |
| 12:18 | CookedGryphon | so if I move the type hint out to a let |
| 12:18 | CookedGryphon | it's fine |
| 12:18 | CookedGryphon | or at least doesn't complain |
| 12:18 | justin_smith | how do I prevent reload-caused inequality in a unit test? |
| 12:19 | justin_smith | I have a test that verifies my custom transit reader works, and an assertion that should be trivial fails after my first reload of the test namespace |
| 12:20 | justin_smith | https://www.refheap.com/102583 line 13 |
| 12:20 | justin_smith | *custom transit writer |
| 12:21 | justin_smith | in other words, how do I make sure (class (Foo.)) is always equal to Foo |
| 12:22 | justin_smith | (within one namespace, I am aware of inter-namespace issues) |
| 12:23 | justin_smith | updated to show the failing unit test message https://www.refheap.com/102583 |
| 12:26 | justin_smith | would this be a question of using clojure.tools.namespace/refresh instead of a simple require :reload? |
| 12:32 | TimMc | Yeah, I don't see why that's breaking. |
| 12:46 | puredanger | just curious, but have you tried ->Thing instead of Thing. ? |
| 12:47 | puredanger | (generally I'd prefer the former anyways) |
| 12:50 | csd_ | How do I access the leiningen tool window in Cursive? |
| 12:52 | cfleming | csd_: View->Tool Windows->Leiningen, or you can click on the toolwindow button at the edge of the screen if you have them shown. If you don't, click on the square icon at the bottom left of the screen, or hit Cmd twice (on mac, not sure on other platforms) to show them temporarily. |
| 12:52 | csd_ | cfleming: thank you |
| 12:55 | noncom | code-ape: hi again! |
| 12:55 | noncom | sorry, workers killed the lights here :( |
| 12:55 | noncom | i've got your refheap snippet |
| 12:56 | code-ape | nomcom: did you figure it out, or make progress? |
| 12:56 | noncom | i was able to get to the address just now |
| 12:57 | noncom | code-ape: you've set up two chains |
| 12:57 | code-ape | noncom: yup! |
| 12:58 | code-ape | noncom: one makes the tcp server the target and the other makes it the source. Inflow and outflow. |
| 13:01 | csd_ | cfleming: is there an easy way to get cursive to show docstrings at the bottom, like with cider? |
| 13:03 | sdegutis | Is this an anti-pattern? (or (not-empty (for [x some-list] ...)) "the list was empty") |
| 13:03 | sdegutis | Or in some other way a bad idea? |
| 13:03 | Shayanjm | So I have a list of list (which could theoretically get pretty huge). I'm trying to partition it by 1000 and iterate over the subsequent list-of-lists |
| 13:04 | sdegutis | Shayanjm: use partition then? |
| 13:04 | Shayanjm | I'm trying to print each sublist with a newline character between prints (so that stdout can be piped to another process which just grabs all the data) |
| 13:04 | sdegutis | Shayanjm: sounds like you can just use doseq with partition |
| 13:04 | sdegutis | Shayanjm: or for and partition and then println the whole thing |
| 13:04 | Shayanjm | sdegutis: I tried for as well as map println, and for some reason there's no output when run via the jar |
| 13:05 | sdegutis | Shayanjm: although you probably want partition-all if the last one will have < 1000 items |
| 13:05 | Shayanjm | but in the repl map println works |
| 13:05 | Shayanjm | yeah |
| 13:05 | Shayanjm | i'm using partition-all 1000 right now |
| 13:05 | Shayanjm | but when I run it via the jar, there's no output |
| 13:05 | sdegutis | Shayanjm: that's because you're never doing stuff with the lazy seq result -- this is a pretty common rookie mistake |
| 13:05 | sdegutis | an *incredibly boring* one fwiw |
| 13:06 | Shayanjm | sdegutis: Ah - that makes sense. So if I wanted to iterate and make sure each one prints - doseq? |
| 13:06 | noncom | code-ape: what is that "thing that emits data" ? |
| 13:06 | sdegutis | Shayanjm: I think amalloy_ can explain better -- he always can |
| 13:06 | noncom | is it a function a deferred or what... |
| 13:06 | sdegutis | Shayanjm: read the docs for doseq, doall, dorun, for, and map |
| 13:07 | justin_smith | puredanger: just got out of a meeting "expected: (= (class (->Thing :a)) Thing)" |
| 13:07 | justin_smith | puredanger: very weird |
| 13:08 | puredanger | justin_smith: my other questions are whether this is 1.6 or 1.7 and whether there is an aot-compiled class version of anything on the classpath |
| 13:08 | justin_smith | puredanger: no AOT I know of, *clojure-version* {:major 1, :minor 7, :incremental 0, :qualifier "beta2"} |
| 13:08 | justin_smith | I should update to the RC |
| 13:08 | code-ape | noncom: actually on second visit I think my example is wrong. Look at the wrap-duplex-stream method in the example. |
| 13:09 | justin_smith | puredanger: we have AOT for a jsvc wrapper, but that is not used during dev, it's a shim that uses resolve at runtime |
| 13:10 | code-ape | mainfold.stream/connect is used to connect two streams with the tcp stream being the target. |
| 13:10 | noncom | uh... maybe... |
| 13:11 | code-ape | noncom: https://github.com/ztellman/aleph/blob/master/examples/src/aleph/examples/tcp.clj#L44 |
| 13:11 | noncom | code-ape: i have that in my code |
| 13:11 | noncom | actually my code is not much different from the example |
| 13:11 | code-ape | noncom: I know, do you know what it does? |
| 13:12 | noncom | code-ape: well, in general. probably i am missing something... |
| 13:12 | justin_smith | puredanger: I still see the failed test with 1.7.0-RC1 |
| 13:13 | puredanger | justin_smith: I wouldn't expect anything changed since beta2 to affect this either way. it's most likely related to CLJ-979 |
| 13:13 | justin_smith | puredanger: this specifically happens after a require :reload of the ns |
| 13:13 | justin_smith | OK |
| 13:13 | justin_smith | yeah, deftype+reload that must be the one! |
| 13:14 | code-ape | noncom: You'll want to use the connect function to connect the stream given (second arg of wrap-duplex-stream) to whatever stream you want. In the example connect is used to connect a just created stream 'out' to the tcp stream 's'. Create whatever stream you want, pass it as an arg, and use connect with the tcp stream as the first arg so that it is the emitor. |
| 13:14 | justin_smith | luckily this was just a sanity-test in the unit tests, so it doesn't break our code, it's merely an indicator of insanity |
| 13:15 | code-ape | noncom: I'm afraid I don't have time to code up an example or I would. |
| 13:17 | puredanger | justin_smith: a new Thing class will get created and updated in the DCL on each reload but something must be resolving the old one. Not sure what in this example though. Have you tried switching to ->Thing ? |
| 13:18 | justin_smith | puredanger: yeah, that's what I meant by "expected: (= (class (->Thing :a)) Thing)" above |
| 13:18 | noncom | code-ape: alright, thank you! |
| 13:18 | puredanger | justin_smith: sorry, reading comprehension fail. |
| 13:19 | justin_smith | puredanger: but that issue on jira seemed to describe the behavior I was seeing quite precisely, so it's good to know it's at least on the radar |
| 13:19 | puredanger | justin_smith: that change is included in 1.7 (since alpha6 I think) |
| 13:19 | puredanger | so that is my confusion |
| 13:20 | justin_smith | puredanger: oh... I'll throw together a minimal reproducing case then, and maybe make my own jira submission (or an addendum to that issue?) |
| 13:20 | puredanger | I am puzzling through some related things on CLJ-1741 at the moment |
| 13:21 | justin_smith | that looks like it could be related, yeah... |
| 13:25 | puredanger | it is... tricky. |
| 13:30 | kaladin | anyone here use yesql? |
| 13:36 | justin_smith | puredanger: OK, I made a shell script that reproduces the issue with various jars - can reproduce the error in a minimal code snippet with versions all the way back to 1.3.0 (I figured older than that wouldn't even be worth trying) |
| 13:37 | justin_smith | puredanger: oh, wait... this is capturing the type in a clojure, which of course would cause inequality... so it is not a good example at all |
| 13:44 | Bronsa | justin_smith: ping me when you have a minimal example, I can take a look when I have some time |
| 13:44 | puredanger | justin_smith: when you say "reload" what exactly do you mean? |
| 13:47 | justin_smith | puredanger: Bronsa: turns out the minimal example requires three files, and fails with versions all the way back to 1.3 |
| 13:47 | justin_smith | https://gist.github.com/noisesmith/793a002ab7454f2b0419 |
| 13:47 | justin_smith | puredanger: the content of reproduce.clj should make what I mean by :reload clear |
| 13:49 | puredanger | Bronsa: me too :) |
| 13:49 | puredanger | justin_smith: I don't think you should expect that example to work (aside from your original case) |
| 13:49 | Bronsa | justin_smith: ah, I think i know why that happens |
| 13:50 | Bronsa | I don't think there's a way to fix it though |
| 13:50 | justin_smith | oh! do tell |
| 13:50 | Bronsa | type.Type is resolved at the ns load time |
| 13:50 | Bronsa | (type/->Type) returns a differnet class at runtime |
| 13:50 | justin_smith | but I reload both namespaces... |
| 13:51 | Bronsa | but you reload type after reloading driver |
| 13:51 | puredanger | but you reload them in the "wrong" order |
| 13:51 | justin_smith | ahh... |
| 13:51 | Bronsa | to fix this we would need to resolve class literals at runtime rather than at load time |
| 13:51 | noncom | is there any function like (f & args) which simply evaluates its args and does nothing else? |
| 13:52 | Bronsa | a significant performance hit, I think |
| 13:52 | justin_smith | puredanger: OK, fixing the order fixes it |
| 13:52 | Cust0dian | noncom, identity? http://clojuredocs.org/clojure.core/identity |
| 13:52 | noncom | ah, it's a (do) form |
| 13:52 | justin_smith | weirdly, in my testing scenario the reloads are in the right order and it still messes up though... |
| 13:52 | noncom | Cust0dian: i thought about it, but it is only 1-arity |
| 13:53 | justin_smith | (inc puredanger) |
| 13:53 | justin_smith | (inc Bronsa) |
| 13:53 | justin_smith | thanks for helping me sort that out, I was very confused for a moment there |
| 13:54 | puredanger | justin_smith: I think putting your deftype in a separate namespace would likely help in the deftest case |
| 13:54 | justin_smith | oh, I'll try that, thanks |
| 13:55 | Bronsa | puredanger: btw if you want to talk about the patch I proposed for CLJ-1714 or have a better proposal I'm happy to discuss the subject |
| 13:55 | puredanger | I've really stepped pretty far back from that, have been thinking about compilation in general |
| 13:55 | puredanger | I think there's no way we should do what you have in the patch there |
| 13:56 | puredanger | and I think the changes in CLJ-979 are good |
| 13:57 | puredanger | there are definitely longer-range and bigger changes needed re aot (clj-322, clj-1544, etc) |
| 13:57 | puredanger | I'm trying to figure out what if anything needs to be changed for 1.7 |
| 14:00 | Bronsa | puredanger: agreed. I come to the conclusion that maybe CLJ-979 should have included changes in the whole loading/compilation mechanism rather than targetting just the classloader |
| 14:01 | puredanger | running "compile" has runtime effects (classloading, updates to defmulti methods and protocol impls, interning of vars, and of course writes of class files to disk). if as in CLJ-1714 you run several compiles in a row, they are affected by the prior compiles. |
| 14:02 | puredanger | what we have (compile 1 namespace arbitrarily transitively and deeply) does not match up to what we typically want (compile all namespaces in a project but not anything outside the project) |
| 14:04 | Bronsa | puredanger: I'm glad to hear that :) have been thinking the same for a while |
| 14:05 | puredanger | I think perhaps requiring that the compile-path be on the classpath was a mistake. I think I'd rather that compilation outputs are purely outputs, not potential inputs. |
| 14:05 | Bronsa | yes, definitely |
| 14:05 | Bronsa | there might be some tooling issues too |
| 14:05 | puredanger | and that compilation should produce all the right runtime effects, in addition to exporting .class |
| 14:06 | Bronsa | trying to reproduce some weird cases manifesting themselves using lein via bare clojure has been a nightmare |
| 14:07 | puredanger | having compile-path on the classpath was necessary before we modified the loader to be able to go back and load the generated classes, but I do not think that is an issue post-979 |
| 14:07 | puredanger | 1741 is trivially resolved by just changing the order of compilation in the project.clj |
| 14:09 | puredanger | is that enough for us to push this off past 1.7? dunno. trying to make my peace with that. |
| 14:09 | Bronsa | puredanger: the real big issue I encountered mixing aot/jit is that once we load somens__init.class (via the applclassloader) classes won't be resolved using dcl |
| 14:10 | Bronsa | and I don't think there's anything we can do about it other than avoiding at all costs loading somens__init.class if not strictly necessary |
| 14:15 | puredanger | isn't that really an issue primarily when doing this mixture of compiling and consuming compiled? |
| 14:27 | Bronsa | puredanger: yes. I confess it never occurred to me that changing the requirements for *compile-path* could be a reasonable solution, shifting the blame from clojure to tooling in a way |
| 14:29 | puredanger | the original assumption (I went back and read the irc logs from Rich around the time) was that classloading would occur normally and aot would just produce classes at runtime that happened to be produced there |
| 14:30 | puredanger | but this predated a lot of the class generation stuff that we have now and I think that is a problematic assumption |
| 14:30 | Bronsa | puredanger: ah, just so you don't waste time as I already did, what we can't do is change how aot classes are preferred over clj files when in the classpath |
| 14:31 | puredanger | I think that's ok |
| 14:31 | puredanger | and desirable |
| 14:31 | Bronsa | that mechanism needs to be in place if we want to distribute both source and aot compiled files for fast loading purposes as clojure does for example |
| 14:32 | puredanger | yes, that's all fine |
| 14:33 | puredanger | there's some other interesting ideas in CLJ-322 and http://dev.clojure.org/display/design/Transitive+AOT+Compilation on the transitive aspects of aot |
| 14:33 | puredanger | I don't have a good opinion yet on a preference over the things people have proposed over time |
| 14:36 | mmeix | ,(defn zigzag [n] (take n (flatten (apply map vector ((juxt reverse identity) (range 1 (inc n))))))) |
| 14:36 | clojurebot | #'sandbox/zigzag |
| 14:37 | mmeix | ,(zigzag 7) |
| 14:37 | clojurebot | (7 1 6 2 5 ...) |
| 14:37 | mmeix | point free :-) |
| 14:37 | mmeix | or is it? |
| 14:41 | Bronsa | dnolen: ping |
| 14:42 | dnolen | Bronsa: pong |
| 14:43 | Bronsa | dnolen: i just noticed cljs allows using ^:const vars as dispatch values in case statements -- this is a significant difference from clj |
| 14:43 | Bronsa | I realize this is intentional but.. do we really want/need it? |
| 14:43 | justin_smith | ,(defn zagzig [n] (take n (apply mapcat list ((juxt reverse identity) (range 1 (inc n)))))) |
| 14:43 | clojurebot | #'sandbox/zagzig |
| 14:44 | justin_smith | ,(zagzig 7) |
| 14:44 | clojurebot | (7 1 6 2 5 ...) |
| 14:44 | justin_smith | mmeix: ^ |
| 14:44 | justin_smith | ~flatten |
| 14:44 | clojurebot | flatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with. |
| 14:44 | mmeix | just trying it out |
| 14:44 | dnolen | Bronsa: probably can't really change it now due to user code depending on it |
| 14:45 | Bronsa | puredanger: and I guess we can't backport this to clojure for the same reason? |
| 14:45 | mmeix | justin_smith thanks! |
| 14:46 | Bronsa | dnolen: btw I have a branch in tools.reader that uses the new ns-* stuff in cljs to support some auto-resolving if you want to try that out. still untested though |
| 14:47 | Bronsa | I see you're having fun trying to gete cljs-in-cljs. I don't envy you, my head hurts just thinking about all the different loading/compilation/runtime stages involved |
| 14:50 | dnolen | Bronsa: haha, macros are really the only last hurdle to a basic working bootstrapped analyzer/compiler. Just need to add macro support to the ClojureScript compiler and add a small hack to append the macros functions to cljs.core. |
| 14:50 | dnolen | Bronsa: analyzing trivial stuff like keywords from bootstrapped analyzer already works, but analyze-seq blocked on macro support |
| 14:51 | Bronsa | dnolen: no more import-macros in core.clj then? |
| 14:52 | dnolen | far more tedious will be IO bits for Node.js / Browser as well supporting deps in JARs under Node.js etc. |
| 14:53 | dnolen | Bronsa: cljs.core macro ns probably needs just a bit of pre-processing, import-macros will probably be hacked to inline source. |
| 14:56 | dfletcher | you know what makes me insanley happy for no reason? when a callback is also a perfectly useful utility function or operation. was doing some JQuery last night and it happened and I realized how rare it is in most languages and how common in clojure <3 |
| 14:56 | dnolen | Bronsa: I will checkout that branch, yeah the idea is just support more copy-pasta between cljs.tools.reader and clojure.tools.reader |
| 14:56 | Bronsa | dnolen: kinda unrelated but do you think there is a chance of removing the dependency on cljs.analyzer from cljs.core.clj? that is really what has drawn me back from keeping on developing t.a.js |
| 14:57 | Bronsa | I needed to backport every change in core.clj to t.a.js and I simply couldn't keep the pace :) |
| 14:57 | dnolen | Bronsa: hrm I don't think so, we use the analyzer for many non-trivial things in the macros file now |
| 15:01 | dnolen | Bronsa: I mean not against cleaning up the macros files if someone wants to do that work. The way it was done was just a matter of convenience. |
| 15:01 | dnolen | "I'm not against" |
| 15:02 | Bronsa | dnolen: got it, thanks. I'll think about it but don't have much time in the last period unfortunately. |
| 15:03 | dnolen | Bronsa: yep, also some stuff would really just be even uglier if not in the macros file, like the top-level `defn` special casing. |
| 15:34 | devn | Hey all, I'm curious how people feel about using logback or slf4j via a properties file vs using something like timbre |
| 15:37 | irctc | I'm wading through clojure.core.reducers docs and the newer transducers. Are the later replacing the former? |
| 15:43 | puredanger | kind of, although they are not either or |
| 15:44 | puredanger | reducers still are the only current path for sequence-like transformations that can occur in parallel on a map or vector via fold |
| 15:44 | irctc | Currently I'm clojure.core/reduce'ing over a LazySeq of Maps. calculating numbers and associng back to the map and conjing to list. Currently taking about 10 minutes serially using regular reduce. Would like to use r/fold having an 8 core dev box and 32 core prod. |
| 15:45 | irctc | puredanger: ah, ok that helps that the parallel aspect is still in reducers. |
| 15:51 | amalloy | fold is going to be a little bit awkward, unless it's quite expensive to calculate those numbers. to fold a lazy seq in parallel you'll have to realize it all at once, and then you'll still have a bottleneck of smooshing together all these intermediate maps into one big map |
| 15:58 | irctc | amalloy: It's expensive because of the amount of data. It's only a lazyseq because that's what's returned by clojure.jdbc. As I understand it 'fold' required putting into a vector anyway, due being implemented with a tree structure that can be easily parallelized. |
| 16:03 | irctc | amalloy: Here's the gist of the serial reduce I'm trying to convert to fold. (reduce (fn [c m] (conj c (assoc-some-extra-stuff m (calc-numbers m other-params-related-to-calculating)))) '() seq-of-maps) |
| 17:30 | thesaskwatch | WARNING: CIDER requires nREPL 0.2.7 (or newer) to work properly |
| 17:30 | thesaskwatch | WARNING: The following required nREPL ops are not supported: |
| 17:30 | thesaskwatch | format-code format-edn ns-path refresh |
| 17:30 | thesaskwatch | Please, install (or update) cider-nrepl 0.9.0-SNAPSHOT and restart CIDER |
| 17:30 | thesaskwatch | WARNING: CIDER's version (0.9.0-snapshot) does not match cider-nrepl's version (0.8.2) |
| 17:30 | thesaskwatch | Hi, what should I do when I get a message like this ^^ |
| 17:30 | thesaskwatch | My ~/lein/profiles.clj looks like this: {:user {:plugins [[cider/cider-nrepl "0.9.0-SNAPSHOT"]]}} |
| 17:40 | thesaskwatch | https://github.com/bhauman/lein-figwheel/issues/149#issue-75500018 seems to help. |
| 18:48 | daviid | hello, here: http://rsb.info.nih.gov/ij/developer/api/ij/plugin/ImageCalculator.html, how do i translate imp3 = ic.run("Average create", imp1, imp2) in clojure ? |
| 18:59 | daviid | i found it: (.run ic "Average create" imp1 imp2) |
| 19:45 | Surgo | How does the #=() dispatch work in EDN? Does it just call a function with the given arguments? |
| 19:45 | Surgo | I can't seem to find any docs about it |
| 19:47 | TEttinger | ,"#=(+ 1 2)" |
| 19:47 | clojurebot | "#=(+ 1 2)" |
| 19:47 | TEttinger | hm |
| 19:47 | TEttinger | ,*reader-eval* |
| 19:47 | clojurebot | #error {\n :cause "Unable to resolve symbol: *reader-eval* in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: *reader-eval* in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6543]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbo... |
| 19:48 | TEttinger | ,*read-eval* |
| 19:48 | clojurebot | false |
| 19:48 | Surgo | heh |
| 19:48 | TEttinger | that's why it isn't evaling it |
| 19:48 | Surgo | let me just paste my example issue |
| 19:48 | Surgo | I'm pretty confused over something |
| 19:48 | TEttinger | ,(with-binding [*read-eval* true] "#=(+ 1 2)") |
| 19:48 | clojurebot | #error {\n :cause "Unable to resolve symbol: with-binding in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: with-binding in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6543]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol:... |
| 19:48 | TEttinger | ,(binding [*read-eval* true] "#=(+ 1 2)") |
| 19:48 | clojurebot | "#=(+ 1 2)" |
| 19:48 | TEttinger | hm |
| 19:49 | Surgo | you forgot read-string |
| 19:49 | Surgo | it works as you'd expect, you get 3 |
| 19:49 | Surgo | I'm having trouble with a function I defined though, one sec while I try to pastebin it out |
| 19:49 | Surgo | can't copy/paste out of my silly VM, I hate vmware |
| 19:49 | TEttinger | no, I didn't forget read-string, that would get a form out of the string, and I want to eval inside the string |
| 19:53 | TEttinger | I never use #=, so I suppose I don't really know what it does |
| 19:53 | amalloy | just don't use #" |
| 19:54 | TEttinger | regex? |
| 19:54 | clojurebot | Sometimes people have a problem, and decide to solve it with regular expressions. Now they have two problems. |
| 19:54 | TEttinger | the first of those questions is typically "where did TEttinger go?" |
| 19:54 | amalloy | er, #= |
| 19:55 | Surgo | python http.server to the rescue. i hate vmware |
| 19:55 | Surgo | it appears to be a function call |
| 19:55 | Surgo | one sec |
| 19:56 | TEttinger | oh and the second of those questions is "gfredericks, can you answer a regex internals question?" |
| 19:57 | Surgo | http://pastebin.com/bMzfy6b8 -- top is the library code, bottom is the weirdness. I've verified that (deserialize base64) works just fine, and a read-string on a basic function works fine, but I can't seem to make the function call happen correctly with my new function |
| 19:58 | TEttinger | missing an # ? |
| 19:58 | TEttinger | (str "=(freeze.core/deserialize \"" |
| 19:58 | Surgo | rofl |
| 19:58 | Surgo | you're a lifesaver |
| 19:58 | Surgo | I've been at this for an hour! |
| 19:59 | TEttinger | heh I hope that's all it needs! |
| 19:59 | Surgo | yep, you got it |
| 19:59 | TEttinger | woo! |
| 20:00 | Surgo | of course, now I've got a second problem :) do you know if there's a way with (prefer-method X Y) to say, prefer X over Y for all defined X |
| 20:00 | Surgo | I'm worried I may have to descend into some macro trickery to enumerate all defined X |
| 20:00 | TEttinger | where X is java.io.Serializable here? |
| 20:01 | Surgo | Y is java.io.Serializable, X is anything that already has a multimethod implementation but also implements java.io.Serializable |
| 20:02 | TEttinger | uh, I think the list of everything that is Serializable is extremely large |
| 20:03 | Surgo | yes :( I am afraid I am going to have to write a macro to enumerate everything |
| 20:03 | TEttinger | there is another way |
| 20:03 | Surgo | essentially my goal is, to have a fallback multimethod implementation for java.io.Serializable so you can use it with...well, anything that spits back out and reads back in stuff with (pr-str), like ring |
| 20:04 | TEttinger | ah, so this needs compatibility with *print-dup* specifically |
| 20:04 | Surgo | yeah, exactly |
| 20:04 | Surgo | if I don't specify the preference order the first time it tries to dump anything that's both serializable and has a multimethod implementation it's going to throw an exception |
| 20:06 | amalloy | are you sure, Surgo? |
| 20:07 | amalloy | i think it should just work, because it uses type hierarchy to figure out automatic preferences |
| 20:08 | Surgo | one sec, pulling an example |
| 20:08 | Surgo | vm copy/paste at it again |
| 20:11 | Surgo | seems that way, at least |
| 20:11 | Surgo | (binding [*print-dup* true] (pr-str (fn [x y] (+ x y)))) IllegalArgumentException Multiple methods in multimethod 'print-dup' match dispatch value: class freeze.core$eval1397$fn__1398 -> interface clojure.lang.Fn and interface java.io.Serializable, and neither is preferred clojure.lang.MultiFn.findAndCacheBestMethod (MultiFn.java:182) |
| 21:21 | tmtwd | how do I get cljs to run on node on emacs? |
| 21:44 | dnolen | tmtwd: https://github.com/clojure/clojurescript/wiki/Emacs-%26-Inferior-Clojure-Interaction-Mode |
| 23:30 | tmtwd | does rlwrap work inside emacs? |
| 23:30 | tmtwd | or do I have to run it in a shell? |
| 23:31 | amalloy | why would you need rlwrap if you're in emacs? you already have emacs editing features? |
| 23:32 | tmtwd | I want a repl |
| 23:32 | tmtwd | can I just use cider-jack-in instead? |
| 23:40 | tmtwd | ClojureScript Node.js REPL server listening on 52201 |
| 23:40 | tmtwd | this launches in my terminal, what does 52201 socket mean? |
| 23:40 | tmtwd | I can't go to localhost:52201 , can I? |