add >=< word to math.order
parent
3026f1c8e3
commit
076b2d0893
|
@ -15,6 +15,12 @@ HELP: <=>
|
|||
}
|
||||
} ;
|
||||
|
||||
HELP: >=<
|
||||
{ $values { "obj1" object } { "obj2" object } { ">=<" "an ordering specifier" } }
|
||||
{ $description "Compares two objects using the " { $link <=> } " comparator and inverts the output." } ;
|
||||
|
||||
{ <=> >=< } related-words
|
||||
|
||||
HELP: +lt+
|
||||
{ $description "Output by " { $link <=> } " when the first object is strictly less than the second object." } ;
|
||||
|
||||
|
@ -85,6 +91,7 @@ ARTICLE: "order-specifiers" "Ordering specifiers"
|
|||
ARTICLE: "math.order" "Linear order protocol"
|
||||
"Some classes have an intrinsic order amongst instances:"
|
||||
{ $subsection <=> }
|
||||
{ $subsection >=< }
|
||||
{ $subsection compare }
|
||||
{ $subsection invert-comparison }
|
||||
"The above words output order specifiers."
|
||||
|
|
|
@ -13,6 +13,8 @@ SYMBOL: +gt+
|
|||
|
||||
GENERIC: <=> ( obj1 obj2 -- <=> )
|
||||
|
||||
: >=< ( obj1 obj2 -- >=< ) <=> invert-comparison ; inline
|
||||
|
||||
M: real <=> 2dup < [ 2drop +lt+ ] [ number= +eq+ +gt+ ? ] if ;
|
||||
|
||||
GENERIC: before? ( obj1 obj2 -- ? )
|
||||
|
|
Loading…
Reference in New Issue