rotate left an array

Christian Köstlin christian.koestlin at gmail.com
Tue Oct 4 21:02:25 UTC 2022


If you are ok with using things from std.range you could use something 
like this:


```d
import std.range : cycle, drop, take;
import std.stdio : writeln;

int main(string[] args)
{
     auto r = [1, 2, 3, 4, 5, 6, 7, 8];
     writeln(r.cycle.drop(3).take(r.length));
     return 0;
}
```

Kind regards,
Christian




More information about the Digitalmars-d-learn mailing list