Skip to content

MAPCOLS / MAPROWS: support in-place line expansion (fnc returns multiple lines) #265

Description

@jimmytacks

Follow-up to #260 / #264.

The v1 MAPCOLS / MAPROWS pair ships with the same-length contract: fnc takes one column (or row) and must return a line of the same length. This keeps the implementation clean and fully testable by reusing the BICOL / BIROW engine directly.

The deferred capability

The original idea (#260) noted an unlock neither competitor wrapper had:

in-place column expansion — splice multiple result columns back at the original position.

i.e. allow fnc to return an m×k block for a selected column, and splice all k result columns back in at the source position (growing the array), rather than requiring k = 1.

Why it was deferred

  • Variable per-line widths mean the result is no longer a fixed m×nSel block, so BICOL can't be reused as-is.
  • The scatter/merge step needs NA-padding + TOCOL collapse tricks (see the combinatorial-generation note in the create-lambda skill) to assemble a ragged result into a rectangle.
  • Harder to test and higher risk for the initial PR.

Acceptance

  • MAPCOLS(array, cols, fnc) where fnc returns m×k splices k columns back at each source position (placement 0), shifting later columns right.
  • Append / prepend modes stack the (wider) result blocks.
  • Symmetric behaviour for MAPROWS (row expansion downward).
  • Decide and document behaviour when different selected lines expand by different widths.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions