detuple

SpecialNodes detuple

shown here with a tuple type that has three slots.

input ports:
Name Type Description Optional

input

?0

a tuple

no

output ports:
Name Type Description Optional

taken from tuple type

taken from tuple type

first slot of the input tuple

yes

taken from tuple type

taken from tuple type

second slot of the input tuple

yes

…​

taken from tuple type

taken from tuple type

final slot of the input tuple

yes

detuple takes an input of tuple type, and outputs its individual slots. See the example SpecialNodes/detuple:

SpecialNodes detuple2

Here, the tuple type is <int a, double b, string c>. The output side of the detuple node therefore has three ports. Running the example yields this:

SpecialNodes detuple3

The tuple type for a detuple, tuple, retuple, pack, unpack, repack, complete, or total node comes from the link connected to its tuple side, i.e., the input side of a detuple, unpack, complete or total node, and the output side of a tuple, retuple, pack, or repack node. The link type can in turn come from the node that is attached to the other end of the link, or it may be set explicitly in the inspector. In the example above, the link entering the detuple node has had its type set explicitly, hence the blue highlight.

It is common to use detuple to extract an individual slot, or a handful of slots, from a tuple value. In this snippet:

SpecialNodes detuple4

The extract node (in this case it is $AWS$DynamoDB$ExportTableToPointInTimeResponseExtract) outputs a tuple whose first slot is a (much larger) tuple. Only the second output port of the second detuple node is connected; the program is extracting just that slot and ignoring the rest.

In a case like this in which several detuple operations are chained together in order to extract a property that is buried inside a complex structure, the unpack node can be used instead. It extracts all the properties from a nest of tuples and presents them together as the outputs of the node.