[Top][All Lists]

[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 <> 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]