Re: Partition
- To: mathgroup at smc.vnet.net
- Subject: [mg71663] Re: Partition
- From: "dimitris" <dimmechan at yahoo.com>
- Date: Sun, 26 Nov 2006 03:48:44 -0500 (EST)
- References: <ek975q$fjq$1@smc.vnet.net>
Something like? lst = ToExpression[CharacterRange["a", "o"]] Partition[lst, 5] Flatten[({First[#1], Rest[#1]} & ) /@ %, 1] {a, b, c, d, e, f, g, h, i, j, k, l, m, n, o} {{a, b, c, d, e}, {f, g, h, i, j}, {k, l, m, n, o}} {a, {b, c, d, e}, f, {g, h, i, j}, k, {l, m, n, o}} KFUPM wrote: > Dear All > > I have a very large list of numbers that look like this: ( although the > size is different) > > list={a,b,c,d,e,f,g,h,i,j,k,l,m,n,o} > > And i need to rewrite the list into > > list2={a,{b,c,d,e},f,{g,h,i,j,},k,{l,m,n,o}} > > Since my list is too big, i need Mathematica to do it for me regardless > of the site of the list. > > I would appreciate it if you can help me in this regard, > > Thanks > > KFUPM