ocaml-batteries-team/batteries-included — pull request #349 by rixed (2013-01-10 21:19:50+00:00)
Title: Add modify

Add function to modify all available keyed containers.

These are :+1:
modify : key -> function from value to new value -> container -> unit
modify_def : default_value -> key -> function from value to new value -> container -> unit
modify_opt : key -> function from optional value to optional new value -> container -> unit

Hashtbl (and all its variants) also have :+1:

map_inplace, filteri_inplace, filter_inplace and filter_map_inplace wich performs as the not-inplace versions but changes the given hash instead of returning a new one (thus they return unit). This saves the allocation of the map.

I have a program that's 20% faster with all this :-)

I also made some cosmetics change here and there that I regrouped in the first comit.