sidekick/doc/Hstring.html
2014-03-06 10:45:04 +01:00

90 lines
No EOL
6.8 KiB
HTML

<!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="Smt.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 modules" rel=Appendix href="index_modules.html">
<link title="Index of module types" rel=Appendix href="index_module_types.html">
<link title="Smt" rel="Chapter" href="Smt.html">
<link title="Hstring" rel="Chapter" href="Hstring.html"><title>Hstring</title>
</head>
<body>
<div class="navbar"><a href="Smt.html">Previous</a>
&nbsp;<a href="index.html">Up</a>
&nbsp;</div>
<center><h1>Module <a href="type_Hstring.html">Hstring</a></h1></center>
<br>
<pre><span class="keyword">module</span> Hstring: <code class="code">sig</code> <a href="Hstring.html">..</a> <code class="code">end</code></pre><b>Hash-consed strings</b>
<p>
Hash-consing is a technique to share values that are structurally
equal. More details on
<a href="http://en.wikipedia.org/wiki/Hash_consing"> Wikipedia</a> and
<a href="http://www.lri.fr/~filliatr/ftp/publis/hash-consing2.pdf"> here</a>.
<p>
This module provides an easy way to use hash-consing for strings.<br>
<hr width="100%">
<pre><span id="TYPEt"><span class="keyword">type</span> <code class="type"></code>t</span> = <code class="type">string Hashcons.hash_consed</code> </pre>
<div class="info">
The type of Hash-consed string<br>
</div>
<pre><span id="VALmake"><span class="keyword">val</span> make</span> : <code class="type">string -> <a href="Hstring.html#TYPEt">t</a></code></pre><div class="info">
<code class="code">make s</code> builds ans returns a hash-consed string from <code class="code">s</code>.<br>
</div>
<pre><span id="VALview"><span class="keyword">val</span> view</span> : <code class="type"><a href="Hstring.html#TYPEt">t</a> -> string</code></pre><div class="info">
<code class="code">view hs</code> returns the string corresponding to <code class="code">hs</code>.<br>
</div>
<pre><span id="VALequal"><span class="keyword">val</span> equal</span> : <code class="type"><a href="Hstring.html#TYPEt">t</a> -> <a href="Hstring.html#TYPEt">t</a> -> bool</code></pre><div class="info">
<code class="code">equal x y</code> returns <code class="code">true</code> if <code class="code">x</code> and <code class="code">y</code> are the same hash-consed string
(constant time).<br>
</div>
<pre><span id="VALcompare"><span class="keyword">val</span> compare</span> : <code class="type"><a href="Hstring.html#TYPEt">t</a> -> <a href="Hstring.html#TYPEt">t</a> -> int</code></pre><div class="info">
<code class="code">compares x y</code> returns <code class="code">0</code> if <code class="code">x</code> and <code class="code">y</code> are equal, and is unspecified
otherwise but provides a total ordering on hash-consed strings.<br>
</div>
<pre><span id="VALhash"><span class="keyword">val</span> hash</span> : <code class="type"><a href="Hstring.html#TYPEt">t</a> -> int</code></pre><div class="info">
<code class="code">hash x</code> returns the integer (hash) associated to <code class="code">x</code>.<br>
</div>
<pre><span id="VALempty"><span class="keyword">val</span> empty</span> : <code class="type"><a href="Hstring.html#TYPEt">t</a></code></pre><div class="info">
the empty (<code class="code">""</code>) hash-consed string.<br>
</div>
<pre><span id="VALlist_assoc"><span class="keyword">val</span> list_assoc</span> : <code class="type"><a href="Hstring.html#TYPEt">t</a> -> (<a href="Hstring.html#TYPEt">t</a> * 'a) list -> 'a</code></pre><div class="info">
<code class="code">list_assoc x l</code> returns the element associated with <code class="code">x</code> in the list of
pairs <code class="code">l</code>.<br>
<b>Raises</b> <code>Not_found</code> if there is no value associated with <code class="code">x</code> in the list <code class="code">l</code>.<br>
</div>
<pre><span id="VALlist_mem_assoc"><span class="keyword">val</span> list_mem_assoc</span> : <code class="type"><a href="Hstring.html#TYPEt">t</a> -> (<a href="Hstring.html#TYPEt">t</a> * 'a) list -> bool</code></pre><div class="info">
Same as <a href="Hstring.html#VALlist_assoc"><code class="code">Hstring.list_assoc</code></a>, but simply returns <code class="code">true</code> if a binding exists, and
<code class="code">false</code> if no bindings exist for the given key.<br>
</div>
<pre><span id="VALlist_mem"><span class="keyword">val</span> list_mem</span> : <code class="type"><a href="Hstring.html#TYPEt">t</a> -> <a href="Hstring.html#TYPEt">t</a> list -> bool</code></pre><div class="info">
<code class="code">list_mem x l</code> is <code class="code">true</code> if and only if <code class="code">x</code> is equal to an element of <code class="code">l</code>.<br>
</div>
<pre><span id="VALlist_mem_couple"><span class="keyword">val</span> list_mem_couple</span> : <code class="type"><a href="Hstring.html#TYPEt">t</a> * <a href="Hstring.html#TYPEt">t</a> -> (<a href="Hstring.html#TYPEt">t</a> * <a href="Hstring.html#TYPEt">t</a>) list -> bool</code></pre><div class="info">
<code class="code">list_mem_couple (x,y) l</code> is <code class="code">true</code> if and only if <code class="code">(x,y)</code> is equal to an
element of <code class="code">l</code>.<br>
</div>
<pre><span id="VALcompare_list"><span class="keyword">val</span> compare_list</span> : <code class="type"><a href="Hstring.html#TYPEt">t</a> list -> <a href="Hstring.html#TYPEt">t</a> list -> int</code></pre><div class="info">
<code class="code">compare_list l1 l2</code> returns <code class="code">0</code> if and only if <code class="code">l1</code> is equal to <code class="code">l2</code>.<br>
</div>
<pre><span id="VALprint"><span class="keyword">val</span> print</span> : <code class="type">Format.formatter -> <a href="Hstring.html#TYPEt">t</a> -> unit</code></pre><div class="info">
Prints a list of hash-consed strings on a formatter.<br>
</div>
<pre><span class="keyword">module</span> <a href="Hstring.H.html">H</a>: <code class="type">Hashtbl.S</code><code class="type"> with type key = t</code></pre><div class="info">
Hash-tables indexed by hash-consed strings
</div>
<pre><span class="keyword">module</span> <a href="Hstring.HSet.html">HSet</a>: <code class="type">Set.S</code><code class="type"> with type elt = t</code></pre><div class="info">
Sets of hash-consed strings
</div>
<pre><span class="keyword">module</span> <a href="Hstring.HMap.html">HMap</a>: <code class="type">Map.S</code><code class="type"> with type key = t</code></pre><div class="info">
Maps indexed by hash-consed strings
</div>
</body></html>