# Flattening the sub-lists [closed]

Is there a way to flatten the sub-lists within a list?

Transform

{{{1, x}}, {{2, x}}, {{3, x}}, {{4, x}}, {{5, x}}, {{6, x}}, {{7, x}}, {{8, x}}, {{9, x}}, {{10, x}}}


Into

{{1, x}, {2, x}, {3, x}, {4, x}, {5, x}, {6, x}, {7, x}, {8, x}, {9, x}, {10, x}}


I know I can do

Flatten /@ {{{1, x}}, {{2, x}}, {{3, x}}, {{4, x}}, {{5, x}}, {{6, x}}, {{7, x}}, {{8, x}}, {{9, x}}, {{10, x}}}


I am wondering whether there are some dedicated functions for such sub-list flattening?

• try Flatten[list,1] – J42161217 Apr 25 '19 at 0:55
• One can also consider using Join @@ yourlist. – Αλέξανδρος Ζεγγ Apr 25 '19 at 3:27

You are doing redundant step with /@, Flatten can make this directly:

Flatten[{{{1, x}}, {{2, x}}, {{3, x}}, {{4, x}}, {{5,
x}}, {{6, x}}, {{7, x}}, {{8, x}}, {{9, x}}, {{10, x}}}, 1]
(* {{1, x}, {2, x}, {3, x}, {4, x}, {5, x}, {6, x}, {7, x}, {8,
x}, {9, x}, {10, x}} *)


Yes, there is a built-in function for what you want to do.

data = {{{1, x}}, {{2, x}}, {{3, x}}, {{4, x}}, {{5, x}}, {{6, x}}, {{7, x}}, {{8, x}}, {{9, x}}, {{10, x}}};
Catenate @ data

{{1, x}, {2, x}, {3, x}, {4, x}, {5, x}, {6, x}, {7, x}, {8, x}, {9, x}, {10, x}}