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将获得相同的名称
热门推荐
10 儿子立冬祝福语简短独特
11 对当兵的祝福语简短
12 侄儿高考试祝福语简短
13 伴郎红包祝福语朋友简短
14 媳妇生日简短祝福语朋友
15 公司年会祝福语简短最好
16 元旦感恩祝福语简短大全
17 红包祝福语简短10字
18 周六早晨祝福语简短