Re: Lists

• To: mathgroup at smc.vnet.net
• Subject: [mg3994] Re: Lists
• From: ianc (Ian Collier)
• Date: Tue, 14 May 1996 02:13:30 -0400
• Organization: Wolfram Research, Inc.
• Sender: owner-wri-mathgroup at wolfram.com

```In article <4ms4eq\$3n0 at dragonfly.wolfram.com>, Alex Bates
<albates at ursula.uoregon.edu> wrote:

>         I have a two dimensional list (i.e. {{1, 23}, {2, 24}, {3, 25},
> {4, 26}}), and I want to remove all the first values in each pair of
> numbers.  For instance, for the first pair, I want it to read {23}, and
> for the second, {24} instead of {2, 24}.
>         Any help would be greatly appreciated.
>
> -Alex Bates

One method is to use Transpose and Part:

In[1]:=
mylist = {{1, 23}, {2, 24}, {3, 25}, {4, 26}}
Out[1]=
{{1, 23}, {2, 24}, {3, 25}, {4, 26}}

In[2]:=
mynewlist = Transpose[ mylist ][[2]]
Out[2]=
{23, 24, 25, 26}

I hope this helps.

--Ian

-----------------------------------------------------------
Ian Collier
Wolfram Research, Inc.
-----------------------------------------------------------
tel:(217) 398-0700   fax:(217) 398-0747    ianc at wolfram.com