     mutating func multiplyUnit(at index: Int, by newValue: UnitType) {
         units[units.startIndex.advanced(by: index)] *= newValue
     }
-
 }
 
 public extension Tensor where UnitType : BinaryInteger {

    public init(_ slice: TensorSlice<UnitType>) {
        self.init(elementShape: slice.elementShape, units: ContiguousArray(slice.units))
    }

}

/// - TODO: Add conditional expressibility conformance in Swift 4

public extension Tensor where UnitType : Equatable {

    public static func ==(lhs: Tensor<UnitType>, rhs: Tensor<UnitType>) -> Bool {
        return lhs.elementsEqual(rhs)
    }

            try body(&ptr)
        }
    }
}

extension Tensor : TextOutputStreamable {
    public func write<Target>(to target: inout Target) where Target : TextOutputStream {
        target.write(isScalar
            ? String(describing: units[0])
            : "[\(map {"\($0)"}.joined(separator: ", "))]")
    }
}
