A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.gnu.org/software/emacs/manual/html_node/elisp/Arrays.html below:

Arrays (GNU Emacs Lisp Reference Manual)

Next: Functions that Operate on Arrays, Previous: Sequences, Up: Sequences, Arrays, and Vectors   [Contents][Index]

6.2 Arrays

An array object has slots that hold a number of other Lisp objects, called the elements of the array. Any element of an array may be accessed in constant time. In contrast, the time to access an element of a list is proportional to the position of that element in the list.

Emacs defines four types of array, all one-dimensional: strings (see String Type), vectors (see Vector Type), bool-vectors (see Bool-Vector Type), and char-tables (see Char-Table Type). Vectors and char-tables can hold elements of any type, but strings can only hold characters, and bool-vectors can only hold t and nil.

All four kinds of array share these characteristics:

When you create an array, other than a char-table, you must specify its length. You cannot specify the length of a char-table, because that is determined by the range of character codes.

In principle, if you want an array of text characters, you could use either a string or a vector. In practice, we always choose strings for such applications, for four reasons:

By contrast, for an array of keyboard input characters (such as a key sequence), a vector may be necessary, because many keyboard input characters are outside the range that will fit in a string. See Key Sequence Input.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4