feat: run-length encoding#30900
Conversation
PR summary c11f04c211Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
| Current number | Change | Type |
|---|---|---|
| 6902 | 1 | backward.isDefEq.respectTransparency |
Current commit 61fa908e8c
Reference commit c11f04c211
You can run this locally as
./scripts/reporting/technical-debt-metrics.sh pr_summary
- The
relativevalue is the weighted sum of the differences with weight given by the inverse of the current value of the statistic. - The
absolutevalue is therelativevalue divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).
|
This pull request has conflicts, please merge |
|
This PR/issue depends on:
|
|
This pull request has conflicts, please merge |
joneugster
left a comment
There was a problem hiding this comment.
runLength seems reasonable to add.
Please avoid empty PR descriptions in future PRs. Even a single sentence about what you're adding or why you need it would be helpful for context when first opening a PR.
| theorem runLength_eq_nil {l : List α} : runLength l = [] ↔ l = [] := by | ||
| rw [runLength, pmap_eq_nil_iff, splitBy_eq_nil] | ||
|
|
||
| theorem runLength_append {n : ℕ} (hn : 0 < n) {a : α} {l : List α} (ha : a ∉ l.head?) : |
There was a problem hiding this comment.
since you're already using ℕ+ wouldn't it be nicer to formulate these lemmas in terms of (n : ℕ+)?
|
|
||
| @[simp] | ||
| theorem flatten_map_runLength (l : List α) : | ||
| (l.runLength.map fun x ↦ replicate x.1 x.2).flatten = l := by |
There was a problem hiding this comment.
| (l.runLength.map fun x ↦ replicate x.1 x.2).flatten = l := by | |
| (l.runLength.map fun (n, a) ↦ replicate n a).flatten = l := by |
and in other places
There was a problem hiding this comment.
This creates a fun x => match x with | (n, a) => ..., which looks ugly when pretty-printed.
List.splitBy#30898Moved from #17105.