Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

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.


  • 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