Hi,
Does anyone know how Haskell’s tuple ordering works?
Presumably for some tuple T1 (x1,x2,...xn) and another tuple T2 (y1,y2,...yn)
Haskell would compare T1 and T2 as follows:
T1 < T2 if:
x1 < y1 OR otherwise if x1 == y1 then if
x2 < y2 OR otherwise if x2 == y2 then if
x3 < y3 OR otherwise etc
xn < yn OR otherwise both tuple are equal
In other words my best guess is that the ordering of tuples
is by comparing the first tuple elements and then the seconds, thirds etc,
until there’s an element less than another.
Is this reasoning correct?
So minimum xs
would yield the “smallest” tuple (according to
the above rules and if xs is a list of tuples)?
Cheers,
Mark Spezzano