MathGroup Archive 2006

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

Search the Archive

Re: Partition


On Nov 25, 2006, at 5:36 AM, 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.
>

list2=(Sequence@@{First[#],Rest[#]})&/@Partition[list,5]

Regards,

Ssezi


  • Prev by Date: disappearing cursor
  • Next by Date: Re: Partition
  • Previous by thread: Partition
  • Next by thread: Re: Partition