1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-16 16:50:21 +02:00

Implemented real quotation (added support for backquotation).

* module/language/elisp/README: Document that.
* module/language/elisp/compile-tree-il.scm: Implement backquote.
* test-suite/tests/elisp-compiler.test: Test quotation and backquotes.
This commit is contained in:
Daniel Kraft 2009-07-18 17:32:59 +02:00
parent e905e490fa
commit 9b5ff6a6e1
3 changed files with 98 additions and 1 deletions

View file

@ -211,6 +211,34 @@
(zerop a)))))
; Quoting and Backquotation.
; ==========================
(with-test-prefix/compile "Quotation"
(pass-if "quote"
(and (equal '42 42) (equal '"abc" "abc")
(equal '(1 2 (3 (4) x)) '(1 2 (3 (4) x)))
(not (equal '(1 2 (3 4 (x))) '(1 2 3 4 x)))
(equal '(1 2 . 3) '(1 2 . 3))))
(pass-if "simple backquote"
(and (equal (\` 42) 42)
(equal (\` (1 (a))) '(1 (a)))
(equal (\` (1 . 2)) '(1 . 2))))
(pass-if "unquote"
(progn (setq a 42 l '(18 12))
(and (equal (\` (\, a)) 42)
(equal (\` (1 a ((\, l)) . (\, a))) '(1 a ((18 12)) . 42)))))
(pass-if "unquote splicing"
(progn (setq l '(18 12) empty '())
(and (equal (\` (\,@ l)) '(18 12))
(equal (\` (l 2 (3 (\,@ l)) ((\,@ l)) (\,@ l)))
'(l 2 (3 18 12) (18 12) 18 12))
(equal (\` (1 2 (\,@ empty) 3)) '(1 2 3))))))
; Macros.
; =======