Lisp of the Day

 

SET and SETQ

Good old set and setq are the functions of the day today. Used practically in every routine that has ever been made. You may be asking what is the difference between set and setq which is a valuable question.

(setq symbol expression)

(set symbol expression)

But, those are the same arguments needed between them. You are correct but set sets the quoted value of a symbol and setq sets the value of a symbol.

(setq c 0)
(repeat 5 (set (read (strcat "v" (itoa (setq c (1+ c))))) c)))
is the same as
(setq v1 1)
(setq v2 2)
(setq v3 3)
(setq v4 4)
(setq v5 5)

This will allow you to save some time in setting multiple values that can be recalled later.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: