Drop
Drop[list, n] gives list with its first n elements dropped.
Drop[list, -n] gives list with its last n elements dropped.
Drop[list,
n
] gives list with its n
element dropped.
Drop[list,
m, n
] gives list with elements m through n dropped.
Drop[list,
m, n, s
] gives list with elements m through n in steps of s dropped.
Drop[list,
,
, ... ] gives a nested list in which elements specified by
have been dropped at level i in list.
Drop uses the standard sequence specification (see Section A.3.5).
Examples: Drop[
a,b,c,d,e
, 2]
.
Drop[
a,b,c,d,e
, -3]
.
Drop[Range[7],
2, 5, 2
]
.
Drop can be used on an object with any head, not necessarily List.
Drop[list,
,
] effectively drops all elements except those in a submatrix of list.
Example: Drop[
a,b,c
,
d,e,f
, 1, -1]
.
See The Mathematica Book on the web: Section 1.8.4.
See also: Rest, Take, Cases.
Further Examples