Add positional helpers to maps library (CELLDIST, ADDRESSES, ROW/COL helpers)#186
Merged
Conversation
…OLOF, ROWNUM/COLNUM Six small Maps lambdas covering address-to-position conversions and grid distance: - CELLDIST(cell1, cell2, [metric]) — Manhattan (0, default), Chebyshev (1), or Euclidean (2) distance between two A1 addresses. Pure-arithmetic body so Excel broadcasting handles both same-shape zip and column x row cartesian inputs naturally. - ADDRESSES(cells) — range reference -> A1 strings, shape-preserving via ADDRESS(ROW, COLUMN, 4). Closes the gap where a downstream lambda wants string addresses but the caller has a reference. - ROWOF / COLOF — extract row/col from CELLTOPOS-encoded position, with optional [mult] matching CELLTOPOS / POSTOCELL convention. - ROWNUM / COLNUM — row/col from A1 address text. Composed on top of CELLTOPOS so address-parsing edge cases (sheet prefix, $, ranges, case-insensitive, multi-letter cols up to XFD) are inherited for free. Closes #182, closes #183, closes #185. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Six small Maps lambdas covering the address ↔ position conversion graph and grid distance:
[mult]matching the CELLTOPOS / POSTOCELL convention.ROW()/COLUMN()but accepting strings. Composed on top of CELLTOPOS so address-parsing edge cases (sheet prefix,$, ranges, case-insensitive, multi-letter cols up to XFD) are inherited.Together with the existing
CELLTOPOS/POSTOCELL, this completes the three-way conversion graph between A1 text, (row, col), and encoded position.Closes #182
Closes #183
Closes #185
Test plan
$-anchor, cell-reference, and cartesian-broadcast cases)=CELLDIST("F28", "G26")→ 3,=CELLDIST({"A1";"B2"}, {"C3","D4"})→ 2×2 grid,=ADDRESSES(F28:H30)→ 3×3 of strings,=ROWNUM("AA17")→ 17,=COLNUM("XFD1")→ 16384🤖 Generated with Claude Code