MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Generalizing Complement to handle multiple occurrences of elements


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


  • Prev by Date: get a table of coordinates from an image of a graph
  • Next by Date: Re: How to rescale the x-axis in an nonlinear way?
  • Previous by thread: Re: get a table of coordinates from an image of a graph
  • Next by thread: Re: Generalizing Complement to handle multiple occurrences