std-copy-tree


Synopsis

(std-copy-tree <lst>)

Description

STD-COPY-TREE returns the same list with keeping the list structure intact, only every element is created of freshly consed memory cells. The argument is equal to the result but not eq, as well as any element of the lists are not eq.

In AutoLISP it is almost never used, because AutoLISP does not allow destructive modifications. Only some sort implementations might destructivly change the original list. So if you don't want to destroy the original list, sort a copy. Have a look at your sort how it behaves. Most of the time you wouldn't care about destructive sorting.

Note

The AutoLISP version so far has a stack problem with too large lists. It is defined highly recursive.

Example

(std-copy-tree '(2 (3 . 0)))	 => (2 (3 . 0))
(vl-sort (std-copy-tree pointlist) 'less-ptx)

=> a sorted copy of the pointlist

Arguments

lst: any list

Return Value

A new list.

Side Effects

None.

Module

(std-require 'STDLIST)

Defined in STDLIST

#- SMALL