Fork me on GitHub
#malli
<
2020-03-21
>
Vincent Cantin07:03:22

@ikitommi Clojure spec’s cat is doing 2 things at the same time and I don’t like that: • It says something about the container type of the sequence, • It says something about the content of the sequence. In Malli, I propose to move the description on the type of container to a separate structure schema name and to remove this responsibility from :cat and :alt . Maybe we can have something like:

[:cat [:a int?] [:b :string?]]              ;; matches '(1 "a") and [1 "a"]
[:in-list [:cat [:a int?] [:b :string?]]]   ;; matches '(1 "a")
[:in-vector [:cat [:a int?] [:b :string?]]] ;; matches '[1 "a"]

ikitommi05:03:22

@U8MJBRSR5 I guess you can say already [:and vector? [:cat ...]]

Vincent Cantin07:03:28

or we can call them seq-of list-of and vector-of

Vincent Cantin07:03:46

I am preparing a commit in my MR, on which we can comment later.