summaryrefslogtreecommitdiffstats
path: root/vendor/array_tool/alternates.txt
blob: 3e13f17cfca82a6fd0ec1b4865773bb0978a35ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
43% SLOWER implementation

pub fn experimental_uniques<T: std::cmp::PartialEq<T> + std::clone::Clone>(a: Vec<T>, b: Vec<T>) -> Vec<Vec<T>> {
  let mut first_uniq = a.clone();
  let mut second_uniq = b.clone();
  
  let mut x = first_uniq.len();

  'outer: loop {
    x -= 1;
    let mut y = second_uniq.len();
    let mut removed = false;
    'inner: loop {
      y -= 1;
      if first_uniq[x] == second_uniq[y] {
        first_uniq.remove(x);
        second_uniq.remove(y);
        removed = true
      }
      if x == 0{
        if y == 0{
          break 'outer
        }
      }
      else {
        if y == 0{
          break
        }
        if removed {
          continue 'outer
        }
      }
    }
  }
 
  vec![first_uniq, second_uniq]
}