Example CpxVector append 013




This example takes 2 existing Vectors and appends the values of each Vector. The result is placed in a new Vector.



Defines the first Complex Vector.

(setq X (new Vector: complex: 1 1.0 2.0)) Returns: #<CpxVector 123456>

Adds a Complex Number to the Vector

(append X #c3.0+4.0i) Returns: #<CpxVector 234567>

Displays the newly appended Vector. Vector X remains unchanged.

(display #<CpxVector 234567> ) Returns: #<CpxVector 234567>

Defines another Vector.

(setq Y #(cpx| 3.0 4.0 5.0 6.0)) Returns: #<CpxVector 345678>
(setq W (append X Y )) Returns: #<CpxVector 456789>

The new Vector contains the value sof Vectors X and Y.

(display W ) Returns: #(cpx| #c1.0+2.0i #c3.0+4.0i #c5.0+6.0i )

Notes and Hints

Append automagically reallocates enough contiguous space in the heap to hold the new vector. If necessary, the contents of the existing heap area is moved to the new location. The garbage collector comes along later to clean up the abandoned object.

Amazingly, the relocation of an object in the heap does not change the contents of the virtual machine container; thus, no dynamic fixup of all the pointers into the heap is required.


Related Examples

Here are examples of the append function at work.

BitVector append 010 CpxVector append 013 FltVector append 007 IntVector append 007
List member 009 Matrix append 007 NumMatrix append 012 NumVector append 008
ObjVector append 009 Pair append 011 ShortVector append 008 String append 001
String append 002 Structure append 004 Structure append 005 Symbol append 003
Vector append 006


Function Links

Here is the link to the current function used in this example.


Here are a number of links to other related functions.

new(CpxVector) replace(CpxVector) rept(CpxVector)


Argument Types

Here are the links to the data types of the arguments used in this example.


Here are a number of links to examples having similar argument types.

CpxVector addMethod 028 CpxVector append 013 CpxVector avg 002 CpxVector binaryInsert 008
CpxVector binarySearch 008 CpxVector cdr 011 CpxVector compare 020 CpxVector compareEQ 020
CpxVector compareGE 020 CpxVector compareGT 020 CpxVector compareLE 020 CpxVector compareLT 020
CpxVector compareNE 020 CpxVector copy 013 CpxVector new 015 CpxVector send 028

How do I contact the AIS Server team?

You can always talk with the AIS at aiserver.sourceforge.net.