MathGroup Archive 1999

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

Search the Archive

Re: Partitioning lists


> I would like a function f to split a list as follows
> 
> a={1,2,3,4,5,6}
> f[a] =
>   {
>     {{1},{2,3,4,5,6}},
>     {{1,2},{3,4,5,6}},
>     {{1,2,3},{4,5,6}},
>     {{1,2,3,4},{5,6}},
>     {{1,2,3,4,5},{6}}
>   }

In[18]:=
t1=Table[Range[k], {k,1,5}];

t2=Table[Range[k,6],{k,2,6}];

Transpose[{t1, t2}]

Out[18]=
{{{1},{2,3,4,5,6}},{{1,2},{3,4,5,6}},{{1,2,3},{4,5,6}},{{1,2,3,4},{5,6}},{{1,
      2,3,4,5},{6}}}



  • Prev by Date: Re: Zeta Function
  • Next by Date: Re: Zeta Function
  • Previous by thread: Re: Partitioning lists
  • Next by thread: rotation matrix to Yaw-Pitch-Roll angles