On Tuesday, May 24, 2016 at 4:54:40 PM UTC-5, Leif wrote: > > Spec usage guide questions: > > There is a small typo in the 'Collections' section (pretend this is a > question): > > (s/conform (s/coll-of number? #{} #{5 10 2})) > ;; should be > (s/conform (s/coll-of number? #{}) #{5 10 2}) > > Fixing...
> > Is there a technical reason why the paths reported by 's/explain' for > regex ops are incomplete? E.g., in the "A game of cards" section, I would > expect: > > (s/explain ::game ...) > At: [::players 0 ::hand 0 1] val: :banana fails spec: ::card predicate: suit? > ;; but the real output is this, indices from regex matches missing > At: [::players ::hand 1] val: :banana fails spec: ::card predicate: suit? > > > It's fine here, but it could get harder to find the failure point in a > larger data structure. > The paths refer to tags in the schemas, not keys in the map. However, this has been asked about several times today and Rich has added support for a :in clause that will track the key paths to master and that will be in alpha2. > > Is there a way to write a map spec that contains *only* the required > keyset? This is against the spirit of the 'composition' arguments in the > Rationale, but sometimes I really want to pin down the exact data in a map, > especially for data about to escape into the wild (e.g. return values of a > web API). > Nothing built in, but it's easy enough to write that predicate yourself if you need it. > The behavior of 's/and' really surprised me (again, pretend this is a > question). The conformed values propagating through is semantically weird > when you have 'core/and' in mind. Also, if you have data keywords and spec > keywords, it could get complicated to keep track of what's what in the > later specs. More examples in the "Composing predicates" section, right > when 's/and' in introduced, might take away the surprise and replace it > with luxurious comfort. > I'll consider it. > Is there a recommended way to introspect specs for our own purposes > (coercion, code generation)? An interpreter on the output of 'describe' > might work (although it's a little complicated for fn specs), but I wanted > to know if you all had any thoughts or plans for the future here. > Could you give more details on what question you would like to ask? > > Thanks, > Leif > > On Tuesday, May 24, 2016 at 1:04:45 PM UTC-4, Alex Miller wrote: >> >> Clojure 1.9.0-alpha1 is now available. >> >> Try it via >> - Download: >> https://repo1.maven.org/maven2/org/clojure/clojure/1.9.0-alpha1 >> - Leiningen: [org.clojure/clojure "1.8.0-alpha2"] >> >> 1.9.0-alpha1 includes the first release of clojure.spec >> <http://clojure.org/about/spec>. >> >> A usage guide for spec is now available: http://clojure.org/guides/spec. >> >> Enjoy! >> Alex >> > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.