Re: A NewBie Question
- To: mathgroup at smc.vnet.net
- Subject: [mg53607] Re: A NewBie Question
- From: "Astanoff" <astanoff at yahoo.fr>
- Date: Thu, 20 Jan 2005 03:47:47 -0500 (EST)
- References: <csl14p$6s5$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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.