|
copy
|
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. When to use 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).
(copy vector) An exact copy of the specified Vector.
Here are a number of links to Lambda coding examples which contain this instruction in various use cases.
Here are the links to the data types of the function arguments. Here are also a number of links to functions having arguments with any of these data types.
You can always talk with the AIS at aiserver.sourceforge.net.
Name
Description
AIS Types vector The Vector to be copied. Vector ShortVector PcodeVector FltVector NumVector IntVector CpxVector ObjVector BitVector
Returns:
Examples
Argument Types
Structure
Dictionary
Directory
Pair
List
Vector
Brick
Matrix
Lambda
NumMatrix
CpxVector
ShortVector
How do I contact the AIS team?