OK, let's see if I can understand that:
The setup is a nice and conventional SETQ.
We've got a COND nested in a SET.
The COND looks at a, if a exists, turn it into a list
If a doesn't exist, it looks at b, and if that exists, turns it into a list
If b doesn't exist, the COND looks at c, and if that exists, turns it into a list
finally, if c doesn't exist, it looks at d, and if d exists, turns it into a list
The SET then turns assigns the value 7 to any variable that is a list.
That all seems to make sense, *except* that this seems to revolve around SET only working on lists, which you said earlier it didn't (you implied that SET can work on non-lists as well), unless the SET is filtering for the "nil"s, but then why would you need the COND statement?
It looks like SET can work on variables without knowing beforehand which variable it's working on. Except that doesn't seem to save on any coding:
(COND
((a)(SETQ a 'a))
((b)(SETQ b 'b))
((c)(SETQ c 'c))
((d)(STEQ d 'd))
)
or would it start saving code if a more complicated example?
dJE
no the only difference is that SETQ can NOT accept an evaluation as its first argument, SET can.
(setq a nil
b nil
c nil
d nil)
; lets do some setup and clear a b c d vars just in case they are set.
(setq d 1)
; now create and one variable called d and fill it with the number 1
; pretending that we had a sitauation where we did not know what variable was used
; but we knew the range; we can run a small invesigation to discover it.
; to return the variable used...
(set
;; find the variable already defined (leave the others untouched)
;; and fill it with a number 7
;;
;; the second argument to SET can also be an evaluation
;; of a process but we are just going to set a number
;; for this example.
(cond
(a 'a)
(b 'b)
(c 'c)
(d 'd) )
7 )
; see the values of the variables to ensure that we didnt touch any other variable besides d
(mapcar 'eval '(a b c d))