Posted on Leave a comment

Lisp of the Day



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.

Leave a Reply