[swift-evolution] rename dropFirst() and dropLast()

James Campbell james at supmenow.com
Tue Dec 29 14:36:54 CST 2015


What about shift and pop?

They both could take an argument of a number of items to shift or pop ? 



Sent from my iPhone

On 29 Dec 2015, at 20:25, Brent Royal-Gordon via swift-evolution <swift-evolution at swift.org> wrote:

>> I guess that's a good argument for keeping "prefix" and "suffix" instead of "take" and "takeEnd". But there is no good noun phrase to use for dropFirst/dropLast (Haskell's "init" and "tail" are nouns but they're very confusing and don't really make sense once you add in an integral argument anyway). The guidelines do say it's acceptable to use an imperative verb if there is no good noun phrase, so "skip" and "skipEnd" (or "skipLast", or maybe "skipSuffix" if we're keeping "suffix") are still reasonable.
> 
> I'm thinking:
> 
>    collection.onlyFirst(5)
>    collection.exceptFirst(5)
>    collection.onlyLast(5)
>    collection.exceptLast(5)
> 
> Perfectly parallel, don't sound like mutating operations, and very clear about which part you keep and which part you toss.
> 
> -- 
> Brent Royal-Gordon
> Architechies
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution


More information about the swift-evolution mailing list