[Cuis-dev] [ChangeSet] Proposal: Interval>>isIncludedIn:

Hernan Wilkinson hernan.wilkinson at 10pines.com
Fri May 1 17:05:46 PDT 2020


I like this message... but intervals are tricky because they are not ranges
really due to the step they can be created with using #by:

For example, (1 to: 10) isIncludedIn: (1 to: 11 by: 2) will return true,
but should it?
We can define that the semantic of #isIncludedIn: does not take care of the
step. That is fine with me (maybe we should look for a message name that
would transmit that semantic better?)

BTW, there already exist the message #includesAllOf: that would do the work
you need but it goes over all the elements of the interval and therefore it
is a bit slower than your implementation.

On the other hand, Interval>>#includes: is not working properly. For
example: (12 to: -1 by: -1) includes: 1 returns false.
I'll take a look at that later.

Juan, what do you think?

Hernan.


On Wed, Apr 29, 2020 at 11:25 PM Nahuel Garbezza via Cuis-dev <
cuis-dev at lists.cuis.st> wrote:

> Hi!
>
> I'd like to add this message in the Interval class, that will allow to
> check if an interval is included in another. For dealing with source ranges
> it will be useful.
>
> Attached is a changeset for the method implementation and another with the
> tests for it
>
> Thanks,
> Nahuel
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev
>


-- 

*Hernán WilkinsonAgile Software Development, Teaching & Coaching*
*Phone: +54-011*-4893-2057
*Twitter: @HernanWilkinson*
*site: http://www.10Pines.com <http://www.10pines.com/>*
Address: Alem 896, Floor 6, Buenos Aires, Argentina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20200501/41cca5dc/attachment.htm>


More information about the Cuis-dev mailing list