WolframLang: List
List is the most fundamental data structure of WolframLang.
(* FullForm syntax *) List[ 3, 4, 5 ] (* a list. shortcut notation *) {3, 4, 5}
List can nest in any way.
{3, 4, {1,2}, 5}
Length
Length[expr]
- return the length of expression. Length
Length[ {3, 4, 5} ] === 3
List Represents Array, Tree, Math Vector/Matrix
A vector (math linear algebra) is reprented by a list. e.g. {a,b,c}
is a 3-dimensional vector.
A math matrix is reprented by nested list. e.g. a 2 by 3 matrix:
{
{a,b,c},
{1,2,3}
}
where
{a,b,c}
is first row.{1,2,3}
is second row.
A tree data structure is a nested list.
e.g. { { {a, b }, m }, {1, 2 } }
TreeForm[ { {{a,b},m}, {1,2} } ]
