Please also take a look at s/double-in, which allows you to exclude NaN 
(and Infinity/-Infinity) as valid values.

(I realize this does not address the any? question, but that seems like a 
rarer issue to me than cases where I'm explicitly spec'ing a double but 
don't want to allow NaN.)

On Monday, November 7, 2016 at 11:37:08 AM UTC-6, Jim foo.bar wrote:
>
> Hi all, 
>
> clojure.spec helped me realise that NaNs totally break [1] equality (per 
> `clojure.core/=`). Even though in real production code this might not be 
> an issue due to how infrequently one deals with NaNs, but during 
> gen-testing I've found them extremely annoying, and I've essentially 
> worked around this by spec-ing things I'd normally specify via `any?`, 
> via `(s/and any? (complement double-NaN?))` instead. I have to do this 
> for any spec, where in the :ret spec i need to be able to confirm that 
> the input coll is equal to the output coll (e.g. `clojure.core/remove` 
> returns the same coll it was passed in when nothing has been removed), 
> which is a possibility in a lot of functions. Have other people 
> encountered this as well, and if yes, how are you guys dealing with it? 
> Thanks in advance... 
>
> Kind regards, 
>
> Dimitris 
>
> [1]: (= [:a Double/NaN] [:a Double/NaN]) => false 
>
>
>
>

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

Reply via email to