This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-10-14
Channels
- # announcements (9)
- # beginners (49)
- # calva (26)
- # cider (6)
- # clj-kondo (17)
- # cljsjs (1)
- # cljsrn (2)
- # clojure (72)
- # clojure-europe (5)
- # clojure-france (8)
- # clojure-greece (1)
- # clojure-italy (5)
- # clojure-nl (9)
- # clojure-spec (49)
- # clojure-uk (17)
- # clojuredesign-podcast (13)
- # clojurescript (137)
- # cursive (15)
- # data-science (1)
- # datomic (55)
- # duct (2)
- # emacs (5)
- # figwheel-main (11)
- # fulcro (11)
- # graphql (1)
- # hoplon (1)
- # instaparse (1)
- # jobs (12)
- # jobs-rus (1)
- # leiningen (1)
- # nrepl (34)
- # nyc (2)
- # off-topic (1)
- # onyx (1)
- # pedestal (1)
- # re-frame (6)
- # reitit (3)
- # remote-jobs (1)
- # shadow-cljs (196)
- # sim-testing (1)
- # spacemacs (9)
- # sql (1)
- # vim (70)
- # xtdb (31)
When throwing ExceptionInfos from different parts of the application (with a :type key in ex-data), and you want to handle only specific types, is it customary to just catch ExceptionInfo, check the :type in ex-data and re-throw if unrecognized?
or just use https://github.com/mpenet/ex that does that and more 🙂
On a related note, I improved quite a bit on that concept on another lib at work, it's on clojars already, just not open-sourced on gh yet (it will be very soon I expect)
https://clojars.org/exoscale/ex https://clojars.org/exoscale/ex-manifold https://clojars.org/exoscale/ex-auspex
@dmarjenburgh There's also https://github.com/redplanetlabs/defexception which allows you to just catch the ExInfo subclasses you're interested in
and one caveat with the mentioned lib is that you would still have to check and rethrow in CLJS
defexception doesn't allow to express hierarchies. imho it's not so useful in practice
I've used slingshot in anger and thought it was pretty good for this.
Out of curiosity, has anyone tried using derive
applied to a type key and gotten a desirable outcome from doing so?
the lib I mentioned does that with an internal hierarchy. It's quite handy to express various things for exceptions "types" matching isa?, like controlling how to react on them
thanks, I’ll have a look
hey people, I even don't know how to ask it... but I am having weird clojure behaviour when I try to run 2 crux nodes at the same time -> crux internally relies on some clojure and obviously is compiling stuff... and what happens is that clojure randomly breaks on random errors like can't find wars, syntax errors etc... and it does not happen when there is only one instance of crux being build... Only thing is happening is that two instances created in same VM... Is there something in clojure which might cause something along those lines?
@olekss.janis That issue seems very specific to crux, you might get faster and better feedback if you post this in the #crux channel. I'm curious to know what's happening as well
https://github.com/cognitect/transit-format/wiki/Community-Implementations - list here
those are the ones I'm aware of, don't know of C or C++
there are some edn impls in both https://github.com/edn-format/edn/wiki/Implementations - might have some small overlap that would be useful if starting such a thing
I believe you need to extend the print-method
multimethod
I recently saw this talk from Alex Miller on Spec: https://www.youtube.com/watch?v=Xb0UhDeHzBM&t=1005s
.. I noticed that he's referencing a non-alpha version of spec possibly? Just wondering if this is close to release. I'd like to use spec but I'm still shy to use it due to the alpha badge and notice in the readme about it being subject to breaking changes. Are many people using it in production here and feel confident it's API won't break when it goes out of alpha?
@thiru0130 i have spec1 alpha code in prod and while it was useful and caught a few times where my app was being sent junk data, i wish I waited longer for things to settle down. i think generally there's no guidelines as to when spec will make it out of alpha
that talk (which I don't even remember where it's from) is actually a couple years old and references namespaces from before we decided to make it alpha
yeah, that looks like maybe a bootleg rip of my talk at Philly ETE in 2017, which is officially hosted at https://www.infoq.com/presentations/clojure-spec/
we are currently working on spec 2 (https://github.com/clojure/spec-alpha2/) which I am hopeful will become a non-alpha release version at some point in the next 3-6 months
there are already, and will be more, breaking changes in the spec forms (most of the api changes are additive, not breaking), but this will all be happening in different namespaces than the original spec. Some transition will be required, but we hope to make it feasible to keep old things working (to some degree) while you move.
depends on your goals. If you're just looking to learn more, no reason to wait. If you're looking to make significant use on a project, you can safely use spec 1 for now and then switch, if your project scenario is tolerant of such a thing.
Awesome, looking forward to it! Thanks @alexmiller
I would actually hesitate to try to create such a thing because it implies a static-ness that is generally not accurate. the prepl architecture diagram currently available is at least the 3rd or 4th version. I'm sure it's not the last. Rich keeps omnigraffles with often dozens of historical versions over time. I have at least a half dozen variants of the spec 2 architecture lying around, some that represent intermediate steps that were explored only through pictures and never actually implemented.
I was going to put it together, but I'd like to convince you first so I'm not potentially upsetting you. I'm not interested in the diagrams from the perspective of implementation. I'm interested in them from the perspective of learning the process in order to use the same kind of process in my own work.
well the "process" part of it is seeing N versions of the same diagram
sounds like you want to grab frames from 10 movies and talk about movie-making
I don't really want to add anything like that to the clojure web site right now as I think Rich would probably have mixed feelings about such a thing
I was interested in seeing examples of the elements stu talked about in his design after agile talk. E.g. the mixing of "types" of diagram together. The design process will reflect in the diagrams, but the expression of information can be captured in a single diagram, or am I missing the point?
I haven't actually seen that one, so not sure
maybe I should just roll back to what are you proposing to do?
Well I was wanting to study them for myself. But linking to them in a gist or something for others seemed like a friendly thing to do. I wouldn't want the existence of such a list to inconvenience anyone or poorly represent their ideas either (and that also applies to making sure I learn the right thing from them).
seems fine, as long as you contextualize them
Speaking of which, do you have your slides online in pdf form or something so I can get the images of the diagrams (or perhaps sources for them)? The video is OK if they're not already up.
I'd really prefer you don't use most of the ones in there as they were pulled from various places and are probably not the best versions of any of them (except the prepl one which is at https://clojure.org/images/content/reference/prepl/prepl.png
The deps one looked to match the one on http://clojure.org. The only novel one was the transducers one.
yeah, I found that buried in my files, I don't know enough context to vouch for it
the deps one is on the site so that's fine
the spec 2 one was only a few hrs old and has already changed since
Is there a core function that does something like this?
(defn index-by
[f coll]
(into {}
(map (fn [elem]
[(f elem) elem]))
coll))
I seem to do the above a lot. It feels like there may be a core function somewhere that does that already.
group-by
?
(defn index-by
"Builds a map whose entries are the result of applying
keyf and valf to every item in the provided collection.
Throws an exception if two items map to the same key,
unless mergef is provided.
valf defaults to identity"
([keyf coll]
(index-by keyf identity coll))
([keyf valf coll]
(reduce (fn [m v]
(let [k (keyf v)]
(if (find m k)
(throw (ex-info "Duplicate key" {:k k}))
(assoc m k (valf v)))))
{}
coll))
([keyf valf mergef coll]
(reduce (fn [m v]
(let [k (keyf v)]
(if-let [entry (find m k)]
(assoc m k (mergef (val entry) (valf v)))
(assoc m k (valf v)))))
{}
coll)))