       return array[index]
     }
   }
-
+  
   public func observe(with observer: @escaping (Event<ObservableArrayEvent<Item>, NoError>) -> Void) -> Disposable {
     observer(.next(ObservableArrayEvent(change: .initial, source: self)))
     return subject.observe(with: observer)

        j -= 1
      }
    }

    // Reverse the result
    return backtrack.reversed()
  }
}

extension MutableObservableArray where Item: Equatable {

  public func replace(with array: [Item], performDiff: Bool) {
    lock.atomic {
      if performDiff {
        let diff = Array.diff(self.array, array)

        var deletes: [Int] = []
        var inserts: [Int] = []
        deletes.reserveCapacity(diff.count)
        inserts.reserveCapacity(diff.count)

        for diffStep in diff {
          switch diffStep {
          case .insert(_, let index):

      }
    }
  }
  
  /// Perform batched updates on the array.
  public func batchUpdate(_ update: (MutableObservableArray<Item>) -> Void) {
    lock.atomic {
