Mapping Each Input to Zero or More Results

Flat mapping applies a function returning a sequence to each input and concatenates the resulting sequences in visitation order.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Trace two records
  2. Keep parent information if needed

Trace two records

A row may contain tags A and B, and the next row no tags. The output list contains A and B in order, with no placeholder for the second row. See flattening one level.

Keep parent information if needed

If later work groups tags by original row, output pairs retaining each row identifier. A composite record can keep origin even when one input produces several results.[1]

References

  1. Python Software Foundation, Functional Programming HOWTO ↩