[m-rev.] for review: Add take_while and drop_while to the list module

Julien Fischer jfischer at opturion.com
Thu Apr 21 15:36:59 AEST 2016


≈
On Thu, 21 Apr 2016, Paul Bone wrote:

> On Thu, Apr 21, 2016 at 01:20:38PM +1000, Julien Fischer wrote:
>>
>> Hi Paul,
>>
>> On Thu, 21 Apr 2016, Paul Bone wrote:
>>
>>>>> I noticed that in our YesLogic code we have some utility code that can be
>>>>> put into the Mercury standard library, including a dropwhile predicate.  So
>>>>> I named it drop_while and submitted it and an similar take_while predicate.
>>>>>
>>>>> I don't really mind what happens, does anyone else have any strong ideas
>>>>> about these kinds of predicates?
>>>>
>>>> I would prefer some consistency in naming for a start ;-)
>>>>
>>>> I suggest adding take_while/4, deprecating the existing takewhile/4
>>>> predicate and adding your new ones as well.  (That said, I think the
>>>> documentation for drop_while/3 is unclear, so don't commit them
>>>> until that's been reviewed.)
>>>
>>> To clarify, we would be (in the long term) renaming takewhile/4 to
>>> take_while/4?
>>
>> Yes.  (The new name is more consistent with your new predicates as
>> well as take_upto etc.)
>
> Yep, the consistency is better.  What I meant that there was no algorithmic
> change.

There is no algorithmic change.

Julien.


More information about the reviews mailing list