Sets the value of a quoted symbol name to an expression
(set sym expr)
The set function is similar to setq except that set evaluates both of its arguments whereas setq only evaluates its second argument.
Each of the following commands sets symbol a to 5.0:
(set 'a 5.0)
(set (read "a") 5.0)
(setq a 5.0)
Both set and setq expect a symbol as their first argument, but set accepts an expression that returns a symbol, whereas setq does not, as the following shows:
Command: (set (read "a") 5.0)
5.0
Command: (setq (read "a") 5.0)
; *** ERROR: syntax error
See Also
-
The setq function.