Wolfram Language & System 11.0 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)

TakeDrop

TakeDrop[list,n]
gives the pair {list1,list2}, where list1 contains the first n elements of list and list2 contains the rest.

TakeDrop[list,seq]
gives the pair {Take[list,seq],Drop[list,seq]}.

DetailsDetails

  • TakeDrop uses the standard sequence specification:
  • Allall elements
    Noneno elements
    nelements 1 through n
    UpTo[n]elements 1 up to at most n, as available
    -nlast 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.
Introduced in 2015
(10.2)
| Updated in 2015
(10.3)