references/sleep-functions/flatten.md

GitHub

flatten

Category: Arrays

Source: https://sleep.dashnine.org/manual/flatten.html


Synopsis

@ flatten(@array)

Returns a shallow copy of the specified array flattened to 1-dimension.

Parameters

@array - the array to flatten.

Returns

A shallow copy of the specified array flattened to 1-dimension.

Examples

Example:

@array = @("a", "b", "c", @("dd", "ee", "ff", @("ggg", "hhh"), "ii"), "j", "k");
@copy = flatten(@array);

println(@copy);

Output:

@('a', 'b', 'c', 'dd', 'ee', 'ff', 'ggg', 'hhh', 'ii', 'j', 'k')

See Also

&clear; &concat; &reverse; &sublist; &splice