std.algorithm.strip functionality

monkyyy crazymonkyyy at gmail.com
Tue May 6 21:54:31 UTC 2025


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 did not remove 15, it does work if 15 is at the beginning or 
> end.
> Is this a bug or am I misunderstading the docs?
>
> version:   1.41.0-beta1 (DMD v2.111.0, LLVM 19.1.7)
>
> thanks

Intended; if you want [1,2,3] 
.retro.find!(a=>a==15).drop(1)/*maybe*/.retro

(I think finding needs an api rework)


More information about the Digitalmars-d-learn mailing list