Skip to content

Flatten

The collection with all levels of nested lists merged into one.

Wolfram LanguageFlatten
Flatten(collection)every level of nested lists merged into one.
Flatten(collection, n)flattening limited to the top `n` levels.

Domain: Collections

Details
  • Undoes Partition: chunking and then re-flattening recovers the original list.
  • Simply deletes inner braces/levels; it doesn't otherwise reorder or transform elements.
  • A depth argument limits flattening to that many levels, leaving deeper nesting intact.
  • compute-engine's Flatten is -only.

Examples

See also: Join