Login | Register
My pages Projects Community openCollabNet

Discussions > users > Re: Lower_Bound Upper_Bound

charles
Discussion topic

Back to topic list

Re: Lower_Bound Upper_Bound

Reply

Author Matthew Heaney <mheaney at on2 dot com>
Full name Matthew Heaney <mheaney at on2 dot com>
Date 2004-05-19 07:20:29 PDT
Message christoph grein wrote:


> OK, I see now the origin of the naming. So Lower_Bound and Upper_Bound denote
> the bounds of a search range, where the names make sense. However taken as
> functions by themselves, the names are still contra-intuitive, therefore I'm
> still with Tuck. (I do not care for STL names, this is Ada.)

OK, but do you have better names?

Ceiling is the same as Lower_Bound, but no one has been able to come up
with a better name for Upper_Bound. The names "Next" or "Succ" might work:

declare
    I : Cursor := Ceiling (S, K1);
    J : constant Cursor := Next (S, K2);
begin
    while I /= J loop ...;
end;



> I do see the problems with missing end points. And why do you only consider
> loops over [A, B] and [A, B), but do not consider (A, B] and (A, B)?

There's nothing that precludes those half-open ranges. I didn't include
them in my examples because they're not very common.

-Matt


--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: users-unsubscribe@ch​arles.tigris.org
For additional commands, e-mail: users-help at charles dot tigris dot org

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

Re: Lower_Bound Upper_Bound Matthew Heaney <mheaney at on2 dot com> Matthew Heaney <mheaney at on2 dot com> 2004-05-19 07:20:29 PDT
Messages per page: