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(https://futhark.readthedocs.io/en/latest/language-reference.html#in-place-updates),
which is why the A parameter has the * annotation.