Skip to content

Add run notation for shapes - #1

Merged
Gulliby merged 1 commit into
mainfrom
feature/shape-run-notation
Oct 21, 2026
Merged

Gulliby merged 1 commit into
mainfrom
feature/shape-run-notation

Conversation

@Gulliby

@Gulliby Gulliby commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Requested by gulliby

Before. A shape had to be written part by part, so a long run of equal parts such as 4,3,3,3,3,1 was tedious and error-prone to type.

After. Wherever a shape is read (rank, conjugate, hooks, compare, neighbors, syt, core), a token may be written PARTxCOUNT; 4,3x2,1 is 4,3,3,1. Commands print the shape spelled out, and their other output is unchanged:

$ youngkit rank 4,3x2,1
shape       4,3,3,1
size        11
rank        32
of          56

Malformed runs, a count outside 1 to 5000, and ordering errors (reported at the spelled-out position) give clear messages, for example youngkit: invalid count "0" in "3x0" (expected 1 to 5000). The total size is computed with math/big before anything is expanded, so 5000x5000 is rejected without building a huge list.

How. internal/shape/shape.go (Parse, same signature and check order) and a new internal/shape/runs.go helper that reads one token. The README gains one paragraph. New tests: internal/shape/runs_test.go (8) and internal/cli/runs_test.go (3); existing tests are unchanged.

Wherever a shape is read, a token may be written PARTxCOUNT for a part repeated COUNT times, so 4,3x2,1 is 4,3,3,1. Size is checked with big integers before the shape is spelled out. Tests and README updated.
@Gulliby Gulliby self-assigned this Oct 21, 2026
@Gulliby
Gulliby merged commit 0ea926f into main Oct 21, 2026
6 checks passed
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.

1 participant