I would like to reduce the number of brackets in a list for nested lists containing 1 sublist. For instance {{1,2,3}}
should become {1,2,3}
However, {{1,2,3},{4,5}}
should stay the same.
I used:
DropLevel[x_] := Level[x, {-1}] /; Dimensions[x][[1]] == 1
Which gives an error on {{1,2,3},{4,5}}
but works on {{1,2,3}}
Dimensions[x][[1]]==1
does work as a test for checking whether a list has two sublists or only 1.
Am I missing something about the way /;
functions?