<I shouldn't be posting yet as I haven't had my first coffee but this thread has been bugging me, so forgive me if it lacks some coherency>
About quote, setq and set ...
Quote (') simply instructs the lisp interpreter "return an expression without evaluating it" (from the help), so if a statement is quoted, e.g. '(+ 2 2) or (quote (+ 2 2)) ... it is not evaluated, thus does not return 4 but the term '(+ 2 2). If a symbol is quoted it similarly is not evaluated but returned as a symbol, e.g. assuming the symbol b hosts hosts the value 42, 'b, or (quote b) will not return 42 but the symbol b.
Now has does this manifest itself with set / setq? It's right in the help file: "The set function is similar to setq except that set evaluates both of its arguments whereas setq only evaluates its second argument."
Say what? First setq.
(setq a b) ... assuming b is bound to the value 42 from before a is now bound to 42. Remember "setq only evaluates its second argument". So the symbol a is not evaluated, but b is evaluated, thus the symbol a is bound to the value 42.
Wait a second, isn't (setq a b) the same as (set 'a b)? Yes it is, setq is merely a convenience function.
Now set.
But what if we don't quote the first term when using set? If you don't quote the first term it is evaluated, which can cause problems if you don't understand what the ramifications are, and haven't initialized a accordingly. As exists currently, a is bound to 42, so if we tried to execute this statement (set a 7) we would get an error, because we would be trying to bind the value 7 to ... the value of 42.
What?
Again, given that a is currently bound to 42, (set a 7) once a is evaluated (value 42) would be analogous to (setq 42 7) which is of course, impossible.
So how do you use set?
Well if you want to set the symbol a to something you would use either (setq a something) or (set 'a something).
However, if you want to take advantage of what is sometimes referred to as "indirect addressing", that is, use one symbol to bind another symbol to some value then the following may illuminate. In order for this work the first symbol must point to another symbol, for example (setq a 'b) or (set 'a 'b). Now we can bind the symbol b to some value using the symbol a: (set a 7). The symbol b is now bound to the value 7.
So ... all this seems academic, where would you use this in the real world? To be honest, it doesn't come up that frequently, is frequently misused, but here are a couple uses.
;; bind the symbols x, y and z to the values 1, 2 and 3 respectively.
(mapcar 'set '(x y z) '(1 2 3))
;; null out the values for multiple symbols
(foreach x '(a b c) (set x nil))
I'd post more but I'm late for work as it is and gotta run.
Edit: After typing out all this sht CAB beat me to it; grrrrr, later.
ciao