Re: Complement
- To: mathgroup at smc.vnet.net
- Subject: [mg6119] Re: [mg6100] Complement
- From: BobHanlon at aol.com
- Date: Fri, 21 Feb 1997 23:46:42 -0500
- Sender: owner-wri-mathgroup at wolfram.com
Complement[{5, 4, 3, 2, 1}, {1, 2}]
{3,4,5}
sameOrderComplement[eall_, ei__] :=
Sort[Complement[eall, ei],
Position[eall, #1][[1, 1]] <
Position[eall, #2][[1, 1]]&]
sameOrderComplement[{5, 4, 3, 2, 1}, {1, 2}]
{5,4,3}
sameOrderComplement[{5, 4, 3, 2, 1}, {1, 2}, {1, 4}]
{5,3}
sameOrderComplement[{5, 4, 3, 6, 3, 2, 1}, {1, 2}]
{5,4,3,6}