- (fun (n1,(o1,a1,go1,p1,d1)) (n2,(o2,a2,go2,p2,d2)) ->
- Pervasives.compare
- (a1,o1,go1,p1,d1) (a2,o2,go2,p2,d2))
+ (fun ((_,n1),(o1,a1,go1,p1,_)) ((_,n2),(o2,a2,go2,p2,_)) ->
+ if a1 = 0 && a2 = 0 then 0
+ else if a1 = 0 then -1
+ else if a2 = 0 then 1
+ else let res = Pervasives.compare (a1,o1,-go1,p1) (a2,o2,-go2,p2)
+ in if res = 0 then Pervasives.compare (HExtlib.list_index ((=) n1) oplist) (HExtlib.list_index ((=) n2) oplist)
+ else res)