copy

copy — makes a copy of the top list level of a list.

Syntax

copy (s_exp)

		

Arguments

s_exp

Any Gamma or Lisp expression.

Returns

A copy of the top list level of the argument.

Description

This function makes a copy of the top list level of the argument if the argument is a list, otherwise it simply returns the argument. This produces a new list which is equal to the previous list, and whose elements are eq. That is, the elements are not copied but simply reside in both the original and the copy.

Example

Gamma> a = list(1, list(2,3,list(4),5));
(1 (2 3 (4) 5))
Gamma> b = copy(a);
(1 (2 3 (4) 5))
Gamma> cadr(a);
(2 3 (4) 5)
Gamma> equal(cadr(a),cadr(b));
t
Gamma> eq(cadr(a),cadr(b));
t
Gamma> 
		

See Also

copy_tree, eq, equal