Back to index A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Other

Alphabetic catalog of Language elements Q

quasiquote

quasiquote builds (almost) constant objects.

Category Special form
Format
(quasiquote template)
`template
Parameters
template any object, most usually a list or a vector
Description quasiquote returns template unevaluated, if it doesn't contain any of the special forms unquote or unquote-splicing.

If a comma (called an unquote expression) appears within template, the expression following it is evaluated and the result is inserted into the template instead of the unquote expression.

If an at-sign immediately follows the comma (called an unquote-splicing expression) the expression must evaluate to a list and its elements are inserted into the template instead of the unquote-splicing expression.

quasiquote forms can be nested. Substitutions are made only for unquoted expressions at the same nesting level of the outermost quasiquote. The nesting level increases in each quasiquote and decreases in each unquotation.

In contrast to quote, the structure returned is always newly allocated.

quasiquote may be abbreviated with a back apostrophe `. The Graffiti stroke for this is "dot, stroke north-west and back".

R4RS Compliance Full
Examples
`(list ,(* 5 6) a b) => (list 30 a b)
`#(3 4 (,(sqrt 9) 5) ,@(reverse '(x y z)) foo) => #(3 4 (3 5) z y x foo)
`(a `(b ,(+ 1 2) ,(foo ,(+ 1 3) d) e) f) => (a (quasiquote (b (unquote (+ 1 2)) (unquote (foo 4 d)) e)) f)

quote

quote returns its unevaluated argument.

Category Special form
Format
(quote obj)
'obj
Parameters
obj any object
Description quote returns obj unevaluated. Use quote to imbed constants in your code. quote may be abbreviated with a single apostrophe '
R4RS Compliance Full
Examples
(quote (a b c)) => (a b c)
'(a b c) => (a b c)
''(a b c) => (quote (a b c))

quotient

quotient divides two integers ignoring the remainder.

Category Primitive procedure
Format (quotient int1 int2)
Parameters
int1an integer
int2an integer
Description quotient divides two integer numbers truncating the result to an integer. Division by zero is an error.
R4RS Compliance Full
Examples
(quotient 7 3) => 2
(quotient -5 4) => -1
(quotient 1000000000000 13) => 76923076923
(quotient 3 0) => error

Back to index A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Other