flatten

flatten given collection by eliminating nested blocks


Parameters

flatten collection :literal :block

Attributes

oncedo not perform recursive flattening

Returns

  • :block

Examples

copy
arr: [[1 2 3] [4 5 6]] print flatten arr ; 1 2 3 4 5 6

copy
arr: [[1 2 3] [4 5 6]] flatten 'arr ; arr: [1 2 3 4 5 6]

copy
flatten [1 [2 3] [4 [5 6]]] ; => [1 2 3 4 5 6]

copy
flatten.once [1 [2 3] [4 [5 6]]] ; => [1 2 3 4 [5 6]]

Related