Maybe I wasn't clear enough in the first post. I undersand that setq is just another way of supplying the quote, so that is not really eliminating the quote.
I also understand that set will attempt to evaluate the symbol if the quote is not supplied, and throws an error if the quote is not there. In fact, it is already "smart" enough to "know" that a symbol is not being supplied if you omit the quote or if you try to use a list as the first argument. If it is already this "smart", why can't it go one small step further and accept an unquoted symbol as the first argument, and "know" that it must not evaluate it?
My point is, other functions "know what to do" without any special "instruction" or marker being fed to them. For example, the function string "knows" to evaluate the argument(s) and convert them to strings, and then concatenate. Does the code writer need to put some special mark on the expression to signal to string that it needs to convert the result of the evaluation into a string? No, it doesn't. That "knowlwdge" (functionality) is built into the function string. So, that is why I ask, what is the point of the function set requiring a quote? Why wasn't it designed to "know" that it *must not* evaluate the first symbol, just like string "knows" to convert to strings? Or, as I already asked, is this just a holdover from earliy LISP?
Another similar example is the function define. It is fed a list comprising two other lits, the function head and the function body. I don't see anything marking the first member of the function head, which is the function name, so that it is not evaluated. After I define the function, I can examine its contents the same way as for the object defined with set.
Code: Select all
(set 'TESTA 10)
;check the contents of the object TESTA defined by set
TESTA => 10
(define (TESTB) (+ 3 7))
;check the contents of the functiion TESTB
TESTB => (lambda () (+ 3 7))
So we can see here that define is "smart" and "knows" not to evaluate the first member of the function head, so why wasn't set designed with the same kind of "smarts"?
+++++++++++
Addendum
I subsequently thought about let. I don't see quote used with let, but it is setting a local variable. So it seems to me inconsistent to require set to use a quote but let does not.
Code: Select all
(set 'x 10) ;=> 10
(define (test)
(let (x 3))
(println x))
(println x) ;=> 10
(test) ;=> 3
(println x) ;=> 10