This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-08-17
Channels
- # announcements (7)
- # babashka (24)
- # beginners (11)
- # boot (16)
- # calva (46)
- # cider (5)
- # clara (3)
- # clj-kondo (2)
- # cljfx (5)
- # clojure (122)
- # clojure-brasil (26)
- # clojure-dev (20)
- # clojure-europe (20)
- # clojure-germany (1)
- # clojure-nl (1)
- # clojure-norway (54)
- # clojure-uk (2)
- # clojurescript (6)
- # core-matrix (23)
- # datomic (85)
- # graalvm (1)
- # honeysql (9)
- # hyperfiddle (31)
- # lsp (3)
- # malli (9)
- # nbb (2)
- # off-topic (15)
- # pathom (15)
- # pedestal (4)
- # polylith (5)
- # re-frame (5)
- # reitit (9)
- # releases (2)
- # shadow-cljs (63)
- # specter (4)
- # xtdb (7)
Is there a particular reason why there's map-of
but the vector equivalent is vector
in the schemas?
no good reason. (bad) names could be revisited if there will be 1.0.0 to clean up things.
good thing is that you can always already add these to the registry:
:vector-of (-collection-schema {:type :vector-of, :pred vector?, :empty []})
:set-of (-collection-schema {:type :set-of, :pred set?, :empty #{}, :in (fn [_ x] x)})
...
Given a value v
and a schema registry with a bunch of named schemas, is there a way to efficiently get all the schemas that v
conforms to?
efficiently - you should loop the registry and create a map of name ->
m/validator
of it. Validators are pure functions and can be cached.
See https://github.com/metosin/malli/blob/master/src/malli/provider.cljc#L15-L16 for example
Yes, it looks like much more fully realized version of what I once called "https://fabricate.site/background/finite-schema-machines" - thanks for the link!