math.order: better docs
parent
e5731dc01f
commit
e6c551a652
|
@ -20,10 +20,6 @@ ARTICLE: "arithmetic-functions" "Arithmetic functions"
|
||||||
"Computing additive and multiplicative inverses:"
|
"Computing additive and multiplicative inverses:"
|
||||||
{ $subsection neg }
|
{ $subsection neg }
|
||||||
{ $subsection recip }
|
{ $subsection recip }
|
||||||
"Minimum, maximum, clamping:"
|
|
||||||
{ $subsection min }
|
|
||||||
{ $subsection max }
|
|
||||||
{ $subsection clamp }
|
|
||||||
"Complex conjugation:"
|
"Complex conjugation:"
|
||||||
{ $subsection conjugate }
|
{ $subsection conjugate }
|
||||||
"Tests:"
|
"Tests:"
|
||||||
|
@ -41,7 +37,8 @@ ARTICLE: "arithmetic-functions" "Arithmetic functions"
|
||||||
{ $subsection truncate }
|
{ $subsection truncate }
|
||||||
{ $subsection round }
|
{ $subsection round }
|
||||||
"Inexact comparison:"
|
"Inexact comparison:"
|
||||||
{ $subsection ~ } ;
|
{ $subsection ~ }
|
||||||
|
"Numbers implement the " { $link "math.order" } ", therefore operations such as " { $link min } " and " { $link max } " can be used with numbers." ;
|
||||||
|
|
||||||
ARTICLE: "power-functions" "Powers and logarithms"
|
ARTICLE: "power-functions" "Powers and logarithms"
|
||||||
"Squares:"
|
"Squares:"
|
||||||
|
|
|
@ -44,39 +44,41 @@ HELP: compare
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
HELP: max
|
HELP: max
|
||||||
{ $values { "x" real } { "y" real } { "z" real } }
|
{ $values { "x" object } { "y" object } { "z" object } }
|
||||||
{ $description "Outputs the greatest of two real numbers." } ;
|
{ $description "Outputs the greatest of two ordered values." }
|
||||||
|
{ $notes "If one value is a floating point positive zero and the other is a negative zero, the result is undefined." } ;
|
||||||
|
|
||||||
HELP: min
|
HELP: min
|
||||||
{ $values { "x" real } { "y" real } { "z" real } }
|
{ $values { "x" object } { "y" object } { "z" object } }
|
||||||
{ $description "Outputs the smallest of two real numbers." } ;
|
{ $description "Outputs the smallest of two ordered values." }
|
||||||
|
{ $notes "If one value is a floating point positive zero and the other is a negative zero, the result is undefined." } ;
|
||||||
|
|
||||||
HELP: clamp
|
HELP: clamp
|
||||||
{ $values { "x" real } { "min" real } { "max" real } { "y" real } }
|
{ $values { "x" object } { "min" object } { "max" object } { "y" object } }
|
||||||
{ $description "Outputs " { $snippet "x" } " if contained in the interval " { $snippet "[min,max]" } " or outputs one of the endpoints." } ;
|
{ $description "Outputs " { $snippet "x" } " if contained in the interval " { $snippet "[min,max]" } " or outputs one of the endpoints." } ;
|
||||||
|
|
||||||
HELP: between?
|
HELP: between?
|
||||||
{ $values { "x" real } { "y" real } { "z" real } { "?" "a boolean" } }
|
{ $values { "x" object } { "y" object } { "z" real } { "?" "a boolean" } }
|
||||||
{ $description "Tests if " { $snippet "x" } " is in the interval " { $snippet "[y,z]" } "." }
|
{ $description "Tests if " { $snippet "x" } " is in the interval " { $snippet "[y,z]" } "." }
|
||||||
{ $notes "As per the closed interval notation, the end-points are included in the interval." } ;
|
{ $notes "As per the closed interval notation, the end-points are included in the interval." } ;
|
||||||
|
|
||||||
HELP: before?
|
HELP: before?
|
||||||
{ $values { "obj1" "an object" } { "obj2" "an object" } { "?" "a boolean" } }
|
{ $values { "obj1" object } { "obj2" object } { "?" "a boolean" } }
|
||||||
{ $description "Tests if " { $snippet "obj1" } " comes before " { $snippet "obj2" } " using an intrinsic total order." }
|
{ $description "Tests if " { $snippet "obj1" } " comes before " { $snippet "obj2" } " using an intrinsic total order." }
|
||||||
{ $notes "Implemented using " { $link <=> } "." } ;
|
{ $notes "Implemented using " { $link <=> } "." } ;
|
||||||
|
|
||||||
HELP: after?
|
HELP: after?
|
||||||
{ $values { "obj1" "an object" } { "obj2" "an object" } { "?" "a boolean" } }
|
{ $values { "obj1" object } { "obj2" object } { "?" "a boolean" } }
|
||||||
{ $description "Tests if " { $snippet "obj1" } " comes after " { $snippet "obj2" } " using an intrinsic total order." }
|
{ $description "Tests if " { $snippet "obj1" } " comes after " { $snippet "obj2" } " using an intrinsic total order." }
|
||||||
{ $notes "Implemented using " { $link <=> } "." } ;
|
{ $notes "Implemented using " { $link <=> } "." } ;
|
||||||
|
|
||||||
HELP: before=?
|
HELP: before=?
|
||||||
{ $values { "obj1" "an object" } { "obj2" "an object" } { "?" "a boolean" } }
|
{ $values { "obj1" object } { "obj2" object } { "?" "a boolean" } }
|
||||||
{ $description "Tests if " { $snippet "obj1" } " comes before or equals " { $snippet "obj2" } " using an intrinsic total order." }
|
{ $description "Tests if " { $snippet "obj1" } " comes before or equals " { $snippet "obj2" } " using an intrinsic total order." }
|
||||||
{ $notes "Implemented using " { $link <=> } "." } ;
|
{ $notes "Implemented using " { $link <=> } "." } ;
|
||||||
|
|
||||||
HELP: after=?
|
HELP: after=?
|
||||||
{ $values { "obj1" "an object" } { "obj2" "an object" } { "?" "a boolean" } }
|
{ $values { "obj1" object } { "obj2" object } { "?" "a boolean" } }
|
||||||
{ $description "Tests if " { $snippet "obj1" } " comes after or equals " { $snippet "obj2" } " using an intrinsic total order." }
|
{ $description "Tests if " { $snippet "obj1" } " comes after or equals " { $snippet "obj2" } " using an intrinsic total order." }
|
||||||
{ $notes "Implemented using " { $link <=> } "." } ;
|
{ $notes "Implemented using " { $link <=> } "." } ;
|
||||||
|
|
||||||
|
@ -100,7 +102,7 @@ ARTICLE: "math.order.example" "Linear order example"
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
ARTICLE: "math.order" "Linear order protocol"
|
ARTICLE: "math.order" "Linear order protocol"
|
||||||
"Some classes have an intrinsic order amongst instances:"
|
"Some classes define an intrinsic order amongst instances. This includes numbers, sequences (in particular, strings), and words."
|
||||||
{ $subsection <=> }
|
{ $subsection <=> }
|
||||||
{ $subsection >=< }
|
{ $subsection >=< }
|
||||||
{ $subsection compare }
|
{ $subsection compare }
|
||||||
|
@ -112,6 +114,10 @@ ARTICLE: "math.order" "Linear order protocol"
|
||||||
{ $subsection before? }
|
{ $subsection before? }
|
||||||
{ $subsection after=? }
|
{ $subsection after=? }
|
||||||
{ $subsection before=? }
|
{ $subsection before=? }
|
||||||
|
"Minimum, maximum, clamping:"
|
||||||
|
{ $subsection min }
|
||||||
|
{ $subsection max }
|
||||||
|
{ $subsection clamp }
|
||||||
"Out of the above generic words, it suffices to implement " { $link <=> } " alone. The others may be provided as an optimization."
|
"Out of the above generic words, it suffices to implement " { $link <=> } " alone. The others may be provided as an optimization."
|
||||||
{ $subsection "math.order.example" }
|
{ $subsection "math.order.example" }
|
||||||
{ $see-also "sequences-sorting" } ;
|
{ $see-also "sequences-sorting" } ;
|
||||||
|
|
Loading…
Reference in New Issue