Hi perhaps I don't understand, but, why do you (MP & CAB) store the data value in a local variable ?
the result returned by (subst ...) won't change the original Data
MP's code will change the original list, and Cab's will with the addition of the Set function shown by MP, thus:
(setq List1 '(1 2 3 4 5))
(setq list2 '(a b c d e))
(defun test(Data / value)
(setq value (eval data))
;; subst the first item in the list with "12"
([color=red]set[/color] data (subst "12" (car value) value))
)
(1 2 3 4 5)
(A B C D E)
TEST
(test 'list1)
("12" 2 3 4 5)
list1
("12" 2 3 4 5)
(test 'list2)
("12" B C D E)
list2
("12" B C D E)
This does exactly what I wanted, though not quite as easiliy as I had hoped.
I guess the other option would be this:
(setq List1 '(1 2 3 4 5))
(setq list2 '(a b c d e))
(defun test(Data / value)
;; subst the first item in the list with "12"
(subst "12" (car value) value)
)
Then calling the routine thus:
(setq List1 (test list1))
(setq list2 (test list2))
This is being driven by multiple lists that need the same functions performed on them. Since these tend to be fairly large lists, I'm hoping the first approach will improve performance and/or decrease memory usage.