stacycurl / pimpathon

Adds useful methods to scala & java classes.
Apache License 2.0
35 stars 9 forks source link

Numeric.boundedInclusive(lower, upper) (and excl) #203

Closed fommil closed 9 years ago

fommil commented 9 years ago

it would be great to be able to write

num.boundedInclusive(10, 100)

instead of the confusing (backward feeling)

(10 max num) min 100
stacycurl commented 9 years ago

What do you expect boundedExclusive to be defined as ? boundedInclusive(lower + one, upper - one) ? (with '+', '-', and 'one' coming from Numeric).

fommil commented 9 years ago

come into my web, said the spider... http://www.amazon.co.uk/Introduction-Metric-Topological-Spaces-Mathematics/dp/019956308X

fommil commented 9 years ago

hehe, but back to the ticket... perhaps having an "exclusive" bounded just confuses things. The user can always calculate inclusive bounds. That might mean that bounded is a good name for the method.

fommil commented 9 years ago

hmm, this does open up the possibility of creating a method with that great Scottish word "outwith".