<html> <head> <link rel="stylesheet" href="style.css" type="text/css"> <link rel="Start" href="index.html"> <link rel="previous" href="SetDomain.html"> <link rel="next" href="Data.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="Domain" rel="Chapter" href="Domain.html"> <link title="SetDomain" rel="Chapter" href="SetDomain.html"> <link title="Stak" rel="Chapter" href="Stak.html"> <link title="Data" rel="Chapter" href="Data.html"> <link title="Cstr" rel="Chapter" href="Cstr.html"> <link title="Var" rel="Chapter" href="Var.html"> <link title="Invariant" rel="Chapter" href="Invariant.html"> <link title="Reify" rel="Chapter" href="Reify.html"> <link title="Arith" rel="Chapter" href="Arith.html"> <link title="Conjunto" rel="Chapter" href="Conjunto.html"> <link title="Goals" rel="Chapter" href="Goals.html"> <link title="FdArray" rel="Chapter" href="FdArray.html"> <link title="Gcc" rel="Chapter" href="Gcc.html"> <link title="Alldiff" rel="Chapter" href="Alldiff.html"> <link title="Sorting" rel="Chapter" href="Sorting.html"> <link title="Interval" rel="Chapter" href="Interval.html"><link title="Access" rel="Section" href="#2_Access"> <link title="Control" rel="Section" href="#2_Control"> <link title="Backtrackable References" rel="Section" href="#2_BacktrackableReferences"> <title>Stak</title> </head> <body> <div class="navbar"><a href="SetDomain.html">Previous</a> <a href="index.html">Up</a> <a href="Data.html">Next</a> </div> <center><h1>Module <a href="type_Stak.html">Stak</a></h1></center> <br> <pre><span class="keyword">module</span> Stak: <code class="code">sig</code> <a href="Stak.html">..</a> <code class="code">end</code></pre><a name="1_GlobalStackofGoalsBacktrackableOperations"></a> <h1>Global Stack of Goals, Backtrackable Operations</h1><br> <hr width="100%"> <br> This module provides functions to control the execution of the goal stack, as well as <em>backtrackable references</em>, i.e. mutable data structures restored on backtracking. Nota: the module name <code class="code">Stak</code> lacks a '<code class="code">c</code>' because of a possible clash with the OCaml standard library module <code class="code">Stack</code>.<br> <br> <a name="2_Access"></a> <h2>Access</h2><br> <pre><span class="keyword">type</span> <a name="TYPElevel"></a><code class="type"></code>level </pre> <div class="info"> Type of a level in the stack.<br> </div> <pre><span class="keyword">val</span> <a name="VALolder"></a>older : <code class="type"><a href="Stak.html#TYPElevel">level</a> -> <a href="Stak.html#TYPElevel">level</a> -> bool</code></pre><div class="info"> <code class="code">older l1 l2</code> true if level <code class="code">l1</code> precedes <code class="code">l2</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALsize"></a>size : <code class="type">unit -> int</code></pre><div class="info"> Size of the stack, i.e. number of trailings.<br> </div> <pre><span class="keyword">val</span> <a name="VALdepth"></a>depth : <code class="type">unit -> int</code></pre><div class="info"> Depth of the stack, i.e. number of active levels.<br> </div> <pre><span class="keyword">val</span> <a name="VALlevel"></a>level : <code class="type">unit -> <a href="Stak.html#TYPElevel">level</a></code></pre><div class="info"> Returns the current level.<br> </div> <pre><span class="keyword">val</span> <a name="VALlevels"></a>levels : <code class="type">unit -> <a href="Stak.html#TYPElevel">level</a> list</code></pre><div class="info"> Returns the current active levels.<br> </div> <pre><span class="keyword">val</span> <a name="VALnb_choice_points"></a>nb_choice_points : <code class="type">unit -> int</code></pre><div class="info"> Access to a global counter incremented at each choice point. Useful to implement search strategies such as Limited Discrepancy Search<br> </div> <br> <a name="2_Control"></a> <h2>Control</h2><br> <pre><span class="keyword">exception</span> <a name="EXCEPTIONLevel_not_found"></a>Level_not_found <span class="keyword">of</span> <code class="type"><a href="Stak.html#TYPElevel">level</a></code></pre> <div class="info"> Raised by <code class="code">cut</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALcut"></a>cut : <code class="type"><a href="Stak.html#TYPElevel">level</a> -> unit</code></pre><div class="info"> <code class="code">cut l</code> cuts the choice points left on the stack until level <code class="code">l</code>. Raise <code class="code">Level_not_found</code> if level is not reached and stack is empty.<br> </div> <pre><span class="keyword">exception</span> <a name="EXCEPTIONFail"></a>Fail <span class="keyword">of</span> <code class="type">string</code></pre> <div class="info"> Raised during solving whenever a failure occurs. The string argument is informative.<br> </div> <pre><span class="keyword">val</span> <a name="VALfail"></a>fail : <code class="type">string -> 'a</code></pre><div class="info"> <code class="code">fail x</code> equivalent to <code class="code">raise (Fail x)</code>.<br> </div> <br> <a name="2_BacktrackableReferences"></a> <h2>Backtrackable References</h2><br> <pre><span class="keyword">type</span> <a name="TYPEref"></a><code class="type">'a</code> ref </pre> <div class="info"> Backtrackable reference of type <code class="code">'a</code>. I.e. type of mutable data structures restored on backtracking.<br> </div> <pre><span class="keyword">val</span> <a name="VALref"></a>ref : <code class="type">'a -> 'a <a href="Stak.html#TYPEref">ref</a></code></pre><div class="info"> Returns a reference whose modifications will be trailed during the solving of a goal.<br> </div> <pre><span class="keyword">val</span> <a name="VALset"></a>set : <code class="type">'a <a href="Stak.html#TYPEref">ref</a> -> 'a -> unit</code></pre><div class="info"> Sets a backtrackable reference.<br> </div> <pre><span class="keyword">val</span> <a name="VALget"></a>get : <code class="type">'a <a href="Stak.html#TYPEref">ref</a> -> 'a</code></pre><div class="info"> Dereference.<br> </div> </body></html>