Sequence does not guarantee that conforming types are multi-pass; first, if added, would be allowed to consume the first element.
What types are you using that conform to Sequence but not Collection?
(It should also be noted that there is Sequence.first(where:). You can write first { _ in true }. Part of the thinking reflected in this design is that it is more surprising for a property to potentially consume elements of a sequence when invoked.)
Well, I’ve personally never had an issue with that. But I find it quite surprising that something as innocuous as
.compactMap { $0.cycled().dropFirst(n).first }
puts my laptop in leaf blower mode. The fact that code in this functional style sometimes works (consuming a Collection; without .cycled()) and sometimes doesn’t (consuming a Sequence).
My personal pet peeve is that the language won't accept:
let first = seq.makeIterator().next()
And generally won't compile mutating methods on ephemeral temporary values:
let target = makeTemp().mutatingMethod()
I don't know what's the reason why it is disallowed to create and immediately discard mutating values. It just forces to declare a temp var without clear benefit.
If this were allowed, this thread would not exist in the first place, answers about the fundamental nature of sequences would be spared to the OP. This is an ergonomic problem with the language, not a problem with Sequence, or the OP's goals.
You can’t tell from this call site, but words is read-only! If mutating methods were allowed on temporaries, this call would be accepted by the compiler, even though it’s clearly wrong.