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

Julien Fischer jfischer at opturion.com
Fri Apr 22 10:17:18 AEST 2016


On Thu, 21 Apr 2016, Peter Wang wrote:

> On Thu, 21 Apr 2016 17:09:07 +1000, Paul Bone <paul at bone.id.au> wrote:
>> 
>> Here's the updated diff.  I've fixed the doc comment for drop_while, renamed
>> take_while/4 to split_while/4, and moved it and the deprecated takewhile/4
>> so that they're after the other split predicates but before the take
>> predicates.  I think this a better name than take_while, and a
>> re-arrangement to put predicates near to other relevant ones.

...

> I disagree.  take_while is the better name.  Repeatedly "take" the head
> of the list "while" this condition is true, and optionally return the
> rest.
>
> In split_list/split_upto, "split" means to split a list into a prefix
> and suffix.  "split_while" suggests repeatedly splitting a list into a
> prefix and suffix (not necessarily head and tail).  It's unclear what
> that operation would be.

Seconded -- split_while is not a good name.

Julien.


More information about the reviews mailing list