Returns an array containing the concatenated results of calling the given transformation with each element of this sequence.
- Xcode 10.0+
- Swift Standard Library
A closure that accepts an element of this sequence as its argument and returns a sequence or collection.
The resulting flattened array.
Use this method to receive a single-level collection when your transformation produces a sequence or collection for each element.
In this example, note the difference in the result of using
flat with a transformation that returns an array.
s is equivalent to
Complexity: O(m + n), where n is the length of this sequence and m is the length of the result.