ELisp: Sequence, Array

By Xah Lee. Date: . Last updated: .

What is Sequence Type

Here's a hierachy chart of elisp's most important list-like datatypes.

emas lisp sequence type
Most commonly used list-like data structure in elisp. (note: there's also char-table and bool-vector datatypes, which are sub-types of vector. They are more specialized.)

Note: “Sequence” and “Array” are not actual datatypes in elisp. They are grouping names for other actual datatypes.

List and Vector both hold a ordered sequence of values, each value can be any type.

Differences Between List and Vector

Here's the primary differences between List and Vector:

In short, list can grow or shorten, but if you have a long list, say 1 thousand items, getting the value of 900th item is slow.

Vector has fixed length. Getting the value of any element is fast.

Emacs Lisp, Functions on Sequence

Lisp Data Structure