[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Difficult macro question: Doing custom `let'
From: |
Jari Aalto+mail.emacs |
Subject: |
Difficult macro question: Doing custom `let' |
Date: |
Mon, 18 Aug 2003 20:43:00 +0300 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/20.7 (windows-nt) (i386-*-nt5.0.2195) |
I'm trying to make a custom `let' macro. The basic idea is that
the variables defined inside `let' should be user defined and
the `let' form simply should set them to nil. Something like:
(setq list '(a b c))
Something, a macro, that turns that into:
(let (a
b
b)
I've experimented with this:
(nconc
(list 'let)
(list
(mapcar
(function
(lambda (x)
(list x nil)))
list)))
--> (let ((a nil) (b nil) (c nil)))
Now the problem is, How Do I make a macro that does exactly that above?
The macro would be called inside function body:
(defun my-test ()
(my-let-transform list
(message "It worked.")))
Which should be after macroexpand:
(defun my-test ()
(let (a
b
b)
(message "It worked.")))
Now, how do I get there?
Jari
- Difficult macro question: Doing custom `let',
Jari Aalto+mail.emacs <=