I have a list with three levels.
list = {{{7, 5, 8}, {4, 8, 9}, {7, 0, 1}, {3, 0, 4}, {5, 1, 2}}};
And I want to put in a list {e,x,y} at the end of every element.
Append[Riffle[#, {{e, x, y}}] & /@ list, {e, x, y}]
Gives:
{{{7, 5, 8}, {e, x, y}, {4, 8, 9}, {e, x, y}, {7, 0, 1}, {e, x,
y}, {3, 0, 4}, {e, x, y}, {5, 1, 2}}, {e, x, y}}
- There is that {e,x,y} missing at the end.
- How do I group every two elements together to get:
{{{7, 5, 8, e, x, y}, {4, 8, 9, e, x, y}, {7, 0, 1, e, x,
y}, {3, 0, 4, e, x, y}, {5, 1, 2, e, x, y}}}
Is there is function to do it in one line?