TakeList
TakeList[list,{n1,n2,…}]
gives the list of results obtained by successively taking ni elements from list.
TakeList[list,{seq1,seq2,…}]
successively uses the sequence specifications seqi.
TakeList[list,seqs1,seqs2,…]
gives a nested list in which elements specified by the lists seqsi are taken at level i in list.
Examples
open allclose allBasic Examples (5)
Scope (2)
Properties & Relations (5)
TakeList[list,seqs] is equivalent to FoldPairList[TakeDrop,list,seqs]:
TakeList[list,{n,…,n}] is equivalent to Partition[list,n] for an appropriate number of take specifications:
The equivalent of Partition[list,UpTo[n]] may require an additional take specification:
Subdivide a list in sublists of different lengths using TakeList:
The original list can be reconstructed using Flatten:
Subdivide an array in blocks of different sizes using TakeList:
The original matrix can be reconstructed with ArrayFlatten:
Take a list of expressions with the same head and any lengths:
Join those expressions into a single expression with the common head:
The original list can be reconstructed with TakeList by giving the lengths of the subexpressions:
Text
Wolfram Research (2017), TakeList, Wolfram Language function, https://reference.wolfram.com/language/ref/TakeList.html.
CMS
Wolfram Language. 2017. "TakeList." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/TakeList.html.
APA
Wolfram Language. (2017). TakeList. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TakeList.html