ELisp: List

By Xah Lee. Date: . Last updated: .

What is List

Emacs Lisp's list datatype is an ordered sequence of things. It is known as linked list data structure in computer science. It is an efficient datatype for stack data structure. (like a stack of books, allowing adding or removing one item at a time from the top in an efficient way.)

Any item can be of any type.

Algorithm properties of lisp list:

Note: List is made up of lower structure called cons cells. [see ELisp: Cons Pair]

Empty List, nil

In elisp, empty list is equivalent to nil. The following are all equivalent.

(eq '() (list ) ) ; t
(eq '() nil); t
(eq (list ) nil ) ; t

Length

length
(length SEQUENCE)

return count of elements.

(length '(3 4))
;; 2

Reference

Emacs Lisp List

Special Lists

List Structure

Lisp Data Structure