Signed-off-by: Matthias Goergens <Matthias.Goergens@citrix.com>
| a::_ -> Some a
| [] -> None
+let make_assoc op l = map (fun item -> item, op item) l
+
let rec replace_assoc key new_value = function
| [] -> []
| (k, _) as p :: tl ->
else
p :: replace_assoc key new_value tl
+let make_assoc op l = map (fun item -> item, op item) l
+
end
(** Replace the value belonging to a key in an association list. *)
val replace_assoc : 'a -> 'b -> ('a * 'b) list -> ('a * 'b) list
+
+ val make_assoc : ('a -> 'b) -> 'a list -> ('a * 'b) list
end