Re: drop* and take* only for specific element values

2014-08-16 Thread monarch_dodra via Digitalmars-d-learn
On Thursday, 14 August 2014 at 07:30:59 UTC, Nordlöw wrote: On Thursday, 14 August 2014 at 00:56:47 UTC, Jonathan M Davis wrote: You forgot the !, making the predicate a function argument. It Great! My solution: Depending on your exact needs, don't forget too about findSkip (same as find,

Re: drop* and take* only for specific element values

2014-08-14 Thread Nordlöw
On Thursday, 14 August 2014 at 00:56:47 UTC, Jonathan M Davis wrote: You forgot the !, making the predicate a function argument. It Great! My solution: auto dropWhile(R, E)(R range, E element) if (isInputRange!R is(ElementType!R == E)) {

drop* and take* only for specific element values

2014-08-13 Thread Nordlöw
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.

Re: drop* and take* only for specific element values

2014-08-13 Thread Meta via Digitalmars-d-learn
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

Re: drop* and take* only for specific element values

2014-08-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Wed, 13 Aug 2014 14:28:29 + Meta via Digitalmars-d-learn digitalmars-d-learn@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

Re: drop* and take* only for specific element values

2014-08-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Wed, 13 Aug 2014 07:45:17 -0700 Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On Wed, 13 Aug 2014 14:28:29 + Meta via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On Wednesday, 13 August 2014 at 12:37:34 UTC, Nordlöw wrote: Are