UNPKG

@ciao-lang/ts-ciao-interface

Version:

Simple Ciao interface for node.

134 lines (114 loc) 14.5 kB
<!DOCTYPE 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>The Ciao library browser &mdash; 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">&#9776;</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="ExtraLibs.html">&#x2191;</a><a class="lpdoc-navbutton" href="version_strings.html">&#x2190;</a><a class="lpdoc-navbutton" href="random.html">&#x2192;</a><a class="lpdoc-navbutton" href="ciaosearch.html">&#x1F50D;</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> &raquo;<br/> </li><li><a href="ExtraLibs.html">PART VIII - Additional libraries</a> &raquo;<br/> </li><li><a href=""><strong>The Ciao library browser</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 internals">Documentation on internals</a></li><li><a href="#Documentation on imports">Documentation on imports</a></li></ul></div><div class="lpdoc-main"><div id=""><h1>The Ciao library browser</h1><a class="lpdoc-idx-anchor" href="ciaosearch.html#librowser"></a> <strong>Author(s):</strong> <a class="lpdoc-idx-anchor" id="Angel Fernandez Pineda" href="ciaosearch.html#Angel Fernandez Pineda">Angel Fernandez Pineda</a>, <a class="lpdoc-idx-anchor" id="Isabel Garcia-Contreras" href="ciaosearch.html#Isabel Garcia-Contreras">Isabel Garcia-Contreras</a>, <a class="lpdoc-idx-anchor" id="Jose F. Morales" href="ciaosearch.html#Jose F. Morales">Jose F. Morales (minor)</a>.<p> The <a class="lpdoc-idx-anchor" id="0" href=""><tt>librowser</tt></a> library provides a set of predicates wich enable the user to interactively find Ciao libraries and/or any predicate exported by them.<p>This is a simple example:<p><pre class="lpdoc-codeblock">?- apropos(aggregates:&apos;.*find.*&apos;). aggregates:findnsols/5 aggregates:findnsols/4 aggregates:findall/4 aggregates:findall/3 yes ?- </pre> <p><a class="lpdoc-idx-anchor" id="1" href=""><tt>librowser</tt></a> is specially useful when inside GNU Emacs: just place the cursor over a librowser response and press C-cTAB in order to get help on the related predicate. Refer to the <strong>&quot;Using Ciao inside GNU Emacs&quot;</strong> chapter for further information. <br/><div id="Usage and interface"><h2>Usage and interface</h2><div class="lpdoc-cartouche"><ul><li><strong>Library usage:</strong><br/>It is not necesary to use this library at user programs. It is designed to be used at the Ciao <em>toplevel</em> shell: <a class="lpdoc-idx-anchor" id="2" href="ciaosearch.html#ciaosh"><tt>ciaosh</tt></a>. In order to do so, just make use of <a class="lpdoc-idx-anchor" id="3" href="toplevel_doc.html#use_module/1"><tt>use_module/1</tt></a> as follows:<p><tt>use_module(library(librowser))</tt>.<p>Then, the library interface must be read. This is automatically done when calling any predicate at librowser, and the entire process will take a little moment.So, you should want to perform such a process after loading the Ciao toplevel:<p><pre class="lpdoc-codeblock">?- use_module(library(librowser)). yes ?- update. </pre> <p>Whether you want this process to be automatically performed when loading <a class="lpdoc-idx-anchor" id="4" href="ciaosearch.html#ciaosh"><tt>ciaosh</tt></a>, you may include those lines in your <em>.ciaorc</em> personal initialization file. <li><strong>Exports:</strong><br/><ul class="lpdoc-itemize-minus"><li><em>Predicates:</em><br/><a class="lpdoc-idx-anchor" id="5" href="#update/0"><tt>update/0</tt></a>, <a class="lpdoc-idx-anchor" id="6" href="#browse/2"><tt>browse/2</tt></a>, <a class="lpdoc-idx-anchor" id="7" href="#where/1"><tt>where/1</tt></a>, <a class="lpdoc-idx-anchor" id="8" href="#describe/1"><tt>describe/1</tt></a>, <a class="lpdoc-idx-anchor" id="9" href="#apropos/1"><tt>apropos/1</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="update/0" href="ciaosearch.html#update/0">update/0</a></div><div class="lpdoc-deftext">This predicate will scan the Ciao <a class="lpdoc-idx-anchor" id="10" href="ciaosearch.html#libraries">libraries</a> for predicate definitions. This may be done once time before calling any other predicate at this library.<p><a class="lpdoc-idx-anchor" id="11" href="#update/0"><tt>update/0</tt></a> will also be automatically called (once) when calling any other predicate at librowser.<p><span class="lpdoc-usage-header">Usage:</span><p>Creates an internal database of modules at Ciao <a class="lpdoc-idx-anchor" id="12" href="ciaosearch.html#libraries">libraries</a>.</p><ul class="lpdoc-itemize-minus"></ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="browse/2" href="ciaosearch.html#browse/2">browse/2</a></div><div class="lpdoc-deftext">This predicate is fully reversible, and is provided to inspect concrete predicate specifications. For example: <pre class="lpdoc-codeblock">?- browse(M,findall/A). A = 3, M = conc_aggregates ? ; A = 4, M = aggregates ? ; A = 3, M = aggregates ? ; no ?- </pre> <p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>browse(Module,Spec)</tt> </span><p>Asocciates the given <span class="lpdoc-var">Spec</span> predicate specification with the <span class="lpdoc-var">Module</span> which exports it.</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="13" href="ciaosearch.html#module_name/1"><tt>librowser:module_name/1</tt></a>)</span><span><span class="lpdoc-var">Module</span> is a module name (an atom) </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="14" href="ciaosearch.html#pred_spec/1"><tt>librowser:pred_spec/1</tt></a>)</span><span><span class="lpdoc-var">Spec</span> is a <strong>Functor/Arity</strong> predicate specification </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="where/1" href="ciaosearch.html#where/1">where/1</a></div><div class="lpdoc-deftext">This predicate will print at the screen the module needed in order to import a given predicate specification. For example: <pre class="lpdoc-codeblock">?- where(findall/A). findall/3 exported at module conc_aggregates findall/4 exported at module aggregates findall/3 exported at module aggregates yes ?- </pre> <p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>where(Spec)</tt> </span><p>Display what module to load in order to import the given <span class="lpdoc-var">Spec</span>.</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="15" href="ciaosearch.html#pred_spec/1"><tt>librowser:pred_spec/1</tt></a>)</span><span><span class="lpdoc-var">Spec</span> is a <strong>Functor/Arity</strong> predicate specification </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="describe/1" href="ciaosearch.html#describe/1">describe/1</a></div><div class="lpdoc-deftext">This one is used to find out which predicates were exported by a given module. Very useful when you know the library, but not the concrete predicate. For example: <pre class="lpdoc-codeblock">?- describe(librowser). Predicates at library librowser : apropos/1 describe/1 where/1 browse/2 update/0 yes ?- </pre> <p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>describe(Module)</tt> </span><p>Display a list of exported predicates at the given <span class="lpdoc-var">Module</span></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="16" href="ciaosearch.html#module_name/1"><tt>librowser:module_name/1</tt></a>)</span><span><span class="lpdoc-var">Module</span> is a module name (an atom) </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="apropos/1" href="ciaosearch.html#apropos/1">apropos/1</a></div><div class="lpdoc-deftext">This tool makes use of <a class="lpdoc-idx-anchor" id="17" href="ciaosearch.html#regular expresions">regular expresions</a> in order to find predicate specifications. It is very useful whether you can&apos;t remember the full name of a predicate. Regular expresions take the same format as described in library <a class="lpdoc-idx-anchor" id="18" href="ciaosearch.html#patterns"><tt>patterns</tt></a>. Example: <pre class="lpdoc-codeblock">?- apropos(&apos;write.&apos;). write:writeq/1 write:writeq/2 yes ?- apropos(&apos;write.*&apos;/2). dht_misc:write_pr/2 profiler_auto_conf:write_cc_assertions/2 mtree:write_mforest/2 transaction_concurrency:write_lock/2 transaction_logging:write/2 provrml_io:write_vrml_file/2 provrml_io:write_terms_file/2 unittest_base:write_data/2 write:write_canonical/2 write:writeq/2 write:write/2 write:write_term/2 stream_utils:write_string/2 res_exectime_hlm_gen:write_hlm_indep_each/2 res_exectime_hlm_gen:write_hlm_indep_2/2 res_exectime_hlm_gen:write_hlm_dep/2 oracle_calibration:write_conf/2 bshare_utils:write_string/2 bshare_utils:write_string_list/2 bshare_utils:write_length/2 bshare_utils:write_neg_db_stream/2 bshare_utils:write_neg_db/2 bshare_utils:write_pos_db/2 yes </pre> When no predicates are found with the exact search, this predicate will perform a fuzzy search which will find predicates at a distance of one edit, swap, deletion or insertion.<p><pre class="lpdoc-codeblock">?- apropos(&apos;wirte&apos;). Predicate wirte not found. Similar predicates: transaction_logging:write/2 write:write/1 write:write/2 yes ?- apropos(apend). Predicate apend not found. Similar predicates: hprolog:append/2 lists:append/3 llists:append/2 yes ?- </pre> <p><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>apropos(RegSpec)</tt> </span><p>This will search any predicate specification <span class="lpdoc-var">Spec</span> which matches the given <span class="lpdoc-var">RegSpec</span> incomplete predicate specification.</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="19" href="#apropos_spec/1"><tt>librowser:apropos_spec/1</tt></a>)</span><span><span class="lpdoc-var">RegSpec</span> is a predicate specification <tt>Pattern</tt>, <tt>Pattern/Arity</tt>, <tt>Module:Pattern</tt>, <tt>Module:Pattern/Arity</tt>. </span> </ul></div></div><p> </div><div id="Documentation on internals"><h2>Documentation on internals</h2><div><div class="lpdoc-defname"><span class="lpdoc-predtag">REGTYPE</span><a class="lpdoc-idx-anchor" id="apropos_spec/1" href="ciaosearch.html#apropos_spec/1">apropos_spec/1</a></div><div class="lpdoc-deftext">Defined as: <pre class="lpdoc-codeblock">apropos_spec(Pattern) :- atm(Pattern). apropos_spec(Pattern/Arity) :- atm(Pattern), int(Arity). apropos_spec(Module:Pattern/Arity) :- atm(Pattern), atm(Module), int(Arity). apropos_spec(Module:Pattern) :- atm(Pattern), atm(Module). </pre> <p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>apropos_spec(S)</tt> </span><p><span class="lpdoc-var">S</span> is a predicate specification <tt>Pattern</tt>, <tt>Pattern/Arity</tt>, <tt>Module:Pattern</tt>, <tt>Module:Pattern/Arity</tt>.</p><ul class="lpdoc-itemize-minus"></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="20" href="regexp_code.html"><tt>regexp_code</tt></a>, <a class="lpdoc-idx-anchor" id="21" href="datafacts_rt.html"><tt>datafacts_rt</tt></a>, <a class="lpdoc-idx-anchor" id="22" href="read.html"><tt>read</tt></a>, <a class="lpdoc-idx-anchor" id="23" href="fastrw.html"><tt>fastrw</tt></a>, <a class="lpdoc-idx-anchor" id="24" href="system.html"><tt>system</tt></a>, <a class="lpdoc-idx-anchor" id="25" href="stream_utils.html"><tt>stream_utils</tt></a>, <a class="lpdoc-idx-anchor" id="26" href="lists.html"><tt>lists</tt></a>, <a class="lpdoc-idx-anchor" id="27" href="fuzzy_search.html"><tt>fuzzy_search</tt></a>, <a class="lpdoc-idx-anchor" id="28" href="pathnames.html"><tt>pathnames</tt></a>, <a class="lpdoc-idx-anchor" id="29" href="ciaosearch.html#bundle_paths"><tt>bundle_paths</tt></a>, <a class="lpdoc-idx-anchor" id="30" href="write.html"><tt>write</tt></a>. <li><em>Packages:</em><br/><a class="lpdoc-idx-anchor" id="31" href="ciaosearch.html#prelude"><tt>prelude</tt></a>, <a class="lpdoc-idx-anchor" id="32" href="ciaosearch.html#initial"><tt>initial</tt></a>, <a class="lpdoc-idx-anchor" id="33" href="condcomp_doc.html"><tt>condcomp</tt></a>, <a class="lpdoc-idx-anchor" id="34" href="assertions_doc.html"><tt>assertions</tt></a>, <a class="lpdoc-idx-anchor" id="35" href="ciaosearch.html#assertions/assertions_basic"><tt>assertions/assertions_basic</tt></a>, <a class="lpdoc-idx-anchor" id="36" href="regexp_doc.html"><tt>regexp</tt></a>, <a class="lpdoc-idx-anchor" id="37" href="datafacts_doc.html"><tt>datafacts</tt></a>, <a class="lpdoc-idx-anchor" id="38" href="dcg_doc.html"><tt>dcg</tt></a>. </ul></div></div><div class="lpdoc-footer">Generated with LPdoc using Ciao</div></div><div class="lpdoc-clearer"></div></div></body></html>