Skip to content

Esta página también está en español.

Léela en español

このページは日本語でも読めます。

日本語で読む

本页也有简体中文版本。

阅读简体中文版本

flatten function

Nested lists flattened into one list.

How to write it

flatten(list)

list
A list of lists. Takes a list.

Examples

  • flatten⁡([[1,2],[3]])=[1,2,3]\displaystyle \operatorname{flatten}(\left[ \left[ 1, 2 \right], \left[ 3 \right] \right]) = \left[ 1, 2, 3 \right]
    flatten([[1, 2], [3]])

    In the solver, flatten([[1, 2], [3]]) gives [1, 2, 3].

    Open in the solver
  • fold

    Combine the elements of a list from the left with a function, starting from a value.

  • first

    The first element of a list.

  • fold_list

    The steps of fold: every partial result, starting from the first value.

  • drop

    A list without its first elements.

  • head

    The head of an expression: the name of the function it is a call of.

  • dimensions

    The size of a list or a matrix, level by level.