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]