Wolfram Language & System 10.4 (2016)|Legacy Documentation
This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)
is a list of elements.
- Lists are very general objects that represent collections of expressions.
- Functions with attribute Listable are automatically "threaded" over lists, so that they act separately on each list element. Most built‐in mathematical functions are Listable.
- represents a vector.
- represents a matrix.
- Nested lists can be used to represent tensors.
- If Nothing appears in a list, it is automatically removed.
- List is a very general construct used to represent collections of expressions. Lists may have any length or depth. The expression List[a,b,c,…] is commonly written and displayed using the shorthand syntax . Lists are particularly important in the Wolfram Language, which does not define explicit vector, matrix, tensor, etc. objects but rather uses (possibly nested) lists to represent such structures. For example, can represent a vector, a matrix, and so on.
- Functions with attribute Listable are automatically “threaded” over lists, meaning they act separately on each list element. Most built‐in mathematical functions are Listable.
- Apply replaces the head of a List (or any other expression) with a new head, while Map applies a function to elements on the first level of a List (or any other expression).
- SparseArray may be used to efficiently represent and compute with lists (or nested lists) that have a constant (often ) “background” value. A SparseArray can be expanded to a full-dimensional List using Normal.
- Values of a list can be efficiently modified in place using Set, e.g. . Common operations to access, insert, or delete elements of a list include Part, Take, Drop, Extract, Insert, Delete, PadLeft/PadRight, Append/AppendTo, and Prepend/PrependTo.
- A flat list of values (i.e. a vector) may be plotted using ListPlot, and an array of values given by a rectangular list of lists may be plotted using ArrayPlot, MatrixPlot, ListDensityPlot, or related functions. Other important and useful functions commonly applied to lists include Total, Accumulate, Mean, and ListConvolve.
- Association provides a generalization of symbolically indexed lists, associative arrays, dictionaries, hashmaps, structs, and a variety of other powerful data structures. An Association is so named because it associates keys with values, allowing highly efficient lookup and updating even with millions of elements.
- A list can be converted to a sequence of expressions by applying Sequence to it. This can be particularly useful since functions in the Wolfram Language often take a flat sequence of arguments instead of an argument list, so use of Sequence allows list-represented data to be easily spliced into other functions.
Introduced in 1988