read


read
or learn more

clojure.spec: Introduction

Jan 10, 2017 some comments

If you’ve looked into the relatively new Clojure library clojure.spec you might have come across something curious. Observe the use of core.spec/or: (require ‘[clojure.spec :as s]) (s/def ::num (s/or :float float? :int int? :ratio ratio?)) (s/conform (s/coll-of ::num) [0.25 1/2 1]) ;;=> [[:float 0.25] [:ratio 1/2] [:int 1]] The result of the call to s/conform […]

Continue