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
Elso 2021-05-12T15:07:59.183400Z

I am trying to make the best case for clojure.spec I can, and apart from instrumentation and generators, I am trying to see if there is spec-powered tooling which is worth investigating thinking of something along these lines: https://reposhub.com/python/miscellaneous/clj-kondo-inspector.html in particular, any ways to integrate spec with cursive would be of great interest, as most folks on my job use it are there things you would suggest to check out?

seancorfield 2021-05-12T16:41:01.184200Z

@d.eltzner012 maybe my blog post from 2019 will help provide some useful insights for you? https://corfield.org/blog/2019/09/13/using-spec/

2021-05-12T16:45:36.184400Z

I wanted to do data transformations from specs and down that path leads macro hell (see: https://github.com/dvingo/my-clj-utils/blob/master/src/main/dv/spec_util.clj#L36 with this helper I was told to just repeat the keys instead: https://clojurians-log.clojureverse.org/clojure-spec/2020-11-14/1605365585.379500) After this interaction, I have found much delight in using malli. Being based on data it makes analysis and transformation fairly trivial; additionally it has clj-kondo support already built in: https://github.com/metosin/malli#clj-kondo perhaps this clj-kondo transform and the graphviz one, plus the others built in would help make the case for adoption on your team.

vlaaad 2021-05-12T18:28:30.185100Z

Why the difference in spec forms of anon fns?

(s/form (s/nilable #(= 1 %)))
=> (clojure.spec.alpha/nilable
     (clojure.core/fn [%]
        (clojure.core/= 1 %)))

(s/form (s/or :maybe-one (s/nilable #(= 1 %))))
=> (clojure.spec.alpha/or
     :maybe-one
     (clojure.spec.alpha/nilable
        (fn* [p1__11188#]
         (clojure.core/= 1 p1__11188#))))

alexmiller 2021-05-12T18:42:52.185400Z

no good reason

alexmiller 2021-05-12T18:43:04.185700Z

probably just not applying the right cleanup function on the latter