Commit 1b09a292 authored by Pietro Abate's avatar Pietro Abate

Add mem function to SortedList.Map

parent 1c8eaf3c
......@@ -243,6 +243,12 @@ module Make(X : Custom.T) = struct
let add x v = union_disj [(x,v)]
let rec mem x l =
match l with
| [] -> false
| (t,_)::q ->
let c = X.compare x t in
(c = 0) || ((c > 0) && (mem x q))
let rec diff l1 l2 =
match (l1,l2) with
......
......@@ -33,6 +33,7 @@ sig
type 'a map
external get: 'a map -> (X.t * 'a) list = "%identity"
val add: X.t -> 'a -> 'a map -> 'a map
val mem: X.t -> 'a map -> bool
val length: 'a map -> int
val domain: 'a map -> t
val restrict: 'a map -> t -> 'a map
......
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