mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
feat(bv): add equal
This commit is contained in:
parent
6ace6f71e0
commit
1b0639886d
2 changed files with 16 additions and 0 deletions
|
|
@ -228,6 +228,18 @@ let clear bv =
|
||||||
assert_bool "must be empty" (CCBV.is_empty bv);
|
assert_bool "must be empty" (CCBV.is_empty bv);
|
||||||
*)
|
*)
|
||||||
|
|
||||||
|
let equal x y : bool =
|
||||||
|
x.size = y.size &&
|
||||||
|
x.a = y.a
|
||||||
|
|
||||||
|
(*$T
|
||||||
|
equal (of_list [1; 3; 4]) (of_list [1; 3; 4])
|
||||||
|
equal (empty()) (empty())
|
||||||
|
not (equal (empty ()) (of_list [1]))
|
||||||
|
not (equal (empty ()) (of_list [2; 5]))
|
||||||
|
not (equal (of_list [1;3]) (of_list [2; 3]))
|
||||||
|
*)
|
||||||
|
|
||||||
let iter bv f =
|
let iter bv f =
|
||||||
let len = array_length_of_size bv.size in
|
let len = array_length_of_size bv.size in
|
||||||
assert (len <= Array.length bv.a);
|
assert (len <= Array.length bv.a);
|
||||||
|
|
|
||||||
|
|
@ -135,6 +135,10 @@ val select : t -> 'a array -> 'a list
|
||||||
val selecti : t -> 'a array -> ('a * int) list
|
val selecti : t -> 'a array -> ('a * int) list
|
||||||
(** Same as {!select}, but selected elements are paired with their indexes. *)
|
(** Same as {!select}, but selected elements are paired with their indexes. *)
|
||||||
|
|
||||||
|
val equal : t -> t -> bool
|
||||||
|
(** Bitwise comparison, including the size ([equal a b] implies [length a=length b]).
|
||||||
|
@since NEXT_RELEASE *)
|
||||||
|
|
||||||
type 'a iter = ('a -> unit) -> unit
|
type 'a iter = ('a -> unit) -> unit
|
||||||
|
|
||||||
val to_iter : t -> int iter
|
val to_iter : t -> int iter
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue