[ENH] Interval method indexOf:

Boris Gaertner Boris.Gaertner at gmx.net
Tue Jun 15 14:22:18 UTC 2004


from the preamble of the attached change set:

"Change Set:  IntervalIndexEnh
Date:   15 June 2004
Author:   Boris Gaertner

Interval inherits #indexOf:startingAt:ifAbsent: from SequenceableCollection.
The inherited method enumerates all elements until it finds a hit. Try

 (1 to: 100000 by: 0.01) indexOf: 99999

to see that this can be extremely time consuming. For Intervals, we can do
better.

This enhancement assumes that the elements of an Interval are Numbers.
It is tempting to use intervals that contain instances of DataAndTime, but
this would require the generalization of some methods. "

Greetings,
Boris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: IntervalIndexEnh.1.cs
Type: application/octet-stream
Size: 1273 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20040615/06ba9f2b/IntervalIndexEnh.1.obj


More information about the Squeak-dev mailing list