Flatten a list: Difference between revisions

Content added Content deleted
Line 2,766: Line 2,766:
def concatMap(f, xs):
def concatMap(f, xs):
return sum(map(f, xs), [])</lang>
return sum(map(f, xs), [])</lang>
(This proves slower, but may also shed useful Rosetta light on the list comprehension version above)
(This proves slower, though micro-optimisation is seldom a good use of time, but it may shed useful Rosetta light on the list comprehension version above)
{{Out}}
{{Out}}
<pre>
<pre>