Is there a pattern to match a list of lists, containing at least one list, with each list containing at least one element?
In the Mathematica documentation it says that the pattern
x:{___List}
will match a list of lists. This is true, but it also matches {}
, which is a list of zero lists (or zero anything). To make sure there is at least one list in my list of lists I can remove one of the underscores to change BlankNullSequence
to BlankSequence
, i.e. switch to
x:{__List}
which no longer matches {}
. It does, however, match {{}}
. How can I also guarantee that each matched sublist is non-empty? Is this even possible, or should I be checking for it programmatically within the Module
to which I'm passing arguments of this form?