Previous Up Next

5.40.14 Flattening a list: flatten

The flatten command replaces any sublists of a list by their elements.

Example

Input:

flatten([[1,[2,3],4],[5,6]])

Output:


1,2,3,4,5,6


If the original list is a matrix, you can also use the mat2list command for this (see Section ‍5.40.34).


Previous Up Next