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