12.3.3 Planar Mapping (flatteningprojection)
A planar map, which can generate sequence of elements for each element in the source collection, merging all return sequences. As we'll see shortly, this is the basic operation of defining other processing operations, including mapping and filtering. The unique feature of planar mapping is the ability to generate multiple output elements for each INPUT element.
Attention
In the LINQ library, this operation is called SelectMany. In a query expression, it is represented by multiple from clauses. As you can see from the name, it is similar to a Select operation, but can return multiple elements for each item in the source. The corresponding function in the F # Library is seq.collect. Here, the name implies implementation, just like calling the Seq.map function, generating sequences of sequences, and then calling Seq.concat to concatenate them together.
Let's take a look at an example that requires planar mapping, that is, it is not possible to write this example with a higher-order function, as in the previous section. Let's take a look at the implementation of the F # sequence expression, and then gradually modify the code to use the mapping.
12.3.3 Planar mapping (flattening projection)