[Issue 7246] New: http://www.d-programming-language.org/phobos/std_algorithm.html#remove
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Jan 7 23:25:32 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7246
Summary: http://www.d-programming-language.org/phobos/std_algor
ithm.html#remove
Product: D
Version: D2
Platform: All
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: websites
AssignedTo: nobody at puremagic.com
ReportedBy: jlquinn at optonline.net
--- Comment #0 from Jerry Quinn <jlquinn at optonline.net> 2012-01-07 23:25:31 PST ---
Example for remove with predicate is the following:
int[] a = [ 1, 2, 3, 2, 3, 4, 5, 2, 5, 6 ];
assert(a[0 .. remove!("a == 2")(a).length] == [ 1, 3, 3, 4, 5, 5, 6 ]);
This example is confusing because the array is named 'a' and the predicate
placeholder is also named 'a'. Yes, reading the predicate blurb at the top
says that 'a' is a predicate var, but if the example used 2 different names, it
would at least alert the impatient reader about this assumption more clearly.
I suggest:
int[] r = [ 1, 2, 3, 2, 3, 4, 5, 2, 5, 6 ];
assert(r[0 .. remove!("a == 2")(r).length] == [ 1, 3, 3, 4, 5, 5, 6 ]);
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list