Open apjanke opened 5 years ago
Ah: to make this work with prettyprint()
, define totalcolumns
and flatDispstrs
methods. totalcolumns
counts the total columns across all variables, recursively expanding nested tables. flatDispstrs
calculates display strings for both headers and cell contents:
For an k rows × n totalcolumns table:
Then you can just format the headers + bodycells as a grid, and not have to worry about doing recursive stuff at the display step; just the string gathering step. The string gathering step can be recursive, using dispstrs() for regular variables and flatDispstrs() for table-valued variables.
Should RowNames be included in totalcolumns? Probably not; it should probably just show up as an extra display column in prettyprint, making n = totalcolumns + 1 for tables with RowNames. RowNames aren't really a column; they're a dimension label (I think).
A bit of improvement in https://github.com/apjanke/octave-tablicious/commit/a39e640da2e05a37036d385811217b11f5e9c122, for subsasgn with nested tables. Going out in Tablicious 0.4.3.
Need to support nested tables. That is, tables, with table-valued variables. These behave somewhat differently than the regular polymorphic array behavior. For example, they have special display formats in the prettyprint output (See the
splitvars
doco and thesummary
doco).Related Issues