joboccara / pipes

Pipelines for expressive code on collections in C++
MIT License
801 stars 80 forks source link

Added stride pipe #24

Closed rathod-sahaab closed 5 years ago

rathod-sahaab commented 5 years ago

It operates like python's list slicing

numbers[first : last : step]

This only takes the step into consideration and thus as the parameter.

It passes only the stepth or the Nth element including the first element

{1, 2, 3, 4, 5, 6} >= step(3)  --> {1, 4}

Difference from pythonic step is that it accepts 0 as a valid step and in that case would only print the first element

I made this using pipes::drop files, please do report if any residue found.

rathod-sahaab commented 5 years ago

Renamed step pipe to stride conforming to ranges

joboccara commented 5 years ago

In order to make the PR complete, could you please add a section to describe stride in the README file?

rathod-sahaab commented 5 years ago

Sure, I will do it soon

joboccara commented 5 years ago

Thanks for the PR!