drop* and take* only for specific element values

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Aug 13 07:45:17 PDT 2014


On Wed, 13 Aug 2014 14:28:29 +0000
Meta via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com> wrote:

> On Wednesday, 13 August 2014 at 12:37:34 UTC, Nordlöw wrote:
> > Are there variants of drop* and take* that only drop element if
> > its equal to a value kind of like strip does?
> >
> > If not I believe they should be added.
>
> No, but it'd probably be useful. Maybe call them dropIf/takeIf,
> or just add an overload that takes a predicate... I'll look into
> making a pull request sometime this week. How do you envision
> these working?

They're called find and until. You just have to give them the opposite
predicate that you'd give a function called dropIf or takeIf.

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list