Elisp: Sequence Type

By Xah Lee. Date: . Last updated: .

Here's a 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 of array type. They are more specialized.)

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

When a function's doc says that an argument is a sequence type, it means that it can be list, vector, or string. (e.g. mapcar)

When a function's doc says an argument is a array type, it means that it can be vector, or string. (e.g. aref)

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, accessing 900th item is slow.

Vector has fixed length. Accessing any element is fast.

Reference

(info "(elisp) Sequences Arrays Vectors")

If you have a question, put $5 at patreon and message me on xah discord.
Or support me by Buy Xah Emacs Tutorial

Emacs Tutorial

Emacs Init

Emacs Keys

ELisp

ELisp Examples

ELisp Write Major Mode


ELisp

Basics

Basic Functions

Writing Command

Writing Script

Lisp Data Structure

Lisp Symbol

Elisp Misc