Skip to content

TOPOS: generalise CELLTOPOS to convert anything to a packed position - #361

Merged
jimmytacks merged 2 commits into
mainfrom
lambda-topos
Aug 28, 2026
Merged

jimmytacks merged 2 commits into
mainfrom
lambda-topos

Conversation

@jimmytacks

@jimmytacks jimmytacks commented Aug 28, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Renames CELLTOPOS to TOPOS and generalises it into the universal to-position converter, and adds COLSTROF, the column-letters twin of COLOF.

TOPOS

  • Address text (e.g. "E5"; sheet prefixes, $ anchors and ranges tolerated) encodes as an absolute packed position ROW*mult+COLUMN — behaviour unchanged from CELLTOPOS.
  • Any direction spelling DIRDELTA accepts — arrow glyphs (↑ ↗ → ...), compass codes (NE, north-east), screen directions (UL, down) — converts to a relative packed movement delta, repacked as rowDelta*mult+colDelta when a custom mult is supplied.
  • Numbers pass through unchanged, so pre-packed positions, deltas and knight moves survive (matches DIRDELTA mode-0 convention).
  • Unrecognised text returns #N/A. Array input lifts element-wise (branch-plus-@ dispatcher retained, incl. the 1x1 arrays poison scalar branches: CELLTOPOS truncates multi-letter columns; FOLDROWS passes 1x1 arrays where REDUCE passes scalars #318 1x1-array guard).

The two branches can't collide: direction tokens never contain digits, addresses always do.

COLSTROF

COLSTROF(pos, [mult]) extracts the column letters from an encoded position — COLSTROF(1200028) returns "AB" — filling the one gap in the pos-decode family (POSTOCELL gives the full address, ROWOF/COLOF give numbers). Pure native-lifting body (MOD + ADDRESS + SUBSTITUTE), no dispatcher needed.

Rename fallout

  • All 9 internal callers updated: CELLDIST, COLNUM, ROWNUM, GRIDAREA, GRIDLOOKUP, LABELCLUSTERS, MOVECELL, NEIGHBOURS, RELGRID.
  • Help-text/description mentions updated in POSAT, POSTOCELL, ROWOF, COLOF, ADDRESSES, GRIDWHERE, MAZEHELP and the five _dir*.const files; dated revision-history lines keep the old name as historical record.
  • COLOF/ROWOF test args composing with CELLTOPOS renamed; loader integration test asserts maps.TOPOS.
  • TOPOS help delimiter switched to ¦ (help content now lists arrow glyphs).

Testing

🤖 Generated with Claude Code

CELLTOPOS becomes TOPOS, the universal to-position converter:

- A1-style address text (sheet prefixes, $ anchors, ranges tolerated)
  encodes as an absolute position ROW*mult+COLUMN, exactly as before
- Any direction spelling DIRDELTA accepts (arrow glyphs, compass codes,
  screen directions) converts to a relative packed movement delta,
  repacked as rowDelta*mult+colDelta when a custom mult is supplied
- Numbers pass through unchanged, so pre-packed positions, deltas and
  knight moves survive
- Unrecognised text returns #N/A

All internal callers (CELLDIST, COLNUM, ROWNUM, GRIDAREA, GRIDLOOKUP,
LABELCLUSTERS, MOVECELL, NEIGHBOURS, RELGRID) and help-text mentions
are renamed; revision-history lines keep the old name as dated record.
Help delimiter switches to broken bar since the help now lists arrow
glyphs. Full harness suite green (1234 cases, incl. 33 TOPOS cases).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jimmytacks
jimmytacks requested a review from taglotacks August 28, 2026 13:01
The letters twin of COLOF: COLSTROF(1200028) returns "AB".
Body is pure native-lifting (MOD + ADDRESS + SUBSTITUTE), so array
input lifts element-wise with no dispatcher, matching COLOF's shape.
Takes the same optional mult as the rest of the pos-decode family.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jimmytacks
jimmytacks merged commit c5497f3 into main Aug 28, 2026
2 checks passed
@jimmytacks
jimmytacks deleted the lambda-topos branch August 28, 2026 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants