The function FLAT takes a list of lists and returns a new list with the items contained in each sub-list.

This function takes a List containing items of any type and returns a new list by "flattening" any nested lists into the resulting list. For each item in the list that is a list itself, each item in the sub-list will be added to the final list. Any items that are not of the list type are passed along into the final list.


FLAT(collection) -> flattened_list


input_list (type: list)
Any list of items.

Return Values

flattened_list (type: list)
A list created by unwrapping any nested sub-lists into the final list.


The most common way to use the FLAT function is to produce a single-level list from a list of lists.

FLAT([[1, 2], [3, 4], [5, 6]]) -> [1, 2, 3, 4, 5, 6]

If there are items in the input_list that are not lists themselves, they will appear un-modified in the final list.

FLAT([1, 2, [3, 4], 5, 6]) -> [1, 2, 3, 4, 5, 6]

The FLAT function only removes a single level of nesting, when provided a list of lists of lists, the result will be a list of lists.

FLAT([[[1, 2], [3, 4]], [[5, 6]]]) -> [[1, 2], [3, 4], [5, 6]]