Re: std.algorithm.strip functionality

2025-05-06 Thread Pete Padil via Digitalmars-d-learn
On Wednesday, 7 May 2025 at 01:40:33 UTC, Jonathan M Davis wrote: On Tuesday, May 6, 2025 3:19:29 PM Mountain Daylight Time Pete Padil via Digitalmars-d-learn wrote: [...] strip removes the requested elements from the ends (whereas stripLeft does it from the front of the range, and stripRight

Re: std.algorithm.strip functionality

2025-05-06 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, May 6, 2025 3:19:29 PM Mountain Daylight Time Pete Padil via Digitalmars-d-learn wrote: > I compiled and ran the following test program: > ```d > import std.stdio, std.algorithm; > > void main() > { > long[] a = [1, 2, 3, 15, 4]; > auto b = a[].strip(15); > writeln(a); >

Re: std.algorithm.strip functionality

2025-05-06 Thread Bastiaan Veelo via Digitalmars-d-learn
These both will print "[1, 2, 3]": ```d writeln([1, 2, 3, 15, 4].until([15])); writeln([1, 2, 3, 15, 4].findSplit([15])[0]); ``` You can press "improve this page" on the top of https://dlang.org/phobos/std_algorithm_mutation.html#strip if you like to add more clarity to the documentation.

Re: std.algorithm.strip functionality

2025-05-06 Thread Pete Padil via Digitalmars-d-learn
On Tuesday, 6 May 2025 at 21:54:31 UTC, monkyyy wrote: On Tuesday, 6 May 2025 at 21:19:29 UTC, Pete Padil wrote: I compiled and ran the following test program: ```d import std.stdio, std.algorithm; void main() { long[] a = [1, 2, 3, 15, 4]; auto b = a[].strip(15); writeln(a); writel

Re: std.algorithm.strip functionality

2025-05-06 Thread monkyyy via Digitalmars-d-learn
On Tuesday, 6 May 2025 at 21:19:29 UTC, Pete Padil wrote: I compiled and ran the following test program: ```d import std.stdio, std.algorithm; void main() { long[] a = [1, 2, 3, 15, 4]; auto b = a[].strip(15); writeln(a); writeln(b); } ``` I get: [1, 2, 3, 15, 4] [1, 2, 3, 15, 4] It

std.algorithm.strip functionality

2025-05-06 Thread Pete Padil via Digitalmars-d-learn
I compiled and ran the following test program: ```d import std.stdio, std.algorithm; void main() { long[] a = [1, 2, 3, 15, 4]; auto b = a[].strip(15); writeln(a); writeln(b); } ``` I get: [1, 2, 3, 15, 4] [1, 2, 3, 15, 4] It did not remove 15, it does work if 15 is at the beginning o