feat(lang): the at operator — crease-segment selection (#50) #63

Merged
toph merged 7 commits from worktree-at-operator into main 2026-07-04 21:43:10 +00:00
Owner

Adds the at operator. A crease name denotes a bundle of segments (one crease_id, one edge per crossed face; ADR 0014), and at projects it down to a single segment by incidence.

  • --l at .p, --l at --a, --l at #(…) — one selector, bare
  • --l at (.p and --a) — two selectors, parenthesised (disambiguates a shared crossing vertex; cap = 2)
  • Singleton-target rule: exactly one segment, else an error (0 → "no segment…", >1 → "ambiguous… add a selector")

Replaces the --( --d #(…) ) restrict escape hatch, which is removed — --( … ) now means only line-through-two-points. Selection is incidence (side_of_line = 0 + param in [0,1]), distinct from toward's proximity.

Implementation is additive: Fold_state edges already carry crease_id + endpoints, so at is a query over the existing subdivision (new crease_segments enumerator). Spec §4.8 documents it; grammar in Appendix A. Whole suite green; the FOLD golden is byte-identical after the syntax-only example migration.

For #50 — first of three slices (pinch creation and ambiguity-enumeration tooling to follow).

Adds the `at` operator. A crease name denotes a *bundle* of segments (one `crease_id`, one edge per crossed face; [ADR 0014](https://git.toph.so/toph/beloch/src/branch/main/decisions/0014-crease-is-a-bundle-of-segments.md)), and `at` projects it down to a single segment by incidence. - `--l at .p`, `--l at --a`, `--l at #(…)` — one selector, bare - `--l at (.p and --a)` — two selectors, parenthesised (disambiguates a shared crossing vertex; cap = 2) - Singleton-target rule: exactly one segment, else an error (`0` → "no segment…", `>1` → "ambiguous… add a selector") Replaces the `--( --d #(…) )` restrict escape hatch, which is removed — `--( … )` now means only line-through-two-points. Selection is incidence (`side_of_line = 0` + param in `[0,1]`), distinct from `toward`'s proximity. Implementation is additive: `Fold_state` edges already carry `crease_id` + endpoints, so `at` is a query over the existing subdivision (new `crease_segments` enumerator). Spec §4.8 documents it; grammar in Appendix A. Whole suite green; the FOLD golden is byte-identical after the syntax-only example migration. For #50 — first of three slices (`pinch` creation and ambiguity-enumeration tooling to follow).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dats65AqKSnHdR7wdxhPh
Replaces the --( --d #(...) ) restrict escape hatch. One selector bare
(--l at .p), two parenthesised (--l at (.p and --a)); point/line/flap
selectors, singleton-target rule with 0/>1 errors.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dats65AqKSnHdR7wdxhPh
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dats65AqKSnHdR7wdxhPh
Author
Owner

crease-at-flap.bel--b (blue, axiom 1) bent by --v (green, axiom 2); --q (pink, axiom 3) is perp to the at #(.c .d) upper segment.

crease pattern

`crease-at-flap.bel` — `--b` (blue, axiom 1) bent by `--v` (green, axiom 2); `--q` (pink, axiom 3) is perp to the `at #(.c .d)` upper segment. ![crease pattern](https://git.toph.so/attachments/48acc495-4395-413e-ad98-5e8b3fec36b7)
The old crease-flap-restrict example crossed --b with --v, where both bundle
segments meet at the same bend point — the at-selection was vacuous. Rewrite as
`perp --b at #(.c .d) through .a`, where different flaps genuinely yield
different axes, and drop the redundant `moving .c` (folding the mapped side is
the default). Rename example + golden to crease-at-flap. Fix the `Bent` error
hint, which still advertised the removed --( --d #(...) ) syntax, to suggest `at`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dats65AqKSnHdR7wdxhPh
toph merged commit 77a8537efc into main 2026-07-04 21:43:10 +00:00
toph deleted branch worktree-at-operator 2026-07-04 21:43:11 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
toph/beloch!63
No description provided.