TakeDrop
TakeDrop[list,n]
gives the pair {list1,list2}, where list1 contains the first n elements of list and list2 contains the rest.
Details
- TakeDrop uses the standard sequence specification:
-
All all elements None no elements n elements 1 through n UpTo[n] elements 1 up to at most n, as available -n last n elements {n} element n only {m,n} elements m through n inclusive {m,n,s} elements m through n in steps of s - TakeDrop can be used on an object with any head, not necessarily List.
- Applying TakeDrop to a SparseArray object normally yields a pair of SparseArray objects.
- Applying TakeDrop to an Association object yields a pair of Association objects containing elements from the specified positions.
Examples
open allclose allScope (5)
Wolfram Research (2015), TakeDrop, Wolfram Language function, https://reference.wolfram.com/language/ref/TakeDrop.html (updated 2015).
Text
Wolfram Research (2015), TakeDrop, Wolfram Language function, https://reference.wolfram.com/language/ref/TakeDrop.html (updated 2015).
CMS
Wolfram Language. 2015. "TakeDrop." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/TakeDrop.html.
APA
Wolfram Language. (2015). TakeDrop. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TakeDrop.html