collectvector

SpecialNodes collectvector

input ports:
Name Type Description Optional

input

?0

element to be added to the vector

no

include

?1 (interpreted as boolean)

if true, add current input to the vector

yes

complete

?2 (interpreted as boolean)

if true, output the accumulated vector and reset the accumulator to the empty state

no

output ports:
Name Type Description Optional

output

vector<?0>

the accumulated vector, output when the complete input is true

no

collectvector reads its three inputs ports. if include is true (or if the include port is not connected), the input is added to the accumulated vector. if complete is true, the accumulated vector is output, and the accumulator is reset to empty. Note that there is no output except when the complete input is true. It is recommended that you read the Iteration section of the Dataflow in Coreograph document in addition to the information presented here.

In the Special Node example collectvector, the collectlist or collectset operation is replaced by collectorvector:

SpecialNodes collectvector2

The result is a vector, which like a list may contain repeated elements. Vectors support efficient access to their individual elements by index; see the getvector special node and example below. An index is a zero-based integer that names a position in the vector. In this case, there are 10 elements in the result vector, so the indices range from 0 to 9. In a sense, a vector is halfway between a list and a map: it maintains a sequential order of its elements, and it allows retrieval of its contents using a key, in this case an index. The result of running the example is this output:

SpecialNodes collectvector3