Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

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

Search the Archive

Re: List Manipulation



In article <69nbfq$89h@smc.vnet.net>, Paul.Hanson@colorado.edu wrote:

> Hola!
>   Hope you're all doing well.  If I have a list of n lists, and want to
> get rid of all the even ones how would I go about doing  this?  That
> is, {{n1},{n2},.....{2n}} converted to {{n1},{n3}...{2n-1}}. I tried
> using the various procedures in Wolfram's book, but nothing seems to
> work (ie, Delete, Take, etc.).  Thanks for the help.
> 
> Paul Hanson
> 
> -- 
>                                  * * 
>                                 *    *
>                            /\    */\*
>                           /  \   /  \ /\


Here is an example of a solution built up in stages

In[1]:=
temp={{n1},{n2},{n3},{n4}}

Out[1]=
{{n1},{n2},{n3},{n4}}

In[2]:=
Partition[temp,2]

Out[2]=
{{{n1},{n2}},{{n3},{n4}}}

In[3]:=
Transpose[Partition[temp,2]]

Out[3]=
{{{n1},{n3}},{{n2},{n4}}}

In[4]:=
Transpose[Partition[temp,2]][[1]]

Out[4]=
{{n1},{n3}}

-- 
David Reiss
dreissNOSPAM@nospam.earthlink.net
http://home.earthlink.net/~dreiss
To send personal email, remove the words  "nospam" and "NOSPAM" from the
email address



  • Prev by Date: Re: Is there a 3.01 student version?
  • Next by Date: iterative function query
  • Prev by thread: Re: List Manipulation
  • Next by thread: Re: List Manipulation