next | previous | forward | backward | up | top | index | toc | home
Macaulay2 > The Macaulay2 language > lists and sequences > flatten

flatten -- flatten a list by unnesting lists

Description

flatten m -- produces a new list from m by effectively removing the braces surrounding the elements of any elements of m which happen to be lists. Also works for matrices.

i1 : flatten {{2,3,4},{{5}},6}

o1 = {2, 3, 4, {5}, 6}

o1 : List

Ways to use flatten :