I'm certain I have reinvented a wheel here, but for the life of me I can't find it. Have I?
(defmacro jrl-extract-list (vars list &rest body)
"Split a list into indiviual variables"
(let ((list* (gensym)))
(append
`(let ,(cons (list list* list) vars))
(seq-map (lambda (var)
`(setq ,var (car ,list*)
,list* (cdr ,list*)))
vars)
body)))#emacs #lisp #elisp
Edit: Of course it was pcase.
Marco Antoniotti
in reply to Jonathan Lamothe • • •Sensitive content
Jonathan Lamothe
in reply to Marco Antoniotti • •would yield:
"foo: 1, bar: 2, baz: 3"Holger
in reply to Jonathan Lamothe • • •Sensitive content
gnu.org
www.gnu.orgJonathan Lamothe
in reply to Holger • •pcase.Jonathan Lamothe
in reply to Jonathan Lamothe • •My guess is that maybe
pcasecan do something similar?pcaseconfuses me.Weekend Editor
in reply to Jonathan Lamothe • • •Sensitive content
Doesn't destructuring-bind do something along these lines, if not exactly this?
(Assuming you meant Common Lisp. If it's Emacs lisp, then I dunno.)
Jonathan Lamothe
in reply to Weekend Editor • •pcase.Thuna
in reply to Jonathan Lamothe • • •Sensitive content