<!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="Option.html"> <link rel="next" href="RefList.html"> <link rel="Up" href="index.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="Base64" rel="Chapter" href="Base64.html"> <link title="BitSet" rel="Chapter" href="BitSet.html"> <link title="Dllist" rel="Chapter" href="Dllist.html"> <link title="DynArray" rel="Chapter" href="DynArray.html"> <link title="Enum" rel="Chapter" href="Enum.html"> <link title="ExtArray" rel="Chapter" href="ExtArray.html"> <link title="ExtHashtbl" rel="Chapter" href="ExtHashtbl.html"> <link title="ExtList" rel="Chapter" href="ExtList.html"> <link title="ExtString" rel="Chapter" href="ExtString.html"> <link title="Global" rel="Chapter" href="Global.html"> <link title="IO" rel="Chapter" href="IO.html"> <link title="OptParse" rel="Chapter" href="OptParse.html"> <link title="Option" rel="Chapter" href="Option.html"> <link title="PMap" rel="Chapter" href="PMap.html"> <link title="RefList" rel="Chapter" href="RefList.html"> <link title="Std" rel="Chapter" href="Std.html"> <link title="UChar" rel="Chapter" href="UChar.html"> <link title="UTF8" rel="Chapter" href="UTF8.html"> <link title="Unzip" rel="Chapter" href="Unzip.html"><title>PMap</title> </head> <body> <div class="navbar"><a class="pre" href="Option.html" title="Option">Previous</a> <a class="up" href="index.html" title="Index">Up</a> <a class="post" href="RefList.html" title="RefList">Next</a> </div> <h1>Module <a href="type_PMap.html">PMap</a></h1> <pre><span class="keyword">module</span> PMap: <code class="code">sig</code> <a href="PMap.html">..</a> <code class="code">end</code></pre><div class="info"> Polymorphic Map. <p> This is a polymorphic map, similar to standard library <code class="code">Map</code> module but in a defunctorized style.<br> </div> <hr width="100%"> <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="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="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="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="VALadd"><span class="keyword">val</span> add</span> : <code class="type">'a -> 'b -> ('a, 'b) <a href="PMap.html#TYPEt">t</a> -> ('a, 'b) <a href="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="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">Not_found</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="PMap.html#TYPEt">t</a> -> ('a, 'b) <a href="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="PMap.html#TYPEt">t</a> -> bool</code></pre><div class="info"> <code class="code">mem x m</code> returns <code class="code">true</code> if <code class="code">m</code> contains a binding for <code class="code">x</code>, and <code class="code">false</code> otherwise.<br> </div> <pre><span id="VALexists"><span class="keyword">val</span> exists</span> : <code class="type">'a -> ('a, 'b) <a href="PMap.html#TYPEt">t</a> -> bool</code></pre><div class="info"> same as <code class="code">mem</code>.<br> </div> <pre><span id="VALiter"><span class="keyword">val</span> iter</span> : <code class="type">('a -> 'b -> unit) -> ('a, 'b) <a href="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="PMap.html#TYPEt">t</a> -> ('a, 'c) <a href="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="PMap.html#TYPEt">t</a> -> ('a, 'c) <a href="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="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 a)...)</code>, where <code class="code">k1 ... kN</code> are the keys of all bindings in <code class="code">m</code>, and <code class="code">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="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="VALenum"><span class="keyword">val</span> enum</span> : <code class="type">('a, 'b) <a href="PMap.html#TYPEt">t</a> -> ('a * 'b) <a href="Enum.html#TYPEt">Enum.t</a></code></pre><div class="info"> creates an enumeration for this 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="Enum.html#TYPEt">Enum.t</a> -> ('a, 'b) <a href="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> </body></html>