Handbook
Glossary
define-sorting ( NAME QUOT -- )
Vocabulary
sorting
.
functor
Inputs
NAME
an
object
QUOT
an
object
Outputs
None
Definition
USING:
functors.backend
functors.private
io
io.streams.string
math.order
parser
present
sequences
;
IN:
sorting.functor
::
define-sorting
( NAME QUOT -- )
[
NAME
present
write
"<=>"
write
]
with-string-writer
create-word-in
:>
NAME<=>
[
NAME
present
write
">=<"
write
]
with-string-writer
create-word-in
:>
NAME>=< NAME<=>
T{
fake-quotation
{
seq
{
QUOT
compare
}
}
}
fake-quotations>
first
( obj1 obj2 -- <=> )
define-declared*
NAME>=<
T{
fake-quotation
{
seq
{
NAME<=>
invert-comparison
}
}
}
fake-quotations>
first
( obj1 obj2 -- >=< )
define-declared*
;