In the following example, how to easily get {2,4,10} using the [[{...}]] syntax?
aa = {2, 4, 6, {8, 10, 12}, 14, 16, 18, 20};
aa[[{1, 2}]]
(*{2,4}*)
aa[[{1, 2(* what to put here?? *)}]]
(*{2,4,10}*)
aa[[{1, 2(* what to put here?? *)}]]
(*{2,4,{10,12}}*)
Part. UseExtractinstead:Extract[aa, {{1}, {2}, {4, 2}}]. – Henrik Schumacher Feb 12 '20 at 22:13Flatten[{aa[[{1, 2}]], aa[[{1, 2, 4}]][[3, 2]]}]gives{2, 4, 10}but I would also useExtract, much simpler. – Nasser Feb 12 '20 at 22:24Join[aa[[{1, 2}]], {aa[[4, 2]]}]– Bob Hanlon Feb 13 '20 at 00:20aa[[##]]&@@@ {1,2, {4, 2}}after Bob Hanlon here – user1066 Feb 13 '20 at 00:20Partis not the right tool for the job here; it cannot mix and match levels in this way.Extractis the correct function for this. – Sjoerd Smit Feb 13 '20 at 12:34