<commit_before># Async/Await: Sequences

* Proposal: [SE-0298](0298-asyncsequence.md)
* Authors: [<NAME>](https://github.com/parkera), [<NAME>](https://github.com/phausler)
* Review Manager: [Doug Gregor](https://github.com/DougGregor)
* Status: **Scheduled for review (January 12...26, 2021)**
* Implementation: [apple/swift#35224](https://github.com/apple/swift/pull/35224)

## Introduction

Swift's [async/await](https://github.com/apple/swift-evolution/blob/main/proposals/0296-async-await.md) feature provides an intuitive, built-in way to write and use functions that return a single value at some future point in time. We propose building on top of this feature to create an intuitive, built-in way to write and use functions that return many values over time.

This proposal is composed of the following pieces:

1. A standard library definition of a protocol that represents an asynchronous sequence of values
2. Compiler support to use `for...in` syntax on an asynchronous sequence of values
3. A standard library implementation of commonly needed functions that operate on an asynchronous sequence of values

## Motivation

We'd like iterating over asynchronous sequences of values to be as easy as iterating over synchronous sequences of values. An example use case is iterating over the lines in a file, like this:
<commit_msg>Initiate review of SE-0298 "Async/Await: Sequences" (#1250)<commit_after># Async/Await: Sequences

* Proposal: [SE-0298](0298-asyncsequence.md)
* Authors: [<NAME>](https://github.com/parkera), [<NAME>](https://github.com/phausler)
* Review Manager: [D<NAME>](https://github.com/DougGregor)
* Status: **Active Review (January 12...26, 2021)**
* Implementation: [apple/swift#35224](https://github.com/apple/swift/pull/35224)

## Introduction

Swift's [async/await](https://github.com/apple/swift-evolution/blob/main/proposals/0296-async-await.md) feature provides an intuitive, built-in way to write and use functions that return a single value at some future point in time. We propose building on top of this feature to create an intuitive, built-in way to write and use functions that return many values over time.

This proposal is composed of the following pieces:

1. A standard library definition of a protocol that represents an asynchronous sequence of values
2. Compiler support to use `for...in` syntax on an asynchronous sequence of values
3. A standard library implementation of commonly needed functions that operate on an asynchronous sequence of values

## Motivation

We'd like iterating over asynchronous sequences of values to be as easy as iterating over synchronous sequences of values. An example use case is iterating over the lines in a file, like this:

{'fraction_non_alphanumeric': 0.09355432780847145, 'fraction_numerical': 0.02725598526703499, 'mean_word_length': 4.969230769230769, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7126603', 'n_tokens_mistral': 805, 'n_tokens_neox': 710, 'n_words': 320}