WolframLang: Delete Element in List
Delete by Index Range
Drop[ expr, n]
-
- Delete n items from beginning.
- If n is negative, delete from end.
Drop[ {1, 2, 3, 4, 5}, 2 ] === {3, 4, 5} Drop[ {1, 2, 3, 4, 5}, -2 ] === {1, 2, 3}
Drop[ expr, {n}]
-
delete nth item.
Drop[ {1, 2, 3, 4, 5}, {3} ] === {1, 2, 4, 5}
Drop[ expr, {m, n}]
-
delete mth to nth.
Drop[ {1, 2, 3, 4, 5}, {2,4} ] === {1, 5}
Delete by Position
Delete[expr, n]
-
if n is a integer, same as
Delete[expr, {n}]
x = {a, {{b, c}, d}, e}; Delete[ x, 1 ] === {{{b, c}, d}, e} Delete[ x, {1} ] === {{{b, c}, d}, e} Delete[ x, {{1}} ] === {{{b, c}, d}, e}
Delete[expr, {pos1, pos2, pos3, etc}]
-
Delete a list of items by Position
x = {a, {{b, c}, d}, e}; Delete[ x, {{1}} ] === {{{b, c}, d}, e} Delete[ x, {{2}} ] === {a, e} Delete[ x, {{1}, {2}} ] === {e} Delete[ x, {{2, 1}} ] === {a, {d}, e} Delete[ x, {{2, 1, 1}} ] === {a, {{c}, d}, e}
Delete by a Filtering Function
Select
Cases
DeleteCases
Delete Duplicates
DeleteDuplicates[expr]
-
Delete duplicates
DeleteDuplicates[ {3, x, 3, x, 4 } ] === {3, x, 4}
WolframLang List Operations
- WolframLang: List Operations
- WolframLang: Get Parts of List
- WolframLang: Add Element to List
- WolframLang: Delete Element in List
- WolframLang: Change Element in List
- WolframLang: Check Item Exist in List
- WolframLang: Filter List
- WolframLang: Sort, Reverse, Order
- WolframLang: List Reshape (split, group, flatten, transpose)
- WolframLang: List Combinatorics
- WolframLang: List Join, Union, Intersection, Difference