MathGroup Archive 2013

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

Search the Archive

Re: Removing list elements in x by list y


There will be many other ways to do that but this works for the example
Delete[x, Flatten[Position[x, #] & /@ y, 1]]

But what would you expect as a result in case of y = {u,w}?


Am 13.06.2013 um 08:36 schrieb Dr. Wolfgang Hintze:

> I have simple question.
> 
> Given two lists
> 
> x = {u, v, w, w, d};
> y = {u, d};
> 
> I wish to "subtract" y from x, i.e. remove exactly the elements in x
> which belong to y giving
> 
> x "-" y = {v,w,w}
> 
> Complement[] gives instead {v,w}.
> Note that we are talking about lists rather than sets.
> 
> I'm sure there is a simple standard command, but I can't find it.
> Can you?
> 
> Regards,
> Wolfgang
> 




  • Prev by Date: Re: Applying data from a database link to a GraphPlot
  • Next by Date: Re: Removing list elements in x by list y
  • Previous by thread: Re: Removing list elements in x by list y
  • Next by thread: Re: Removing list elements in x by list y