flatten()

Synopsis

"Flattens" a list containing sub-lists, such that all the "leaves" of the original list appear in the result list without any intervening list levels. Basically, all intermediate list braces are removed leaving a one-level list .

Syntax

flatten ( list As List) As List 
Argument Type Description
list List Original list .

Example 1

Intent >flatten({{a}, b, {{c}, d}}) 
--> {a, b, c, d} 

Example 2

Intent >flatten({{1, 3}, {2, {4}}, 7, {{}, {{5}, 6}}}) 
--> {1, 3, 2, 4, 7, 5, 6} 

Example 3

Intent >flatten({}) 
--> {}