Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: more looping trouble

  • To: mathgroup at smc.vnet.net
  • Subject: [mg85500] Re: more looping trouble
  • From: Albert Retey <awnl at arcor.net>
  • Date: Wed, 13 Feb 2008 04:05:57 -0500 (EST)
  • References: <fomjsd$hsj$1@smc.vnet.net>

Hi,

> 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.

for many many cases you won't even need a Map or other constructs when 
learning that many functions in Mathematica work to various levels in 
nested lists, here I think the following will not only be very simple 
and easy to read but also quite efficient:

lst = {{1, 2, 3}, {a, b, c}, {x, y, z}};

Take[lst, All, 2]

hth,

albert


  • Prev by Date: Re: Graph with different edge thicknesses
  • Next by Date: FindMaximum query
  • Previous by thread: Re: more looping trouble
  • Next by thread: NDSolve and Parametric Plot