You can file a jira if you like, I'm not sure Rich's thoughts on this. 

Also, keep in mind that you can also compose preds and get this with 
slightly more effort now:

(s/and (s/double-in :min 0.0 :max 1.0) #(not= 0.0 %))




On Wednesday, July 20, 2016 at 2:03:28 PM UTC-5, Mars0i wrote:
>
> clojure.spec/double-in defines a spec that tests whether a double is 
> greater than or equal to a minimum value and less than or equal to a 
> maximum value.  This is useful for many purposes, but sometimes you need to 
> test whether a double is greater than a minimum or less than a maximum. 
>  There are many mathematical applications that assume half-open intervals 
> (> min and <= max; >= min and < max) or open intervals (> min and < max). 
>  Example: You are going to divide by the double, so it must be > 0, not 
> just >= 0.  Providing double-in but only allowing it to specify closed 
> intervals seems arbitrary.
>
> It's easy enough to write open-interval and half-open interval tests, 
> either using s/and with s/double-in, or just by defining a function from 
> scratch.  However, if Clojure is going to provide double-in, why make us do 
> that?  Why not have a common interface that adds two optional keywords to 
> specify whether the bounds are open or closed?  This is not a request to 
> add the kitchen sink; it's a natural extension to deal with a common use 
> case.  The alternative would be to define three additional versions of 
> double-in, and people will do that on their own, or define a new more 
> flexible double-in if there's no built-in spec function that does it.
>
>
> I'd suggest a new keyword with one of the following forms: 
>
>
> :min-open, :min-greater, :min-greater-than, :min-strict, :greater-min, 
> :strict-min, etc.,
>
>
> and a corresponding keyword for the max side.
>
>
> Default values should be false, for compatibility with the current 
> definition of double-in.
>
>
> I can add a JIRA ticket if this seems worthwhile.  I wanted to see what 
> people think first.  (I'd have to sign up with the JIRA system, but I 
> assume I'm allowed to do that.)  My apologies if there's already a JIRA 
> ticket for this.  I don't seem to be able to find anything on double-in, 
> but I'm not sure I understand the search syntax.
>

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