1

I have the following:

Clear[a, b];
a = {{1, 2, 3}, {4, 2, 5}, {6, 7, 8}};
b = GroupBy[a, #[[2]] &];

b

whose output is:

<| 2 -> {{1, 2, 3}, {4, 2, 5}}, 7 -> {{6, 7, 8}} |>

But how do I construct a pattern for b? I have been taking stabs in the dark, but nothing has worked so far.

MatchQ[b, _Association[_Integer -> {__Integer} ..]] (* False *)

MatchQ[b, _Association[Key[_Integer] -> {__Integer} ..]] (* False *)

Since the stars in the universe will likely burn out before I have exhausted all the combinatorial possibilities, I would be grateful for some help.

Shredderroy
  • 5,249
  • 17
  • 26

0 Answers0