[swift-evolution] [Accepted with modifications] SE-0045: Add scan, prefix(while:), drop(while:), and unfold to the stdlib

Kevin Ballard kevin at sb.org
Fri May 6 18:34:29 CDT 2016


On Fri, May 6, 2016, at 02:23 PM, Dave Abrahams via swift-evolution wrote:
> 
> on Fri May 06 2016, Kevin Ballard <swift-evolution at swift.org> wrote:
> 
> >     One idea that came out of the core team discussion was something like:
> >
> >     sequence(from: 0) { $0 += 42 }
> >
> >     Since it returns a sequence.
> >
> > It just occurred to me that, if we follow existing naming conventions, this
> > function would end up returning a value of type SequenceSequence 😁.
> 
> Why do you think so?

A random sampling of functions that generate non-Array sequences and their corresponding sequence type:

* Sequence.flatten() -> FlattenSequence
* Sequence.joined() -> JoinedSequence
* LazySequenceProtocol.map() -> LazyMapSequence
* LazySequenceProtocol.filter() -> LazyFilterSequence

-Kevin Ballard


More information about the swift-evolution mailing list