Re: more looping trouble

• To: mathgroup at smc.vnet.net
• Subject: [mg85447] Re: [mg85436] more looping trouble
• From: Bob Hanlon <hanlonr at cox.net>
• Date: Mon, 11 Feb 2008 06:04:22 -0500 (EST)

```data = {{1, 2, 3}, {2, 3, 4}, {3, 4, 5}};

Most /@ data

{{1, 2}, {2, 3}, {3, 4}}

data[[All, {1, 2}]]

{{1, 2}, {2, 3}, {3, 4}}

Part[#, {1, 2}] & /@ data

{{1, 2}, {2, 3}, {3, 4}}

Delete[#, -1] & /@ data

{{1, 2}, {2, 3}, {3, 4}}

Take[#, 2] & /@ data

{{1, 2}, {2, 3}, {3, 4}}

Last /@ data

{3,4,5}

data[[All, 3]]

{3,4,5}

Part[#, 3] & /@ data

{3,4,5}

Drop[#, 2] & /@ data

{{3}, {4}, {5}}

Take[#, -1] & /@ data

{{3}, {4}, {5}}

Delete[#, {{1}, {2}}] & /@ data

{{3}, {4}, {5}}

Bob Hanlon

---- Francis Bitonti <frankb.mail at gmail.com> wrote:
> Sorry for these lame questions but I'm still trying to get my head around
> loops. I though I had it but I hit a snag today.
>
> I have a table of numbers {{1,2,3},{2,3,4}} I want to use a loop to remove
> the third integer in each set and reassemble them as a new table.
> However, something is going wrong I think it's because i'm not grasping some
> fundamental idea about how to perform these type of operations on tables.
>
> CLICK THIS LINK TO VIEW MY NOTEBOOK IN HTML FORMAT
>
>
>
>
>
> --
>
> _Francis Bitonti