[swift-evolution] Using "where" to filter an array
cocoadev at charlessoft.com
Sat Dec 19 21:52:56 CST 2015
> On Dec 19, 2015, at 9:43 PM, Charles Constant via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> I noticed several weeks ago that the following is illegal:
> let new_arr = el in arr where el.is <http://el.is/>_foo // illegal
> I assumed it would work because it's consistent with the filtering that exists in a "for" loop, i.e.:
> for el in arr where el.is <http://el.is/>_foo // legal
> Is this "new proposal" material? I thought I would check in case it's already on the roadmap, or inherently wrong.
I believe what you want is already possible via the “filter” method.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution