[swift-evolution] Proposal: Add SequenceType.first
Brent Royal-Gordon
brent at architechies.com
Sat Jan 2 23:50:25 CST 2016
> If I don’t sound sympathetic, it’s because nobody has shown a use-case for this functionality, and until I see one I am going to have a hard time believing there’s a problem worth solving. If you want to make the case that we need something like this, please show me why.
Didn't this thread start off with a use case?
seq.lazy.filter(predicate).first // is not actually lazy, and Swift provides no good way to do this
One way to fix this is to add `first` to `SequenceType`, but it feels strange for a property to potentially consume part of the sequence. `buffered` ultimately has the same problem. By representing this as a function, it at least looks like something that might have side effects.
--
Brent Royal-Gordon
Architechies
More information about the swift-evolution
mailing list