Skip to content

Instantly share code, notes, and snippets.

@jasdev
Created March 14, 2021 22:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasdev/cfbb1a2a57d9fa40af68a51caa189a6f to your computer and use it in GitHub Desktop.
Save jasdev/cfbb1a2a57d9fa40af68a51caa189a6f to your computer and use it in GitHub Desktop.
RangeReplaceableCollection.rotated(toStartAt:).
extension RangeReplaceableCollection {
func rotated(toStartAt newStart: Index) -> SubSequence {
self[newStart...] + self[..<newStart]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment