I am trying to create a list variable that can be set to one list or another depending on a condition. What I have so far is as follows.
(let ((l (if local list1 list2))) ; Append items to the list )
localis a parameter that can be set to
list2are list variables.
Then when I later try to access either list1 or list2, I am getting the following error.
Lisp error: (wrong-type-argument sequencep t)
Essentially, what I am trying to do is update either list1 or list2 depending on the value of local. Perhaps this is what is causing my issue.
The following is the shortest code segment that illustrates the problem.
(defvar local-list '()) (defvar global-list '()) (defun add-item-to-list (local item) (let ((l (if local local-list global-list))) (add-to-list 'l item) ) ) (defun print-local-list () (mapc (lambda (item) (message item)) local-list) ) (add-item-to-list t "Blue") (add-item-to-list t "Greem") (add-item-to-list t "Red") (print-local-list)