Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > ac00cb96767d9c54367b331f839b9a30 > files > 261

ocaml-batteries-2.1-3.mga4.x86_64.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<link rel="Start" href="index.html">
<link rel="previous" href="BatMap.Infix.html">
<link rel="Up" href="BatMap.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of class methods" rel=Appendix href="index_methods.html">
<link title="Index of classes" rel=Appendix href="index_classes.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Index of module types" rel=Appendix href="index_module_types.html">
<link title="BatArray" rel="Chapter" href="BatArray.html">
<link title="BatAvlTree" rel="Chapter" href="BatAvlTree.html">
<link title="BatBase64" rel="Chapter" href="BatBase64.html">
<link title="BatBig_int" rel="Chapter" href="BatBig_int.html">
<link title="BatBigarray" rel="Chapter" href="BatBigarray.html">
<link title="BatBitSet" rel="Chapter" href="BatBitSet.html">
<link title="BatBool" rel="Chapter" href="BatBool.html">
<link title="BatBounded" rel="Chapter" href="BatBounded.html">
<link title="BatBuffer" rel="Chapter" href="BatBuffer.html">
<link title="BatCache" rel="Chapter" href="BatCache.html">
<link title="BatChar" rel="Chapter" href="BatChar.html">
<link title="BatCharParser" rel="Chapter" href="BatCharParser.html">
<link title="BatComplex" rel="Chapter" href="BatComplex.html">
<link title="BatConcurrent" rel="Chapter" href="BatConcurrent.html">
<link title="BatDeque" rel="Chapter" href="BatDeque.html">
<link title="BatDigest" rel="Chapter" href="BatDigest.html">
<link title="BatDllist" rel="Chapter" href="BatDllist.html">
<link title="BatDynArray" rel="Chapter" href="BatDynArray.html">
<link title="BatEnum" rel="Chapter" href="BatEnum.html">
<link title="BatFile" rel="Chapter" href="BatFile.html">
<link title="BatFingerTree" rel="Chapter" href="BatFingerTree.html">
<link title="BatFloat" rel="Chapter" href="BatFloat.html">
<link title="BatFormat" rel="Chapter" href="BatFormat.html">
<link title="BatGc" rel="Chapter" href="BatGc.html">
<link title="BatGenlex" rel="Chapter" href="BatGenlex.html">
<link title="BatGlobal" rel="Chapter" href="BatGlobal.html">
<link title="BatHashcons" rel="Chapter" href="BatHashcons.html">
<link title="BatHashtbl" rel="Chapter" href="BatHashtbl.html">
<link title="BatHeap" rel="Chapter" href="BatHeap.html">
<link title="BatIMap" rel="Chapter" href="BatIMap.html">
<link title="BatIO" rel="Chapter" href="BatIO.html">
<link title="BatISet" rel="Chapter" href="BatISet.html">
<link title="BatInnerIO" rel="Chapter" href="BatInnerIO.html">
<link title="BatInnerPervasives" rel="Chapter" href="BatInnerPervasives.html">
<link title="BatInnerWeaktbl" rel="Chapter" href="BatInnerWeaktbl.html">
<link title="BatInt" rel="Chapter" href="BatInt.html">
<link title="BatInt32" rel="Chapter" href="BatInt32.html">
<link title="BatInt64" rel="Chapter" href="BatInt64.html">
<link title="BatInterfaces" rel="Chapter" href="BatInterfaces.html">
<link title="BatLazyList" rel="Chapter" href="BatLazyList.html">
<link title="BatLexing" rel="Chapter" href="BatLexing.html">
<link title="BatList" rel="Chapter" href="BatList.html">
<link title="BatLog" rel="Chapter" href="BatLog.html">
<link title="BatLogger" rel="Chapter" href="BatLogger.html">
<link title="BatMap" rel="Chapter" href="BatMap.html">
<link title="BatMarshal" rel="Chapter" href="BatMarshal.html">
<link title="BatMultiMap" rel="Chapter" href="BatMultiMap.html">
<link title="BatMultiPMap" rel="Chapter" href="BatMultiPMap.html">
<link title="BatMutex" rel="Chapter" href="BatMutex.html">
<link title="BatNativeint" rel="Chapter" href="BatNativeint.html">
<link title="BatNum" rel="Chapter" href="BatNum.html">
<link title="BatNumber" rel="Chapter" href="BatNumber.html">
<link title="BatOo" rel="Chapter" href="BatOo.html">
<link title="BatOptParse" rel="Chapter" href="BatOptParse.html">
<link title="BatOption" rel="Chapter" href="BatOption.html">
<link title="BatOrd" rel="Chapter" href="BatOrd.html">
<link title="BatParserCo" rel="Chapter" href="BatParserCo.html">
<link title="BatPathGen" rel="Chapter" href="BatPathGen.html">
<link title="BatPervasives" rel="Chapter" href="BatPervasives.html">
<link title="BatPrintexc" rel="Chapter" href="BatPrintexc.html">
<link title="BatPrintf" rel="Chapter" href="BatPrintf.html">
<link title="BatQueue" rel="Chapter" href="BatQueue.html">
<link title="BatRMutex" rel="Chapter" href="BatRMutex.html">
<link title="BatRandom" rel="Chapter" href="BatRandom.html">
<link title="BatRef" rel="Chapter" href="BatRef.html">
<link title="BatRefList" rel="Chapter" href="BatRefList.html">
<link title="BatResult" rel="Chapter" href="BatResult.html">
<link title="BatReturn" rel="Chapter" href="BatReturn.html">
<link title="BatScanf" rel="Chapter" href="BatScanf.html">
<link title="BatSeq" rel="Chapter" href="BatSeq.html">
<link title="BatSet" rel="Chapter" href="BatSet.html">
<link title="BatSplay" rel="Chapter" href="BatSplay.html">
<link title="BatStack" rel="Chapter" href="BatStack.html">
<link title="BatStream" rel="Chapter" href="BatStream.html">
<link title="BatString" rel="Chapter" href="BatString.html">
<link title="BatSubstring" rel="Chapter" href="BatSubstring.html">
<link title="BatSys" rel="Chapter" href="BatSys.html">
<link title="BatText" rel="Chapter" href="BatText.html">
<link title="BatTuple" rel="Chapter" href="BatTuple.html">
<link title="BatUChar" rel="Chapter" href="BatUChar.html">
<link title="BatUTF8" rel="Chapter" href="BatUTF8.html">
<link title="BatUnit" rel="Chapter" href="BatUnit.html">
<link title="BatUnix" rel="Chapter" href="BatUnix.html">
<link title="BatUref" rel="Chapter" href="BatUref.html">
<link title="BatVect" rel="Chapter" href="BatVect.html">
<link title="Batteries" rel="Chapter" href="Batteries.html">
<link title="BatteriesConfig" rel="Chapter" href="BatteriesConfig.html">
<link title="BatteriesPrint" rel="Chapter" href="BatteriesPrint.html">
<link title="BatteriesThread" rel="Chapter" href="BatteriesThread.html">
<link title="Extlib" rel="Chapter" href="Extlib.html"><link title="Polymorphic maps" rel="Section" href="#4_Polymorphicmaps">
<link title="Boilerplate code" rel="Subsection" href="#6_Boilerplatecode">
<title>Batteries user guide : BatMap.PMap</title>
</head>
<body>
<div class="navbar"><a class="pre" href="BatMap.Infix.html" title="BatMap.Infix">Previous</a>
&nbsp;<a class="up" href="BatMap.html" title="BatMap">Up</a>
&nbsp;</div>
<h1>Module <a href="type_BatMap.PMap.html">BatMap.PMap</a></h1>

<pre><span class="keyword">module</span> PMap: <code class="code"><span class="keyword">sig</span></code> <a href="BatMap.PMap.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><hr width="100%">
<br>
<h4 id="4_Polymorphicmaps">Polymorphic maps</h4>
<p>

      The functions below present the manipulation of polymorphic maps,
      as were provided by the Extlib PMap module.
<p>

      They are similar in functionality to the functorized <a href="BatMap.Make.html"><code class="code"><span class="constructor">BatMap</span>.<span class="constructor">Make</span></code></a>
      module, but the compiler cannot ensure that maps using different
      key ordering have different types: the responsibility of not
      mixing non-sensical comparison functions together is to the
      programmer. If in doubt, you should rather use the <a href="BatMap.Make.html"><code class="code"><span class="constructor">BatMap</span>.<span class="constructor">Make</span></code></a>
      functor for additional safety.<br>

<pre><span id="TYPEt"><span class="keyword">type</span> <code class="type">('a, 'b)</code> t</span> </pre>


<pre><span id="VALempty"><span class="keyword">val</span> empty</span> : <code class="type">('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a></code></pre><div class="info ">
The empty map, using <code class="code">compare</code> as key comparison function.<br>
</div>

<pre><span id="VALis_empty"><span class="keyword">val</span> is_empty</span> : <code class="type">('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> bool</code></pre><div class="info ">
returns true if the map is empty.<br>
</div>

<pre><span id="VALcreate"><span class="keyword">val</span> create</span> : <code class="type">('a -> 'a -> int) -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a></code></pre><div class="info ">
creates a new empty map, using the provided function for key comparison.<br>
</div>

<pre><span id="VALget_cmp"><span class="keyword">val</span> get_cmp</span> : <code class="type">('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> 'a -> 'a -> int</code></pre><div class="info ">
returns the comparison function of the given map<br>
</div>

<pre><span id="VALsingleton"><span class="keyword">val</span> singleton</span> : <code class="type">?cmp:('a -> 'a -> int) -> 'a -> 'b -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a></code></pre><div class="info ">
creates a new map with a single binding<br>
</div>

<pre><span id="VALcardinal"><span class="keyword">val</span> cardinal</span> : <code class="type">('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> int</code></pre><div class="info ">
Return the number of bindings of a map.<br>
</div>

<pre><span id="VALadd"><span class="keyword">val</span> add</span> : <code class="type">'a -> 'b -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a></code></pre><div class="info ">
<code class="code">add x y m</code> returns a map containing the same bindings as
      <code class="code">m</code>, plus a binding of <code class="code">x</code> to <code class="code">y</code>. If <code class="code">x</code> was already bound
      in <code class="code">m</code>, its previous binding disappears.<br>
</div>

<pre><span id="VALfind"><span class="keyword">val</span> find</span> : <code class="type">'a -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> 'b</code></pre><div class="info ">
<code class="code">find x m</code> returns the current binding of <code class="code">x</code> in <code class="code">m</code>,
      or raises <code class="code"><span class="constructor">Not_found</span></code> if no such binding exists.<br>
</div>

<pre><span id="VALremove"><span class="keyword">val</span> remove</span> : <code class="type">'a -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a></code></pre><div class="info ">
<code class="code">remove x m</code> returns a map containing the same bindings as
      <code class="code">m</code>, except for <code class="code">x</code> which is unbound in the returned map.<br>
</div>

<pre><span id="VALmem"><span class="keyword">val</span> mem</span> : <code class="type">'a -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> bool</code></pre><div class="info ">
<code class="code">mem x m</code> returns <code class="code"><span class="keyword">true</span></code> if <code class="code">m</code> contains a binding for <code class="code">x</code>,
      and <code class="code"><span class="keyword">false</span></code> otherwise.<br>
</div>

<pre><span id="VALiter"><span class="keyword">val</span> iter</span> : <code class="type">('a -> 'b -> unit) -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> unit</code></pre><div class="info ">
<code class="code">iter f m</code> applies <code class="code">f</code> to all bindings in map <code class="code">m</code>.
      <code class="code">f</code> receives the key as first argument, and the associated value
      as second argument. The order in which the bindings are passed to
      <code class="code">f</code> is unspecified. Only current bindings are presented to <code class="code">f</code>:
      bindings hidden by more recent bindings are not passed to <code class="code">f</code>.<br>
</div>

<pre><span id="VALmap"><span class="keyword">val</span> map</span> : <code class="type">('b -> 'c) -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> ('a, 'c) <a href="BatMap.PMap.html#TYPEt">t</a></code></pre><div class="info ">
<code class="code">map f m</code> returns a map with same domain as <code class="code">m</code>, where the
      associated value <code class="code">a</code> of all bindings of <code class="code">m</code> has been
      replaced by the result of the application of <code class="code">f</code> to <code class="code">a</code>.
      The order in which the associated values are passed to <code class="code">f</code>
      is unspecified.<br>
</div>

<pre><span id="VALmapi"><span class="keyword">val</span> mapi</span> : <code class="type">('a -> 'b -> 'c) -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> ('a, 'c) <a href="BatMap.PMap.html#TYPEt">t</a></code></pre><div class="info ">
Same as <code class="code">map</code>, but the function receives as arguments both the
      key and the associated value for each binding of the map.<br>
</div>

<pre><span id="VALfold"><span class="keyword">val</span> fold</span> : <code class="type">('b -> 'c -> 'c) -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> 'c -> 'c</code></pre><div class="info ">
<code class="code">fold f m a</code> computes <code class="code">(f kN dN ... (f k1 d1 (f k0 d0 a))...)</code>,
      where <code class="code">k0,k1..kN</code> are the keys of all bindings in <code class="code">m</code>,
      and <code class="code">d0,d1..dN</code> are the associated data.
      The order in which the bindings are presented to <code class="code">f</code> is
      unspecified.<br>
</div>

<pre><span id="VALfoldi"><span class="keyword">val</span> foldi</span> : <code class="type">('a -> 'b -> 'c -> 'c) -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> 'c -> 'c</code></pre><div class="info ">
Same as <code class="code">fold</code>, but the function receives as arguments both the
      key and the associated value for each binding of the map.<br>
</div>

<pre><span id="VALfilterv"><span class="keyword">val</span> filterv</span> : <code class="type">('a -> bool) -> ('key, 'a) <a href="BatMap.PMap.html#TYPEt">t</a> -> ('key, 'a) <a href="BatMap.PMap.html#TYPEt">t</a></code></pre><div class="info ">
<code class="code">filterv f m</code> returns a map where only the values <code class="code">a</code> of <code class="code">m</code>
     such that <code class="code">f a = <span class="keyword">true</span></code> remain. The bindings are passed to <code class="code">f</code>
     in increasing order with respect to the ordering over the
     type of the keys.<br>
</div>

<pre><span id="VALfilter"><span class="keyword">val</span> filter</span> : <code class="type">('key -> 'a -> bool) -> ('key, 'a) <a href="BatMap.PMap.html#TYPEt">t</a> -> ('key, 'a) <a href="BatMap.PMap.html#TYPEt">t</a></code></pre><div class="info ">
<code class="code">filter f m</code> returns a map where only the (key, value) pairs
     <code class="code">key</code>, <code class="code">a</code> of <code class="code">m</code> such that <code class="code">f key a = <span class="keyword">true</span></code> remain. The
     bindings are passed to <code class="code">f</code> in increasing order with respect
     to the ordering over the type of the keys.<br>
</div>

<pre><span id="VALfilter_map"><span class="keyword">val</span> filter_map</span> : <code class="type">('key -> 'a -> 'b option) -><br>       ('key, 'a) <a href="BatMap.PMap.html#TYPEt">t</a> -> ('key, 'b) <a href="BatMap.PMap.html#TYPEt">t</a></code></pre><div class="info ">
<code class="code">filter_map f m</code> combines the features of <code class="code">filter</code> and
      <code class="code">map</code>.  It calls calls <code class="code">f key0 a0</code>, <code class="code">f key1 a1</code>, <code class="code">f keyn an</code>
      where <code class="code">a0..an</code> are the elements of <code class="code">m</code> and <code class="code">key0..keyn</code> the
      respective corresponding keys. It returns the map of
      pairs <code class="code">keyi</code>,<code class="code">bi</code> such as <code class="code">f keyi ai = <span class="constructor">Some</span> bi</code> (when <code class="code">f</code> returns
      <code class="code"><span class="constructor">None</span></code>, the corresponding element of <code class="code">m</code> is discarded).<br>
</div>

<pre><span id="VALchoose"><span class="keyword">val</span> choose</span> : <code class="type">('key, 'a) <a href="BatMap.PMap.html#TYPEt">t</a> -> 'key * 'a</code></pre><div class="info ">
Return one binding of the given map, or raise <code class="code"><span class="constructor">Not_found</span></code> if
      the map is empty. Which binding is chosen is unspecified,
      but equal bindings will be chosen for equal maps.<br>
</div>

<pre><span id="VALsplit"><span class="keyword">val</span> split</span> : <code class="type">'key -><br>       ('key, 'a) <a href="BatMap.PMap.html#TYPEt">t</a> -><br>       ('key, 'a) <a href="BatMap.PMap.html#TYPEt">t</a> * 'a option * ('key, 'a) <a href="BatMap.PMap.html#TYPEt">t</a></code></pre><div class="info ">
<code class="code">split x m</code> returns a triple <code class="code">(l, data, r)</code>, where
      <code class="code">l</code> is the map with all the bindings of <code class="code">m</code> whose key
      is strictly less than <code class="code">x</code>;
      <code class="code">r</code> is the map with all the bindings of <code class="code">m</code> whose key
      is strictly greater than <code class="code">x</code>;
      <code class="code">data</code> is <code class="code"><span class="constructor">None</span></code> if <code class="code">m</code> contains no binding for <code class="code">x</code>,
      or <code class="code"><span class="constructor">Some</span> v</code> if <code class="code">m</code> binds <code class="code">v</code> to <code class="code">x</code>.<br>
</div>

<pre><span id="VALmin_binding"><span class="keyword">val</span> min_binding</span> : <code class="type">('key, 'a) <a href="BatMap.PMap.html#TYPEt">t</a> -> 'key * 'a</code></pre><div class="info ">
returns the binding with the smallest key<br>
</div>

<pre><span id="VALmax_binding"><span class="keyword">val</span> max_binding</span> : <code class="type">('key, 'a) <a href="BatMap.PMap.html#TYPEt">t</a> -> 'key * 'a</code></pre><div class="info ">
returns the binding with the largest key<br>
</div>

<pre><span id="VALenum"><span class="keyword">val</span> enum</span> : <code class="type">('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> ('a * 'b) <a href="BatEnum.html#TYPEt">BatEnum.t</a></code></pre><div class="info ">
creates an enumeration for this map, enumerating key,value pairs with the keys in increasing order.<br>
</div>

<pre><span id="VALbackwards"><span class="keyword">val</span> backwards</span> : <code class="type">('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> ('a * 'b) <a href="BatEnum.html#TYPEt">BatEnum.t</a></code></pre><div class="info ">
creates an enumeration for this map, enumerating key,value pairs with the keys in decreasing order.<br>
</div>

<pre><span id="VALkeys"><span class="keyword">val</span> keys</span> : <code class="type">('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> 'a <a href="BatEnum.html#TYPEt">BatEnum.t</a></code></pre><div class="info ">
Return an enumeration of all the keys of a map.<br>
</div>

<pre><span id="VALvalues"><span class="keyword">val</span> values</span> : <code class="type">('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> 'b <a href="BatEnum.html#TYPEt">BatEnum.t</a></code></pre><div class="info ">
Return an enumeration of al the values of a map.<br>
</div>

<pre><span id="VALof_enum"><span class="keyword">val</span> of_enum</span> : <code class="type">?cmp:('a -> 'a -> int) -> ('a * 'b) <a href="BatEnum.html#TYPEt">BatEnum.t</a> -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a></code></pre><div class="info ">
creates a map from an enumeration, using the specified function
      for key comparison or <code class="code">compare</code> by default.<br>
</div>

<pre><span id="VALfor_all"><span class="keyword">val</span> for_all</span> : <code class="type">('a -> 'b -> bool) -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> bool</code></pre><div class="info ">
Tests whether all key value pairs satisfy some predicate function<br>
</div>

<pre><span id="VALexists"><span class="keyword">val</span> exists</span> : <code class="type">('a -> 'b -> bool) -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> bool</code></pre><div class="info ">
Tests whether some key value pair satisfies some predicate function<br>
</div>

<pre><span id="VALpartition"><span class="keyword">val</span> partition</span> : <code class="type">('a -> 'b -> bool) -><br>       ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> * ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a></code></pre><div class="info ">
<code class="code">partition p m</code> returns a pair of maps <code class="code">(m1, m2)</code>, where <code class="code">m1</code>
      contains all the bindings of <code class="code">s</code> that satisfy the predicate
      <code class="code">p</code>, and <code class="code">m2</code> is the map with all the bindings of <code class="code">s</code> that do
      not satisfy <code class="code">p</code>.<br>
</div>

<pre><span id="VALadd_carry"><span class="keyword">val</span> add_carry</span> : <code class="type">'a -> 'b -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> * 'b option</code></pre><div class="info ">
<code class="code">add_carry k v m</code> adds the binding <code class="code">(k,v)</code> to <code class="code">m</code>, returning the new map and optionally the previous value bound to <code class="code">k</code>.<br>
</div>

<pre><span id="VALmodify"><span class="keyword">val</span> modify</span> : <code class="type">'a -> ('b -> 'b) -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a></code></pre><div class="info ">
<code class="code">modify k f m</code> replaces the previous binding for <code class="code">k</code> with <code class="code">f</code>
      applied to that value.  If <code class="code">k</code> is unbound in <code class="code">m</code> or <code class="code"><span class="constructor">Not_found</span></code> is
      raised during the search,  <code class="code"><span class="constructor">Not_found</span></code> is raised.<br>
<b>Since</b> 1.2.0<br>
<b>Raises</b> <code>Not_found</code> if <code class="code">k</code> is unbound in <code class="code">m</code> (or <code class="code">f</code> raises <code class="code"><span class="constructor">Not_found</span></code>)<br>
</div>

<pre><span id="VALmodify_def"><span class="keyword">val</span> modify_def</span> : <code class="type">'b -> 'a -> ('b -> 'b) -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a></code></pre><div class="info ">
<code class="code">modify_def v0 k f m</code> replaces the previous binding for <code class="code">k</code>
      with <code class="code">f</code> applied to that value. If <code class="code">k</code> is unbound in <code class="code">m</code> or
      <code class="code"><span class="constructor">Not_found</span></code> is raised during the search, <code class="code">f v0</code> is
      inserted (as if the value found were <code class="code">v0</code>).<br>
<b>Since</b> 1.3.0<br>
</div>

<pre><span id="VALmodify_opt"><span class="keyword">val</span> modify_opt</span> : <code class="type">'a -><br>       ('b option -> 'b option) -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a></code></pre><div class="info ">
<code class="code">modify_opt k f m</code> allow to modify the binding for <code class="code">k</code> in <code class="code">m</code>
      or absence thereof.<br>
<b>Since</b> 2.1<br>
</div>

<pre><span id="VALextract"><span class="keyword">val</span> extract</span> : <code class="type">'a -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> 'b * ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a></code></pre><div class="info ">
<code class="code">extract k m</code> removes the current binding of <code class="code">k</code> from <code class="code">m</code>,
      returning the value <code class="code">k</code> was bound to and the updated <code class="code">m</code>.<br>
</div>

<pre><span id="VALpop"><span class="keyword">val</span> pop</span> : <code class="type">('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> ('a * 'b) * ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a></code></pre><div class="info ">
<code class="code">pop m</code> returns a binding from <code class="code">m</code> and <code class="code">m</code> without that
      binding.<br>
</div>

<pre><span id="VALunion"><span class="keyword">val</span> union</span> : <code class="type">('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a></code></pre><div class="info ">
<code class="code">union m1 m2</code> merges two maps, using the comparison function of
      <code class="code">m1</code>. In case of conflicted bindings, <code class="code">m2</code>'s bindings override
      <code class="code">m1</code>'s. Equivalent to <code class="code">foldi add m2 m1</code>.
      The resulting map uses the comparison function of <code class="code">m1</code>.<br>
</div>

<pre><span id="VALdiff"><span class="keyword">val</span> diff</span> : <code class="type">('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a></code></pre><div class="info ">
<code class="code">diff m1 m2</code> removes all bindings of keys found in <code class="code">m2</code> from <code class="code">m1</code>,
      using the comparison function of <code class="code">m1</code>. Equivalent to
      <code class="code">foldi (<span class="keyword">fun</span> k _v m <span class="keywordsign">-&gt;</span> remove k m) m2 m1</code>
      The resulting map uses the comparison function of <code class="code">m1</code>.<br>
</div>

<pre><span id="VALintersect"><span class="keyword">val</span> intersect</span> : <code class="type">('b -> 'c -> 'd) -><br>       ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> ('a, 'c) <a href="BatMap.PMap.html#TYPEt">t</a> -> ('a, 'd) <a href="BatMap.PMap.html#TYPEt">t</a></code></pre><div class="info ">
<code class="code">intersect merge_f m1 m2</code> returns a map with bindings only for
      keys bound in both <code class="code">m1</code> and <code class="code">m2</code>, and with <code class="code">k</code> bound to <code class="code">merge_f
      v1 v2</code>, where <code class="code">v1</code> and <code class="code">v2</code> are <code class="code">k</code>'s bindings in <code class="code">m1</code> and <code class="code">m2</code>.
      The resulting map uses the comparison function of <code class="code">m1</code>.<br>
</div>

<pre><span id="VALmerge"><span class="keyword">val</span> merge</span> : <code class="type">('key -> 'a option -> 'b option -> 'c option) -><br>       ('key, 'a) <a href="BatMap.PMap.html#TYPEt">t</a> -><br>       ('key, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> ('key, 'c) <a href="BatMap.PMap.html#TYPEt">t</a></code></pre><div class="info ">
<code class="code">merge f m1 m2</code> computes a map whose keys is a subset of keys of <code class="code">m1</code>
      and of <code class="code">m2</code>. The presence of each such binding, and the corresponding
      value, is determined with the function <code class="code">f</code>.
      The resulting map uses the comparison function of <code class="code">m1</code>.<br>
</div>

<pre><span id="VALmerge_unsafe"><span class="keyword">val</span> merge_unsafe</span> : <code class="type">('key -> 'a option -> 'b option -> 'c option) -><br>       ('key, 'a) <a href="BatMap.PMap.html#TYPEt">t</a> -><br>       ('key, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> ('key, 'c) <a href="BatMap.PMap.html#TYPEt">t</a></code></pre><div class="info ">
Same as merge, but assumes the comparison function of both maps
      are equal. If it's not the case, the result is a map using the
      comparison function of its first parameter, but which <code class="code"><span class="keywordsign">'</span>b option</code>
      elements are passed to the function is unspecified.<br>
</div>

<pre><span id="VALcompare"><span class="keyword">val</span> compare</span> : <code class="type">('b -> 'b -> int) -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> int</code></pre>
<pre><span id="VALequal"><span class="keyword">val</span> equal</span> : <code class="type">('b -> 'b -> bool) -><br>       ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> bool</code></pre><div class="info ">
Construct a comparison or equality function for maps based on a
      value comparison or equality function.  Uses the key comparison
      function to compare keys<br>
</div>

<pre><span class="keyword">module</span> <a href="BatMap.PMap.Exceptionless.html">Exceptionless</a>: <code class="code"><span class="keyword">sig</span></code> <a href="BatMap.PMap.Exceptionless.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><div class="info">
Exceptionless versions of functions
</div>

<pre><span class="keyword">module</span> <a href="BatMap.PMap.Infix.html">Infix</a>: <code class="code"><span class="keyword">sig</span></code> <a href="BatMap.PMap.Infix.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><div class="info">
Infix operators over a <a href="BatMap.PMap.html"><code class="code"><span class="constructor">BatMap</span>.<span class="constructor">PMap</span></code></a>
</div>

<pre><span id="VAL(-->)"><span class="keyword">val</span> (--&gt;)</span> : <code class="type">('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> 'a -> 'b</code></pre><div class="info ">
Map find and insert from Infix<br>
</div>

<pre><span id="VAL(<--)"><span class="keyword">val</span> (&lt;--)</span> : <code class="type">('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> 'a * 'b -> ('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a></code></pre>
<pre><span id="VALbindings"><span class="keyword">val</span> bindings</span> : <code class="type">('key, 'a) <a href="BatMap.PMap.html#TYPEt">t</a> -> ('key * 'a) list</code></pre><div class="info ">
Return the list of all bindings of the given map.
      The returned list is sorted in increasing key order.
<p>

      Added for compatibility with stdlib 3.12<br>
</div>
<br>
<h6 id="6_Boilerplatecode">Boilerplate code</h6><br>
<br>
<div class="h7" id="7_Printing">Printing</div><br>

<pre><span id="VALprint"><span class="keyword">val</span> print</span> : <code class="type">?first:string -><br>       ?last:string -><br>       ?sep:string -><br>       ?kvsep:string -><br>       ('a <a href="BatInnerIO.html#TYPEoutput">BatInnerIO.output</a> -> 'b -> unit) -><br>       ('a <a href="BatInnerIO.html#TYPEoutput">BatInnerIO.output</a> -> 'c -> unit) -><br>       'a <a href="BatInnerIO.html#TYPEoutput">BatInnerIO.output</a> -> ('b, 'c) <a href="BatMap.PMap.html#TYPEt">t</a> -> unit</code></pre>
<pre><span id="VALget_cmp"><span class="keyword">val</span> get_cmp</span> : <code class="type">('a, 'b) <a href="BatMap.PMap.html#TYPEt">t</a> -> 'a -> 'a -> int</code></pre><div class="info ">
get the comparison function used for a polymorphic map<br>
</div>
</body></html>