mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 19:25:28 -05:00
update header, and use more (==) in CCIntMap
This commit is contained in:
parent
d135f73c76
commit
48bb1e24c6
2 changed files with 9 additions and 49 deletions
|
|
@ -1,27 +1,5 @@
|
||||||
(*
|
|
||||||
copyright (c) 2013-2015, simon cruanes
|
|
||||||
all rights reserved.
|
|
||||||
|
|
||||||
redistribution and use in source and binary forms, with or without
|
(* This file is free software, part of containers. See file "license" for more details. *)
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
redistributions of source code must retain the above copyright notice, this
|
|
||||||
list of conditions and the following disclaimer. redistributions in binary
|
|
||||||
form must reproduce the above copyright notice, this list of conditions and the
|
|
||||||
following disclaimer in the documentation and/or other materials provided with
|
|
||||||
the distribution.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*)
|
|
||||||
|
|
||||||
(** {1 Map specialized for Int keys} *)
|
(** {1 Map specialized for Int keys} *)
|
||||||
|
|
||||||
|
|
@ -259,7 +237,7 @@ let update k f t =
|
||||||
|
|
||||||
let doubleton k1 v1 k2 v2 = add k1 v1 (singleton k2 v2)
|
let doubleton k1 v1 k2 v2 = add k1 v1 (singleton k2 v2)
|
||||||
|
|
||||||
let rec equal ~eq a b = match a, b with
|
let rec equal ~eq a b = a==b || match a, b with
|
||||||
| E, E -> true
|
| E, E -> true
|
||||||
| L (ka, va), L (kb, vb) -> ka = kb && eq va vb
|
| L (ka, va), L (kb, vb) -> ka = kb && eq va vb
|
||||||
| N (pa, sa, la, ra), N (pb, sb, lb, rb) ->
|
| N (pa, sa, la, ra), N (pb, sb, lb, rb) ->
|
||||||
|
|
@ -308,7 +286,9 @@ let choose t =
|
||||||
try Some (choose_exn t)
|
try Some (choose_exn t)
|
||||||
with Not_found -> None
|
with Not_found -> None
|
||||||
|
|
||||||
let rec union f t1 t2 = match t1, t2 with
|
let rec union f t1 t2 =
|
||||||
|
if t1==t2 then t1
|
||||||
|
else match t1, t2 with
|
||||||
| E, o | o, E -> o
|
| E, o | o, E -> o
|
||||||
| L (k, v), o
|
| L (k, v), o
|
||||||
| o, L (k, v) ->
|
| o, L (k, v) ->
|
||||||
|
|
@ -361,7 +341,9 @@ let rec union f t1 t2 = match t1, t2 with
|
||||||
equal ~eq:(=) (of_list l) (union (fun _ a _ -> a) (of_list l)(of_list l)))
|
equal ~eq:(=) (of_list l) (union (fun _ a _ -> a) (of_list l)(of_list l)))
|
||||||
*)
|
*)
|
||||||
|
|
||||||
let rec inter f a b = match a, b with
|
let rec inter f a b =
|
||||||
|
if a==b then a
|
||||||
|
else match a, b with
|
||||||
| E, _ | _, E -> E
|
| E, _ | _, E -> E
|
||||||
| L (k, v), o
|
| L (k, v), o
|
||||||
| o, L (k, v) ->
|
| o, L (k, v) ->
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,5 @@
|
||||||
(*
|
|
||||||
copyright (c) 2013-2015, simon cruanes
|
|
||||||
all rights reserved.
|
|
||||||
|
|
||||||
redistribution and use in source and binary forms, with or without
|
(* This file is free software, part of containers. See file "license" for more details. *)
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
redistributions of source code must retain the above copyright notice, this
|
|
||||||
list of conditions and the following disclaimer. redistributions in binary
|
|
||||||
form must reproduce the above copyright notice, this list of conditions and the
|
|
||||||
following disclaimer in the documentation and/or other materials provided with
|
|
||||||
the distribution.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*)
|
|
||||||
|
|
||||||
(** {1 Map specialized for Int keys}
|
(** {1 Map specialized for Int keys}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue