I have a nested list, and I am trying to non-destructively replace all its elements (inside the nested list as well). That is, given my input list
\'(1 \'(2
What am I doing wrong?
You have actually done a good work with loop and it works! Remember that ' stands for quote, so:
'(1 '(2 3 4) '(5 6 7) 8 9)
is equal to
(quote (1 (quote (2 3 4)) (quote (5 6 7)) 8 9))
; | | | | | | | | | | |
(0 (0 (0 0 0)) (0 (0 0 0)) 0 0)
you see, your quotes have been substituted too (except for the first one, which has been consumed during evaluation of the function argument)! One quote is enough to suspend execution.