commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian Crum <adrian.c...@sandglass-software.com>
Subject Re: [functor] CharacterRange, FloatRange, DoubleRange and open/closed intervals
Date Tue, 24 Jan 2012 20:30:55 GMT
On 1/24/2012 8:15 PM, Matt Benson wrote:
> Thanks for your interest, Adrian!  Comments inline:
>
> On Tue, Jan 24, 2012 at 1:58 PM, Adrian Crum
> <adrian.crum@sandglass-software.com>  wrote:
>> On 1/24/2012 6:58 PM, Matt Benson wrote:
>>> IMO the difference between [lang]'s and [functor]'s range concepts is that
>>> those in [lang] are intended to be able to say whether a given value is in
>>> the Range, but, with the exception of CharRange (this class is not even
>>> public), they make no provision for iterating over members of the range. I
>>> would therefore design a [functor]-targeted Range builder API to allow the
>>> user to specify how next values are obtained. Range may not even be the best
>>> word to describe the behavior we are trying to model here, so let's be open
>>> to reinterpretation as we proceed.
>>
>>  From my perspective, Range + Step = Sequence.
> I'll buy that if noone else objects.  :)
>
>> A Range iterator would be
>> useful for implementing mathematical sets.
> e.g. integer range a..b step 3 yields the sequence of integers n
> greater than or equal to a and less than or equal to b where (n - a) %
> 3 == 0 ?  Is this useful?
>
> Matt

It would be useful for a mathematician. Another possibility is a Range 
of Dates, with a step of one hour, or one day or...

The Range class could accept an Iterator factory so various steps can be 
implemented in client code.

-Adrian


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message