The copy function creates new copy of the object on the heap with its own
unique object id. The new object id is returned by the copy function.
Structure
The copy function may appear similar to the setq function but its
behavior is different if the target object is a collection object such as a
Structure (Structures, vectors, lists and dictionaries are collection objects
stored in the heap. See the Analytic Information Server Introduction Book).
When you use the setq function to assign a native data type such as
Number, Void, Boolean, Text, the immediate data is copied to the target container.
When you use the setq function on a collection data type such as a Structure
(source), a pointer to the data location (the object id) is copied to the
target container (target). Therefore, if the new container (target)
changes a value in the structure, the (source) container will show the
change since (source) and (target) are pointing to the same data.
(From a C-programmer's perspective, the source and target are pointer
dereferencing the same memory location). However if the copy function was used,
it produces a copy of the structure (target) in a different memory location.
Changes to the copy are only visible to the (target) container.
(From a C-programmer's perspective, the copy function behaves like the memcpy standard function).
Vector
The copy function returns an exact copy of a Vector object.
Brick
The copy function returns an exact copy of a Brick object.
Pair
The copy function returns an exact copy of a Pair.
List
The copy function returns an exact copy of a List.
Lambda
The copy function creates an exact copy of the specified Lambda object.
The newly cloned Lambda has the same behavior and structure as the original Lambda
with the exception that the cloned Lambda has a similar but distinct Pv structure.
This allows cloning of Lambda objects, which have the same behavior but may have
different values in their persistent variables.
The copy function may appear similar to the setq function but its
behavior is different if the target object is a collection object such as a
Vector (Structures, vectors, lists and dictionaries are collection objects
stored in the heap). See the Analytic Information Server Introduction Book).
When you use the setq function to assign a native data type such as
Number, Void, Boolean, Text, the immediate data is copied to the target container.
When you use the setq function on a collection data type such as a Vector
(source), a pointer to the data location (the object id) is copied to the
target container (target). Therefore, if the new container (target)
changes a value in the vector, the (source) container will show the
change since (source) and (target) are pointing to the same data.
(From a C-programmer's perspective, the source and target are pointer
dereferencing the same memory location). However if the copy function was used,
it produces a copy of the vector (target) in a different memory location.
Changes to the copy are only visible to the (target) container.
(From a C-programmer's perspective, the copy function behaves like the memcpy
standard function).
Brick
The copy function may appear similar to the setq function but its
behavior is different if the target object is a collection object such as a
Brick (Structures, vectors, lists and dictionaries are collection objects
stored in the heap. See the Analytic Information Server Introduction Book).
When you use the setq function to assign a native data type such as
Number, Void, Boolean, Text, the immediate data is copied to the target container.
When you use the setq function on a collection data type such as a Brick
(source), a pointer to the data location (the object id) is copied to the
target container (target). Therefore, if the new container (target)
changes a value in the brick, the (source) container will show the
change since (source) and (target) are pointing to the same data.
(From a C-programmer's perspective, the source and target are pointer
dereferencing the same memory location). However if the copy function was used,
it produces a copy of the brick (target) in a different memory location.
Changes to the copy are only visible to the (target) container.
(From a C-programmer's perspective, the copy function behaves like the memcpy standard function).
Structure
The copy function returns an exact copy of a structure object.
Dictionary
The copy function produces a copy of the Dictionary (target)
in a different memory location (From a C-programmer's perspective, the
copy function behaves like the memcpy standard function).
Directory
The copy function produces a copy of the Directory (target)
in a different memory location (From a C-programmer's perspective, the
copy function behaves like the memcpy standard function).
Matrix
The copy function may appear similar to the setq function but its
behavior is different if the target object is a collection object such as a
Matrix (Structures, vectors, lists and dictionaries are collection objects
stored in the heap). See the Analytic Information Server Introduction Book).
When you use the setq function to assign a native data type such as
Number, Void, Boolean, Text, the immediate data is copied to the target container.
When you use the setq function on a collection data type such as a Matrix
(source), a pointer to the data location (the object id) is copied to the
target container (target). Therefore, if the new container (target)
changes a value in the Matrix, the (source) container will show the
change since (source) and (target) are pointing to the same data.
(From a C-programmer's perspective, the source and target are pointer
dereferencing the same memory location). However if the copy function was used,
it produces a copy of the matrix (target) in a different memory location.
Changes to the copy are only visible to the (target) container.
(From a C-programmer's perspective, the copy function behaves like the memcpy
standard function).
NumMatrix
The copy function may appear similar to the setq function but its
behavior is different if the target object is a collection object such as a
Matrix (Structures, vectors, lists and dictionaries are collection objects
stored in the heap). See the Analytic Information Server Introduction Book).
When you use the setq function to assign a native data type such as
Number, Void, Boolean, Text, the immediate data is copied to the target container.
When you use the setq function on a collection data type such as a Matrix
(source), a pointer to the data location (the object id) is copied to the
target container (target). Therefore, if the new container (target)
changes a value in the Matrix, the (source) container will show the
change since (source) and (target) are pointing to the same data.
(From a C-programmer's perspective, the source and target are pointer
dereferencing the same memory location). However if the copy function was used,
it produces a copy of the matrix (target) in a different memory location.
Changes to the copy are only visible to the (target) container.
(From a C-programmer's perspective, the copy function behaves like the memcpy
standard function).
Pair
The copy function may appear similar to the setq function but its
behavior is different if the target object is a collection object such as a
Pair or List (Structures, vectors, lists and dictionaries are collection objects
stored in the heap). See the Analytic Information Server Introduction Book).
When you use the setq function to assign a native data type such as
Number, Void, Boolean, Text, the immediate data is copied to the target container.
When you use the setq function on a collection data type such as a Pair
(source), a pointer to the data location (the object id) is copied to the
target container (target). Therefore, if the new container (target)
changes a value in the Pair, the (source) container will show the
change since (source) and (target) are pointing to the same data.
(From a C-programmer's perspective, the source and target are pointer
dereferencing the same memory location). However if the copy function was used,
it produces a copy of the Pair (target) in a different memory location.
Changes to the copy are only visible to the (target) container.
(From a C-programmer's perspective, the copy function behaves like the memcpy
standard function).
List
The copy function may appear similar to the setq function but its
behavior is different if the target object is a collection object such as a
Pair or List (Structures, vectors, lists and dictionaries are collection objects
stored in the heap). See the Analytic Information Server Introduction Book).
When you use the setq function to assign a native data type such as
Number, Void, Boolean, Text, the immediate data is copied to the target container.
When you use the setq function on a collection data type such as a Pair
(source), a pointer to the data location (the object id) is copied to the
target container (target). Therefore, if the new container (target)
changes a value in the Pair, the (source) container will show the
change since (source) and (target) are pointing to the same data.
(From a C-programmer's perspective, the source and target are pointer
dereferencing the same memory location). However if the copy function was used,
it produces a copy of the Pair (target) in a different memory location.
Changes to the copy are only visible to the (target) container.
(From a C-programmer's perspective, the copy function behaves like the memcpy
standard function).
Lambda
Use this function when a multiple copies of the Lambda are required. For instance,
if one has a blank expert Lambda, and one needs expert help on two separate subjects.
Make two copies of the blank expert Lambda. Teach the first expert Lambda about subject
one, and teach the second expert Lambda about subject two.