clojure-spec

About: http://clojure.org/about/spec Guide: http://clojure.org/guides/spec API: https://clojure.github.io/spec.alpha/clojure.spec.alpha-api.html
2020-02-05T06:45:09.142900Z

@kenny couldn't you do this with a multi-spec defmethods returning select specs?

kenny 2020-02-05T15:55:51.145400Z

Not when it's a nested collection.

2020-02-05T16:02:42.145600Z

Ah right, agreed this would be great to have built in

kenny 2020-02-05T16:08:04.145800Z

Definitely agree. Fortunately it's not that hard to build in yourself if it doesn't include it. It really does seem like something it should support by default though.

2020-02-05T17:13:50.146200Z

Right, I built a spec that did something like this for spec-1, basically “clamped” nested multi-specs. It was a bit unwieldy because the definitions had to be so long.

2020-02-05T14:42:05.143800Z

hi, when to use :req or :req-un? I’ve used :req-un always

orestis 2020-02-05T15:44:32.145300Z

If you have maps with namespaced keywords, use :req

kenny 2020-02-05T15:55:51.145400Z

Not when it's a nested collection.

2020-02-05T16:02:42.145600Z

Ah right, agreed this would be great to have built in

kenny 2020-02-05T16:08:04.145800Z

Definitely agree. Fortunately it's not that hard to build in yourself if it doesn't include it. It really does seem like something it should support by default though.

2020-02-05T16:30:34.146100Z

👍

2020-02-05T17:13:50.146200Z

Right, I built a spec that did something like this for spec-1, basically “clamped” nested multi-specs. It was a bit unwieldy because the definitions had to be so long.