I have a list that looks like:


How would I create a list that looks like:


I have tried Flatten but that doesn't seem to work at the desired level.

  • 1
    $\begingroup$ Try mapping Flatten $\endgroup$
    – M.R.
    Jun 2, 2020 at 3:39
  • $\begingroup$ Yeah that's exactly what i was missing, thanks! $\endgroup$
    – D'Angelo
    Jun 2, 2020 at 3:43

2 Answers 2


You can tell Flatten to leave level 1 as-is but to flatten levels 2 and 3 together:

Flatten[z, {{1}, {2, 3}}]
(* {{a, b, b, c, c, d, d, e}, {b, c, d, e, w, e}} *)

This syntax is quite flexible, see Flatten command: matrix as second argument.


Try the map function

list = {{{a, b}, {b, c}, {c, d}, {d, e}}, {{b, c}, {d, e}, {w, e}}}
Flatten /@ list
  • $\begingroup$ Yes that was it, thank you. $\endgroup$
    – D'Angelo
    Jun 2, 2020 at 3:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.