val vector = Vector(a, b, c, d)
for (element <- vector if element.minSeparation(vector))
doSomething
The minSeparation method compares the currently selected element with each element in the rest of the vector. The problem is that I don’t want to compare it to itself. So what is the best way to create a copy of the vector without the current element? Note that some elements could possibly be identical, and I don’t want to eliminate copies of the current element, just the current element itself. Thanks.
I would use a function similar to tails or permutations, that iterates through every element and the corresponding vector with that element excluded. I don’t think it’s part of the std library but it’s not that hard to write.