(syntax datum) #'datum
(quasisyntax <template>) #`<template>
unsyntax #,<template>
unsyntax-splicing #,@<template>
The quasisyntax form is similar to syntax, but it allows parts of the quoted text to be evaluated, in a
manner similar to the operation of quasiquoted.
Within a quasisyntax template, subforms of unsyntax and unsyntax-splicing forms are evaluated, and every-
thing else is treated as ordinary template material, as with "syntax". The value of each unsyntax subform is
inserted into the output in place of the unsyntax form, while the value of each unsyntax-splicing subform is
spliced into the surrounding list or vector structure. Uses of unsyntax and unsyntax-splicing are vaild only
within quasisyntax expressions.
A quasisyntax expression may be nested, with each quasisyntax introducing a new level of syntax quotation
and each unsyntax or unsyntax-splicing taking away a level of quotation. An expression nested within n quasi-
syntax expressions must be within n unsyntax or unsyntax-splicing expressions to be evaluated.
Use of unsyntax and unsyntax-splicing with zero or more than one subform are vaild only in splicing (list or
vector) contexts. (unsyntax template ...) is equivalent to (unsyntax template) ..., and (unsyntax-splicing
template ...) is equivalent to (unsyntax-splicing template) ... . These forms are primarily useful as intermediate forms in the output of the quasisyntax expander.
(quasisyntax <template>) #`<template>
unsyntax #,<template>
unsyntax-splicing #,@<template>
The quasisyntax form is similar to syntax, but it allows parts of the quoted text to be evaluated, in a
manner similar to the operation of quasiquoted.
Within a quasisyntax template, subforms of unsyntax and unsyntax-splicing forms are evaluated, and every-
thing else is treated as ordinary template material, as with "syntax". The value of each unsyntax subform is
inserted into the output in place of the unsyntax form, while the value of each unsyntax-splicing subform is
spliced into the surrounding list or vector structure. Uses of unsyntax and unsyntax-splicing are vaild only
within quasisyntax expressions.
A quasisyntax expression may be nested, with each quasisyntax introducing a new level of syntax quotation
and each unsyntax or unsyntax-splicing taking away a level of quotation. An expression nested within n quasi-
syntax expressions must be within n unsyntax or unsyntax-splicing expressions to be evaluated.
Use of unsyntax and unsyntax-splicing with zero or more than one subform are vaild only in splicing (list or
vector) contexts. (unsyntax template ...) is equivalent to (unsyntax template) ..., and (unsyntax-splicing
template ...) is equivalent to (unsyntax-splicing template) ... . These forms are primarily useful as intermediate forms in the output of the quasisyntax expander.
本文详细解析了宏引号(syntaxdatum)、准引号(quasisyntax)及其相关形式unsyntax和unsyntax-splicing的功能与用法。通过这些形式可以在模板中插入计算结果,同时保持大部分模板内容不变。
364

被折叠的 条评论
为什么被折叠?



