diff --git a/core/math/order/order-docs.factor b/core/math/order/order-docs.factor index 4c5bc381cc..efce6c3570 100644 --- a/core/math/order/order-docs.factor +++ b/core/math/order/order-docs.factor @@ -31,8 +31,7 @@ HELP: +gt+ { $description "Output by " { $link <=> } " when the first object is strictly greater than the second object." } ; HELP: invert-comparison -{ $values { "<=>" symbol } - { "<=>'" symbol } } +{ $values { "<=>" symbol } { ">=<" symbol } } { $description "Invert the comparison symbol returned by " { $link <=> } "." } { $examples { $example "USING: math.order prettyprint ;" "+lt+ invert-comparison ." "+gt+" } } ; diff --git a/core/math/order/order.factor b/core/math/order/order.factor index b39b81ba2f..4598d19d35 100644 --- a/core/math/order/order.factor +++ b/core/math/order/order.factor @@ -7,7 +7,7 @@ SYMBOL: +lt+ SYMBOL: +eq+ SYMBOL: +gt+ -: invert-comparison ( <=> -- <=>' ) +: invert-comparison ( <=> -- >=< ) #! Can't use case, index or nth here dup +lt+ eq? [ drop +gt+ ] [ +eq+ eq? +eq+ +lt+ ? ] if ; @@ -19,10 +19,10 @@ GENERIC: <=> ( obj1 obj2 -- <=> ) ! Defining a math generic for comparison forces a single math ! promotion, and speeds up comparisons on numbers. -: (real<=>) ( x y -- ? ) +: (real<=>) ( x y -- <=> ) 2dup < [ 2drop +lt+ ] [ number= +eq+ +gt+ ? ] if ; inline -MATH: real<=> ( x y -- ? ) +MATH: real<=> ( x y -- <=> ) M: fixnum real<=> { fixnum fixnum } declare (real<=>) ; inline M: bignum real<=> { bignum bignum } declare (real<=>) ; inline M: float real<=> { float float } declare (real<=>) ; inline