[ Can destructuring-setq be defined using destructuring-bind? ]
There is destructuring-bind but it seems there is no destructuring-setq. Is it possible to define it using destructuring-bind?
(let (a b c d) (destructuring-setq ((a b) (c d)) '((1 2) (3 4))) `(,b ,d)) (destructuring-bind ((a b) (c d)) '((1 2) (3 4)) `(,b ,d))
This would be a highly nontrivial endeavor.
- Find all variables to be bound
- Replace them with gensyms (or use
copy-symbolfor total unreadability of the macroexpansion :-) and keep a map from the old symbols to the new ones.
Return something like
(destructuring-bind (new-lambda-list) expression (setq old-var-1 new-gensym-1 ...))
The analyser is present in any Common Lisp implementation (see, e.g., the link above) and it is not simple.
I suggest that you ask yourself whether
destructuring-bind is really not enough.