Skip to main content
1 of 3
polfosol
  • 964
  • 7
  • 21

Inconsistency of interpreting TableForm inputs

Consider this line of code and its result:

TableForm[{{a, b}, {c, d}}, TableHeadings -> {None, {1, 2}}] 

table-form of a list

As you see, when I assign the output of TableForm to a variable, it is saved as a List. But when I restart the kernel by executing Quit and run the second line, it returns:

{None,OutputFormsDump`HeadedColumns}[{{1,2},{a,b},{c,d}}] 

So it seems that you have to execute a TableForm command somewhere in your code before assigning a list in table-from! Currently, I use a rather ugly hack like this:

table-form fix

which checks the Depth of a simple table before executing the assignment. If tables are not interpreted as list, then it prints a temporary TableForm and after that, all table inputs will behave as lists.

Why does this happen? Is this a feature or a ?

polfosol
  • 964
  • 7
  • 21