UNPKG
lean4-code-actions
Version:
latest (1.1.32)
1.1.32
Refactorings and snippets for Lean 4
lean4-code-actions
/
libs
/
utils
/
arithmetic
/
compare.ts
7 lines
(5 loc)
•
224 B
text/typescript
View Raw
1
2
3
4
5
6
7
import
{
BasicArithmetic
}
from
'../arithmetic'
/** * This function should be passed to array.sort() */
export
const
compare = <N>
(
{ gt, lt }: BasicArithmetic<N>
) =>
(
a: N, b: N
) =>
(
lt
(a, b)) ? -
1
: ((
gt
(a, b)) ?
1
:
0
)