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/vector-functions.html | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 devdocs/elisp/vector-functions.html (limited to 'devdocs/elisp/vector-functions.html') diff --git a/devdocs/elisp/vector-functions.html b/devdocs/elisp/vector-functions.html new file mode 100644 index 00000000..a65f54d3 --- /dev/null +++ b/devdocs/elisp/vector-functions.html @@ -0,0 +1,47 @@ +

Functions for Vectors

Here are some functions that relate to vectors:

Function: vectorp object +
+

This function returns t if object is a vector.

(vectorp [a])
+     ⇒ t
+(vectorp "asdf")
+     ⇒ nil
+
+
+
Function: vector &rest objects +
+

This function creates and returns a vector whose elements are the arguments, objects.

(vector 'foo 23 [bar baz] "rats")
+     ⇒ [foo 23 [bar baz] "rats"]
+(vector)
+     ⇒ []
+
+
+
Function: make-vector length object +
+

This function returns a new vector consisting of length elements, each initialized to object.

(setq sleepy (make-vector 9 'Z))
+     ⇒ [Z Z Z Z Z Z Z Z Z]
+
+
+
Function: vconcat &rest sequences +
+

This function returns a new vector containing all the elements of sequences. The arguments sequences may be proper lists, vectors, strings or bool-vectors. If no sequences are given, the empty vector is returned.

The value is either the empty vector, or is a newly constructed nonempty vector that is not eq to any existing vector.

(setq a (vconcat '(A B C) '(D E F)))
+     ⇒ [A B C D E F]
+(eq a (vconcat a))
+     ⇒ nil
+
+
(vconcat)
+     ⇒ []
+(vconcat [A B C] "aa" '(foo (6 7)))
+     ⇒ [A B C 97 97 foo (6 7)]
+
+

The vconcat function also allows byte-code function objects as arguments. This is a special feature to make it easy to access the entire contents of a byte-code function object. See Byte-Code Objects.

For other concatenation functions, see mapconcat in Mapping Functions, concat in Creating Strings, and append in Building Lists.

+
+

The append function also provides a way to convert a vector into a list with the same elements:

(setq avector [1 two (quote (three)) "four" [five]])
+     ⇒ [1 two '(three) "four" [five]]
+(append avector nil)
+     ⇒ (1 two '(three) "four" [five])
+
+
+

+ 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/Vector-Functions.html +

+
-- cgit v1.2.3