I have a list of the form:
toy = {{a, {b, c}}, {d, {e, f}}, {g, {h, j}}, {k, {m, n}}};
and would like to create the list
{{a, c}, {d, f}, {g, j}, {k, n}}
from toy.
The following code does it but I find this esthetically unsatisfactory because I don't like creating the two independent lists toy[[;; , 1]] and toy[[;; , 2, 2]] and combining them.
Transpose[{toy[[;; , 1]], toy[[;; , 2, 2]]}]
Is there a cleaner more direct way to do this?
{#[[1]], #[[2, 2]]} & /@ toy
or{#1, #2[[2]]} & @@@ toy
$\endgroup$toy /. {x_, {y_, z_}} :> {x, z}
$\endgroup$toy[[All, 2]] = toy[[All, 2, 2]]; toy
$\endgroup$Transpose@{toy[[All,1]],toy[[All,2,2]]}
$\endgroup$