What Frank means is that Smalltalk Interval are countable (and most are finite).

However, the original usage of Interval was for Text editing, and an
Interval from 5 to: 4 means that the cursor is before (after?)
position 5. That's why Interval is a strange beast, not exactly
polymorphic to an Array of Number. Those two views have introduced a
number of unconsistencies in the library...

Last thing, I don't recommend using Interval of Float, (1.5 to: 1.6
by: 0.01), rather use Integer or Fraction. You never know where the
Float Interval really ends, it's progression is generally not
constant, and to:do: used to behaved differently than do:

Nicolas

2012/12/16 Igor Stasenko <[email protected]>:
> On 16 December 2012 09:26, Frank Shearar <[email protected]> wrote:
>> On 16 December 2012 01:06, Igor Stasenko <[email protected]> wrote:
>>> On 15 December 2012 23:45, Chris Muller <[email protected]> wrote:
>>>>> and i always hitting the wall with my head again and again.. because
>>>>> there's no such protocol
>>>>> and instead (after opening browser and looking at class, i figuring
>>>>> that i should use #first/#last, but it is completely unintuitive to
>>>>> me)..
>>>>
>>>> Me too, when I was using what I knew would only ever need to be,
>>>> simply, an Interval.
>>>>
>>>> Later the complexity increased and it would be either a Interval or
>>>> Array of numbers.  It was a transparent / painless improvement.  After
>>>> gaining that appreciation, now I think of Intervals as just "efficient
>>>> Arrays" and think naturally to use #first / #last.
>>>>
>>>
>>> Well, my math background prevents me from thinking this way.
>>> Since in math, intervals are defined on sets of numbers.
>>> (like Real set).. you cannot treat it as array , simply because there
>>> is an infinite number
>>> of values inside any non-empty interval, and you cannot enumerate them.
>>
>> But it's a subset of the integers, not the reals!
>>
> what?
> then how you explain this:
>
> (1.5 to: 1.6 by: 0.01) collect: [:i | i ]
>
>> frank
>>
>>> --
>>> Best regards,
>>> Igor Stasenko.
>>>
>>
>
>
>
> --
> Best regards,
> Igor Stasenko.
>

Reply via email to