user=> (s/explain (s/every ::s/any) nil) val: nil fails predicate: coll?
indicates that s/every (also s/coll-of) validate using coll? as the predicate and coll? (like most type predicates) does not validate nil. nil punning is more often done for sequences. Sequences with structure are typically speced using regex ops, which does validate on nil. user=> (s/valid? (s/* ::s/any) nil) true On Wednesday, June 29, 2016 at 8:57:49 AM UTC-5, Simon Belak wrote: > > map-of now conforming is fantastic news! > One question though: why doesn't every validate when given nil for > collection? Seems inconsistent given pervasive nil punning elsewhere and > that [] validates. > > s > > > On Wednesday, June 29, 2016 at 12:13:25 AM UTC+2, Alex Miller wrote: >> >> Clojure 1.9.0-alpha8 is now available. >> >> Try it via >> >> - Download: >> https://repo1.maven.org/maven2/org/clojure/clojure/1.9.0-alpha8 >> - Dependency: [org.clojure/clojure "1.9.0-alpha8"] >> >> 1.9.0-alpha8 includes the following changes since 1.9.0-alpha7: >> >> The collection spec support has been greatly enhanced, with new controls >> for conforming, generation, counts, distinct elements and collection kinds. >> See the docs for every, every-kv, coll-of and map-of for details. >> >> instrumenting and testing has been streamlined and made more composable, >> with powerful new features for spec and gen overrides, stubbing, and >> mocking. See the docs for these functions in clojure.spec.test: instrument, >> test, enumerate-ns and summarize-results. >> >> Namespaced keyword reader format, printing and destructuring have been >> enhanced for lifting namespaces up for keys, supporting more succinct use >> of fully-qualified keywords. Updated docs will be added to clojure.org >> soon. >> >> Many utilities have been added, for keys spec merging, fn exercising, >> Java 1.8 timestamps, bounded-count and more. >> >> Changelog: >> >> clojure.spec: >> >> - [changed] map-of - now conforms all values and optionally all keys, has >> additional kind, count, gen options >> - [changed] coll-of - now conforms all elements, has additional kind, >> count, gen options. No longer takes init-coll param. >> - [added] every - validates a collection by sampling, with many >> additional options >> - [added] every-kv - validates a map by sampling, with many additional >> options >> - [added] merge >> - [changed] gen overrides can now be specified by either name or path >> - [changed] fspec generator - creates a function that generates return >> values according to the :ret spec and ignores :fn spec >> - [added] explain-out - produces an explain output string from an >> explain-data result >> - [changed] explain-data - output is now a vector of problems with a >> :path element, not a map keyed by path >> - [added] get-spec - for looking up a spec in the registry by keyword or >> symbol >> - [removed] fn-spec - see get-spec >> - [added] exercise-fn - given a spec'ed function, returns generated args >> and the return value >> - All instrument functions moved to clojure.spec.test >> >> clojure.spec.test: >> >> - [changed] instrument - previously took a var, now takes either a >> symbol, namespace symbol, or a collection of symbols or namespaces, plus >> many new options for stubbing or mocking. Check the docstring for more info. >> - [removed] instrument-ns - see instrument >> - [removed] instrument-all - see instrument >> - [changed] unstrument - previously took a var, now takes a symbol, >> namespace symbol, or collection of symbol or namespaces >> - [removed] unstrument-ns - see unstrument >> - [removed] unstrument-all - see unstrument >> - [added] instrumentable-syms - syms that can be instrumented >> - [added] with-instrument-disabled - disable instrument's checking of >> calls within a scope >> - [changed] check-var renamed to test and has a different signature, >> check docs >> - [changed] run-tests - see test >> - [changed] run-all-tests - see test >> - [changed] check-fn - renamed to test-fn >> - [added] abbrev-result - returns a briefer description of a test >> - [added] summarize-result - returns a summary of many tests >> - [added] testable-syms - syms that can be tested >> - [added] enumerate-namespace - provides symbols for vars in namespaces >> >> clojure.core: >> >> - [changed] - inst-ms now works with java.time.Instant instances when >> Clojure is used with Java 8 >> - [added] bounded-count - if coll is counted? returns its count, else >> counts at most first n elements of coll using its seq >> >> -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
