MathGroup Archive 2005

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

Search the Archive

Re: A NewBie Question


Why not this way :
In[1]:=
takeParts[myList_List, sizes_List]:=
With[{r = Rest@FoldList[Plus,0,sizes]},
Take[myList,#]& /@ Transpose[{r-sizes+1,r}]]

In[2]:=
takeParts[{a,b,c,d,e,f,g,h,i},{2,3,4}]
Out[2]=
{{a,b},{c,d,e},{f,g,h,i}}


hth

V.A.


  • Prev by Date: Re: cubic quarternion group
  • Next by Date: Problem with Fonts
  • Previous by thread: Re: A NewBie Question
  • Next by thread: Re: A NewBie Question