Continuing the discussion from [Accepted] SE-0220: count(where:):

I've been thinking about counting lately. As I was thinking, I remembered that we added a `Sequence.count(where:)`

to implement that, but the compiler keeps choking on it due to name conflicts. Maybe we should just punt and rename it:

```
extension Sequence {
/// Determines how many elements qualify for the given predicate.
///
/// - Parameter isIncluded: A predicate that takes an `Element` value that
/// shall return `true` only when its given element should be counted.
/// - Returns: The number of elements that returned `true` from the calls to
/// `isIncluded`.
///
/// - Complexity: O(*n*), where *n* is the length of the sequence.
public func countThoseMatching(by isIncluded: (Element) throws -> Bool) rethrows -> Int {
var count = 0
for e in self where try isIncluded(e) {
count += 1
}
return count
}
}
extension Sequence where Element: Equatable {
/// Determines how many elements equal the given value.
///
/// - Parameter value: A value to compare all the elements against.
/// - Returns: The number of elements that equal `value`.
///
/// - Complexity: O(*n*), where *n* is the length of the sequence.
public func countMatches(to value: Element) -> Int {
return countThoseMatching(by: { $0 == value })
}
}
```

But right now I need an unconditional count. I realized that `count(where:)`

is the same as `filter(_:)`

followed by an unconditional counting method. I was about to post that here, but I counter-realized the manual method doesn't cover predicates that could throw. (Plus the user experience issues mentioned in the original thread.)

An unconditional count could be done with `count(where:)`

with `{ _ in true }`

, but that doesn't sound efficient. Unless it can be shown that using the always-`true`

predicate always elides the loop's test during the SIL or LLVM phase, then we need something like:

```
extension Sequence {
/// Measures the length of the sequence by burning through its elements.
///
/// - Returns: The number of elements in the sequence
///
/// - Complexity: O(*n*), where *n* is the length of the sequence.
public func overworkedCount() -> Int {
var count = 0
for _ in self {
count += 1
}
return count
}
}
```

`unconditionalCount()`

could be a less-cute name. My playground accepted `count()`

, but I don't want to risk causing another compiler name-overload conflict.