MathGroup Archive 2007

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

Search the Archive

Re: Iterate through a list


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