@ciao-lang/ts-ciao-interface
Version:
Simple Ciao interface for node.
37 lines • 12.1 kB
HTML
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><meta name="theme-color" content="#273f79"/><link rel="stylesheet" href="lpdoc.css" type="text/css"/><script type="text/javascript" src="lpdoc.js"></script><title>Aggregates (concurrency-safe) — The Ciao System v1.22</title></head><body><div class="lpdoc-page fixleftbar"><a href="#" id="sidebar-toggle-button" class="lpdoc-navbutton"><span id="sidebar-button-arrow">☰</span></a><div id="sidebar" class="lpdoc-sidebar"><div style="height: 40px; margin-left: auto; margin-right: auto"><img src="ciao-logo_autofig.png" width=auto height=100%></div><div class="lpdoc-nav"><span class="lpdoc-on-right"><a class="lpdoc-navbutton" href="ExtendLang.html">↑</a><a class="lpdoc-navbutton" href="concurrency.html">←</a><a class="lpdoc-navbutton" href="actmod_doc.html">→</a><a class="lpdoc-navbutton" href="ciaosearch.html">🔍</a></span><span><a href="ciaofulltoc.html">TOC</a></span></div><hr></hr><ul class="lpdoc-itemize-sectpath"><li><a href="ciao.html">The Ciao System</a> »<br/> </li><li><a href="ExtendLang.html">PART IV - Language extensions</a> »<br/> </li><li><a href=""><strong>Aggregates (concurrency-safe)</strong></a></li></ul><hr></hr><em>ON THIS PAGE</em><ul><li><a href="#Usage and interface">Usage and interface</a></li><li><a href="#Documentation on exports">Documentation on exports</a></li><li><a href="#Documentation on imports">Documentation on imports</a></li></ul></div><div class="lpdoc-main"><div id=""><h1>Aggregates (concurrency-safe)</h1><a class="lpdoc-idx-anchor" href="ciaosearch.html#conc_aggregates"></a>
<strong>Author(s):</strong> <a class="lpdoc-idx-anchor" id="Manuel Carro" href="ciaosearch.html#Manuel Carro">Manuel Carro (concurrency-safeness)</a>.<p>
This module implements thread-safe aggregation predicates. Its use and results should be the same as those in the <a class="lpdoc-idx-anchor" id="0" href="ciaosearch.html#aggregates">aggregates</a> library, but several goals can use them concurrently without the interference and wrong results (due to implementation reasons) <a class="lpdoc-idx-anchor" id="1" href="ciaosearch.html#aggregates">aggregates</a> might lead to. This particular implementation is completely based on the one used in the <a class="lpdoc-idx-anchor" id="2" href="ciaosearch.html#aggregates">aggregates</a> library (whose original authors were <a class="lpdoc-idx-anchor" id="3" href="aggregates.html#Richard A. O'Keefe">Richard A. O'Keefe</a> and <a class="lpdoc-idx-anchor" id="4" href="aggregates.html#David H.D. Warren">David H.D. Warren</a>). <br/><div id="Usage and interface"><h2>Usage and interface</h2><div class="lpdoc-cartouche"><ul><li><strong>Library usage:</strong><br/><tt>:- use_module(library(conc_aggregates)).</tt><li><strong>Exports:</strong><br/><ul class="lpdoc-itemize-minus"><li><em>Predicates:</em><br/><a class="lpdoc-idx-anchor" id="5" href="aggregates.html#findall/3"><tt>findall/3</tt></a>, <a class="lpdoc-idx-anchor" id="6" href="aggregates.html#setof/3"><tt>setof/3</tt></a>, <a class="lpdoc-idx-anchor" id="7" href="aggregates.html#bagof/3"><tt>bagof/3</tt></a>.
</ul></ul></div></div><div id="Documentation on exports"><h2>Documentation on exports</h2><div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="findall/3" href="ciaosearch.html#findall/3">findall/3</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><span class="lpdoc-on-right"><span class="lpdoc-iso">ISO</span></span><span><tt>findall(Template,Generator,List)</tt></span>
</span><p>A special case of bagof, where all free variables in the <span class="lpdoc-var">Generator</span> are taken to be existentially quantified. Safe in concurrent applications.</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="8" href="term_typing.html#nonvar/1"><tt>term_typing:nonvar/1</tt></a>)</span><span><span class="lpdoc-var">Generator</span> is currently a term which is not a free variable.
</span>
<li><em>The following properties should hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="9" href="basic_props.html#term/1"><tt>basic_props:term/1</tt></a>)</span><span><span class="lpdoc-var">Template</span> is any term.
</span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="10" href="basic_props.html#cgoal/1"><tt>basic_props:cgoal/1</tt></a>)</span><span><span class="lpdoc-var">Goal</span> is a term which represents a goal, i.e., an atom or a structure.
</span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="11" href="basic_props.html#list/1"><tt>basic_props:list/1</tt></a>)</span><span><span class="lpdoc-var">Set</span> is a list.
</span>
<li><em>The following properties should hold globally:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="12" href="native_props_nfdet_doc.html#is_det/1"><tt>native_props:is_det/1</tt></a>)</span><span>All calls of the form <span class="lpdoc-var">findall(Template,Generator,List)</span> are deterministic.
</span>
</ul>
<em>Meta-predicate</em> with arguments: <tt>findall(?,goal,?)</tt>.<br/></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="setof/3" href="ciaosearch.html#setof/3">setof/3</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><span class="lpdoc-on-right"><span class="lpdoc-iso">ISO</span></span><span><tt>setof(Template,Goal,Set)</tt></span>
</span><p>Finds the <span class="lpdoc-var">Set</span> of instances of the <span class="lpdoc-var">Template</span> satisfying the <span class="lpdoc-var">Generator</span>. The set is in ascending order (see <a class="lpdoc-idx-anchor" id="13" href="term_compare.html#compare/3"><tt>compare/3</tt></a> for a definition of this order) without duplicates, and is non-empty. If there are no solutions, <a class="lpdoc-idx-anchor" id="14" href="aggregates.html#setof/3"><tt>setof/3</tt></a> fails. <a class="lpdoc-idx-anchor" id="15" href="aggregates.html#setof/3"><tt>setof/3</tt></a> may succeed in more than one way, binding free variables in the <span class="lpdoc-var">Generator</span> to different values. This can be avoided by using existential quantifiers on the free variables in front of the <span class="lpdoc-var">Generator</span>, using <a class="lpdoc-idx-anchor" id="16" href="aggregates.html#^/2"><tt>^/2</tt></a>. E.g., in <tt>A^p(A,B)</tt>, <tt>A</tt> is existentially quantified. Safe in concurrent apllications.</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="17" href="term_typing.html#nonvar/1"><tt>term_typing:nonvar/1</tt></a>)</span><span><span class="lpdoc-var">Goal</span> is currently a term which is not a free variable.
</span>
<li><em>The following properties should hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="18" href="basic_props.html#term/1"><tt>basic_props:term/1</tt></a>)</span><span><span class="lpdoc-var">Template</span> is any term.
</span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="19" href="basic_props.html#cgoal/1"><tt>basic_props:cgoal/1</tt></a>)</span><span><span class="lpdoc-var">Goal</span> is a term which represents a goal, i.e., an atom or a structure.
</span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="20" href="basic_props.html#list/1"><tt>basic_props:list/1</tt></a>)</span><span><span class="lpdoc-var">Set</span> is a list.
</span>
<li><em>The following properties should hold globally:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="21" href="basic_props.html#not_further_inst/2"><tt>basic_props:not_further_inst/2</tt></a>)</span><span><span class="lpdoc-var">Template</span> is not further instantiated.
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="bagof/3" href="ciaosearch.html#bagof/3">bagof/3</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><span class="lpdoc-on-right"><span class="lpdoc-iso">ISO</span></span><span><tt>bagof(Template,Generator,Bag)</tt></span>
</span><p>Finds all the instances of the <span class="lpdoc-var">Template</span> produced by the <span class="lpdoc-var">Generator</span>, and returns them in the <span class="lpdoc-var">Bag</span> in the order in which they were found. If the <span class="lpdoc-var">Generator</span> contains free variables which are not bound in the <span class="lpdoc-var">Template</span>, it assumes that this is like any other Prolog question and that you want bindings for those variables. This can be avoided by using existential quantifiers on the free variables in front of the <span class="lpdoc-var">Generator</span>, using <a class="lpdoc-idx-anchor" id="22" href="aggregates.html#^/2"><tt>^/2</tt></a>. Safe in concurrent applications.</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="23" href="term_typing.html#nonvar/1"><tt>term_typing:nonvar/1</tt></a>)</span><span><span class="lpdoc-var">Generator</span> is currently a term which is not a free variable.
</span>
<li><em>The following properties should hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="24" href="basic_props.html#term/1"><tt>basic_props:term/1</tt></a>)</span><span><span class="lpdoc-var">Template</span> is any term.
</span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="25" href="basic_props.html#cgoal/1"><tt>basic_props:cgoal/1</tt></a>)</span><span><span class="lpdoc-var">Goal</span> is a term which represents a goal, i.e., an atom or a structure.
</span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="26" href="basic_props.html#list/1"><tt>basic_props:list/1</tt></a>)</span><span><span class="lpdoc-var">Set</span> is a list.
</span>
<li><em>The following properties should hold globally:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="27" href="basic_props.html#not_further_inst/2"><tt>basic_props:not_further_inst/2</tt></a>)</span><span><span class="lpdoc-var">Template</span> is not further instantiated.
</span>
</ul></div></div><p>
</div><div id="Documentation on imports"><h2>Documentation on imports</h2>This module has the following direct dependencies:<ul class="lpdoc-itemize-minus"><li><em>System library modules:</em><br/><a class="lpdoc-idx-anchor" id="28" href="ciaosearch.html#native_props"><tt>native_props</tt></a>, <a class="lpdoc-idx-anchor" id="29" href="datafacts_rt.html"><tt>datafacts_rt</tt></a>.
<li><em>Packages:</em><br/><a class="lpdoc-idx-anchor" id="30" href="ciaosearch.html#prelude"><tt>prelude</tt></a>, <a class="lpdoc-idx-anchor" id="31" href="ciaosearch.html#initial"><tt>initial</tt></a>, <a class="lpdoc-idx-anchor" id="32" href="condcomp_doc.html"><tt>condcomp</tt></a>, <a class="lpdoc-idx-anchor" id="33" href="assertions_doc.html"><tt>assertions</tt></a>, <a class="lpdoc-idx-anchor" id="34" href="ciaosearch.html#assertions/assertions_basic"><tt>assertions/assertions_basic</tt></a>, <a class="lpdoc-idx-anchor" id="35" href="isomodes_doc.html"><tt>isomodes</tt></a>, <a class="lpdoc-idx-anchor" id="36" href="ciaosearch.html#nativeprops"><tt>nativeprops</tt></a>, <a class="lpdoc-idx-anchor" id="37" href="datafacts_doc.html"><tt>datafacts</tt></a>.
</ul></div></div><div class="lpdoc-footer">Generated with LPdoc using Ciao</div></div><div class="lpdoc-clearer"></div></div></body></html>