Function cop::union2 [−][src]
pub fn union2<T: Eq>(v1: Vec<T>, v2: Vec<T>) -> Vec<T>ⓘ
Compute the union of two vectors, removing duplicates from the first one.
This function first removes duplicates from the first vector, keeping the first occurence of each element. It then removes from the first vector any element present in the second vector. Finally, it reverses the first vector and concatenates it with the second vector.
This function is so complicated in order to
simulate the function union2
of Otten’s leanCoP.
assert_eq!(cop::union2(vec![2, 1, 3, 4, 1], vec![2, 2]), vec![4, 3, 1, 2, 2]);