A list in lisp is a series of cons cells, but in Python, a native list is a different kind of object. For translating code from lisp to Python, one might simply take lisp lists and translate them to Python native lists. However, this runs into trouble with side effecting cons cells not coming across to the Python code. For example, consider this code in lisp:
(setq a (list 1 2 3 4))
(let ((b a)
(a (cddr a)))
(declare (special a b))
(setf (cadr b) ‘b)
(setf (cadr a) ‘d)
(print a))
(print a)
;; Results in:
(3 d)
(1 b 3 d)
Is there a Python package that would provide a better emulation of lisp lists in Python? Does such package offer easy conversion to regular Python lists?
What might the above code look like in Python using such package?