let rec compare_aux e1 e2 =
match (e1, e2) with
(End, End) -> 0
| (End, _) -> -1
| (_, End) -> 1
| (More(v1, r1, e1), More(v2, r2, e2)) ->
let c = Ord.compare v1 v2 in
if c <> 0
then c
else compare_aux (cons_enum r1 e1) (cons_enum r2 e2)