From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/elisp/vectors.html | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 devdocs/elisp/vectors.html (limited to 'devdocs/elisp/vectors.html') diff --git a/devdocs/elisp/vectors.html b/devdocs/elisp/vectors.html new file mode 100644 index 00000000..c1c2653f --- /dev/null +++ b/devdocs/elisp/vectors.html @@ -0,0 +1,13 @@ +

Vectors

A vector is a general-purpose array whose elements can be any Lisp objects. (By contrast, the elements of a string can only be characters. See Strings and Characters.) Vectors are used in Emacs for many purposes: as key sequences (see Key Sequences), as symbol-lookup tables (see Creating Symbols), as part of the representation of a byte-compiled function (see Byte Compilation), and more.

Like other arrays, vectors use zero-origin indexing: the first element has index 0.

Vectors are printed with square brackets surrounding the elements. Thus, a vector whose elements are the symbols a, b and a is printed as [a b a]. You can write vectors in the same way in Lisp input.

A vector, like a string or a number, is considered a constant for evaluation: the result of evaluating it is the same vector. This does not evaluate or even examine the elements of the vector. See Self-Evaluating Forms. Vectors written with square brackets should not be modified via aset or other destructive operations. See Mutability.

Here are examples illustrating these principles:

(setq avector [1 two '(three) "four" [five]])
+     ⇒ [1 two '(three) "four" [five]]
+(eval avector)
+     ⇒ [1 two '(three) "four" [five]]
+(eq avector (eval avector))
+     ⇒ t
+
+
+

+ Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc.
Licensed under the GNU GPL license.
+ https://www.gnu.org/software/emacs/manual/html_node/elisp/Vectors.html +

+
-- cgit v1.2.3