-
-(*
-module DiscriminationTree = struct
- type key = path_string
- type t = Node of PosEqSet.t option * (t PSMap.t)
-
- let empty = Node (None, PSMap.empty)
-
- let rec find l t =
- match (l, t) with
- | [], Node (None, _) -> raise Not_found
- | [], Node (Some v, _) -> v
- | x::r, Node (_, m) -> find r (PSMap.find x m)
-
- let rec mem l t =
- match (l, t) with
- | [], Node (None, _) -> false
- | [], Node (Some _, _) -> true
- | x::r, Node (_, m) -> try mem r (PSMap.find x m) with Not_found -> false
-
- let add l v t =
- let rec ins = function
- | [], Node (_, m) -> Node (Some v, m)
- | x::r, Node (v, m) ->
- let t' = try PSMap.find x m with Not_found -> empty in
- let t'' = ins (r, t') in
- Node (v, PSMap.add x t'' m)
- in
- ins (l, t)
-
- let rec remove l t =
- match (l, t) with
- | [], Node (_, m) -> Node (None, m)
- | x::r, Node (v, m) ->
- try
- let t' = remove r (PSMap.find x m) in
- let m' = if t' = empty then PSMap.remove x m else PSMap.add x t' m in
- Node (v, m')
- with Not_found ->
- t
-
- let rec fold f t acc =
- let rec traverse revp t acc = match t with
- | Node (None, m) ->
- PSMap.fold (fun x -> traverse (x::revp)) m acc
- | Node (Some v, m) ->
- f (List.rev revp) v (PSMap.fold (fun x -> traverse (x::revp)) m acc)
- in
- traverse [] t acc
-
-end
-*)
-