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

Paul Bone paul at bone.id.au
Thu Apr 21 15:12:09 AEST 2016


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.


-- 
Paul Bone


More information about the reviews mailing list