Swapping two elements of an array
You can swap two elements of an array as follows:
def swap 't (i: i64) (j: i64) (A: *[]t) =
  let tmp = copy A[j]
  let A[j] = copy A[i]
  let A[i] = tmp
  in AThis uses in-place updates, which interacts with
the uniqueness type
system, which is why the A parameter has the * annotation.