This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-10-06
Channels
- # aleph (79)
- # bangalore-clj (3)
- # beginners (49)
- # boot (74)
- # cider (10)
- # cljs-dev (21)
- # cljsrn (2)
- # clojure (105)
- # clojure-berlin (1)
- # clojure-brasil (1)
- # clojure-dusseldorf (1)
- # clojure-korea (1)
- # clojure-poland (3)
- # clojure-russia (38)
- # clojure-spec (146)
- # clojure-uk (20)
- # clojurescript (70)
- # cloverage (1)
- # component (1)
- # core-async (23)
- # css (16)
- # cursive (22)
- # datascript (1)
- # datomic (22)
- # defnpodcast (6)
- # emacs (60)
- # events (1)
- # hoplon (94)
- # jobs (1)
- # jobs-rus (13)
- # luminus (11)
- # off-topic (11)
- # om (48)
- # onyx (5)
- # proton (7)
- # re-frame (87)
- # reagent (39)
- # rethinkdb (1)
- # ring-swagger (14)
- # rum (6)
- # specter (14)
- # untangled (105)
- # vim (6)
- # yada (22)
Is there anything like core.async or manifold but with the addition of consumer having to acknowledge when it's done processing a message? A stream/channel that behaves more like Kafka, amazon's SQS or anything with at-least-once semantics.
@yonatanel do you mean, producer would get notified when consumer finishes (as opposed to "starts") processing of a single value?
@misha yes, because if I'm consuming Kafka into a buffered channel I might commit the offset too early, before that buffer was actually processed.
of course, if that's the desired model. I just wonder if anyone modeled it in memory
I've seen people pass a promise together with the message, and resolve the promise when done processing, but it's ugly
Hello folks, I was wondering, is there a way to pretty print log error messages (an ex-info
data for instance), kind of like what Ruby does with https://github.com/smartinez87/exception_notification ?
there is nothing special in exception_notification. Nothing you could not roll out in an hour or two with no dependencies.
I guess it depends what you need. If you are working on a ring you could do something like https://8thlight.com/blog/mike-knepper/2015/05/19/handling-exceptions-with-middleware-in-clojure.html
Using Java Interop, how do I write to a public instance field? http://Clojure.org reference has the example (.-x (java.awt.Point. 1 2)) for reading. How would I write the x field to be 3 for example?
@poverholt (set! (. instance-expr instanceFieldName-symbol) expr)
@kidpollo thanks for the link..the comparison went there, and of course that lib has more than 500 commits so it must be doing something ;) I hope your estimate is good and I'll have to work just a few hours on it
I don’t get this macroexpansion (from a boot REPL):
boot.user=> (macroexpand `(fn [] {:post [(even? %)]} 1))
(fn* ([] (clojure.core/let [% 1] (clojure.core/assert (clojure.core/even? boot.user/%)) %)))
The assert works, but why boot.user/%
?that is the reason yes. I think the underlying issue is you forgot the # on your function literal though.
boot.user=> `(fn[] {:post [#(even? %)]} 1)
(clojure.core/fn [] {:post [(fn* [p1__2437__2438__auto__] (clojure.core/even? p1__2437__2438__auto__))]} 1)
@borkdude not familiar with the fn expansion, but usually you use a '
with macroexpand
@jr that’s also not how post conditions work. you have to provide an expression that references %
(at least I don't think you need to qualify the symbols there)
user=> (fn[] {:post [(#(even? %) %)]} 1)
#object[user$eval30$fn__31 0x130dca52 "user$eval30$fn__31@130dca52"]
user=> (*1)
AssertionError Assert failed: ((fn* [p1__29#] (even? p1__29#)) %) user/eval30/fn--31 (NO_SOURCE_FILE:9)
user=>
right, well undocumented on clojuredocs http://clojuredocs.org/clojure.core/fn
because it's what the http://clojure.org cheat sheet links to
so (eval (macroexpand-all expr))
is not always equal to evaluating expr
from the REPL?
(eval (macroexpand-all `((fn [] {:post [(even? %)]} 1))))
clojure.lang.Compiler$CompilerException: java.lang.RuntimeException: No such var: boot.user/%, compiling:(/var/folders/7t/gpzjxhts24d5wvqys1dfvrd80000gn/T/boot.user1557650643773325784.clj:1:1)
java.lang.RuntimeException: No such var: boot.user/%
clojuredocs is largely the blind leading the blind, and should be take with a grain of salt
I notice this is also true of the autogen'd docs so I don't really see this as clojuredoc's fault http://clojure.github.io/clojure/branch-master/clojure.core-api.html#clojure.core/fn
as others have mentioned, the reader attempts to resolve % as a fully qualified namespace when using the backtick
user=> (s/describe `fn)
(fspec :args (cat :name (? simple-symbol?) :bs (alt :arity-1 :clojure.core.specs/args+body :arity-n (+ (spec :clojure.core.specs/args+body)))) :ret any? :fn nil)
user=> (s/describe :clojure.core.specs/args+body)
(cat :args :clojure.core.specs/arg-list :prepost (? map?) :body (* any?))
user=>
jesus, there's terse and then there's missing some of the arguments. it's cool that you can drill down to it in the alpha using spec, but I don't think anyone is very likely to do that
I’ve done this before when I was wondering about this. I think it’s one of the points of spec, documentation.
"Problems Docs are not enough” http://clojure.org/about/spec
it does, but because of the indirection there's not much of a hint that it will accept a prepost map
its documented in the offical docs on http://clojure.org, clojuredocs is a community effort(last I checked) that a lot of people like to use for whatever reason, which has resulted in some references to it creeping in to stuff on http://clojure.org (in specifically community contributed parts like the cheat sheet)
my point was, I went to the reference documentation where most people would look, the http://clojure.org cheat sheet and clicked on fn, and it didn't include prepost map so I figured it didn't. then I got told "ugh, you shouldn't use the cheat sheet" I should use apropos and doc apparently, which also don't mention it, but that's apparently ok because doc is supposed to be terse, and I could've followed 2 levels of spec indirection (if I happened to be using the alpha) to find out what arguments the core freakin form supports
@bfabry tbh I never used pre/post on fn, I just discovered it by luck/trying. It’s not that terribly important.
@borkdude exactly, unless you've read that specific page or the source recently there's no way you'd know it supported it. I'm pissed at the general attitude that "derr you're doing it wrong" when it's pretty clearly barely documented
I don't think anyone said you were doing anything wrong. I don't care for http://clojuredocs.org
the objective truth of what is and isn't there, is in the clojure source code (since there is no formal language spec), at a remove from that are the http://clojure.org docs, and at even more removes from that are the clojuredocs docs
Yeah, I think all it was is each of us were thinking about the ways that we would find that information. And the fact that they are so diverse is just something to think about for when you are curious about something else
@bfabry - you could rectify the situation by adding this information to http://clojuredocs.org/clojure.core/fn , no?
to walk around complaining about things not being documented is silly too, there are a whole lot of docs, did you read them all? is that how you can say something isn't documented?
i’ve never used that website to add an example myself, but it looks like that’s something that’s possible, and seems like it would solve the problem you are frustrated with
and the circle's complete, "make a pr". I am in the process of doing that. I wasn't complaining, I was explaining why I didn't think it was supported, and got annoyed at the "should've read the source" bullshit
if you really want to know, read the source, if you only sort of kind of want to know, read other stuff
but if you have a question, what to know how something works, etc the source is there
please stop telling that to everyone who comes across an incomplete piece of documentation, I quite like clojure and it's hard enough to hire people who know it without having people actively discouraging people from using it