stride in slices

Paul Backus snarwin at gmail.com
Mon Jun 4 15:43:07 UTC 2018


On Sunday, 3 June 2018 at 11:13:52 UTC, DigitalDesigns wrote:
> On Sunday, 3 June 2018 at 07:30:56 UTC, Meta wrote:
>> On Saturday, 2 June 2018 at 18:49:51 UTC, DigitalDesigns wrote:
>>> Proposal:
>>>
>>> [a..b;m]
>>>
>>> m is the stride, if ; is not a good char then |, :, !, or # 
>>> could be good chars.
>>
>> This is exactly what std.range.stride does. The syntax 
>> [a..b;m] directly translates to [a..b].stride(m).
>
>
> So, can I do
>
> X[a..b].stride(m) = 0;

You can use std.algorithm.iteration.each to modify a range 
in-place:

https://run.dlang.io/is/2jjZHh


More information about the Digitalmars-d mailing list