Anonymous user
Flatten a list: Difference between revisions
m
added a ;Task: and ;Related task; (bold) headers, added other whitespace to the task's preamble.
(→{{header|JavaScript}}: Expression in terms of concatMap, and fusion with concatMap) |
m (added a ;Task: and ;Related task; (bold) headers, added other whitespace to the task's preamble.) |
||
Line 1:
{{task}}
Write a function to flatten the nesting in an arbitrary [[wp:List (computing)|list]] of values. Your program should work on the equivalent of this list:▼
;Task:
▲Write a function to flatten the nesting in an arbitrary [[wp:List (computing)|list]] of values.
Your program should work on the equivalent of this list:
[[1], 2, [[3, 4], 5], [[[]]], [[[6]]], 7, 8, []]
Where the correct result would be the list:
[1, 2, 3, 4, 5, 6, 7, 8]
C.f. [[Tree traversal]]▼
;Related task:
<br><br>
|