Fork me on GitHub
#clojure-spec
<
2017-05-01
>
Oliver George03:05:30

Just putting it out there: I love clojure.spec

souenzzo15:05:46

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.

thheller09:05:41

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

thheller09:05:53

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

gfredericks13:05:06

test.check and clojure.spec have made it onto neural network garbage twitter https://mobile.twitter.com/BobEbooks/status/859025622689087488

ikitommi17:05:49

@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.

ikitommi17:05:04

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

ikitommi18:05:31

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

ikitommi18:05:16

(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]}

ikitommi18:05:04

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

ikitommi18:05:05

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.

ikitommi18:05:53

(and “Do not call this directly”…)

fossifoo18:05:56

@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

danielcompton22:05:14

@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
      d]
  a)
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)

mobileink23:05:10

d needs a value.

danielcompton23:05:34

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