39348
|
1 |
(* ========================================================================= *)
|
|
2 |
(* ORDERED TYPES *)
|
72004
|
3 |
(* Copyright (c) 2004 Joe Leslie-Hurd, distributed under the BSD License *)
|
39348
|
4 |
(* ========================================================================= *)
|
|
5 |
|
|
6 |
structure IntOrdered =
|
|
7 |
struct type t = int val compare = Int.compare end;
|
|
8 |
|
|
9 |
structure IntPairOrdered =
|
|
10 |
struct
|
|
11 |
|
|
12 |
type t = int * int;
|
|
13 |
|
|
14 |
fun compare ((i1,j1),(i2,j2)) =
|
|
15 |
case Int.compare (i1,i2) of
|
|
16 |
LESS => LESS
|
|
17 |
| EQUAL => Int.compare (j1,j2)
|
|
18 |
| GREATER => GREATER;
|
|
19 |
|
|
20 |
end;
|
|
21 |
|
|
22 |
structure StringOrdered =
|
|
23 |
struct type t = string val compare = String.compare end;
|