This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-09-09
Channels
- # admin-announcements (1)
- # beginners (78)
- # boot (36)
- # cider (13)
- # cljs-dev (15)
- # cljsjs (3)
- # cljsrn (10)
- # clojure (99)
- # clojure-austin (1)
- # clojure-australia (1)
- # clojure-italy (14)
- # clojure-korea (17)
- # clojure-norway (1)
- # clojure-russia (42)
- # clojure-sg (1)
- # clojure-spec (50)
- # clojure-uk (80)
- # clojurebridge (24)
- # clojurescript (83)
- # community-development (10)
- # conf-proposals (36)
- # core-async (12)
- # cursive (20)
- # datomic (38)
- # hoplon (63)
- # lambdaisland (2)
- # leiningen (6)
- # nyc (2)
- # om (54)
- # om-next (52)
- # onyx (129)
- # planck (15)
- # re-frame (38)
- # reagent (2)
- # rethinkdb (8)
- # specter (1)
- # untangled (2)
The validation benchmark has been updated with alpha12 showing the spec improvements: http://muhuk.github.io/validation-benchmark
yes, should help a lot with runtime use cases
http://imgur.com/a/l9Hc3 shows the before
alexmiller: that's great. Means I'll use it to conform stuff in my sparkling spark jobs. :-D Thx!
generally, it’s faster than schema, so if schema was fast enough for you, it should be sufficient
I'm going to have to study the commit(s) that are responsible for that massive speed up -- very curious about how that was achieved! 😸
lot of changes. one change of possible importance is that a spec using another registered spec will “compile” in that definition, so changes to the upstream spec (during dev) now require the downstream spec to be reloaded
so it’s a little less dynamic than prior
this does not affect recursive specs as delays are used
> (s/conform (s/coll-of int? :type set?) #{0 1})
#{0 1}
> (s/conform (s/coll-of int? :type set?) [0 1])
[0 1]
(s/conform (s/coll-of int? :type set?) [0 "e"])
:clojure.spec/invalid
I'm hitting odd behavior with clojure.spec and I'm not sure it's me or a bug in clojure.spec. Here's the example: https://gist.github.com/Jannis/f23a2ecf350b401745d190b02bbb619c
What I would expect is no surrounding []
around [:nested ...]
in the second case. It seems that ::link-value
spec is clashing with the ::query
spec. If I change ::link-value
to e.g. (s/tuple symbol? keyword?)
I don't get the extract []
. The odd thing is that despite the "clash", [:link ...]
never appears in the output... any ideas?
@otfrom :type isn’t a thing
it’s :kind
if only you had the spec specs, it would tell you that :)
@jannis so the one you’re asking about is
(s/conform ::query '[a b [c d]])
;;=> [[:single [:simple a]]
;; [:nested {:parent [:simple b], :children [[:single [:simple c]]]}]]
the outermost [ ] is from ::query
the [ ] around :single and :nested are due to the s/alt tagging
@alexmiller thx. Mostly just flailing around in the library trying to learn it (and getting dumb things wrong) 😉
@alexmiller The one I'm asking about is [[:single [:simple a]] [[:nested ...]]]
- with the [[:nested ..]]
instead of [:nested ..]
.
What's puzzling me there is that the other two examples don't have the extra []
around [:nested ...]
- and that I can make it disappear in the second case if I change the :link-value
spec that should have no impact here.
oh, this reminds me of something
that example in the comment also has something similar
I’ve been looking at some regex conform results that seem off to me - although most of those relate to use of s/?
In this case I think s/conform
may not know which of [::query :single :link]
and [::query :nested :children]
to pick. It decides on :nested
instead of :single
but surrounds it with the extra []
for some reason.
I don’t think that’s what’s happening - I think it has to do with the guts of the regex derivatives and when it decides to create the nested context
You know the internals, I don't. 😉 Is there anything I can do to help investigate the problem (if it is one at all)?
no, I’m looking at some of this stuff already
if you wanted to boil it down to a simpler repro and file a jira, that would be helpful
just to make sure that it does get addressed and not just “in my head” :)
how do I spec that a map should look like: {:db/id <something>}
. I don't own the db
namespace so am not sure how to spec for that.
(s/keys :req [:db/id])
and then separately (s/def :db/id <something>)
which could come from a lib or could be something you build