set (AutoLISP)

Sets the value of a quoted symbol name to an expression

Supported Platforms: Windows and Mac OS

Signature

(set sym expr)
sym

Type: Symbol

The user-defined variable to assign expr to.

expr

Type: Integer, Real, String, List, Symbol, File, ads_name, T, or nil

An AutoLISP expression.

Return Values

Type: Integer, Real, String, List, Symbol, File, ads_name, T, or nil

The value of the expression.

Remarks

The set function is similar to setq except that set evaluates both of its arguments whereas setq only evaluates its second argument.

Examples

Each of the following commands sets symbol a to 5.0:

(set 'a 5.0)
5.0

(set (read "a") 5.0)
5.0

(setq a 5.0)
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:

(set (read "a") 5.0)
5.0

(setq (read "a") 5.0)
; *** ERROR: syntax error