clojure-spec

2023-10-17T16:44:58.215609Z

Hi everyone, I wanna spec sth like this :

[[:__      :TXC    :BTC    :ALT    :PAXG   ]
 [:TT1     0M      0M      0M       0M     ]
 [:TT2     0M      0M      0M       0M     ]
 [:TT3     0M      0M      0M       0M     ]
 [:TT4     0M      0M      0M       0M     ]
 [:Others  0M      0M      0M       0M     ]
 ]
but the following spec won't work :
(spec/def ::X-Header-Row     (spec/cat :dont-care #{:__} :exposure-id-s (spec/+ ::Exposure-ID)))
(spec/def ::X-Row            (spec/cat :g-id ::Group-ID :weights (spec/+ decimal?)))
(spec/def ::X                (spec/cat :header ::X-Header-Row  :rows (spec/+ ::X-Row)))
What is it that I'm not getting about how spec/cat works and how can I spec that table ? Thanks a lot in advance

2023-10-18T11:51:39.345969Z

Thanks a lot, Alex

Alex Miller (Clojure team) 2023-10-17T16:55:20.260669Z

won't work .... because?

Alex Miller (Clojure team) 2023-10-17T17:39:43.301779Z

regex ops combine to spec one collection, so you need to do something to separate the outer collection and the inner collection "levels"

Alex Miller (Clojure team) 2023-10-17T17:40:26.019259Z

probably the shortest path to that is to wrap s/spec around the X-Row cat