help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using setq to obtain a symbol from a list, so that I can assign a fu


From: David Combs
Subject: Re: Using setq to obtain a symbol from a list, so that I can assign a function to it
Date: Sat, 17 May 2008 22:14:06 +0000 (UTC)

In article <mailman.10729.1208927476.18990.help-gnu-emacs@gnu.org>,
Kevin Rodgers  <kevin.d.rodgers@gmail.com> wrote:
>srinik001@hotmail.com wrote:
>> Oops... I got the subject wrong. Instead of
>> 
>> " Using setq to obtain a symbol from a list, so that I can assign a
>> function to it", it should read, "Using setq to assign value to the
>> result of a function". Sorry about that.
>
>Use set instead of setq:
>
>,----[ C-h f setq RET ]
>| setq is a special form in `C source code'.
>| (setq [sym val]...)
>|
>| Set each sym to the value of its val.
>| The symbols sym are variables; they are literal (not evaluated).
>| The values val are expressions; they are evaluated.
>| Thus, (setq x (1+ y)) sets `x' to the value of `(1+ y)'.
>| The second val is not computed until after the first sym is set, and 
>so on;
>| each val can use the new value of variables set earlier in the `setq'.
>| The return value of the `setq' form is the value of the last val.
>|
>| [back]
>`----
>
>,----[ C-h f set RET ]
>| set is a built-in function in `C source code'.
>| (set symbol newval)
>|
>| Set symbol's value to newval, and return newval.
>|
>| [back]
>`----
>
>-- 
>Kevin Rodgers
>Denver, Colorado, USA
>
>
>

Kevin, could you elaborate on that just a bit, on why
setq is *not* the right thing to use.

And, in general, when *do* you use plain set?


THANKS!

David




reply via email to

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