On quote

(list ,(+ 1 2) 4) =) (list 3 4)
(let ((name 'a)) (list ,name ',name))
=) (list a (quote a))
(a ,(+ 1 2) ,@(map abs '(4 -5 6)) b)
=) (a 3 4 5 6 b)
(( foo ,(- 10 3)) ,@(cdr '(c)) . ,(car '(cons)))
=) ((foo 7) . cons)
#(10 5 ,(sqrt 4) ,@(map sqrt '(16 9)) 8)

=) #(10 5 2 4 3 8)


Quasiquote forms may be nested. Substitutions are made
only for unquoted components appearing at the same nesting
level as the outermost backquote. The nesting level increases
by one inside each successive quasiquotation, and
decreases by one inside each unquotation.


(a (b ,(+ 1 2) ,(foo ,(+ 1 3) d) e) f)
=) (a (b ,(+ 1 2) ,(foo 4 d) e) f)
(let ((name1 'x)
(name2 'y))
(a (b ,,name1 ,',name2 d) e))
=) (a (b ,x ,'y d) e)
The two notations hqq templatei and (quasiquote
hqq templatei) are identical in all respects. ,hexpressioni
is identical to (unquote hexpressioni), and ,@hexpressioni
is identical to (unquote-splicing hexpressioni). The external
syntax generated by write for two-element lists
whose car is one of these symbols may vary between implementations.
(quasiquote (list (unquote (+ 1 2)) 4))
=) (list 3 4)
'(quasiquote (list (unquote (+ 1 2)) 4))
=) (list ,(+ 1 2) 4)
i.e., (quasiquote (list (unquote (+ 1 2)) 4))


Unpredictable behavior can result if any of the symbols
quasiquote, unquote, or unquote-splicing appear in positions
within a hqq templatei otherwise than as described
above.

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值