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

Dave Abrahams dabrahams at apple.com
Fri May 6 19:58:03 CDT 2016


on Fri May 06 2016, Kevin Ballard <swift-evolution at swift.org> wrote:

> 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

Oh!  I get it.

-- 
Dave



More information about the swift-evolution mailing list