Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #14849 > unrolled thread

Re: Removing list elements in x by list y

Started byUlrich Arndt <ulrich.arndt@data2knowledge.de>
First post2013-06-14 08:49 +0000
Last post2013-06-14 08:49 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Removing list elements in x by list y Ulrich Arndt <ulrich.arndt@data2knowledge.de> - 2013-06-14 08:49 +0000

#14849 — Re: Removing list elements in x by list y

FromUlrich Arndt <ulrich.arndt@data2knowledge.de>
Date2013-06-14 08:49 +0000
SubjectRe: Removing list elements in x by list y
Message-ID<kpelf1$hrj$1@smc.vnet.net>
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
> 

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web