         return .init(length: length, table: d)
     }
     
+    @inlinable
     public subscript(i: Int) -> Int {
         table[i] ?? i
     }


public struct Permutation<n: SizeType>: Multiplicative, MathSet, Hashable {
    public let length: Int
    private let table: [Int : Int]
    
    public init(length: Int, table: [Int : Int]) {
        assert(Set(table.keys) == Set(table.values))

    }
    
    public var inverse: Self? {
        .init(length: length, table: table.invert())
    }
    
    public var indices: [Int] {
        (0 ..< length).map{ self[$0] }
    }
    
    // memo: the number of transpositions in it's decomposition.
