Generalizing Complement to handle multiple occurrences of elements
- To: mathgroup at smc.vnet.net
- Subject: [mg112425] Generalizing Complement to handle multiple occurrences of elements
- From: Mark Coleman <markspcoleman at gmail.com>
- Date: Wed, 15 Sep 2010 04:38:25 -0400 (EDT)
Greetings,
I'm wondering how one can efficiently generalize the built-in
Complement function to return multiple occurrences of elements. For
instance, the current version generates
a={1,2,2,3,4,4,4,4}
b={3,5,7}
Complement[a,b]={1,2,4}
I'm looking for a way to define
myComplement[a,b]={1,2,2,4,4,4,4}
My current code is very inefficient!
Thanks,
Mark
- Follow-Ups:
- Re: Generalizing Complement to handle multiple occurrences
- From: Leonid Shifrin <lshifr@gmail.com>
- Re: Generalizing Complement to handle multiple occurrences
- From: "Niels R. Walet" <niels.walet@manchester.ac.uk>
- Re: Generalizing Complement to handle multiple occurrences