cljs.spec/cat

MOVED, please see cljs.spec.alpha/cat
macroremoved v1.9.542added v1.9.14Edit
(cat & key-pred-forms)

Source docstring:
Takes key+pred pairs, e.g.

(s/cat :e even? :o odd?)

Returns a regex op that matches (all) values in sequence, returning a map
containing the keys of each pred and the corresponding value.
Source code @ clojurescript:src/main/cljs/cljs/spec.cljc
(defmacro cat
  [& key-pred-forms]
  (let [pairs (partition 2 key-pred-forms)
        keys (mapv first pairs)
        pred-forms (mapv second pairs)
        pf (mapv #(res &env %) pred-forms)]
    ;;(prn key-pred-forms)
    (clojure.core/assert (clojure.core/and (even? (count key-pred-forms)) (every? keyword? keys)) "cat expects k1 p1 k2 p2..., where ks are keywords")
    `(cat-impl ~keys ~pred-forms '~pf)))