title: How do I calculate the delta (inserted/deleted/moved indexes) of two lists?
body: <p>Assuming I have two lists of objects that have unique ids and an attribute that determines their order, how can I efficiently get the delta indexes (which indexes were inserted, which were deleted, and which were moved)?</p>
  
  <p>Example of input:</p>
  
  <pre><code>let before: [(id: String, timestamp: String)] = [
      ("A", "2015-06-04T12:38:09Z"),
      ("B", "2015-06-04T10:12:45Z"),
      ("C", "2015-06-04T08:39:55Z"),
      ("D", "2015-06-03T23:58:32Z"),
      ("E", "2015-06-01T00:05:51Z"),
  ]
  
  let after: [(id: String, timestamp: String)] = [
      ("F", "2015-06-04T16:13:01Z"),
      ("C", "2015-06-04T15:10:29Z"),
      ("A", "2015-06-04T12:38:09Z"),
      ("B", "2015-06-04T10:12:45Z"),
  ]
  
  let delta = deltaFn(before, after)
  </code></pre>
  
  <p>Here's the above visualized:</p>
  
  <pre><code>BEFORE                                   AFTER
  +-------+----+----------------------+    +-------+----+----------------------+
  | index | id | timestamp            |    | index | id | timestamp            |
  +-------+----+----------------------+    +-------+----+----------------------+
  |     0 |  A | 2015-06-04T12:38:09Z |    |     0 |  F | 2015-06-04T16:13:01Z |
  |     1 |  B | 2015-06-04T10:12:45Z |    |     1 |  C | 2015-06-04T15:10:29Z |
  |     2 |  C | 2015-06-04T08:39:55Z |    |     2 |  A | 2015-06-04T12:38:09Z |
  |     3 |  D | 2015-06-03T23:58:32Z |    |     3 |  B | 2015-06-04T10:12:45Z |
  |     4 |  E | 2015-06-01T00:05:51Z |    |     - |    |                      |
  +-------+----+----------------------+    +-------+----+----------------------+
  </code></pre>
  
  <p>Expected result (delta):</p>
  
  <pre><code>Inserted indexes:  [0]
  Deleted indexes:   [3, 4]
  Moved indexes:     [(from: 0, to: 2), (from: 1, to: 3), (from: 2, to: 1)]
  </code></pre>