swiftlang/swift

[SR-6864] Add a "cycle" method to the standard library

Open

#49,413 opened on Jan 29, 2018

View on GitHub
 (1 comment) (0 reactions) (0 assignees)Swift (10,719 forks)batch import
featuregood first issuestandard libraryswift evolution proposal needed

Repository metrics

Stars
 (69,989 stars)
PR merge metrics
 (Avg merge 8d 17h) (510 merged PRs in 30d)

Description

Previous ID SR-6864
Radar None
Original Reporter @airspeedswift
Type New Feature
Votes 0
Component/s Standard Library
Labels New Feature, StarterProposal
Assignee None
Priority Medium

md5: ce3f8a07c6a7edad8e1997fb1e825980

Issue Description:

It is often useful to cycle over a sequence indefinitely. For example, just like you can write zip(repeatElement("foo", count: Int.max), myArray) and zip(1..., myArray), you could write {{zip([.grey,.white].cycle(), myArray)}}.

Contributor guide