This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-05-01
Channels
- # beginners (121)
- # boot (12)
- # cider (14)
- # clara (19)
- # cljsjs (1)
- # clojure (124)
- # clojure-italy (4)
- # clojure-nl (2)
- # clojure-russia (47)
- # clojure-spec (20)
- # clojure-uk (7)
- # clojurescript (102)
- # cursive (16)
- # datomic (10)
- # emacs (2)
- # events (2)
- # immutant (3)
- # luminus (5)
- # lumo (33)
- # off-topic (2)
- # om (5)
- # onyx (22)
- # parinfer (1)
- # pedestal (32)
- # protorepl (1)
- # re-frame (6)
- # reagent (2)
- # ring-swagger (2)
- # rum (1)
- # spacemacs (8)
- # specter (17)
- # yada (1)
Just putting it out there: I love clojure.spec
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
test.check and clojure.spec have made it onto neural network garbage twitter https://mobile.twitter.com/BobEbooks/status/859025622689087488
@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.
(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.
@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
@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
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)
yep, I know, I'm trying to reproduce the error @thheller got