[swift-evolution] Changing the curried static methods

Erica Sadun erica at ericasadun.com
Sun Mar 13 12:50:00 CDT 2016


> On Mar 13, 2016, at 11:30 AM, Stephen Celis <stephen.celis at gmail.com> wrote:
> 
>> On Mar 13, 2016, at 1:18 PM, Erica Sadun <erica at ericasadun.com> wrote:
>> 
>> Since removeFromSuperview doesn't take a UIView argument, it sounds like what you're looking for is
>> something that acts like "apply", to apply a lambda/closure/selector/whatever to each member of a collection.
>> 
>> view.subviews.apply(UIView.removeFromSuperview)
>> 
>> -- E
> 
> This is what `forEach` currently does with the existing curried static syntax, right?
> 
> I was more interested in the implications of an example brought up in the OP:
> 
>    frames.map(CGRect.insetBy(-10, -10))
> 
> - Stephen

forEach currently does f(x).
apply would do x.f()

-- E



More information about the swift-evolution mailing list