Suppose I have a list
l = {a, b, c, d, e, f....}
I would like to remove one of each pair {x,y} if some function check[x,y] returns xor y (or do nothing for that particular pair if the function returns {}). The order of the list is important. For example, if
check[c,e] === c;
check[a,f] === f;
and check on any other combination is empty, the final list should be
{a, b, d, e, ...}
I know how to write a for loop and do index-based removal, but is it a slicker way to do it using Mathematica's list manipulation functions?
EDIT:
The check function should be non-overlapping in my usage, but in case if there is problematic overlap, say
check[a,e] === a;
check[a,f] === f;
both e and f should remain, since after removal of a (assuming position of a is earlier than f), there is no pair that can be formed with {a,f}.


Checkis intended to be your own, custom function but that name is already in use. User symbols should start with lower case letters. – Mr.Wizard♦ Oct 6 '12 at 8:37check[a,b] == aandcheck[a,d] == a? Is it sufficient to removea? Should the secondcheckbe performed at all? – Mr.Wizard♦ Oct 6 '12 at 8:44fis removed and nota-- should the element that is not returned be removed? – Mr.Wizard♦ Oct 6 '12 at 9:05checkof course; question again edited for consistency. (It proves that I should go to bed instead...) – polyglot Oct 6 '12 at 9:10