clojure 语法引用和取消引用
示例
来自标准库(core.clj:807)的示例:
(defmacro and
"Evaluates exprs one at a time, from left to right. If a form
returns logical false (nil or false), and returns that value and
doesn't evaluate any of the other expressions, otherwise it returns
the value of the last expr. (and) returns true."
{:added "1.0"}
([] true)
([x] x)
([x & next]
`(let [and# ~x]
(if and# (and ~@next) and#))))`所谓语法的报价是一样(quote)的,但递归的:它会导致(let…),(if…)等宏扩展过程中,但作为被输出到未评估
~akaunquote取消语法引用形式内单个形式的语法引用。因此,x在扩展宏时会输出的值(而不是输出x符号)
~@akaunquote-splicing就像unquote一样,但是使用list参数并将其扩展,每个列表项以单独的形式
#将唯一的ID附加到符号上,以防止名称冲突。它在语法引用的表达式内为同一符号附加相同的id,因此and#insidelet和and#insideif将获得相同的名称
热门推荐
1 训练狗狗憋尿
2 狗狗追踪训练
3 狗狗训练要多少钱
5 深圳狗狗训练
6 训练狗狗唤回
7 狗狗叫怎么训练
8 狗狗训练班
10 狗狗社会化训练
11 狗狗叫回训练
12 广州狗狗训练学校
13 狗狗训练躺下
14 狗狗随行训练
15 训练狗狗巡回
16 狗狗要怎么训练
17 狗狗喂食训练
18 训练狗狗躺下