Tuple items

Uses Tuples

The first item of a tuple can be extracted as:
s1:𝕊, s2:𝕊, first((s1, s2)) : s1
s1:𝕊, s2:𝕊, s3:𝕊, first((s1, s2, s3)) : s1

The corresponding rules are:
s1_:𝕊, s2_:𝕊, first((v1:s1_, v2:s2_)) ⇒ v1
s1_:𝕊, s2_:𝕊, s3_:𝕊, first((v1:s1_, v2:s2_, v3:s3_)) ⇒ v1

The second item of a tuple can be extracted as:
s1:𝕊, s2:𝕊, second((s1, s2)) : s2
s1:𝕊, s2:𝕊, s3:𝕊, second((s1, s2, s3)) : s2

The corresponding rules are:
s1_:𝕊, s2_:𝕊, second((v1:s1_, v2:s2_)) ⇒ v2
s1_:𝕊, s2_:𝕊, s3_:𝕊, second((v1:s1_, v2:s2_, v3:s3_)) ⇒ v2

The third item of a tuple can be extracted as:
s1:𝕊, s2:𝕊, s3:𝕊, third((s1, s2, s3)) : s3

The corresponding rule is:
s1_:𝕊, s2_:𝕊, s3_:𝕊, third((v1:s1_, v2:s2_, v3:s3_)) ⇒ v3

Examples

Uses example Integers

Extracting the first element:
example first((1, 2)) ⇒ 1
example first((1, 2, 3)) ⇒ 1

Extracting the second element:
example second((1, 2)) ⇒ 2
example second((1, 2, 3)) ⇒ 2

Extracting the third element:
example third((1, 2, 3)) ⇒ 3