This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-12-08
Channels
- # adventofcode (240)
- # beginners (87)
- # boot (4)
- # cider (27)
- # cljs-dev (20)
- # cljsrn (24)
- # clojure (365)
- # clojure-argentina (1)
- # clojure-brasil (4)
- # clojure-dev (12)
- # clojure-greece (65)
- # clojure-india (1)
- # clojure-italy (15)
- # clojure-japan (1)
- # clojure-losangeles (1)
- # clojure-madison (4)
- # clojure-poland (3)
- # clojure-russia (5)
- # clojure-spec (3)
- # clojure-uk (105)
- # clojurescript (27)
- # core-async (1)
- # core-logic (3)
- # cursive (61)
- # datomic (68)
- # devcards (4)
- # docs (27)
- # duct (67)
- # emacs (15)
- # events (1)
- # fulcro (8)
- # graphql (50)
- # lein-figwheel (1)
- # lumo (15)
- # numerical-computing (1)
- # off-topic (77)
- # om (3)
- # onyx (5)
- # parinfer (3)
- # planck (2)
- # portkey (5)
- # re-frame (4)
- # reagent (16)
- # ring (14)
- # rum (3)
- # shadow-cljs (17)
- # vim (1)
Hi all… anyone got a nicer way of doing this?
(defn cat-specs
"Takes a spec and finds the highest level 's/cat' from it and extracts the
specs of the values it matches."
[spec]
(->> (s/form spec)
(tree-seq seq? identity)
(filter seq?)
(filter #(= 'clojure.spec.alpha/cat (first %)))
(first)
(rest)
(partition 2)
(map second)))
(defn cat-specs
"Takes a spec and finds the highest level 's/cat' from it and extracts the
specs of the values it matches."
[spec]
(->> (s/form spec)
(s/conform (s/cat :op '#{clojure.spec.alpha/cat}
:args (s/* (s/cat :name keyword?
:value any?))))
:args
(map :value)))
Some like this.
This issue will help
https://dev.clojure.org/jira/browse/CLJ-2112