Common Lisp Double-Backquote, Unquote, Quote, Unquote sequence?

后端 未结 2 703
悲哀的现实
悲哀的现实 2021-02-01 20:04

I\'m reading Let Over Lambda, which deals with some pretty deeply layered macro authoring. It\'s fascinating and I\'m mostly managing to keep up with it.

In Chapter 4 Ho

2条回答
  •  闹比i
    闹比i (楼主)
    2021-02-01 20:43

    The ,',X trick is used to shield the X from another evaluation.

    See how:

         (setq a 'fn)
         (let ((x 'a)) ``(,,x ,',x)) ==>  `(,a a) ==> (fn a)
    
         ;; ``,',X ==> `,(quote "the value of X") ==> "the value of X"
    
         ;; ``,,X  ==> `,"the value of X" ==> "the value of the value of X"
    

提交回复
热议问题