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

Kevin Ballard kevin at sb.org
Sat Apr 30 16:37:34 CDT 2016


Precedent suggests that they should be named either drop/take, or
possibly skip/take. But Swift chose drop/prefix already (we have
dropFirst and dropLast already in the stdlib), which is why this
proposal is following the same terminology.
 
-Kevin
 
On Sat, Apr 30, 2016, at 02:29 AM, William Shipley via swift-evolution wrote:
>   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
> _________________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160430/2413209b/attachment.html>


More information about the swift-evolution mailing list