[Issue 4535] std.range could have a takeWhile!pred(range) function
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Jul 11 01:55:35 PDT 2017
https://issues.dlang.org/show_bug.cgi?id=4535
timon.gehr at gmx.ch changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|WONTFIX |---
--- Comment #7 from timon.gehr at gmx.ch ---
(In reply to Jonathan M Davis from comment #6)
> (In reply to timon.gehr from comment #5)
> > This enhancement requests is not "INVALID".
>
> Closing it as "won't fix" would be more appropriate.
Perhaps. There is nothing about the suggestion that is "invalid" though.
> We already have until,
> which does what takeWhile would do - it just has an arguably worse name. Is
> there something about until that does not fulfill what takeWhile would do?
In many (most?) circumstances it is just silly to have to specify a condition
to detect the first element that you do /not/ want included in your range.
There is a reason 'filter' keeps the elements for which the predicate evaluates
to 'true' and not those for which it evaluates to 'false'.
> While I don't think that it existed when this issue was opened, there is now
> an overload for until that does not take a sentinel and AFAIK does exactly
> what takeWhile would do.
I guess one way to use it is to create one's own takeWhile function.
--
More information about the Digitalmars-d-bugs
mailing list