Repository navigation
Add run notation for shapes - #1
Merged
Merged
Conversation
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.
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.
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,1was tedious and error-prone to type.After. Wherever a shape is read (
rank,conjugate,hooks,compare,neighbors,syt,core), a token may be writtenPARTxCOUNT;4,3x2,1is4,3,3,1. Commands print the shape spelled out, and their other output is unchanged: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 withmath/bigbefore anything is expanded, so5000x5000is rejected without building a huge list.How.
internal/shape/shape.go(Parse, same signature and check order) and a newinternal/shape/runs.gohelper that reads one token. The README gains one paragraph. New tests:internal/shape/runs_test.go(8) andinternal/cli/runs_test.go(3); existing tests are unchanged.