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

Mark Brown mark at mercurylang.org
Thu Apr 21 12:37:12 AEST 2016


On Thu, Apr 21, 2016 at 12:02 PM, Paul Bone <paul at bone.id.au> wrote:
> On Thu, Apr 21, 2016 at 11:55:58AM +1000, Mark Brown wrote:
>> Hi Paul,
>>
>> On Thu, Apr 21, 2016 at 11:11 AM, Paul Bone <paul at bone.id.au> wrote:
>> > For review by anyone
>> >
>> > ---
>> >
>> > Add take_while and drop_while to the list module
>>
>> Are you aware there is already a takewhile predicate in the list module?
>>
>
> No I wasn't, it looks like it behaves differently anyway.

All the more reason to be aware of it ;-)

>
> 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?

The new variants would be better near the existing takewhile, so users
get a better idea of their options. (I know it's also similar to
take_upto, but it takes a higher-order argument so is probably better
grouped with those predicates.)

Cheers,
Mark


More information about the reviews mailing list