Re: List Manipulation
- To: mathgroup@smc.vnet.net
- Subject: [mg10494] Re: List Manipulation
- From: "Stephen P Luttrell" <luttrell@signal.dra.hmg.gb>
- Date: Tue, 20 Jan 1998 02:22:44 -0500
- Organization: Defence Evaluation and Research Agency
- References: <69nbfq$89h@smc.vnet.net>
> 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.
Try this example
a=Table[i+j,{i,4},{j,2}]
b=Partition[a,2]
c=Map[#[[1]]&,b]
which gives the required output
{{2,3},{3,4},{4,5},{5,6}}
{{{2,3},{3,4}},{{4,5},{5,6}}}
{{2,3},{4,5}}
=======================================================
Stephen P Luttrell
luttrell@signal.dra.hmg.gb
Adaptive Systems Theory 01684-894046 (phone)
Room EX21, DERA 01684-894384 (fax)
Malvern, Worcs, WR14 3PS, U.K.
http://www.dra.hmg.gb/cis5pip/Welcome.html