4, 4]]

let flatMapped = numbers.flatMap { Array(repeating: $0, count: $0) }
// [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]
</code></pre>
<p>In fact, <code>s.flatMap(transform)</code>  is equivalent to
<code>Array(s.map(transform).joined())</code>.</p>
<ul>
<li>Parameter transform: A closure that accepts an element of this
sequence as its argument and returns a sequence or collection.</li>
</ul>
<blockquote>
<p>Complexity:
O(<em>m</em> + <em>n</em>), where <em>n</em> is the length of this sequence and <em>m</em> is the 