stride in slices

Seb seb at wilzba.ch
Sun Jun 3 08:19:06 UTC 2018


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).

We even have slide which is a generalization of stride (striding 
is sliding with a window size of 1):

[a..b].slide(1, m)

https://dlang.org/phobos/std_range.html#slide


More information about the Digitalmars-d mailing list