The name is self-evident. How can I build a new list X from another list Y (of the same structure), but as a result, a list indicating somewhere else in the memory area is practically a different object? I tried with make-list :initial-element Yor added to the empty list, but I still get the same object. Thanks!
make-list :initial-element Y
Generic Lisp
Use the COPY LIST to copy the first level of the list.
Use COPY-TREE to copy the conses tree, a tiered list will be copied at all levels.
COPY-TREE, COPY-LIST conses . ( EQL, EQ).
. Lisp HyperSpec Conses .
, COPY-LIST.
My copy worked (using sbcl).
REPL:
(defvar a '((1 2 3) (4 5 6))) (defvar b (copy-tree a)) (setf (nth 0 (nth 0 b)) "4") a ; ((1 2 3) (4 5 6)) is returned b ;(("4" 2 3) (4 5 6)) is returned
Perhaps if you provided us with more sources, we could help.
Source: https://habr.com/ru/post/1722861/More articles:ASP MVC Foreign Key Submit Problem - asp.netПостоянная ссылка/лучшая практика - sqlGit repository synchronization through machines without push - gitHow to call a browser through Java coding? - javaReady-made image processing solution - phpSilverlight ui upgrade issue - multithreadingDjango selects model objects based on time at intervals on the model itself - djangoС# -Сравнимый и IEquatable - genericsHow to adjust speaker volume from a Java program? - javaЯкорь HTML заменяет RegEx - htmlAll Articles