Re: help with simple data transform
- To: mathgroup at smc.vnet.net
- Subject: [mg37752] Re: help with simple data transform
- From: lalu_bhatt at yahoo.com (Bhuvanesh)
- Date: Mon, 11 Nov 2002 05:10:15 -0500 (EST)
- References: <aqld8o$bie$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Terrell Mitchell <usenet at twocedars.mailshell.com> wrote:
> I can read this into lists and end up with
> {n,n,n,n},{n,n,n,n,n,n},{n,n,n,n,n},{n,n}
> I need to turn this into
> {n,{n,n,n}},{n,{n,n,n,n,n}},{n,{n,n,n,n}},{n,{n}}
> to use as the triangulation data.
How about...
In[1]:= tmp = {{n,n,n,n},{n,n,n,n,n,n},{n,n,n,n,n},{n,n}};
In[2]:= Map[{First[#], Rest[#]}&, tmp]
Out[2]= {{n, {n, n, n}}, {n, {n, n, n, n, n}}, {n, {n, n, n, n}}, {n, {n}}}
--
Bhuvanesh,
Wolfram Research.