pack
shown here with a tuple type that has four (possibly nested) slots.
Name | Type | Description | Optional |
---|---|---|---|
taken from tuple type |
taken from tuple type |
first slot of the nested input tuple |
yes |
taken from tuple type |
taken from tuple type |
second slot of the nested input tuple |
yes |
… |
|||
taken from tuple type |
taken from tuple type |
final slot of the nested input tuple |
yes |
Name | Type | Description | Optional |
---|---|---|---|
output |
?0 |
the tuple resulting from packing the slot inputs into the tuple type of the output |
no |
pack
takes inputs for every slot in a nested tuple type, and outputs the tuple that has those values as the tuple slots. See the example SpecialNodes/pack:
The result of running this project is this:
The two highlighted edges have been assigned the same nested tuple type: < <int a, int b> X, <int a, int b> Y >
. This is a tuple of two elements. Each element is itself a tuple of two integers called a
and b
. Given four integers, there are two ways to put them together into a tuple of this type. One way is to first create the two tuples <int a, int b>
for the two halves X
and Y
. The other way is to use pack
to directly assemble the whole nested tuple structure from the four integers. The result is the same either way. pack
and unpack
are handy for dealing with nested tuple types, and nested tuple types are quite common in cloud applications because API requests and responses are often structured in this way.