Skip to content

Commit 9df234a

Browse files
Update 0220-count-where.md (#2237)
* Update status (Accepted). * Add links to second review. Co-authored-by: John McCall <[email protected]>
1 parent bb13553 commit 9df234a

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

proposals/0220-count-where.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,14 @@
33
* Proposal: [SE-0220](0220-count-where.md)
44
* Author: [Soroush Khanlou](https://github.com/khanlou)
55
* Review Manager: [Ben Cohen](https://github.com/airspeedswift)
6-
* Status: **Active Review (July 18 – July 28, 2023)**
7-
* Previous status: **Accepted (2018-08-15) then Expired**
6+
* Status: **Accepted**
87
* Implementation: [apple/swift#16099](https://github.com/apple/swift/pull/16099), [apple/swift#22289](https://github.com/apple/swift/pull/22289) (revert PR)
9-
* Previous Decision Notes: [Rationale](https://forums.swift.org/t/accepted-se-0220-count-where/15280), [Additional Commentary](https://forums.swift.org/t/require-parameter-names-when-referencing-to-functions/27048)
8+
* Review: ([first pitch](https://forums.swift.org/t/count-where-on-sequence/11186)) ([first review](https://forums.swift.org/t/se-0220-count-where/15048)) ([first acceptance](https://forums.swift.org/t/accepted-se-0220-count-where/15280)) ([second pitch](https://forums.swift.org/t/pitch-restore-count-where-from-se-0220/65859)) ([second review](https://forums.swift.org/t/refresh-review-se-0220-count-where/66235)) ([second acceptance](https://forums.swift.org/t/accepted-again-se-0220-count-where/66659))
109

1110
## Introduction
1211

1312
While Swift's `Sequence` models brings a lot of niceties that we didn't have access to in Objective-C, like `map` and `filter`, there are other useful operations on sequences that the standard library doesn't support yet. One current missing operation is `count(where:)`, which counts the number of elements in a `Sequence` that pass some test.
1413

15-
Swift-evolution thread: [`count(where:)` on Sequence](https://forums.swift.org/t/count-where-on-sequence/11186)
16-
1714
## Motivation
1815

1916
Counting the number of objects that pass a test has a wide range of uses in many domains. However, Swift currently doesn't give its users a simple way to perform this operation. While the behavior can currently be approximated with a `filter` and a `count`, this approach creates an intermediate array which it immediately discards. This is a bit wasteful.

0 commit comments

Comments
 (0)