MathGroup Archive 1999

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

Search the Archive

Re: Partitioning lists

  • To: mathgroup at smc.vnet.net
  • Subject: [mg20585] Re: [mg20439] Partitioning lists
  • From: Arnold Seiken <seikena at union.edu>
  • Date: Sat, 30 Oct 1999 14:54:57 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

> 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