This probably is easy but I cant seem to get
lets say I have a b and d
(setq a '(x y))
(setq b '(p q))
(setq d '("a" "b"))
how can get a list containing (x y p q) with the information I have with d
UPDATE; Ok what I had tried was this
(apply 'nconc (mapcar (lambda (x)
(symbol-value (intern x)))
d))
but I dont really understand what nconc does. if evaluate twice, value changes. thrice emacs goes without response
This should do it:
(apply 'append (mapcar (lambda (name) (symbol-value (intern name))) d))
Can you change what d to use symbols instead of strings? It would be much simpler to do:
(setq d '(a b))
(apply 'append (mapcar 'symbol-value d))
If the contents of a and b are known at the time you set d, you could even do this:
(setq d `(,@a ,@b))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With