[swift-evolution] [Accepted with modifications] SE-0045: Add scan, prefix(while:), drop(while:), and unfold to the stdlib
clattner at apple.com
Wed May 4 18:50:45 CDT 2016
Proposal link: https://github.com/apple/swift-evolution/blob/master/proposals/0045-scan-takewhile-dropwhile.md
Hello Swift Community,
The review of SE-0045: "Add scan, prefix(while:), drop(while:), and unfold to the stdlib" ran from April 28...May 3, 2016. A subset of the proposal is *accepted, with modifications* for Swift 3. This proposal included four new additions to the standard library:
Sequence.prefix(while:) & Sequence.drop(while:) - These are *accepted* as specified in revision 3 of the proposal.
Sequence.scan(_:combine:) - This addition is *rejected* by the core team. While this operation is provided by other functional language libraries, its use case is narrow and not obviously as applicable for Swift programmers. Swift intentionally has a high bar for “general utility” when adding operations to the standard library: it isn’t enough to be useful in some cases - it must be broadly useful by lots of people. The core team felt like this was too narrow to be worth including.
unfold(_:applying:) - This addition is *rejected* by the core team as written, but deserves more discussion in the community, and potentially could be the subject of a future proposal. The core team felt that the utility of this operation is high enough to be worth including in the standard library, but could not find an acceptable name for it. “unfold” is problematic, despite its precedence in other language, because Swift calls the corresponding operation “reduce” and not “fold”. No one could get excited about “unreduce”. “iterate” was also considered, but a noun is more appropriate than an verb in this case. Given the lack of a good name, the core team preferred to reject to let the community discuss it more.
Thank you to Kevin Ballard for proposing these operations!
More information about the swift-evolution