title: map2 in scala in Exception Handling
body: <pre><code>def map[B] (f: A=&gt;B) : Option[B]
  
  def flatMap[B] (f: A=&gt;Option[B]) : Option[B] 
  
  def map2[A,B,C] (ao: Option[A], bo: Option[B]) (f: (A,B) =&gt; C) :Option[C] =
  ao.flatMap(aa=&gt;
    bo.map(bb=&gt;
      (f(aa,bb))))
  </code></pre>
  
  <p>Here is the definition of map and flatMap in Exception Handling and I have this map2 formed on the basis of map and flatMap. It is really hard to understand the formation of map2. Can some one explain the role of flatMap and map in map2. Thank you</p>