Re: Complement
- To: mathgroup at smc.vnet.net
- Subject: [mg6102] Re: [mg6100] Complement
- From: Allan Hayes <hay at haystack.demon.co.uk>
- Date: Fri, 21 Feb 1997 23:46:06 -0500
- Sender: owner-wri-mathgroup at wolfram.com
Houshou Chen <houshou at eecs.umich.edu> [mg6100] Complement writes > The result of Complement always resort the order, Is there any code > such that taking the complement without changing the original > order? > > Complement[{5,4,3,2,1},{1,2}] is {3, 4, 5}, I would like the result > to be {5,4,3} instead. Houshou: DeleteCases[{5,4,3,2,1}, Alternatives@@{1,2}] {5, 4, 3} Because Alternatives@@{1,2} becomes Alternatives[1,2] we can work with lists as inputs. Allan Hayes hay at haystack.demon.co.uk http://www.haystack.demon.co.uk