Given a set of triple lists (all contain element 9
!)
tripel = {{5, 10, 9}, {4, 9, 3}, {3, 9, 8}, {4, 5, 9}, {9, 10, 8}}
I would like to rearrange tripel
to
Map[Which[#[[1]] == 9, #, #[[2]] ==9, {#[[2]], #[[3]], #[[1]]}, #[[3]] ==9, {#[[3]], #[[1]], #[[2]]}] &, tripel]
(*{{9, 5, 10}, {9, 3, 4}, {9, 8, 3}, {9, 4, 5}, {9, 10, 8}}*)
Is there a more direct and simple way to realize this cyclic permutation in Mathematica? Thanks!
{{9, 5, 10}, {9, 4, 3}, {9, 3, 8}, {9, 4, 5}, {9, 10, 8}}
or is it correct as it is? $\endgroup$