compare ( obj1 obj2 quot -- <=> )
Factor handbook » The language » Objects » Linear order protocol

Prev:>=< ( obj1 obj2 -- >=< )
Next:invert-comparison ( <=> -- >=< )


Vocabulary
math.order

Inputs
obj1an object
obj2an object
quota quotation with stack effect ( obj -- newobj )


Outputs
<=>an ordering specifier


Word description
Compares the results of applying the quotation to both objects via <=>.

Examples
USING: kernel math.order prettyprint sequences ; "hello" "hi" [ length ] compare .
+gt+


See also
sort, sort-by, inv-sort-by, sort-keys, sort-values

Definition


: compare ( obj1 obj2 quot -- <=> ) bi@ <=> ; inline