Value Tuple Routines
16 nodes
On this page 16
Compare
FunctionOrders two tuples of the same type element by element: the first position where they differ decides, as in sorting by several columns.
Compare(left: TTuple, right: TTuple) -> Integer
int Compare(TTuple left, TTuple right)
Parameters
| name | type | default | description |
|---|---|---|---|
| left | TTuple | — | The first tuple. |
| right | TTuple | — | The second tuple. |
Returns
| result | Integer |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Value Tuple Routines
- Package
- Standard Library
Compare Objects
FunctionOrders two values when you only have them as plain objects, using the left value's own comparison; null sorts before everything else.
CompareObjects(left: Any, right: Any) -> Integer
int CompareObjects(object left, object right)
Parameters
| name | type | default | description |
|---|---|---|---|
| left | Any | — | The first value; it must be comparable (as tuples, numbers and text are), or System.ArgumentException is thrown. Null sorts first. |
| right | Any | — | The second value; it must be of a type the left value can compare against, or the left value's comparison throws (for a tuple, System.ArgumentException). |
Returns
| result | Integer |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Value Tuple Routines
- Package
- Standard Library
Create
FunctionOverload 1 of 9
Create() -> ValueTuple
ValueTuple Create()
Makes the empty tuple, which holds no elements; it is the tuple form of "nothing", and every empty tuple equals every other.
Returns
| result | ValueTuple |
Overload 2 of 9
Create(item1: T1) -> (T1)
ValueTuple<T1> Create(T1 item1)
Makes a tuple holding one element.
Parameters
| name | type | default | description |
|---|---|---|---|
| item1 | T1 | — | The element. |
Returns
| result | (T1) |
Overload 3 of 9
Create(item1: T1, item2: T2) -> (T1, T2)
(T1, T2) Create(T1 item1, T2 item2)
Makes a pair: a tuple holding two elements, which may be of different types, for passing two related values along one wire.
Parameters
| name | type | default | description |
|---|---|---|---|
| item1 | T1 | — | The first element. |
| item2 | T2 | — | The second element. |
Returns
| result | (T1, T2) |
Overload 4 of 9
Create(item1: T1, item2: T2, item3: T3) -> (T1, T2, T3)
(T1, T2, T3) Create(T1 item1, T2 item2, T3 item3)
Makes a tuple holding three elements, which may be of different types.
Parameters
| name | type | default | description |
|---|---|---|---|
| item1 | T1 | — | The first element. |
| item2 | T2 | — | The second element. |
| item3 | T3 | — | The third element. |
Returns
| result | (T1, T2, T3) |
Overload 5 of 9
Create -> (T1, T2, T3, T4)
item1: T1
item2: T2
item3: T3
item4: T4(T1, T2, T3, T4) Create(T1 item1, T2 item2, T3 item3, T4 item4)
Makes a tuple holding four elements, which may be of different types.
Parameters
| name | type | default | description |
|---|---|---|---|
| item1 | T1 | — | The first element. |
| item2 | T2 | — | The second element. |
| item3 | T3 | — | The third element. |
| item4 | T4 | — | The fourth element. |
Returns
| result | (T1, T2, T3, T4) |
Overload 6 of 9
Create -> (T1, T2, T3, T4, T5)
item1: T1
item2: T2
item3: T3
item4: T4
item5: T5(T1, T2, T3, T4, T5) Create(
T1 item1,
T2 item2,
T3 item3,
T4 item4,
T5 item5)Makes a tuple holding five elements, which may be of different types.
Parameters
| name | type | default | description |
|---|---|---|---|
| item1 | T1 | — | The first element. |
| item2 | T2 | — | The second element. |
| item3 | T3 | — | The third element. |
| item4 | T4 | — | The fourth element. |
| item5 | T5 | — | The fifth element. |
Returns
| result | (T1, T2, T3, T4, T5) |
Overload 7 of 9
Create -> (T1, T2, T3, T4, T5, T6)
item1: T1
item2: T2
item3: T3
item4: T4
item5: T5
item6: T6(T1, T2, T3, T4, T5, T6) Create(
T1 item1,
T2 item2,
T3 item3,
T4 item4,
T5 item5,
T6 item6)Makes a tuple holding six elements, which may be of different types.
Parameters
| name | type | default | description |
|---|---|---|---|
| item1 | T1 | — | The first element. |
| item2 | T2 | — | The second element. |
| item3 | T3 | — | The third element. |
| item4 | T4 | — | The fourth element. |
| item5 | T5 | — | The fifth element. |
| item6 | T6 | — | The sixth element. |
Returns
| result | (T1, T2, T3, T4, T5, T6) |
Overload 8 of 9
Create -> (T1, T2, T3, T4, T5, T6, T7)
item1: T1
item2: T2
item3: T3
item4: T4
item5: T5
item6: T6
item7: T7(T1, T2, T3, T4, T5, T6, T7) Create(
T1 item1,
T2 item2,
T3 item3,
T4 item4,
T5 item5,
T6 item6,
T7 item7)Makes a tuple holding seven elements, which may be of different types.
Parameters
| name | type | default | description |
|---|---|---|---|
| item1 | T1 | — | The first element. |
| item2 | T2 | — | The second element. |
| item3 | T3 | — | The third element. |
| item4 | T4 | — | The fourth element. |
| item5 | T5 | — | The fifth element. |
| item6 | T6 | — | The sixth element. |
| item7 | T7 | — | The seventh element. |
Returns
| result | (T1, T2, T3, T4, T5, T6, T7) |
Overload 9 of 9
Create -> ValueTuple<T1, T2, T3, T4, T5, T6, T7, (T8)>
item1: T1
item2: T2
item3: T3
item4: T4
item5: T5
item6: T6
item7: T7
item8: T8ValueTuple<T1, T2, T3, T4, T5, T6, T7, ValueTuple<T8>> Create(
T1 item1,
T2 item2,
T3 item3,
T4 item4,
T5 item5,
T6 item6,
T7 item7,
T8 item8)Makes a tuple holding eight elements, which may be of different types.
Parameters
| name | type | default | description |
|---|---|---|---|
| item1 | T1 | — | The first element. |
| item2 | T2 | — | The second element. |
| item3 | T3 | — | The third element. |
| item4 | T4 | — | The fourth element. |
| item5 | T5 | — | The fifth element. |
| item6 | T6 | — | The sixth element. |
| item7 | T7 | — | The seventh element. |
| item8 | T8 | — | The eighth element. |
Returns
| result | ValueTuple<T1, T2, T3, T4, T5, T6, T7, (T8)> |
Remarks
The eighth element is stored in a nested one-element tuple (the Rest field), as every tuple of more than seven elements is; ValueTupleRoutines.Length, ValueTupleRoutines.Get and ValueTupleRoutines.ToArray look through the nesting and count it as eight elements.
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Value Tuple Routines
- Package
- Standard Library
Equals
FunctionWhether two tuples of the same type hold equal elements, position by position, using each element type's default equality.
Equals(left: TTuple, right: TTuple) -> Truth
bool Equals(TTuple left, TTuple right)
Parameters
| name | type | default | description |
|---|---|---|---|
| left | TTuple | — | The first tuple. |
| right | TTuple | — | The second tuple. |
Returns
| result | Truth |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Value Tuple Routines
- Package
- Standard Library
Format
FunctionWrites a tuple as text, its elements separated by commas inside parentheses, for example (1, apple, True).
Format(tuple: Any) -> Text
string Format(object tuple)
Parameters
| name | type | default | description |
|---|---|---|---|
| tuple | Any | — | The tuple to write. Null throws System.ArgumentNullException and a value that is not a tuple throws System.ArgumentException. |
Returns
| result | Text |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Value Tuple Routines
- Package
- Standard Library
Get
FunctionThe element at a position in a tuple, counting from zero; use ValueTupleRoutines.TryGet when the position may be out of range.
Get(tuple: Any, index: Integer) -> Any
object Get(object tuple, int index)
Parameters
| name | type | default | description |
|---|---|---|---|
| tuple | Any | — | The tuple to read. Null throws System.ArgumentNullException and a value that is not a tuple throws System.ArgumentException. |
| index | Integer | — | The zero-based position; a position below zero or at or past the tuple's length throws System.IndexOutOfRangeException. |
Returns
| result | Any |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Value Tuple Routines
- Package
- Standard Library
Hash
FunctionA hash code combining the tuple's elements, so equal tuples get equal codes; use it for bucketing or quick inequality checks.
Hash(tuple: Any) -> Integer
int Hash(object tuple)
Parameters
| name | type | default | description |
|---|---|---|---|
| tuple | Any | — | The tuple to hash; null answers 0. |
Returns
| result | Integer |
Remarks
The code is randomised per process, so do not store it or compare it across runs. This does not check that the value is a tuple: any other value answers its own hash code.
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Value Tuple Routines
- Package
- Standard Library
Is Tuple
FunctionWhether Value is a tuple, so the other tuple routines can read it.
IsTuple(value: Any) -> Truth
bool IsTuple(object value)
Parameters
| name | type | default | description |
|---|---|---|---|
| value | Any | — | The value to check; null answers false. |
Returns
| result | Truth |
Remarks
This accepts any value that exposes its elements by position, which includes the older reference-type System.Tuple classes as well as value tuples; ValueTupleRoutines.IsTupleType is stricter and accepts only value tuple types.
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Value Tuple Routines
- Package
- Standard Library
Is Tuple Type
FunctionWhether Type is a value tuple type of any size, from the empty tuple up to seven elements plus a nested rest; for checking a type before you have a value of it.
IsTupleType(type: Type) -> Truth
bool IsTupleType(Type type)
Parameters
| name | type | default | description |
|---|---|---|---|
| type | Type | — | The type to check; null answers false. The reference-type System.Tuple classes answer false. |
Returns
| result | Truth |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Value Tuple Routines
- Package
- Standard Library
Length
FunctionHow many elements a tuple holds, counting through the nested rest of a tuple with more than seven elements.
Length(tuple: Any) -> Integer
int Length(object tuple)
Parameters
| name | type | default | description |
|---|---|---|---|
| tuple | Any | — | The tuple to measure. Null throws System.ArgumentNullException and a value that is not a tuple throws System.ArgumentException. |
Returns
| result | Integer |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Value Tuple Routines
- Package
- Standard Library
Structural Compare
FunctionOrders two tuples element by element like ValueTupleRoutines.Compare, with Comparer ordering each pair of elements, for example to sort text elements case-insensitively.
StructuralCompare -> Integer
left: Any
right: Any
comparer: IComparerint StructuralCompare(
object left,
object right,
IComparer comparer)Parameters
| name | type | default | description |
|---|---|---|---|
| left | Any | — | The first tuple; null or a value that does not support structural comparison throws System.ArgumentException. |
| right | Any | — | The second tuple; null sorts before any tuple, and a tuple of a different type throws System.ArgumentException. |
| comparer | IComparer | — | The comparer that orders each pair of elements; null throws System.ArgumentNullException. |
Returns
| result | Integer |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Value Tuple Routines
- Package
- Standard Library
Structural Equals
FunctionWhether two tuples hold equal elements, position by position, with Comparer deciding each pair, for example to compare text elements case-insensitively.
StructuralEquals -> Truth
left: Any
right: Any
comparer: IEqualityComparerbool StructuralEquals(
object left,
object right,
IEqualityComparer comparer)Parameters
| name | type | default | description |
|---|---|---|---|
| left | Any | — | The first tuple; null or a value that does not support structural comparison throws System.ArgumentException. |
| right | Any | — | The second tuple; null, or a tuple of a different type, answers false. |
| comparer | IEqualityComparer | — | The comparer that decides whether two elements are equal; null throws System.ArgumentNullException. |
Returns
| result | Truth |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Value Tuple Routines
- Package
- Standard Library
Structural Hash
FunctionA hash code for a tuple in which each element is hashed by Comparer, to pair with ValueTupleRoutines.StructuralEquals using the same comparer, for example to treat text elements case-insensitively.
StructuralHash -> Integer
tuple: Any
comparer: IEqualityComparerint StructuralHash(object tuple, IEqualityComparer comparer)
Parameters
| name | type | default | description |
|---|---|---|---|
| tuple | Any | — | The tuple to hash; null or a value that does not support structural comparison throws System.ArgumentException. |
| comparer | IEqualityComparer | — | The comparer that hashes each element; null throws System.ArgumentNullException. |
Returns
| result | Integer |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Value Tuple Routines
- Package
- Standard Library
To Array
FunctionCopies a tuple's elements into a new array in order, so they can be handled as a list.
ToArray(tuple: Any) -> Any Array
object[] ToArray(object tuple)
Parameters
| name | type | default | description |
|---|---|---|---|
| tuple | Any | — | The tuple to copy. Null throws System.ArgumentNullException and a value that is not a tuple throws System.ArgumentException. |
Returns
| result | Any Array |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Value Tuple Routines
- Package
- Standard Library
Try Get
FunctionReads the element at a position in a tuple without throwing, telling you whether there was one.
TryGet -> (result: Truth, value: Any)
tuple: Any
index: Integerbool TryGet(object tuple, int index, out object value)
Parameters
| name | type | default | description |
|---|---|---|---|
| tuple | Any | — | The tuple to read; null or a value that is not a tuple answers false. |
| index | Integer | — | The zero-based position; out of range answers false. |
Returns
| result | Truth |
| value | Any |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Value Tuple Routines
- Package
- Standard Library
Validate Tuple
FunctionChecks that a value is a tuple and throws if it is not, so a graph fails at a clear point instead of further on.
ValidateTuple(tuple: Any)
void ValidateTuple(object tuple)
Parameters
| name | type | default | description |
|---|---|---|---|
| tuple | Any | — | The value to check. Null throws System.ArgumentNullException and a value that is not a tuple throws System.ArgumentException. |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Value Tuple Routines
- Package
- Standard Library