Function interleave_arrays
pub fn interleave_arrays<T, #uint N>(l: [T; N], r: [T; N]) -> [T; { 2 * N }]Expand
Interleaves the elements of two arrays.
An array containing elements from both input arrays is built, with even positions occupied by
elements from the first array and odd positions occupied by those from the second array. In
other words, given two arrays [l0, l1, l2, ...] and [r0, r1, r2, ...], the output would be
[l0, r0, l1, r1, l2, r2, ...].
Examples
let l = [10u8, 11u8, 12u8];
let r = [20u8, 21u8, 22u8];
assert interleave_arrays(l, r) == [10u8, 20u8, 11u8, 21u8, 12u8, 22u8];
let empty: [uint<8>; 0] = [];
assert interleave_arrays([], []) == empty;