[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A question about macro bindings in cl-lib
From: |
Stephen Berman |
Subject: |
Re: A question about macro bindings in cl-lib |
Date: |
Wed, 24 Apr 2013 10:56:02 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
On Wed, 24 Apr 2013 16:17:42 +0800 Xue Fuqiao <xfq.free@gmail.com> wrote:
> In (info "(cl) Macro Bindings"):
>
> (cl-defmacro my-dolist ((x list) &rest body)
> (let ((var (cl-gensym)))
> (list 'cl-loop 'for var 'on list 'do
> (cl-list* 'cl-symbol-macrolet
> (list (list x (list 'car var)))
> body))))
> (setq mylist '(1 2 3 4))
> (my-dolist (x mylist) (cl-incf x))
> mylist
> => (2 3 4 5)
>
> The `my-dolist' call shown here expands to
>
> (cl-loop for G1234 on mylist do
> (cl-symbol-macrolet ((x (car G1234)))
> (cl-incf x)))
>
> I understand what this macro does, but what does "G1234" mean here?
Does the doc string of cl-gensym answer the question for you? If not,
can you make the question more specific?
Steve Berman