[swift-evolution] SE-0045 Add scan, prefix(while:), drop(while:), and unfold to the stdlib

William Shipley wjs at mac.com
Sat Apr 30 04:29:34 CDT 2016


  func drop(@noescape while predicate: (Self.Iterator.Element) throws -> Bool) rethrows -> Self.SubSequence
  func prefix(@noescape while predicate: (Self.Iterator.Element) throws -> Bool) rethrows -> Self.SubSequence


Now I may just be a simple country hyper-chicken, but so I don’t know if there are other languages that inspired the names of these functions, but it ruffles my feathers that we have the words “drop” and “prefix” for two functions that are kind of symmetric, instead of symmetric words like “drop” and “keep” or “prefix” and “suffix”.

Not that I’m in love with those particular examples, I’m just saying I’d like it if there were some symmetry in the words that suggested the symmetry of the functions. But, again, maybe these are, like, some standard terms that I just missed out on and everyone would hate it if we didn’t use the standard name, like if we renamed “cos()” to “adjacentOverHypotenuse()”.

Ba-kawk,
-Wil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160430/71083abb/attachment.html>


More information about the swift-evolution mailing list