#clojure logs

2015-06-15

01:25skelternetthis journey with clojurescript, oauth2, google, compojure, ring, friend and transit has been a long hard slog.
01:36TEttingerskelternet: perhaps a journey with toto, scarecrow, lion, and tinman would be more enjoyable.
01:36TEttinger(I think those probably are all libraries too, now that I think about it)
01:39skelternet(shudder)
03:56ro_stfor 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:58TEttinger,(defmacro [[x y]] `(+ ~x ~y))
03:58clojurebot#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:58TEttinger,(defmacro split+ [[x y]] `(+ ~x ~y))
03:58clojurebot#'sandbox/split+
03:58TEttinger,(split+ [10 5])
03:58clojurebot15
03:59TEttingernice, destructuring works in macros
04:11TEttinger,(print (defmacro split+ [[x y]] `(+ ~x ~y)))
04:11clojurebot#'sandbox/split+
04:54jonathanjdo zippers only operate on these tree structures where only the leaf nodes can contain data?
05:39dagda1_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:40dagda1_basically I wanted to use take-while or something until the list is empty? is this possible?
06:11borkdudehas anyone by any change made a ring middleware for prerender.io?
06:15oddcullypromising, if their own homepage is just a white page without javascript...
06:16wasamasalol
06:16wasamasaseems as if this progressive enhancement thing is still pretty revolutionary
06:17winkoddcully: they say 'Allow your Javascript website to be crawled perfectly by search engines.'
06:17winknothing about humans
06:19oddcullyah those pesky humans... always complaining
06:55jonathanjhrm, how can i have a list of (:x m) and (:y m) but only if the values for those keys are not nil?
06:56jonathanj((juxt :x :y) m) -> [:something nil]
07:10J_A_WorkSo I’ve got auto-complete and ac-cider installed and working, but my repl completion is terribly broken.
07:13J_A_Worknm, just needed a restart.
07:14oddcullyjonathanj: "but only" sounds to me like if or when. and every? could be used to see if all are non-nil
07:16jonathanji don't actually know what i want
07:16jonathanji'm trying to figure out how to use zippers with my data structure but i just can't get anywhere
07:18jonathanjall 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:53TimMcwink++
07:54winkI pleas not guilty
07:54wink*plead
08:52irctcQuestion 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:54mmeixdoing it again (building a function and having the feeling, that this could be done easier...): https://www.refheap.com/102574
08:57justin_smithmmeix: (reduce #(if (apply = %2) (conj %1 (first %2)) (into %1 %2)))
08:57justin_smithmmeix: by avoiding concat it becomes more efficient, and you keep the vector representation
09:00mmeixah great - I had the same feeling about concat, but the solution didn't want to show itself in my brain ... thanks! (again & again)
09:15justin_smithand of course the apply thing is just to reduce the noise
09:15mmeixyes, understood
09:18mmeixI had - erroneousley - remembered, that "into" reverses the input
09:18mmeixbut this isn't the case
09:18mmeix,(into [1 2] [3 4])
09:18clojurebot[1 2 3 4]
09:18mmeixok
09:19justin_smithmmeix: into is like reduce conj
09:19mmeixok
09:19TMA,(into '(1 2) '(3 4))
09:19clojurebot(4 3 1 2)
09:19lumafiit's just (reduce conj to from)
09:19justin_smithit reverses (just like conj does) if the destination is a list
09:19mmeixah! yes
09:19mmeixthat makes it clearer
09:22Emppericfleming: thank you for the latest cursive update, fixed the debugger for me! <3
09:23Empperifinally it understands it's evaluating clojure code and provides all the appropriate debugging tools for it
09:30justin_smitha rebus for node.js http://i.imgur.com/dCYJZTC.jpg
09:30justin_smithno, rebus is the wrong term
09:36TimMcjustin_smith: "Probably not street legal"?
09:36justin_smithjust like node!
10:15elvis4526Hey guys, how do i use the clj->js macro in clj ?
10:42wasamasanot cljs->js in cljs?
10:52justin_smithelvis4526: I don't think clj->js is implemented in clj
10:53cflemingEmpperi: Seriously man, you have the weirdest problems - and solutions! I didn't touch the debugger in the last release.
10:53cflemingEmpperi: Not sure what it was, but I'm glad it's working :-)
10:54xemdetiathe worst kind of fix
10:55oddcullywith intellij it could be also sunflares
11:02xemdetiaI double foil my laptop to make sure that doesn't happen
11:02xemdetiaunless I need a baked potato more than an ide at the time
11:07Emppericfleming: lol, well it did fix the debugger for me :)
11:14noncomdoes anyone actually use aleph for TCP?
11:14justin_smithnoncom: I've played with it as a simple http server - or do you mean raw tcp without the http stuff on top?
11:15noncomyeah
11:15code-apenoncom: I've done a little bit of raw TCP stuff.
11:15code-apewith Aleph*
11:15noncomhow do you setup a client to be ready to receive a string from a server?
11:16Shayanjmis there a way to suppress certain things from being printed to stdout from other packages/libraries?
11:16noncomi look into the examples on the official papers... the examples are too convoluted
11:16Shayanjmthere are some warnings being printed to stdout upon loading a certain package which is an issue since the stdout is piped and reused
11:16noncomit looks like aleph is already leaving our realm and heading toward some higher intelligence...
11:18code-apenoncom: 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:18justin_smithShayanjm: 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:18noncomcode-ape: http://ideolalia.com/aleph/literate.html#aleph.examples.tcp
11:18Shayanjmjustin_smith: It's clj-http and the issue is actually from the logging library
11:18justin_smithShayanjm: with all seriousness, you can also wrap calls in with-out-str which will capture any stdout usage of code inside it
11:18Shayanjmsl4j is throwing warnings, I think because clj-http is missing a jar
11:19justin_smithShayanjm: yeah, with a logging lib you can make it log to a file
11:19justin_smithor send the messages to a server, or just shut up
11:19ShayanjmHow do I do that for a package installed via clojars?
11:19Shayanjmsince I don't have access to the configs locally (unless... I do?)
11:19justin_smithShayanjm: it uses the classpath to find its configs
11:20justin_smithShayanjm: 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:20ShayanjmI think it might just be easier to wrap my require in with-out-str
11:20noncomcode-ape: i would be highly grateful if you explain how i can just setup a channgel i can read from and write to
11:20Shayanjmbut that means i'll have to break that line out of the ns :require
11:21justin_smithShayanjm: 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:21code-apenoncom: 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:21Shayanjmgotcha
11:22Shayanjmjustin_smith: so by explicitly depending on a sl4j impl - do you mean installing sl4j in the top level project manually?
11:22Shayanjmlet me try that
11:22justin_smithShayanjm: no, sl4j is an interface
11:22Shayanjmoic
11:22ShayanjmMy noob is showing, sorry
11:22justin_smithShayanjm: so you need some other lib that satisfies that interface
11:22noncomcode-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:22justin_smithno problem, this stuff is weird :)
11:22Shayanjmso like some other logging lib or something?
11:23code-apenoncom: 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:23noncomyes, sounds great! :) also it resembles what written in the docs and in my code :)
11:23noncomstill i just don't get, what's going on
11:23justin_smithShayanjm: 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:24Shayanjmoh awesome
11:24Shayanjmthanks justin_smith - I'll play with it
11:24justin_smithShayanjm: to make it not use stdout, you might want the log4j impl
11:24justin_smiththere are examples of all the config on that page
11:25code-apenoncom: if you're willing to use Gloss, his example sounds like what you want.
11:25noncomi pretty much replicate what's written in the doc
11:25code-apenoncom: gloss will take bytes from the TCP connection and hand you thing (objects, strings, arrays, etc)
11:25noncomand i am able to send strings
11:25noncomhowever, i cannot manage getting them in..
11:25Shayanjmjustin_smith: this page clears things up - thanks a lot
11:25noncomah, alright, i guess the question is to broad
11:26code-apenoncom: gotcha, one sec.
11:26justin_smithShayanjm: glad I could help
11:28noncomcode-ape: in other words, can't receive whats sent back from the server
11:28noncomcode-ape: ideally i need to send a string and wait for an answer
11:28Shayanjmjustin_smith: adding sl4j-simple was a simple fix, thanks a lot
11:28noncomwhen the answer comes, i act on it...
11:31code-apenoncom: 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:32noncomcode-ape: what does all that mean?!
11:32code-apeum, I can code it up, where are we suppose to code stuff here?
11:33noncomcode-ape: look : https://www.refheap.com/102581
11:33noncomcode-ape: code examples can be posted on refheap
11:34noncomcode-ape: so, about my refheap: my biggest misunderstanding is how d/let-flow breaks the client so that it is not readable anymore
11:34noncomit starts to return that << ... >> always
11:34noncom(server logs are ok, it is just echoing)
11:35noncomcode-ape: also, why does it return << ... >> instead of "nothing" when i read on a stream that does not hold a pending value?
11:36code-apenoncom: https://www.refheap.com/102582
11:38code-apenoncom: that's all the help I can give for the moment, got to get back to work!
12:08CookedGryphonHow do I type hint something that takes method(Collection<String> blah)
12:09CookedGryphonthere is a second implementation method(String oneblah)
12:09CookedGryphonsimply ^Collection still gives me call to static method can't be resolved argument types: unknown
12:11justin_smithCookedGryphon: I assume you imported java.util.Collection?
12:11justin_smith,java.util.Collection
12:11clojurebotjava.util.Collection
12:11justin_smith,Collection
12:11clojurebot#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:12CookedGryphonI hadn't
12:12CookedGryphonbut even when I do, it's the same error
12:12justin_smithoh, that's very weird
12:14TimMcCookedGryphon: What if you fully qualify it in the type hint?
12:14CookedGryphonSame error
12:14CookedGryphonwarning*
12:15CookedGryphonIf I do the converse, and type hint a String in the same place
12:15TimMcWell, there goes that idea.
12:15CookedGryphonthat's fine
12:18CookedGryphonoh
12:18CookedGryphonso if I move the type hint out to a let
12:18CookedGryphonit's fine
12:18CookedGryphonor at least doesn't complain
12:18justin_smithhow do I prevent reload-caused inequality in a unit test?
12:19justin_smithI 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:20justin_smithhttps://www.refheap.com/102583 line 13
12:20justin_smith*custom transit writer
12:21justin_smithin other words, how do I make sure (class (Foo.)) is always equal to Foo
12:22justin_smith(within one namespace, I am aware of inter-namespace issues)
12:23justin_smithupdated to show the failing unit test message https://www.refheap.com/102583
12:26justin_smithwould this be a question of using clojure.tools.namespace/refresh instead of a simple require :reload?
12:32TimMcYeah, I don't see why that's breaking.
12:46puredangerjust curious, but have you tried ->Thing instead of Thing. ?
12:47puredanger(generally I'd prefer the former anyways)
12:50csd_How do I access the leiningen tool window in Cursive?
12:52cflemingcsd_: 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:52csd_cfleming: thank you
12:55noncomcode-ape: hi again!
12:55noncomsorry, workers killed the lights here :(
12:55noncomi've got your refheap snippet
12:56code-apenomcom: did you figure it out, or make progress?
12:56noncomi was able to get to the address just now
12:57noncomcode-ape: you've set up two chains
12:57code-apenoncom: yup!
12:58code-apenoncom: one makes the tcp server the target and the other makes it the source. Inflow and outflow.
13:01csd_cfleming: is there an easy way to get cursive to show docstrings at the bottom, like with cider?
13:03sdegutisIs this an anti-pattern? (or (not-empty (for [x some-list] ...)) "the list was empty")
13:03sdegutisOr in some other way a bad idea?
13:03ShayanjmSo 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:04sdegutisShayanjm: use partition then?
13:04ShayanjmI'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:04sdegutisShayanjm: sounds like you can just use doseq with partition
13:04sdegutisShayanjm: or for and partition and then println the whole thing
13:04Shayanjmsdegutis: I tried for as well as map println, and for some reason there's no output when run via the jar
13:05sdegutisShayanjm: although you probably want partition-all if the last one will have < 1000 items
13:05Shayanjmbut in the repl map println works
13:05Shayanjmyeah
13:05Shayanjmi'm using partition-all 1000 right now
13:05Shayanjmbut when I run it via the jar, there's no output
13:05sdegutisShayanjm: that's because you're never doing stuff with the lazy seq result -- this is a pretty common rookie mistake
13:05sdegutisan *incredibly boring* one fwiw
13:06Shayanjmsdegutis: Ah - that makes sense. So if I wanted to iterate and make sure each one prints - doseq?
13:06noncomcode-ape: what is that "thing that emits data" ?
13:06sdegutisShayanjm: I think amalloy_ can explain better -- he always can
13:06noncomis it a function a deferred or what...
13:06sdegutisShayanjm: read the docs for doseq, doall, dorun, for, and map
13:07justin_smithpuredanger: just got out of a meeting "expected: (= (class (->Thing :a)) Thing)"
13:07justin_smithpuredanger: very weird
13:08puredangerjustin_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:08justin_smithpuredanger: no AOT I know of, *clojure-version* {:major 1, :minor 7, :incremental 0, :qualifier "beta2"}
13:08justin_smithI should update to the RC
13:08code-apenoncom: actually on second visit I think my example is wrong. Look at the wrap-duplex-stream method in the example.
13:09justin_smithpuredanger: we have AOT for a jsvc wrapper, but that is not used during dev, it's a shim that uses resolve at runtime
13:10code-apemainfold.stream/connect is used to connect two streams with the tcp stream being the target.
13:10noncomuh... maybe...
13:11code-apenoncom: https://github.com/ztellman/aleph/blob/master/examples/src/aleph/examples/tcp.clj#L44
13:11noncomcode-ape: i have that in my code
13:11noncomactually my code is not much different from the example
13:11code-apenoncom: I know, do you know what it does?
13:12noncomcode-ape: well, in general. probably i am missing something...
13:12justin_smithpuredanger: I still see the failed test with 1.7.0-RC1
13:13puredangerjustin_smith: I wouldn't expect anything changed since beta2 to affect this either way. it's most likely related to CLJ-979
13:13justin_smithpuredanger: this specifically happens after a require :reload of the ns
13:13justin_smithOK
13:13justin_smithyeah, deftype+reload that must be the one!
13:14code-apenoncom: 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:14justin_smithluckily 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:15code-apenoncom: I'm afraid I don't have time to code up an example or I would.
13:17puredangerjustin_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:18justin_smithpuredanger: yeah, that's what I meant by "expected: (= (class (->Thing :a)) Thing)" above
13:18noncomcode-ape: alright, thank you!
13:18puredangerjustin_smith: sorry, reading comprehension fail.
13:19justin_smithpuredanger: 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:19puredangerjustin_smith: that change is included in 1.7 (since alpha6 I think)
13:19puredangerso that is my confusion
13:20justin_smithpuredanger: oh... I'll throw together a minimal reproducing case then, and maybe make my own jira submission (or an addendum to that issue?)
13:20puredangerI am puzzling through some related things on CLJ-1741 at the moment
13:21justin_smiththat looks like it could be related, yeah...
13:25puredangerit is... tricky.
13:30kaladinanyone here use yesql?
13:36justin_smithpuredanger: 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:37justin_smithpuredanger: 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:44Bronsajustin_smith: ping me when you have a minimal example, I can take a look when I have some time
13:44puredangerjustin_smith: when you say "reload" what exactly do you mean?
13:47justin_smithpuredanger: Bronsa: turns out the minimal example requires three files, and fails with versions all the way back to 1.3
13:47justin_smithhttps://gist.github.com/noisesmith/793a002ab7454f2b0419
13:47justin_smithpuredanger: the content of reproduce.clj should make what I mean by :reload clear
13:49puredangerBronsa: me too :)
13:49puredangerjustin_smith: I don't think you should expect that example to work (aside from your original case)
13:49Bronsajustin_smith: ah, I think i know why that happens
13:50BronsaI don't think there's a way to fix it though
13:50justin_smithoh! do tell
13:50Bronsatype.Type is resolved at the ns load time
13:50Bronsa(type/->Type) returns a differnet class at runtime
13:50justin_smithbut I reload both namespaces...
13:51Bronsabut you reload type after reloading driver
13:51puredangerbut you reload them in the "wrong" order
13:51justin_smithahh...
13:51Bronsato fix this we would need to resolve class literals at runtime rather than at load time
13:51noncomis there any function like (f & args) which simply evaluates its args and does nothing else?
13:52Bronsaa significant performance hit, I think
13:52justin_smithpuredanger: OK, fixing the order fixes it
13:52Cust0diannoncom, identity? http://clojuredocs.org/clojure.core/identity
13:52noncomah, it's a (do) form
13:52justin_smithweirdly, in my testing scenario the reloads are in the right order and it still messes up though...
13:52noncomCust0dian: i thought about it, but it is only 1-arity
13:53justin_smith(inc puredanger)
13:53justin_smith(inc Bronsa)
13:53justin_smiththanks for helping me sort that out, I was very confused for a moment there
13:54puredangerjustin_smith: I think putting your deftype in a separate namespace would likely help in the deftest case
13:54justin_smithoh, I'll try that, thanks
13:55Bronsapuredanger: 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:55puredangerI've really stepped pretty far back from that, have been thinking about compilation in general
13:55puredangerI think there's no way we should do what you have in the patch there
13:56puredangerand I think the changes in CLJ-979 are good
13:57puredangerthere are definitely longer-range and bigger changes needed re aot (clj-322, clj-1544, etc)
13:57puredangerI'm trying to figure out what if anything needs to be changed for 1.7
14:00Bronsapuredanger: 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:01puredangerrunning "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:02puredangerwhat 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:04Bronsapuredanger: I'm glad to hear that :) have been thinking the same for a while
14:05puredangerI 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:05Bronsayes, definitely
14:05Bronsathere might be some tooling issues too
14:05puredangerand that compilation should produce all the right runtime effects, in addition to exporting .class
14:06Bronsatrying to reproduce some weird cases manifesting themselves using lein via bare clojure has been a nightmare
14:07puredangerhaving 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:07puredanger1741 is trivially resolved by just changing the order of compilation in the project.clj
14:09puredangeris that enough for us to push this off past 1.7? dunno. trying to make my peace with that.
14:09Bronsapuredanger: 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:10Bronsaand 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:15puredangerisn't that really an issue primarily when doing this mixture of compiling and consuming compiled?
14:27Bronsapuredanger: 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:29puredangerthe 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:30puredangerbut this predated a lot of the class generation stuff that we have now and I think that is a problematic assumption
14:30Bronsapuredanger: 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:31puredangerI think that's ok
14:31puredangerand desirable
14:31Bronsathat 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:32puredangeryes, that's all fine
14:33puredangerthere'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:33puredangerI don't have a good opinion yet on a preference over the things people have proposed over time
14:36mmeix,(defn zigzag [n] (take n (flatten (apply map vector ((juxt reverse identity) (range 1 (inc n)))))))
14:36clojurebot#'sandbox/zigzag
14:37mmeix,(zigzag 7)
14:37clojurebot(7 1 6 2 5 ...)
14:37mmeixpoint free :-)
14:37mmeixor is it?
14:41Bronsadnolen: ping
14:42dnolenBronsa: pong
14:43Bronsadnolen: i just noticed cljs allows using ^:const vars as dispatch values in case statements -- this is a significant difference from clj
14:43BronsaI realize this is intentional but.. do we really want/need it?
14:43justin_smith,(defn zagzig [n] (take n (apply mapcat list ((juxt reverse identity) (range 1 (inc n))))))
14:43clojurebot#'sandbox/zagzig
14:44justin_smith,(zagzig 7)
14:44clojurebot(7 1 6 2 5 ...)
14:44justin_smithmmeix: ^
14:44justin_smith~flatten
14:44clojurebotflatten 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:44mmeixjust trying it out
14:44dnolenBronsa: probably can't really change it now due to user code depending on it
14:45Bronsapuredanger: and I guess we can't backport this to clojure for the same reason?
14:45mmeixjustin_smith thanks!
14:46Bronsadnolen: 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:47BronsaI 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:50dnolenBronsa: 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:50dnolenBronsa: analyzing trivial stuff like keywords from bootstrapped analyzer already works, but analyze-seq blocked on macro support
14:51Bronsadnolen: no more import-macros in core.clj then?
14:52dnolenfar more tedious will be IO bits for Node.js / Browser as well supporting deps in JARs under Node.js etc.
14:53dnolenBronsa: cljs.core macro ns probably needs just a bit of pre-processing, import-macros will probably be hacked to inline source.
14:56dfletcheryou 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:56dnolenBronsa: I will checkout that branch, yeah the idea is just support more copy-pasta between cljs.tools.reader and clojure.tools.reader
14:56Bronsadnolen: 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:57BronsaI needed to backport every change in core.clj to t.a.js and I simply couldn't keep the pace :)
14:57dnolenBronsa: hrm I don't think so, we use the analyzer for many non-trivial things in the macros file now
15:01dnolenBronsa: 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:01dnolen"I'm not against"
15:02Bronsadnolen: got it, thanks. I'll think about it but don't have much time in the last period unfortunately.
15:03dnolenBronsa: yep, also some stuff would really just be even uglier if not in the macros file, like the top-level `defn` special casing.
15:34devnHey all, I'm curious how people feel about using logback or slf4j via a properties file vs using something like timbre
15:37irctcI'm wading through clojure.core.reducers docs and the newer transducers. Are the later replacing the former?
15:43puredangerkind of, although they are not either or
15:44puredangerreducers still are the only current path for sequence-like transformations that can occur in parallel on a map or vector via fold
15:44irctcCurrently 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:45irctcpuredanger: ah, ok that helps that the parallel aspect is still in reducers.
15:51amalloyfold 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:58irctcamalloy: 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:03irctcamalloy: 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:30thesaskwatchWARNING: CIDER requires nREPL 0.2.7 (or newer) to work properly
17:30thesaskwatchWARNING: The following required nREPL ops are not supported:
17:30thesaskwatchformat-code format-edn ns-path refresh
17:30thesaskwatchPlease, install (or update) cider-nrepl 0.9.0-SNAPSHOT and restart CIDER
17:30thesaskwatchWARNING: CIDER's version (0.9.0-snapshot) does not match cider-nrepl's version (0.8.2)
17:30thesaskwatchHi, what should I do when I get a message like this ^^
17:30thesaskwatchMy ~/lein/profiles.clj looks like this: {:user {:plugins [[cider/cider-nrepl "0.9.0-SNAPSHOT"]]}}
17:40thesaskwatchhttps://github.com/bhauman/lein-figwheel/issues/149#issue-75500018 seems to help.
18:48daviidhello, 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:59daviidi found it: (.run ic "Average create" imp1 imp2)
19:45SurgoHow does the #=() dispatch work in EDN? Does it just call a function with the given arguments?
19:45SurgoI can't seem to find any docs about it
19:47TEttinger,"#=(+ 1 2)"
19:47clojurebot"#=(+ 1 2)"
19:47TEttingerhm
19:47TEttinger,*reader-eval*
19:47clojurebot#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:48TEttinger,*read-eval*
19:48clojurebotfalse
19:48Surgoheh
19:48TEttingerthat's why it isn't evaling it
19:48Surgolet me just paste my example issue
19:48SurgoI'm pretty confused over something
19:48TEttinger,(with-binding [*read-eval* true] "#=(+ 1 2)")
19:48clojurebot#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:48TEttinger,(binding [*read-eval* true] "#=(+ 1 2)")
19:48clojurebot"#=(+ 1 2)"
19:48TEttingerhm
19:49Surgoyou forgot read-string
19:49Surgoit works as you'd expect, you get 3
19:49SurgoI'm having trouble with a function I defined though, one sec while I try to pastebin it out
19:49Surgocan't copy/paste out of my silly VM, I hate vmware
19:49TEttingerno, I didn't forget read-string, that would get a form out of the string, and I want to eval inside the string
19:53TEttingerI never use #=, so I suppose I don't really know what it does
19:53amalloyjust don't use #"
19:54TEttingerregex?
19:54clojurebotSometimes people have a problem, and decide to solve it with regular expressions. Now they have two problems.
19:54TEttingerthe first of those questions is typically "where did TEttinger go?"
19:54amalloyer, #=
19:55Surgopython http.server to the rescue. i hate vmware
19:55Surgoit appears to be a function call
19:55Surgoone sec
19:56TEttingeroh and the second of those questions is "gfredericks, can you answer a regex internals question?"
19:57Surgohttp://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:58TEttingermissing an # ?
19:58TEttinger(str "=(freeze.core/deserialize \""
19:58Surgorofl
19:58Surgoyou're a lifesaver
19:58SurgoI've been at this for an hour!
19:59TEttingerheh I hope that's all it needs!
19:59Surgoyep, you got it
19:59TEttingerwoo!
20:00Surgoof 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:00SurgoI'm worried I may have to descend into some macro trickery to enumerate all defined X
20:00TEttingerwhere X is java.io.Serializable here?
20:01SurgoY is java.io.Serializable, X is anything that already has a multimethod implementation but also implements java.io.Serializable
20:02TEttingeruh, I think the list of everything that is Serializable is extremely large
20:03Surgoyes :( I am afraid I am going to have to write a macro to enumerate everything
20:03TEttingerthere is another way
20:03Surgoessentially 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:04TEttingerah, so this needs compatibility with *print-dup* specifically
20:04Surgoyeah, exactly
20:04Surgoif 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:06amalloyare you sure, Surgo?
20:07amalloyi think it should just work, because it uses type hierarchy to figure out automatic preferences
20:08Surgoone sec, pulling an example
20:08Surgovm copy/paste at it again
20:11Surgoseems that way, at least
20:11Surgo(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:21tmtwdhow do I get cljs to run on node on emacs?
21:44dnolentmtwd: https://github.com/clojure/clojurescript/wiki/Emacs-%26-Inferior-Clojure-Interaction-Mode
23:30tmtwddoes rlwrap work inside emacs?
23:30tmtwdor do I have to run it in a shell?
23:31amalloywhy would you need rlwrap if you're in emacs? you already have emacs editing features?
23:32tmtwdI want a repl
23:32tmtwdcan I just use cider-jack-in instead?
23:40tmtwdClojureScript Node.js REPL server listening on 52201
23:40tmtwdthis launches in my terminal, what does 52201 socket mean?
23:40tmtwdI can't go to localhost:52201 , can I?