Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: Iterate through a list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg76914] Re: Iterate through a list
  • From: chuck009 <dmilioto at comcast.com>
  • Date: Wed, 30 May 2007 05:12:51 -0400 (EDT)

Suppose your list is newlist.  The following code is shorthand for "map the pure function defined by #[[1]] to each element of the list.  Since each element of the list is a sublist, the mapping function is taking the first item in each sublist. Check out the Map command.    

newlist = #[[1]] & /@ list

or:

newlist=Map[First,newlist]


  • Prev by Date: Re: Polynomial to List
  • Next by Date: LogLinearListPlot
  • Previous by thread: Re: upcoming book for Mathematica 6!
  • Next by thread: Re: Iterate through a list