// Assumes b != c fn index_two<T>(a:& mut[T], b:usize, c:usize) -> (&mut T, &mut T) { let ordered = b < c; let (low_idx, high_idx) = if ordered { (b,c) } else { (c,b) }; let (low_slice, high_slice) = a.split_at_mut(high_idx); let (low, high) = (&mut low_slice[low_idx], &mut high_slice[0]); return if ordered { (low, high) } else { (high, low) } } // Usage: let (column_b, column_c) = index_two(&mut data, b-1, c-1);
https://files.mastodon.social/media_attachments/files/109/464/849/437/818/225/original/57fa8816e0da2bce.png