mirror of
https://github.com/c-cube/sidekick.git
synced 2025-12-12 14:00:42 -05:00
improve zarith and backtrackable table
This commit is contained in:
parent
fbf7c5e090
commit
82acf271d3
3 changed files with 4 additions and 1 deletions
|
|
@ -16,6 +16,7 @@ module type S = sig
|
||||||
val remove : _ t -> key -> unit
|
val remove : _ t -> key -> unit
|
||||||
val push_level : _ t -> unit
|
val push_level : _ t -> unit
|
||||||
val pop_levels : _ t -> int -> unit
|
val pop_levels : _ t -> int -> unit
|
||||||
|
val n_levels : _ t -> int
|
||||||
end
|
end
|
||||||
|
|
||||||
module type ARG = sig
|
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] iter f self = M.iter f self.tbl
|
||||||
let[@inline] push_level self = BS.push_level self.undo
|
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] 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 =
|
let add self k v : unit =
|
||||||
if BS.n_levels self.undo > 0 then (
|
if BS.n_levels self.undo > 0 then (
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ module type S = sig
|
||||||
val remove : _ t -> key -> unit
|
val remove : _ t -> key -> unit
|
||||||
val push_level : _ t -> unit
|
val push_level : _ t -> unit
|
||||||
val pop_levels : _ t -> int -> unit
|
val pop_levels : _ t -> int -> unit
|
||||||
|
val n_levels : _ t -> int
|
||||||
end
|
end
|
||||||
|
|
||||||
module type ARG = sig
|
module type ARG = sig
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ module Rational
|
||||||
include Q
|
include Q
|
||||||
let denum = den
|
let denum = den
|
||||||
let pp = pp_print
|
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 infinity = Q.inf
|
||||||
let minus_infinity = Q.minus_inf
|
let minus_infinity = Q.minus_inf
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue