List


是一个元素列表.

更多信息更多信息

  • 列表是代表表达式集合的非常一般的对象.
  • 有属性 Listable 的函数自动线性作用于列表,使得它们分别对每个列表元素作用. 大多数内置数学函数都是Listable.
  • 表示一个向量.
  • 表示一个矩阵.
  • 嵌套列表可用于表示张量.

背景
背景

  • 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 builtin 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.
1988年引入
(1.0)