An action in an edit script to transform one source sequence into a target sequence.
Equations
- Lean.Diff.instReprAction = { reprPrec := Lean.Diff.reprAction✝ }
Equations
- Lean.Diff.instBEqAction = { beq := Lean.Diff.beqAction✝ }
Equations
- Lean.Diff.instHashableAction = { hash := Lean.Diff.hashAction✝ }
Equations
- One or more equations did not get rendered due to their size.
Determines a prefix to show on a given line when printing diff results.
For delete
, the prefix is "-"
, for insert
, it is "+"
, and for skip
it is " "
.
Equations
- Lean.Diff.Action.delete.linePrefix = "-"
- Lean.Diff.Action.insert.linePrefix = "+"
- Lean.Diff.Action.skip.linePrefix = " "
A histogram entry consists of the number of times the element occurs in the left and right input arrays along with an index at which the element can be found, if applicable.
- leftCount : Nat
How many times the element occurs in the left array
An index of the element in the left array, if applicable
Invariant: the count is non-zero iff there is a saved index
- rightCount : Nat
How many times the element occurs in the right array
An index of the element in the right array, if applicable
Invariant: the count is non-zero iff there is a saved index
A histogram for arrays maps each element to a count and, if applicable, an index.
Equations
- Lean.Diff.Histogram α lsize rsize = Std.HashMap α (Lean.Diff.Histogram.Entry α lsize rsize)
Add an element from the right array to a histogram
Equations
- One or more equations did not get rendered due to their size.
Given two Subarray
s, find their common prefix and return their differing suffixes
Equations
- Lean.Diff.matchPrefix left right = Lean.Diff.matchPrefix.go left right #[]
Given two Subarray
s, find their common suffix and return their differing prefixes
Equations
- Lean.Diff.matchSuffix left right = Lean.Diff.matchSuffix.go left right 0
Finds the least common subsequence of two arrays using a variant of jgit's histogram diff algorithm.
Unlike jgit's implementation, this one does not perform a cutoff on histogram bucket sizes, nor does it fall back to the Myers diff algorithm. This means that it has quadratic worst-case complexity. Empirically, however, even quadratic cases of this implementation can handle hundreds of megabytes in a second or so, and it is intended to be used for short strings like error messages. Be cautious when applying it to larger workloads.