WolframLang: List

By Xah Lee. Date: . Last updated: .

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}

List

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 tree data structure is a nested list. e.g. { { {a, b }, m }, {1, 2 } }

TreeForm[ { {{a,b},m}, {1,2} } ]
WolframLang TreeForm 2022-07-06 hdYYw
WolframLang TreeForm 2022-07-06

List

WolframLang in Depth

Basics

Comment, Print

String

Arithmetic

List

Expression, Atom, Head

Boolean

Conditional

Variable

Loop

Data Structure

Function

Pattern Matching

Advanced

Shell Tasks

Misc