From a3dafe14bcc8bab97cac61c3e53385211645af3c Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Sun, 15 Nov 2026 21:12:34 +0100 Subject: [PATCH] =?UTF-8?q?Answer=20prose=20round=201:=200=20=F0=9F=94=B4,?= =?UTF-8?q?=209=20=F0=9F=9F=A1=20(0=20misread);=20state=20the=20entry's=20?= =?UTF-8?q?premises=20and=20measure,=20name=20withoutEdgeWhitespace=20for?= =?UTF-8?q?=20the=20replay,=20say=20every=20other=20node=20is=20linked?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 +- docs/decisions.md | 41 +++++++++++++++++++++++++---------------- todo.md | 6 +++--- 3 files changed, 29 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2330a2f..e6004d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## Unreleased -- `adfToPortableMarkdown` writes a line of whitespace-only text nodes beside a hard break, alternating linked and plain or emphasized, in time linear in its length, where `0.3.1` took time quadratic in it. +- `adfToPortableMarkdown` writes a line of whitespace-only text nodes beside a hard break, every other one linked, in time linear in the number of nodes, where `0.3.1` took time quadratic in it. - `adfToPortableMarkdown` writes a line of code spans alternating with emphasized spaces in time linear in its length, where `0.3.1` took time quadratic in it. - `adfToHtml` writes a media single, a media group and a caption as `
` holding an `` and a `
`, and as `
` of `` files, where diff --git a/docs/decisions.md b/docs/decisions.md index 6655a9f..e1b9ada 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -1187,25 +1187,34 @@ so it doesn't bound the walk's cost. ## After each trim pass, the reducer drops the edge whitespace the passes to come would drop, a round per pass -2026-11-15, item 190's chunk. Goal 9. Valid while `link` is the only kept mark that is not -edge-stripping, and every hard break the reducer hands the trim is alike. +2026-11-15, item 190's chunk. Goal 9. Valid while `link` is the only kept mark besides `code` that is +not edge-stripping, the trim leaves a `code` leaf as it is, every hard break the reducer hands the +trim is alike, and every leaf it hands the trim is text or a hard break. `trimPass` judges every leaf against one snapshot, so a blank leaf reaches a line edge only the pass after its neighbour dropped there: n blanks at a hard break took n + 1 passes, each linear. -`withoutEdgeWhitespace` replays those drops in rounds, one per pass to come, and a round judges only -the leaves beside a leaf the round before dropped, so all rounds together are linear. A round is -exact because whitespace at a line edge goes or stays by three facts no pass changes: its leaf's -outermost mark, the outermost mark of the leaf across the hard break, and whether a hard break lies -between. Three things keep it so, each found by the property test against the one-leaf-per-pass -reference: a round judges all its leaves before it changes any, since a leaf goes by a neighbour -that goes in the same pass; a round also judges the edge whitespace of a leaf holding text; and the -replay reads the pass's line merged, as `trimPass` merges before it judges. No round merges again: -a leaf that goes has a hard break or a line edge beside it, so it brings no two leaves together. -The replay runs after a -pass, never before the first: a pass also takes marks off whitespace by the line as it stands, and -the first pass must see the line as it came. Measured in passes -(§Cost fixes are measured, never timed): both of item 190's lines took 7, 101 and 1 001 passes at -6, 100 and 1 000 blanks, and take 2 at each, as at 100 000. +`withoutEdgeWhitespace` replays those drops in rounds, one per pass to come. A round after the +first judges only the leaves beside a leaf the round before dropped, and no judging reads a leaf's +text: each leaf's edge whitespace is counted once, and `trimmingRuns` is handed a one-character +stand-in. So all rounds together are linear. A line holding any other leaf, such as a mention, is +left to the passes, since a link run crosses such a leaf and a round reads only the leaves beside +an edge. + +A round judges whitespace at a line edge by its leaf's marks, the marks of the leaf across the hard +break, and whether a hard break lies between. That it drops what the passes would is held by the +property test against its reference counts (`runsSharedWithNext`), which found three things a +round owes: it judges all its leaves before it changes any, since `trimPass` judges a leaf by its +neighbour as that stood before the pass, even where the neighbour goes in the same pass; it also +judges the edge whitespace of a leaf holding more than whitespace, such as `'x '`; and it reads +the pass's line merged, as `trimPass` merges before it judges. No round merges again: a leaf that +goes has a hard break or a line edge beside it, so it brings no two leaves together. +`withoutEdgeWhitespace` runs after a pass, never before the first: a pass also takes marks off +whitespace, and the first pass must see the line as it came. + +Measured in counts (§Cost fixes are measured, never timed): both lines of `blankLines` +(`src/markdown/portable/inline-reduction.test.ts`) took 7, 101 and 1 001 passes at 6, 100 and 1 000 +blanks, and take 2 at each, as at 100 000; and the trim reads the text of each leaf it keeps as +often at 1 000 blanks as at 6. ## Only the hard break holds a raw newline diff --git a/todo.md b/todo.md index 4920c70..0ec2500 100644 --- a/todo.md +++ b/todo.md @@ -108,12 +108,12 @@ Forge's runtime, which no leg tests. `portable/inline-reduction.ts`'s `leafEdges` finds the trail with an unanchored `/[ \t]*$/`, quadratic in a run of blanks inside one leaf: a paragraph of `a`, 80 000 spaces, `b` takes 6.5 s in -`adfToPortableMarkdown`. Scan backward, as the expand title's trim does. `withoutLineEdges`, in the -same file, finds its trail with the same expression. +`adfToPortableMarkdown`. Scan backward, as the expand title's trim does. `edgeWhitespace`, in the +same file, counts a leaf's lead and trail by index. ### 191. Make the edge trim and the reference of its property test agree on a line whose strong link run ends in blanks before two hard breaks. -Found while shipping item 190, on `origin/main`'s trim as well as on that chunk's: fast-check seed 578490788, path `94554:1:8:16:15:15:16:16:16:16`, in `trims a spanned line as the reference counts trim it, in no more passes` (`src/markdown/portable/inline-reduction.test.ts`), about one random line in 100 000, so the gate's 3 000 runs on a fixed seed pass. The line, with `held` a link to `v` and `strong`: `'x '` holding `held` and `backgroundColor`, `' '` holding `held`, `' '` unmarked, a hard break, `' '` holding `held`, `' '` unmarked, a hard break. `trimmedEdges` returns the one leaf `'x'`; the reference, `trimPass` on `runsSharedWithNext`'s counts, also keeps a linked `' '`. Decide which is right by `docs/decisions.md` → "After 32 passes…" and the trim's entries, then fix the other and pin the line as a fixed test. +Found while shipping item 190, on `origin/main`'s trim as well as on that chunk's: fast-check seed 578490788, path `94554:1:8:16:15:15:16:16:16:16`, in `trims a spanned line as the reference counts trim it, in no more passes` (`src/markdown/portable/inline-reduction.test.ts`), about one random line in 100 000, so the gate's 3 000 runs on a fixed seed pass. The line, with `held` a link to `v` and `strong`: `'x '` holding `held` and `backgroundColor`, `' '` holding `held`, `' '` unmarked, a hard break, `' '` holding `held`, `' '` unmarked, a hard break. `trimmedEdges` returns the one leaf `'x'`; the reference, `trimPass` on `runsSharedWithNext`'s counts, also keeps a linked `' '`. Decide which is right by `docs/decisions.md` → "After 32 passes…" and the trim's entries, then fix the other and pin the line as a fixed test. A second line of the class, with no link and one hard break: seed -1783810909, path `201490:2:4:5:9:9:9:15:14:18:18:18:18:22:23:23`, the line `'x '` strong, `' '` code, `' '` strong, a hard break, `' '` unmarked, `'x '` strong, `' '` unmarked; the trim gives `x`, `' '`, `' '`, hard break, `x`, the reference `'x '`, `' '`, hard break, `x`. ### 31. Make the branch-coverage figure repeat across runs of an unchanged tree.