[m-rev.] for review add ranges.search_member/4

Julien Fischer jfischer at opturion.com
Sat Mar 16 17:20:47 AEDT 2024


On Sat, 16 Mar 2024, Zoltan Somogyi wrote:

> On 2024-03-16 17:08 +11:00 AEDT, "Julien Fischer" <jfischer at opturion.com> wrote:
>> The main thing I would like is feedback on is the name of the new
>> prediate.
>
> I don't particularly like it, but can't think of anything better.

The other altenative I had was search_range.

...

>> +    % search_member(N, Set, L, H):
>> +    % L and H are the endpoints of the range in Set that contains N.
>
> I would reword as
>
> If N is in Set, then succeed, setting Lo and Hi to the endpoints
> of the range in which it is contained.

Done.

>> +search_member(N, range(L0, H0, Rest), L, H) :-
>> +    ( if
>> +        N > L0,
>> +        N =< H0
>> +    then
>> +        L = L0 + 1,
>> +        H = H0
>> +    else
>> +        search_member(N, Rest, L, H)
>> +    ).
>
> I would s/L/Lo/ and s/H/Hi/ here as well.

Done.

> The rest of the diff is fine.

Thanks for that.

Julien.


More information about the reviews mailing list