apple / swift-algorithms

Commonly used sequence and collection algorithms for Swift
Apache License 2.0
5.97k stars 443 forks source link

[Rotate] Modify API of rotate(subrange:) to take an arbitrary range expression #165

Closed LucianoPAlmeida closed 1 year ago

LucianoPAlmeida commented 3 years ago

Just throwing the idea here, maybe would be nice to be able to call this API with any kind of range. And since is not a source breaking change, I thought it was worth bring to discussion.

cc @natecook1000

Checklist

mdznr commented 3 years ago

I think this is a great change. Since you could subscript a collection this way, it makes sense for rotate to also let you reference a subrange this way.