Commit eb6ac8df by POTTIER Francois

Add [Misc.ListExtras.equal] and [Misc.ListExtras.hash].

parent 1829433a
......@@ -408,3 +408,9 @@ let once x y =
let result = !s in
s := y;
result
module ListExtras = struct
let equal = List.for_all2
let hash hash xs =
Hashtbl.hash (List.map hash xs)
end
......@@ -217,3 +217,11 @@ val dup: ('a -> 'a -> int) -> 'a list -> 'a option
is called and produces [y] forever thereafter. *)
val once: 'a -> 'a -> (unit -> 'a)
(* Equality and hashing for lists, parameterized over equality and hashing
for elements. *)
module ListExtras : sig
val equal: ('a -> 'a -> bool) -> 'a list -> 'a list -> bool
val hash: ('a -> int) -> 'a list -> int
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment