[Feature Request] ArcTables.MoveTable
Closed this issue · 0 comments
Freymaurer commented
let reorder (oldIndex, newIndex) (arr:ResizeArray<'T>) =
let table = arr.[oldIndex]
arr.Insert(newIndex, table)
let updatedOldIndex = if newIndex <= oldIndex then oldIndex + 1 else oldIndex
arr.RemoveAt(updatedOldIndex)
arr
let x() = ResizeArray([0..20])
reorder (0, 15) (x()) |> Array.ofSeq
// val it: int array =
// [|1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 0; 15; 16; 17; 18; 19; 20|]
reorder (15, 0) (x()) |> Array.ofSeq
// val it: int array =
// [|15; 0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 16; 17; 18; 19; 20|]