This provides a useful input format, extendable with Ctrl+Enter:
CellPrint[Cell[
BoxData[RowBox[{"(", "\[NoBreak]",
TagBox[GridBox[{{"1"}, {"2"}, {"3"}, {"4"}, {"5"}}], Column], "\[NoBreak]",
")"}]], "Input"]]
The generated cell evaluates to a flat List
:
{1, 2, 3, 4, 5}
However adding a comment produces a spurious Null
:
{1, 2 Null, 3, 4, 5}
Without the TagBox[. . ., Column]
comments work normally, but input is not recognized as a flat list:
CellPrint[Cell[
BoxData[RowBox[{"(", "\[NoBreak]", GridBox[{{"1"}, {"2"}, {"3"}, {"4"}, {"5"}}],
"\[NoBreak]", ")"}]], "Input"]]
{{1}, {2}, {3}, {4}, {5}}
Is there a similar flat-list input construction that allows comments?
TagBox
it breaks when you add a comment, because the FE interpretsRowBox[{"a", RowBox[{"(*", "b", "*)}]}]
incorrectly. On the other handTemplateBox
has a flexibleInterpretationFunction
option that you could use to take aGridBox
input and handle it correctly, I believe. $\endgroup$