title: Modify an element in Map
body: <p>I have defined some types as follows:</p>
  
  <pre><code>module SMap = Map.Make(String)
  
  type s = 
    { t: int
      fa: int list } 
  
  type t = s SMap.t
  </code></pre>
  
  <p>I would like to write a function <code>modify</code> to add <code>100</code> to the list <code>fa</code> for the element corresponding to <code>key</code>. The following code works:</p>
  
  <pre><code>let modify (key: String) (x: t) =
    let a = SMap.find key x in
    SMap.add key { a with fa = a.fa @ [100] } (SMap.remove key x)
  </code></pre>
  
  <p>However, removing and adding an element looks redundant for me... Could any tell me if there is a better way to directly modify it?</p>