1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 03:30:27 +02:00

doc: Add unquote and unquote-splicing examples.

Suggested by Vincent Legoll <vincent.legoll@gmail.com>.

* doc/ref/api-evaluation.texi (Expression Syntax): Add an unquote and an
unquote-splicing example.
This commit is contained in:
Ludovic Courtès 2016-07-22 16:39:12 +02:00 committed by Andy Wingo
parent 0cf155be72
commit ad7e806a9f

View file

@ -136,6 +136,7 @@ an expression to be evaluated and inserted. The comma syntax @code{,}
is simply a shorthand for an @code{unquote} form. For example,
@example
`(1 2 (* 9 9) 3 4) @result{} (1 2 (* 9 9) 3 4)
`(1 2 ,(* 9 9) 3 4) @result{} (1 2 81 3 4)
`(1 (unquote (+ 1 1)) 3) @result{} (1 2 3)
`#(1 ,(/ 12 2)) @result{} #(1 6)
@ -153,8 +154,9 @@ the returned list inserted. @var{expr} must evaluate to a list. The
@example
(define x '(2 3))
`(1 ,x 4) @result{} (1 (2 3) 4)
`(1 ,@@x 4) @result{} (1 2 3 4)
`(1 (unquote-splicing (map 1+ x))) @result{} (1 3 4)
`(1 (unquote-splicing (map 1+ x))) @result{} (1 3 4)
`#(9 ,@@x 9) @result{} #(9 2 3 9)
@end example