Drop¶
Status: Stable
documented, exercised by the test suite and/or worked examples, with no known limitations recorded.
Description¶
Drop[list, n]
gives list with its first n elements dropped.
Drop[list, -n]
drops the last n elements.
Drop[list, {m, n}]
drops elements m through n.
Drop[list, {m, n, s}]
drops elements m through n in steps of s.
Drop[list, {m}]
drops the single element at position m.
Drop[list, spec1, spec2, ...]
drops elements at successive levels.
Negative indices count from the end; UpTo[n], All, and None are also accepted.
Indices are 1-based; out-of-range requests leave the expression unevaluated.
Examples¶
No verified examples yet for this function.
Implementation notes¶
Attributes: NHoldRest, Protected.
Implementation status¶
Stable — documented, exercised by the test suite and/or worked examples, with no known limitations recorded.
References¶
- Source:
src/info.c - Specification:
docs/spec/builtins/structural-manipulation.md
Notes & additional examples¶
Worked examples¶
Notes¶
Drop is the complement of Take. A plain count drops from the front
(Drop[list, n]) or, with a negative count, from the back. The {m, n} form
drops a contiguous block, {m, n, s} drops a strided slice, and {m} drops a
single element. Multiple level specifications drop along successive list
dimensions, so the {2}, {2} example deletes the second row and the second
column of a matrix in one call. Indices are 1-based and negative indices count
from the end; out-of-range requests leave the expression unevaluated.