improve zarith and backtrackable table

This commit is contained in:
Simon Cruanes 2022-02-08 13:12:07 -05:00
parent fbf7c5e090
commit 82acf271d3
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
3 changed files with 4 additions and 1 deletions

View file

@ -16,6 +16,7 @@ module type S = sig
val remove : _ t -> key -> unit
val push_level : _ t -> unit
val pop_levels : _ t -> int -> unit
val n_levels : _ t -> int
end
module type ARG = sig
@ -49,6 +50,7 @@ module Make(A : ARG) = struct
let[@inline] iter f self = M.iter f self.tbl
let[@inline] push_level self = BS.push_level self.undo
let[@inline] pop_levels self n = BS.pop_levels self.undo n ~f:(apply_undo self)
let[@inline] n_levels self = BS.n_levels self.undo
let add self k v : unit =
if BS.n_levels self.undo > 0 then (

View file

@ -18,6 +18,7 @@ module type S = sig
val remove : _ t -> key -> unit
val push_level : _ t -> unit
val pop_levels : _ t -> int -> unit
val n_levels : _ t -> int
end
module type ARG = sig

View file

@ -19,7 +19,7 @@ module Rational
include Q
let denum = den
let pp = pp_print
let hash a = Hashtbl.hash (Z.hash (num a), Z.hash (den a))
let hash a = CCHash.combine2 (Z.hash (num a)) (Z.hash (den a))
let infinity = Q.inf
let minus_infinity = Q.minus_inf