terminal_table/transformations

Value-preserving table composition and geometric transformations.

Procs

proc duplicateColumn(table: Table; index: int; copies = 1): Table {.
    ...raises: [ValueError], tags: [], forbids: [].}
Inserts copies of one column and its cells immediately to its right.
proc duplicateRow(table: Table; index: int; copies = 1): Table {.
    ...raises: [ValueError], tags: [], forbids: [].}
Inserts copies additional instances immediately after one body row.
proc extractColumns(table: Table; indexes: openArray[int]): Table {.
    ...raises: [ValueError], tags: [], forbids: [].}
Returns the requested columns in the supplied order.
proc extractRows(table: Table; indexes: openArray[int]): Table {.
    ...raises: [ValueError], tags: [], forbids: [].}
Returns the requested body rows in the supplied order.
proc horizontalConcat(left, right: Table): Table {....raises: [ValueError],
    tags: [], forbids: [].}
Joins tables side by side. Their body heights and section presence match.
proc merge(base, overlay: Table): Table {....raises: [ValueError], tags: [],
    forbids: [].}
Fills empty body cells in base from an equally shaped overlay.
proc removeColumns(table: Table; indexes: openArray[int]): Table {.
    ...raises: [ValueError], tags: [], forbids: [].}
Returns a copy without the specified columns.
proc removeRows(table: Table; indexes: openArray[int]): Table {.
    ...raises: [ValueError], tags: [], forbids: [].}
Returns a copy without the specified body rows.
proc rotate180(table: Table): Table {....raises: [ValueError, Exception],
                                      tags: [RootEffect], forbids: [].}
Rotates the body by 180 degrees.
proc rotateClockwise(table: Table): Table {....raises: [ValueError, Exception],
    tags: [RootEffect], forbids: [].}
Rotates the body 90 degrees clockwise.
proc rotateCounterClockwise(table: Table): Table {.
    ...raises: [ValueError, Exception], tags: [RootEffect], forbids: [].}
Rotates the body 90 degrees counter-clockwise.
proc splitColumns(table: Table; at: range[0 .. high(int)]): tuple[
    before, after: Table] {....raises: [ValueError], tags: [], forbids: [].}
Splits the table before column index at.
proc splitRows(table: Table; at: range[0 .. high(int)]): tuple[
    before, after: Table] {....raises: [ValueError], tags: [], forbids: [].}
Splits the body before index at.
proc transpose(table: Table): Table {....raises: [ValueError, Exception],
                                      tags: [RootEffect], forbids: [].}
Transposes the body. Header/footer are removed because their axis changes.
proc verticalConcat(top, bottom: Table): Table {....raises: [ValueError], tags: [],
    forbids: [].}
Stacks tables with equal column counts. The top presentation is retained.