Given a set of lexical variables, is it feasible to rebind a subset of them depending on circumstances at runtime. My first idea was to use #'set something like:
(let (A B C D E)
(declare (ignorable A B C D E))
(mapc #'set '(b e) (list 1 2)) ;(list 1 2) stands for a function call to get values
...)
but this only works for special variables (and is depreciated). I have come up with a solution that does work (by building a setf expression), but am reluctant to show it as it is so complex and inefficient. Is there a straightforward solution?
(ps: I appreciate this problem is perverse, but presently don't see a way to refactor around it.)
Maybe something like this: a CASE maps from a sym to the setter code.
Result:
(NIL 1 NIL NIL 2)