[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ask for the value of several variables at once
From: |
John Mastro |
Subject: |
Re: ask for the value of several variables at once |
Date: |
Sat, 17 Mar 2018 13:59:40 -0700 |
Emanuel Berg <moasen@zoho.com> wrote:
> But as I've said, I'm not good with macros, and
> it shows, because as much as this seems to work
> when eval'd and executed, the byte compiler
> doesn't like it:
>
> geh.el:24:1:Error: Symbol's function definition
> is void: syms-status
>
> (defun syms-status (&rest sym-list)
> (mapcar (lambda (s) (list s (symbol-value s))) sym-list))
>
> (defmacro vars-status (&rest sym-list)
> `(quote ,(apply #'syms-status sym-list)))
> ;; (setq foo 22 bar 88)
> ;; (vars-status foo bar)
I think what you really want for vars-status is:
(defmacro vars-status (&rest sym-list)
`(apply #'syms-status ',sym-list))
Or, equivalently (if the quasiquote syntax makes it harder to see what's
going on):
(defmacro vars-status (&rest sym-list)
(list 'apply '(function syms-status) (list 'quote sym-list)))
The difference is that your implementation above will call syms-status
at macro-expansion time, whereas this will call it at run-time.
John
- Re: ask for the value of several variables at once, (continued)
- Message not available
- Re: ask for the value of several variables at once, Emanuel Berg, 2018/03/09
- Re: ask for the value of several variables at once, Uwe Brauer, 2018/03/14
- Re: ask for the value of several variables at once, Yuri Khan, 2018/03/14
- Message not available
- Re: ask for the value of several variables at once, Emanuel Berg, 2018/03/14
- Re: ask for the value of several variables at once, Yuri Khan, 2018/03/14
- Message not available
- Re: ask for the value of several variables at once, Emanuel Berg, 2018/03/14
- Message not available
- Re: ask for the value of several variables at once, Emanuel Berg, 2018/03/17
- Re: ask for the value of several variables at once, Emanuel Berg, 2018/03/17
- Re: ask for the value of several variables at once,
John Mastro <=
- Message not available
- Re: ask for the value of several variables at once, Emanuel Berg, 2018/03/18
- Re: ask for the value of several variables at once, Emanuel Berg, 2018/03/18
- Re: ask for the value of several variables at once, John Mastro, 2018/03/19
- Re: ask for the value of several variables at once, Stefan Monnier, 2018/03/18
- Message not available
- Re: ask for the value of several variables at once, Emanuel Berg, 2018/03/18
- Message not available
- Re: ask for the value of several variables at once, Emanuel Berg, 2018/03/14
- Message not available
- Re: ask for the value of several variables at once, Emanuel Berg, 2018/03/09
- Re: ask for the value of several variables at once, Emanuel Berg, 2018/03/09
- Re: ask for the value of several variables at once, Emanuel Berg, 2018/03/09
- Re: ask for the value of several variables at once, tomas, 2018/03/09