Skip to content

LAMBDA idea: MAPCOLS / MAPROWS #260

Description

@jimmytacks

Origin

Synced from Notion: LAMBDA: MAPCOLS / MAPROWS

Problem

Applying a function to specific columns (or rows) of an array — transforming them in place, or deriving new ones — has no single clean primitive. The competitor workbook ("Collecting Scarves") solved it with two unrelated wrappers: BSC / _bySpecificCols (in-place) and _hstackFnc (append derived columns). They share no name stem, so finding one never surfaces the other. We want one discoverable, orientation-symmetric pair.

Proposed

=MAPCOLS(array, cols, fnc, [placement], [keep_source])
=MAPROWS(array, rows, fnc, [placement], [keep_source])

Built on the existing BICOL / BIROW engine — these are just selection + placement layers, no new engine required.

  • cols / rows — index list of columns/rows to transform; negative = counted from the end
  • fnc — function applied to each selected column/row
  • placement — 0 = in place (default) · 1 = append at right/bottom · -1 = prepend
  • keep_source — when the result lands in a new position, keep the original column (default) or drop it

Notes

  • Subsumes competitor BSC (placement 0) and _hstackFnc (placement 1, keep/drop via keep_source).
  • Unlocks a capability neither competitor wrapper had: in-place column expansion — splice multiple result columns back at the original position.
  • Open design choice: a single public MAPCOLS with a placement arg (preferred — fewer public names) vs. a discoverable pair. Either way keep a shared stem so intellisense pairs them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or improvementlambda-ideaLAMBDA function idea for the backlogstatus: doneCompleted

    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