Fork me on GitHub
Oliver George03:05:30

Just putting it out there: I love clojure.spec


olivergeorge: clojure.spec.alpha 😉

Oliver George10:05:15

Fair call. I had just finished watching Rich's spec-ulation talk before it happened. Makes total sense in that light.


I think we should maybe add a #(even? (count bindings)) predicate to the clojure.core/let and other specs


I certainly couldn't make sense of that error for a while 😛


test.check and clojure.spec have made it onto neural network garbage twitter


@fossifoo spec-tools tests are run on travis with node too, so it should work, tested with cljs-version 1.9.518. But to enable specs to be created a runtime, data-specs uses the functional internal of clojure.spec (the ^:skip-wiki fns :() => just extracted ‘em into separate namespace - don’t have to use those. Spec-swagger needs a lot of attention, next on the todo-list, will start by converting to vanilla specs.


If I remember right, there will be public *functions* to create specs some time in the future.


is there a way to unform a conformed value of s/map-of?


(s/def ::a (s/or :int int?))

(s/conform ::a 1)
; [:int 1]

(s/unform ::a (s/conform ::a 1))
; 1

(s/def ::map-of (s/map-of ::a ::a :conform-keys true))

(s/conform ::map-of {1 1})
; {[:int 1] [:int 1]}

(s/unform ::map-of (s/conform ::map-of {1 1}))
; {[:int 1] [:int 1]}


thanks. is it still a plan to create a public layer of functions to create the specs (besides the macros)?


also, would be interested in having a functional way to register specs. the def-impl looks private as it has the :skip-wiki meta on it.


(and “Do not call this directly”…)


@ikitommi okay, just wanted to check the status. i want to go the other way around (use swagger json to generate testdata) and think i might go via spec. a generic spec will also be very helpful for parsing. changing it to standard spec would indeed be better for me. it's hard enough to understand one DSL

Alex Miller (Clojure team)19:05:22

@ikitommi still tbd. As I've said in the past, you can get same benefits of functional API by unforming with spec specs


@thheller what was the form that gave that error? Here's what I got, I must be misunderstanding what you meant:

(let [a 1
      b 2
      c 3
clojure.lang.ExceptionInfo: Call to clojure.core/let did not conform to spec:
                            In: [0] val: () fails spec: :clojure.core.specs/bindings at: [:args :bindings :init-expr] predicate: any?,  Insufficient input
                            :clojure.spec/args  ([a 1 b 2 c 3 d] a)


d needs a value.


yep, I know, I'm trying to reproduce the error @thheller got