Wolfram Language & System 10.3 (2015)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.
BUILT-IN WOLFRAM LANGUAGE SYMBOL

Take

Take[list,n]
gives the first n elements of list.

Take[list,-n]
gives the last n elements of list.

Take[list,{m,n}]
gives elements m through n of list.

Take[list,seq1,seq2,]
gives a nested list in which elements specified by are taken at level i in list.

DetailsDetails

• Take 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
• Take can be used on an object with any head, not necessarily List.
• Take[list,seq1,seq2] effectively extracts a submatrix from list.
• Applying Take to a SparseArray object normally yields another SparseArray object.
• Applying Take to an Association object yields an Association containing elements from the specified positions.

ExamplesExamplesopen allclose all

Basic Examples  (6)Basic Examples  (6)

Take the first 4 elements from a list:

 Out[1]=

Take the last 3 elements:

 Out[1]=

Take elements 2 through 4:

 Out[1]=

Take the second element from an Association:

 Out[1]=

Take all but the first element from an Association:

 Out[1]=

Take every other element from 2 to 6 from an Association:

 Out[1]=