<!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="Up" href="Reins.Lists.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="Reins" rel="Chapter" href="Reins.html"><title>Reins.Lists.ListSig</title> </head> <body> <div class="navbar"> <a href="Reins.Lists.html">Up</a> </div> <center><h1>Module type <a href="type_Reins.Lists.ListSig.html">Reins.Lists.ListSig</a></h1></center> <br> <pre><span class="keyword">module type</span> ListSig = <code class="code">sig</code> <a href="Reins.Lists.ListSig.html">..</a> <code class="code">end</code></pre><hr width="100%"> <pre><span id="TYPEt"><span class="keyword">type</span> <code class="type">'a</code> t</span> </pre> <div class="info"> The type of the list<br> </div> <pre><span id="VALempty"><span class="keyword">val</span> empty</span> : <code class="type">'a <a href="Reins.Lists.ListSig.html#TYPEt">t</a></code></pre><div class="info"> The empty list<br> </div> <pre><span id="VALis_empty"><span class="keyword">val</span> is_empty</span> : <code class="type">'a <a href="Reins.Lists.ListSig.html#TYPEt">t</a> -> bool</code></pre><div class="info"> Returns true if the list is empty<br> </div> <pre><span id="VALlength"><span class="keyword">val</span> length</span> : <code class="type">'a <a href="Reins.Lists.ListSig.html#TYPEt">t</a> -> int</code></pre><div class="info"> Returns the length of the list<br> </div> <pre><span id="VALrev"><span class="keyword">val</span> rev</span> : <code class="type">'a <a href="Reins.Lists.ListSig.html#TYPEt">t</a> -> 'a <a href="Reins.Lists.ListSig.html#TYPEt">t</a></code></pre><div class="info"> Reverse the list<br> </div> <pre><span id="VALcons"><span class="keyword">val</span> cons</span> : <code class="type">'a -> 'a <a href="Reins.Lists.ListSig.html#TYPEt">t</a> -> 'a <a href="Reins.Lists.ListSig.html#TYPEt">t</a></code></pre><div class="info"> <code class="code">cons x t</code> Add the element <code class="code">x</code> to the front of list <code class="code">t</code><br> </div> <pre><span id="VALsnoc"><span class="keyword">val</span> snoc</span> : <code class="type">'a -> 'a <a href="Reins.Lists.ListSig.html#TYPEt">t</a> -> 'a <a href="Reins.Lists.ListSig.html#TYPEt">t</a></code></pre><div class="info"> <code class="code">snoc x t</code> Add the element <code class="code">x</code> to the end of list <code class="code">t</code><br> </div> <pre><span id="VALhd"><span class="keyword">val</span> hd</span> : <code class="type">'a <a href="Reins.Lists.ListSig.html#TYPEt">t</a> -> 'a</code></pre><div class="info"> <code class="code">hd t</code> Return the first element at the front of the list. All lists in the Reins library raise <code class="code">Failure "hd"</code> when applied to an empty list.<br> </div> <pre><span id="VALtl"><span class="keyword">val</span> tl</span> : <code class="type">'a <a href="Reins.Lists.ListSig.html#TYPEt">t</a> -> 'a <a href="Reins.Lists.ListSig.html#TYPEt">t</a></code></pre><div class="info"> <code class="code">tl t</code> Return the list with the first element removed. All lists in the Reins library raise <code class="code">Failure "tl"</code> when applied to an empty list.<br> </div> <pre><span id="VALpop"><span class="keyword">val</span> pop</span> : <code class="type">'a <a href="Reins.Lists.ListSig.html#TYPEt">t</a> -> 'a * 'a <a href="Reins.Lists.ListSig.html#TYPEt">t</a></code></pre><div class="info"> Returns both the first element of the list and the remaining tail of the list. All lists in the Reins library raise <code class="code">Failure "pop"</code> when applied to an empty list.<br> </div> <pre><span id="VALlast"><span class="keyword">val</span> last</span> : <code class="type">'a <a href="Reins.Lists.ListSig.html#TYPEt">t</a> -> 'a</code></pre><div class="info"> <code class="code">last t</code> Returns the element at the back of the list. All lists in the Reins library raise <code class="code">Failure "last"</code> when applied to an empty list.<br> </div> <pre><span id="VALappend"><span class="keyword">val</span> append</span> : <code class="type">'a <a href="Reins.Lists.ListSig.html#TYPEt">t</a> -><br> 'a <a href="Reins.Lists.ListSig.html#TYPEt">t</a> -> 'a <a href="Reins.Lists.ListSig.html#TYPEt">t</a></code></pre><div class="info"> <code class="code">append t1 t2</code> Append the list <code class="code">t2</code> onto the end of list <code class="code">t1</code>.<br> </div> <pre><span id="VALflatten"><span class="keyword">val</span> flatten</span> : <code class="type">'a <a href="Reins.Lists.ListSig.html#TYPEt">t</a> <a href="Reins.Lists.ListSig.html#TYPEt">t</a> -> 'a <a href="Reins.Lists.ListSig.html#TYPEt">t</a></code></pre><div class="info"> Flatten a list of lists into a single list<br> </div> <pre><span id="VALfrom_list"><span class="keyword">val</span> from_list</span> : <code class="type">'a list -> 'a <a href="Reins.Lists.ListSig.html#TYPEt">t</a></code></pre><div class="info"> Create a list from a builtin list type<br> </div> <pre><span id="VALto_list"><span class="keyword">val</span> to_list</span> : <code class="type">'a <a href="Reins.Lists.ListSig.html#TYPEt">t</a> -> 'a list</code></pre><div class="info"> Convert the list into a builtin list type<br> </div> <pre><span id="VALiter"><span class="keyword">val</span> iter</span> : <code class="type">('a -> unit) -> 'a <a href="Reins.Lists.ListSig.html#TYPEt">t</a> -> unit</code></pre><div class="info"> <code class="code">iter f t</code> Apply <code class="code">f</code> to each element in list <code class="code">t</code>.<br> </div> <pre><span id="VALfold"><span class="keyword">val</span> fold</span> : <code class="type">('a -> 'b -> 'a) -> 'a -> 'b <a href="Reins.Lists.ListSig.html#TYPEt">t</a> -> 'a</code></pre><div class="info"> <code class="code">fold f acc t</code> Accumulates the result <code class="code">acc</code> by applying <code class="code">f acc x</code> for each element <code class="code">x</code> in <code class="code">t</code>.<br> </div> <pre><span id="VALrev_map"><span class="keyword">val</span> rev_map</span> : <code class="type">('a -> 'b) -> 'a <a href="Reins.Lists.ListSig.html#TYPEt">t</a> -> 'b <a href="Reins.Lists.ListSig.html#TYPEt">t</a></code></pre><div class="info"> <code class="code">rev_map f t</code> Creates a new list by applying <code class="code">f</code> to each element of <code class="code">t</code>. The resulting list is in reverse order of <code class="code">t</code>.<br> </div> <pre><span id="VALmap"><span class="keyword">val</span> map</span> : <code class="type">('a -> 'b) -> 'a <a href="Reins.Lists.ListSig.html#TYPEt">t</a> -> 'b <a href="Reins.Lists.ListSig.html#TYPEt">t</a></code></pre><div class="info"> <code class="code">map f t</code> Creates a new list by applying <code class="code">f</code> to each element of <code class="code">t</code>. The resulting list is in the same order as <code class="code">t</code>.<br> </div> <pre><span id="VALto_string"><span class="keyword">val</span> to_string</span> : <code class="type">('a -> string) -> 'a <a href="Reins.Lists.ListSig.html#TYPEt">t</a> -> string</code></pre><div class="info"> <code class="code">to_string to_s t</code> Convert the list <code class="code">t</code> into a string using <code class="code">to_s</code> to individually convert each element into a string. All lists in the Reins library format the list following OCaml syntax. e.g., "<code class="code">x1; x2; x3</code>"<br> </div> <pre><span id="VALcompare"><span class="keyword">val</span> compare</span> : <code class="type">('a -> 'a -> int) -><br> 'a <a href="Reins.Lists.ListSig.html#TYPEt">t</a> -> 'a <a href="Reins.Lists.ListSig.html#TYPEt">t</a> -> int</code></pre><div class="info"> <code class="code">compare f t1 t2</code> Compares the lists <code class="code">t1</code> and <code class="code">t2</code> using <code class="code">f</code> to compare individual elements. Returns 0 if <code class="code">t1</code> and <code class="code">t2</code> are equal (under f). Returns <code class="code"><0</code> if <code class="code">t1</code> is less than <code class="code">t2</code> and returns <code class="code">>0</code> otherwise.<br> </div> <pre><span id="VALgen"><span class="keyword">val</span> gen</span> : <code class="type">(?size:int -> Random.State.t -> 'a) -><br> ?size:int -> Random.State.t -> 'a <a href="Reins.Lists.ListSig.html#TYPEt">t</a></code></pre><div class="info"> <code class="code">gen f ?size rs</code> Generates a random list whose length is bounded by <code class="code">size</code>. Each element in the list is computed by calling <code class="code">f ?size rs</code>.<br> </div> </body></html>