clarify doc for <= on tuple uses lexicographic order (#10069)

This commit is contained in:
Timothee Cour 2018-12-21 13:52:28 -08:00 • committed by Andreas Rumpf
commit 8aa5d126fe

View file

@ -2624,8 +2624,8 @@ proc `==`*[T: tuple|object](x, y: T): bool =
return true return true
proc `<=`*[T: tuple](x, y: T): bool = proc `<=`*[T: tuple](x, y: T): bool =
## generic ``<=`` operator for tuples that is lifted from the components ## generic lexicographic ``<=`` operator for tuples that is lifted from the
## of `x` and `y`. This implementation uses `cmp`. ## components of `x` and `y`. This implementation uses `cmp`.
for a, b in fields(x, y): for a, b in fields(x, y):
var c = cmp(a, b) var c = cmp(a, b)
if c < 0: return true if c < 0: return true
@ -2633,8 +2633,8 @@ proc `<=`*[T: tuple](x, y: T): bool =
return true return true
proc `<`*[T: tuple](x, y: T): bool = proc `<`*[T: tuple](x, y: T): bool =
## generic ``<`` operator for tuples that is lifted from the components ## generic lexicographic ``<`` operator for tuples that is lifted from the
## of `x` and `y`. This implementation uses `cmp`. ## components of `x` and `y`. This implementation uses `cmp`.
for a, b in fields(x, y): for a, b in fields(x, y):
var c = cmp(a, b) var c = cmp(a, b)
if c < 0: return true if c < 0: return true