Missed that s/nilable exists. Cheers. 

On 29 June 2016 at 16:04:05, Alex Miller ([email protected]) wrote:

Also, you can turn any predicate into a nil-accepting predicate with s/nilable.

user=> (s/valid? (s/nilable (s/every ::s/any)) nil)
true

On Wednesday, June 29, 2016 at 9:02:43 AM UTC-5, Alex Miller wrote:
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
--
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 a topic in the Google 
Groups "Clojure" group.
To unsubscribe from this topic, visit 
https://groups.google.com/d/topic/clojure/vF3RuDWuX8I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to 
[email protected].
For more options, visit https://groups.google.com/d/optout.

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

Reply via email to