Say I have the list
{{a}, {0, 2, 5}, {5, 4, 1}, {a}, {1, 1, 0}, {1, 4, 2},
{3, 3, 0}, {a}, {3, 2, 0}, {1, 4, 1}}
I would like to make sublists of everything beginning with the {a}
element till the next {a}
or the and of the list.
Either
{{{0, 2, 5}, {5, 4, 1}},
{{1, 1, 0}, {1, 4, 2}, {3, 3, 0}},
{{3, 2, 0}, {1, 4, 1}}}
or
{{{a},{0, 2, 5}, {5, 4, 1}},
{{a},{1, 1, 0}, {1, 4, 2}, {3, 3, 0}},
{{a},{3, 2, 0}, {1, 4, 1}}}
would be acceptable. I'm sure there is a duplicate, but I can't find the easiest way to do this (that isn't a clunky While
loop with an AppendTo
)