Operators Support ================= Standard Python Operators ------------------------- +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | operator | description | hgraph name | TS[int] TS[float] | TS[bool] | TS[str] | TS[enum] | TS[date,datetime] | TS[timedelta] | TS[CompoundScalar] | TS[tuple] | TS[set] | TS[dict] | TSS[T] | TSL[TST, S] | TSB[Schema] | TSD[K, V] | +================+==================+=============+======================+=====================+========================+=====================+==========================+========================+====================+===========================+======================+=======================+========================+=======================+=========================+====================================+ | a + b | addition | add\_ | ✅ | ❌ | ✅ | ❌ | ✅ b is timedelta | ✅ | ❌ | ✅ concat tuples | ❌ | ❌ | ❌ | ✅ item-wise | ✅ item-wise | ❌ | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | a - b | subtraction | sub\_ | ✅ | ❌ | ❌ | ❌ | ✅ | ✅ | ❌ | ❌ | ✅ set diff | ✅ diff | ✅ set difference | ✅ item-wise | ✅ item-wise | ✅ diff | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | a \* b | multiplication | mul\_ | ✅ | ❌ | ✅ b is int | ❌ | ❌ | ✅ b is int/float | ❌ | ✅ b is int | ❌ | ❌ | ❌ | ✅ item-wise | ✅ item-wise | ❌ | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | a / b | true division | div\_ | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ b is int/float | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ item-wise | ✅ item-wise | ❌ | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | a // b | floor division | floordiv\_ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ item-wise | ✅ item-wise | ❌ | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | a % b | modulo | mod\_ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ item-wise | ✅ item-wise | ❌ | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | divmod(a, b) | divmod | divmod\_ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | a \*\* b | pow | pow\_ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ item-wise | ✅ item-wise | ❌ | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | a << b | left shift | lshift\_ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❓ shift items left | ❌ | ❌ | ❌ | ✅ item-wise | ✅ item-wise | ❌ | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | a >> b | right shift | rshift\_ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ item-wise | ✅ item-wise | ❌ | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | a & b | bitwise and | bit_and | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ intersection | ❓ intersection | ✅ intersection | ✅ item-wise | ✅ item-wise | ✅ intersection | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | a | b | bitwise or | bit_or | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ union | ❓ union | ✅ union | ✅ item-wise | ✅ item-wise | ✅ merge | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | a ^ b | bitwise xor | bit_xor | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ symm. diff | ❓ symm. diff | ✅ symm. diff | ✅ item-wise | ✅ item-wise | ✅ symm. diff | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | a == b | equal | eq\_ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ single bool | ✅ single bool | ✅ | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | a != b | not equal | ne\_ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ single bool | ✅ single bool | ✅ | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | a < b | less | lt\_ | ✅ | ✅ | ✅ | ✅ value | ✅ | ✅ | ❌ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | a <= b | less or equal | le\_ | ✅ | ✅ | ✅ | ✅ value | ✅ | ✅ | ❌ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | a > b | greater | gt\_ | ✅ | ✅ | ✅ | ✅ value | ✅ | ✅ | ❌ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | a >= b | greater or equal | ge\_ | ✅ | ✅ | ✅ | ✅ value | ✅ | ✅ | ❌ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | -a | unary negative | neg\_ | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ item-wise | ✅ item-wise | ❌ | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | +a | unary positive | pos\_ | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ item-wise | ✅ item-wise | ❌ | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | ~a | inversion | invert\_ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ item-wise | ✅ item-wise | ❌ | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | abs(a) | abs | abs\_ | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ item-wise | ✅ item-wise | ❌ | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | a[b] | getitem | getitem\_ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ✅ | ❌ | ✅ item by index | ✅ item by index | ✅ | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | a.b | getattr | getattr\_ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ item by name | ✅ if values is a schema type | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ |   | | | | | | | | | | | | | | | | | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | not\_(a) | not | not\_ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | and\_(a, b) | and | and\_ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | or\_(a, b) | or | or\_ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | len\_(a) | len | len\_ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ number of items | ✅ | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ |   | | | | | | | | | | | | | | | | | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | min\_(\*args) | multi-arg min | min\_ | ✅ | ✅ | ✅ | ✅ value | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ item-wise | ✅ item-wise | ❌ | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | max\_(\*args) | multi-arg max | max\_ | ✅ | ✅ | ✅ | ✅ value | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ item-wise | ✅ item-wise | ❌ | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | sum\_(\*args) | multi-arg sum | sum\_ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ | ❌ | ✅ | ❌ | ❌ | ❌ | ✅ item-wise | ✅ item-wise | ❌ | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | min\_(a) | unary min | min\_ | ✅ running min | ✅ running min | ✅ running min | ✅ running min | ✅ running min | ✅ running min | ❌ | ✅ min item | ✅ min item | ✅ min value | ✅ min item | ✅ min item | ✅ min item | ✅ min value | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | max\_(a) | unary max | max\_ | ✅ running max | ✅ running max | ✅ running max | ✅ running max | ✅ running max | ✅ running max | ❌ | ✅ max item | ✅ max item | ✅ max value | ✅ max item | ✅ max item | ✅ max item | ✅ max value | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | sum\_(a) | unary sum | sum\_ | ✅ running sum | ✅ running sum | ✅ running sum | ❌ | ❌ | ✅ running sum | ❌ | ✅ sum items | ✅ sum items | ✅ sum values | ✅ sum items | ✅ sum items | ✅ sum items | ✅ sum value | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ |   | | | | | | | | | | | | | | | | | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | contains(a, b) | b in a | contains\_ | ❌ | ❌ | ✅ substring find | ❌ | ❌ | ❌ | ❌ | ✅ | ✅ | ✅ key find | ✅ | ❌ | ❌ | ✅ | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | is_empty(a) | empty test | is_empty | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | type\_(a) | type | type\_ | ✅ int or float | ✅ bool | ✅ str | ✅ enum | ✅ date or datetime | ✅ timedelta | ✅ | ✅ tuple[...] | ✅ set[...] | ✅ set[...] | ❌ | ❌ | ❌ | ❌ | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ | str\_(a) | str | str\_ | ✅ | ✅ | ✅ no-op | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ |   | | | | | | | | | | | | | | | | | +----------------+------------------+-------------+----------------------+---------------------+------------------------+---------------------+--------------------------+------------------------+--------------------+---------------------------+----------------------+-----------------------+------------------------+-----------------------+-------------------------+------------------------------------+ convert ------- +------------------------+------------------------+----------+---------+--------------------+----------------------+----------------------+------------------------------+--------------------+-------------+-----------------------------+--------------------------------------------------------------+ | from \ to | TS[T], T is int, float | TS[bool] | TS[str] | TS[CompoundScalar] | TS[tuple] | TS[set] | TS[dict] | TSS[T] | TSL[TST, S] | TSB[Schema] | TSD[K, V] | +========================+========================+==========+=========+====================+======================+======================+==============================+====================+=============+=============================+==============================================================+ | TS[T], T is int, float | ✅ | ✅ | ✅ | | ✅ tuple of one | ✅ tuple of one | ✅ key and value inputs | ✅ set of one | | | | +------------------------+------------------------+----------+---------+--------------------+----------------------+----------------------+------------------------------+--------------------+-------------+-----------------------------+--------------------------------------------------------------+ | TS[bool] | ✅ | ✅ | ✅ | | ✅ tuple of one | ✅ tuple of one | | | | | | +------------------------+------------------------+----------+---------+--------------------+----------------------+----------------------+------------------------------+--------------------+-------------+-----------------------------+--------------------------------------------------------------+ | TS[str] | ✅ | ✅ | ✅ | | ✅ tuple of one | ✅ tuple of one | | ✅ set of one | | | | +------------------------+------------------------+----------+---------+--------------------+----------------------+----------------------+------------------------------+--------------------+-------------+-----------------------------+--------------------------------------------------------------+ | TS[CompoundScalar] | ❌ | ✅ | ✅ | ✅ | | | | | | ✅ | | +------------------------+------------------------+----------+---------+--------------------+----------------------+----------------------+------------------------------+--------------------+-------------+-----------------------------+--------------------------------------------------------------+ | TS[tuple] | ❌ | ✅ | ✅ | | ✅ | ✅ | ✅ key and value tuples | ✅ | ✅ | | | +------------------------+------------------------+----------+---------+--------------------+----------------------+----------------------+------------------------------+--------------------+-------------+-----------------------------+--------------------------------------------------------------+ | TS[set] | ❌ | ✅ | ✅ | | ✅ | ✅ | | ✅ | | | ✅ if supplied a value | +------------------------+------------------------+----------+---------+--------------------+----------------------+----------------------+------------------------------+--------------------+-------------+-----------------------------+--------------------------------------------------------------+ | TS[dict] | ❌ | ✅ | ✅ | | | | ✅ | | | ✅ for uniform schemas | ✅ | +------------------------+------------------------+----------+---------+--------------------+----------------------+----------------------+------------------------------+--------------------+-------------+-----------------------------+--------------------------------------------------------------+ | TSS[T] | ❌ | ✅ | ✅ | | ✅ | ✅ | | | | | ✅ if supplied a value | +------------------------+------------------------+----------+---------+--------------------+----------------------+----------------------+------------------------------+--------------------+-------------+-----------------------------+--------------------------------------------------------------+ | TSL[TST, S] | ❌ | ✅ | ✅ | | ✅ | | ✅ ints for keys | | ✅ | | ✅ with int keys, or use combine with a tuple of keys | +------------------------+------------------------+----------+---------+--------------------+----------------------+----------------------+------------------------------+--------------------+-------------+-----------------------------+--------------------------------------------------------------+ | TSB[Schema] | ❌ | ✅ | ✅ | ✅ | | | | | | ✅ | ✅ if the schema is uniform | +------------------------+------------------------+----------+---------+--------------------+----------------------+----------------------+------------------------------+--------------------+-------------+-----------------------------+--------------------------------------------------------------+ | TSD[K, V] | ❌ | ✅ | ✅ | | | | ✅ | | | ✅ for uniform schemas | ✅ | +------------------------+------------------------+----------+---------+--------------------+----------------------+----------------------+------------------------------+--------------------+-------------+-----------------------------+--------------------------------------------------------------+ combine ------- +-----------------------------------+----------------------+---------+-------------------------------------+---------+-------------+-------------+---------------------------------+ | from \ to | TS[tuple] | TS[set] | TS[Mapping] | TSS[T] | TSL[TST, S] | TSB[Schema] | TSD[K, V] | +===================================+======================+=========+=====================================+=========+=============+=============+=================================+ | TS[T], T is int, float, bool, str | ✅ | ✅ | ✅ from two inputs for K and V | ✅ | | | ✅ for two inputs, K and V | +-----------------------------------+----------------------+---------+-------------------------------------+---------+-------------+-------------+---------------------------------+ | TS[tuple] | ✅ same as sums | ✅ | ✅ from two inputs for K and V | ✅ | | | ✅ for two inputs, K and V | +-----------------------------------+----------------------+---------+-------------------------------------+---------+-------------+-------------+---------------------------------+ | TS[set] | | | | ✅ | | | | +-----------------------------------+----------------------+---------+-------------------------------------+---------+-------------+-------------+---------------------------------+ | TS[Mapping] | | | | | | | ✅ | +-----------------------------------+----------------------+---------+-------------------------------------+---------+-------------+-------------+---------------------------------+ | TSS[T] | | | | ✅ | | | | +-----------------------------------+----------------------+---------+-------------------------------------+---------+-------------+-------------+---------------------------------+ | TSD[K, V] | | | | | | | ✅ | +-----------------------------------+----------------------+---------+-------------------------------------+---------+-------------+-------------+---------------------------------+ emit ---- +------------------------+-------------+ | input type | output type | +========================+=============+ | TS[tuple[SCALAR, ...]] | TS[SCALAR] | +------------------------+-------------+ | TS[set[SCALAR]] | TS[SCALAR] | +------------------------+-------------+ | TS[Mapping[K, V]] | TS[V] | +------------------------+-------------+ | TSS[SCALAR] | TS[SCALAR] | +------------------------+-------------+ | TSL[T, SIZE] | T | +------------------------+-------------+ | TSD[K, V] | V | +------------------------+-------------+