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

Backquote

Backquote constructs allow you to quote a list, but selectively evaluate elements of that list. In the simplest case, it is identical to the special form quote (described in the previous section; see Quoting). For example, these two forms yield identical results:

`(a list of (+ 2 3) elements)
+     ⇒ (a list of (+ 2 3) elements)
+
+
'(a list of (+ 2 3) elements)
+     ⇒ (a list of (+ 2 3) elements)
+
+

The special marker ‘,’ inside of the argument to backquote indicates a value that isn’t constant. The Emacs Lisp evaluator evaluates the argument of ‘,’, and puts the value in the list structure:

`(a list of ,(+ 2 3) elements)
+     ⇒ (a list of 5 elements)
+
+

Substitution with ‘,’ is allowed at deeper levels of the list structure also. For example:

`(1 2 (3 ,(+ 4 5)))
+     ⇒ (1 2 (3 9))
+
+

You can also splice an evaluated value into the resulting list, using the special marker ‘,@’. The elements of the spliced list become elements at the same level as the other elements of the resulting list. The equivalent code without using ‘`’ is often unreadable. Here are some examples:

(setq some-list '(2 3))
+     ⇒ (2 3)
+
+
(cons 1 (append some-list '(4) some-list))
+     ⇒ (1 2 3 4 2 3)
+
+
`(1 ,@some-list 4 ,@some-list)
+     ⇒ (1 2 3 4 2 3)
+
+ +
(setq list '(hack foo bar))
+     ⇒ (hack foo bar)
+
+
(cons 'use
+  (cons 'the
+    (cons 'words (append (cdr list) '(as elements)))))
+     ⇒ (use the words foo bar as elements)
+
+
`(use the words ,@(cdr list) as elements)
+     ⇒ (use the words foo bar as elements)
+
+

If a subexpression of a backquote construct has no substitutions or splices, it acts like quote in that it yields conses, vectors and strings that might be shared and should not be modified. See Self-Evaluating Forms.

+

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

+
-- cgit v1.2.3