The tuple! datatype is used to represent rgb and rgba color values, ip addresses, and version numbers.
A tuple! must have at least two decimal points and the digits must be positive integers in the range 0 - 255.
Tuple! is a member of the following typesets: immediate!, scalar!
A sequence of three to twelve positive integers separated by decimal points.
1.2.3
255.255.255.0
1.2.3.4.5.6.7.8.9.10.11.12
Tuple values can be created using literal syntax, or at runtime by using a make constructor or to conversion.
>> make tuple! [1 2 3]
== 1.2.3>> to tuple! [42]
== 42.0.0
>> to tuple! [1 2 3]
== 1.2.3All comparators can be applied on tuple!: =, ==, <>, >, <, >=, <=, =?. In addition, min, and max are also supported.
min and max when applied to two tuple! arguments require tuples of the same size.
>> min 1.2.3 4.5.6
== 1.2.3
>> max 1.2.3 4.5.6
== 4.5.6+, -, *, /, %, //, add, subtract, multiply, divide, remainder, and mod can be used with tuple! values.
If the result of the arithmetic falls outside of the range 0 - 255, the result will be cut off at 0 or 255.
>> gray
== 128.128.128
>> gray * 2
== 255.255.255Use tuple? to check if a value is of the tuple! datatype.
>> tuple? 1.2.3
== trueUse type? to return the datatype of a given value.
>> type? 1.2.3
== tuple!