ToLehmerCode
Entry i counts the later entries smaller than p(i).
ToLehmerCode(Permutation)
Details
- Takes a `Permutation` and returns a `SubexcedantSeq` — a typed map, so a wrong carrier is a type error rather than a wrong answer.
- Its total is the inversion count, which is the Lehmer code's whole point.