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


Groups > comp.soft-sys.math.mathematica > #15124

Re: Changing a list with the information of other

From Themis Matsoukas <tmatsoukas@me.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Changing a list with the information of other
Date 2013-07-03 22:05 +0000
Message-ID <kr2771$8uq$1@smc.vnet.net> (permalink)
Organization Time-Warner Telecom

Show all headers | View raw


Here is one way:

a = {{0, 1}, {1, w}, {2, 1 + w}, {3, 1 + 2 w}, {4, 2}, {5, 2 w}, {6, 
    2 + 2 w}, {7, 2 + w}};
b = {1, 1 + w, 2 + w, 2 w, 2, 2 + 2 w, 1 + 2 w, w};

Apply[#1 &, 
 Flatten[Table[Select[a, #[[2]] == b[[i]] &, 2], {i, 1, b // Length}],
   1], 1]

{0, 2, 7, 5, 4, 6, 3, 1}

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Changing a list with the information of other Themis Matsoukas <tmatsoukas@me.com> - 2013-07-03 22:05 +0000

csiph-web