What order do you expect the output to be in when you run flatmap? In doing research on it, I&#x27;ve seen at least three distinct orders. One, results are interleaved. Two, results are depth first. Three, results are breadth first.<p>If the final order of the output is important (and it frequently is), you have to understand not only &quot;map, then flatten&quot;, but the order in which the flatten occurs. And that appears to be implementation dependent.