

<!DOCTYPE html>
<!-- Server: sfs-forge-1 -->


    

















<html lang="en" class="no-js">
<head>
    <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
    <title>
  XSB / Src  (SVN)-old /
  [r6903]
  /trunk/XSB/docs/userman/builtin.tex
</title>
    

<meta name="viewport" content="width=1100">


<link rel="icon" sizes="180x180" href="https://a.fsdn.com/con/img/sandiego/logo-180x180.png" type="image/png">
<link rel="icon" sizes="any" href="https://a.fsdn.com/con/img/sandiego/svg/originals/sf-icon-orange-no_sf.svg" type="image/svg+xml">
<link rel="apple-touch-icon" sizes="180x180" href="https://a.fsdn.com/con/img/sandiego/logo-180x180.png">
<link rel="mask-icon" href="https://a.fsdn.com/con/img/sandiego/svg/originals/sf-icon-orange-no_sf.svg" color="#FF6600">


<script src="https://a.fsdn.com/allura/nf/1753456284/_ew_/theme/sftheme/js/sftheme/cmp2.js"></script>






    
    
    
    
    
    
    
    
    <link rel="stylesheet" href="https://a.fsdn.com/con/css/lato.css?">


<script>
if (!window.SF) { window.SF = {}; }
SF.sandiego = false;
SF.sandiego_chrome = true;
SF.cdn = "https://a.fsdn.com/con";
SF.fpid = 'e7ad0448-32d5-49fb-8f11-fd2e5104e1d5';
SF.billboard_route = '/software/product/$slug/';
</script>
    
        <!-- ew:head_css -->

    
        <link rel="stylesheet"
                type="text/css"
                href="https://a.fsdn.com/allura/nf/1753456284/_ew_/_slim/css?href=allura%2Fcss%2Fforge%2Fhilite.css%3Ballura%2Fcss%2Fforge%2Ftooltipster.css"
                >
    
        <link rel="stylesheet"
                type="text/css"
                href="https://a.fsdn.com/allura/nf/1753456284/_ew_/allura/css/font-awesome.min.css"
                >
    
        <link rel="stylesheet"
                type="text/css"
                href="https://a.fsdn.com/allura/nf/1753456284/_ew_/theme/sftheme/css/forge.css"
                >
    
        
<!-- /ew:head_css -->

    
    
        <!-- ew:head_js -->

    
        <script type="text/javascript" src="https://a.fsdn.com/allura/nf/1753456284/_ew_/_slim/js?href=allura%2Fjs%2Fjquery-3.6.0.min.js%3Ballura%2Fjs%2Fjquery.cookie-1.4.1.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fshared_head.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Ftypescript%2Fcompliance.js"></script>
    
        
<!-- /ew:head_js -->

    

    
        <style type="text/css">
            /* make URL &amp; Project custom fields in support tickets not get hidden as much */
.project-forge.mountpoint-site-support .view_holder .grid-4:nth-child(5),
.project-forge.mountpoint-site-support .view_holder .grid-4:nth-child(6) {
  overflow: visible;
  font-size: 22px;
  width: 340px;
  line-height: 1;
  margin-bottom: 5px;
}
.project-forge.mountpoint-site-support .view_holder .grid-4:nth-child(5) label, .project-forge.mountpoint-site-support .view_holder .grid-4:nth-child(6) label {
  font-size: 14px;
}
        </style>
    
    
    <link rel="alternate" type="application/rss+xml" title="RSS" href="/p/xsb/src/feed.rss"/>
    <link rel="alternate" type="application/atom+xml" title="Atom" href="/p/xsb/src/feed.atom"/>
    <style type="text/css">
        #access_urls .btn-set {
            
            min-width: 14em;
        }
    </style>

    <style>.XwoDvsKAIDocURHDvwnDgbDhzrCvKNwqJwnDvg {
        display: none
    }</style>

    
    
    
        <link rel="canonical" href="https://sourceforge.net/p/xsb/src/6903/tree/trunk/XSB/docs/userman/builtin.tex" />
    


    

<script>
    var data = {hem: null };
    bizx.uids.gatherAndClean(data);
</script>



<script>
    function initPiwik(){
      var _paq = window._paq = window._paq || [];
      _paq.push(['trackPageView', document.title, {
            dimension1: 'xsb',
            dimension2: 'svn'
      }]);
      _paq.push(['enableLinkTracking']);
      
          _paq.push(['enableHeartBeatTimer']);
      
      (function() {
        var u="//analytics.slashdotmedia.com/";
        _paq.push(['setTrackerUrl', u+'sf.php']);
        _paq.push(['setSiteId', 39]);
        
        var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
        g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'sf.js'; s.parentNode.insertBefore(g,s);
      })();
    }
    bizx.cmp.ifConsent({ purposes: ['storage', 'measurement'], vendors: 'sdm'}, initPiwik);
</script>






<!-- Hubspot tracking -->






 <script>
    $(function() {
        bizx.cmp.ifConsent({ purposes: 'all' , vendors: 'narrative'}, function() {
            var current_time = (new Date()).getTime();
            let imageUrl = "https://io.narrative.io/?companyId=2440&id=first_party%3Ae7ad0448-32d5-49fb-8f11-fd2e5104e1d5&id=site_name%3Asourceforge.net&id=url%3A%2Fp%2Fxsb%2Fsrc%2F6903%2Ftree%2Ftrunk%2FXSB%2Fdocs%2Fuserman%2Fbuiltin.tex&id=pagetitle%3A%24PAGE_TITLE&id=vertical%3AOpen+Source+Software&id=product%3AXSB";
            imageUrl = imageUrl.replace(encodeURIComponent("$PAGE_TITLE"), document.title);  

            imageUrl = URL.parse(imageUrl);
            let hem = bizx.uids.getHem();
            if (hem) {
                imageUrl.searchParams.append('id', 'hem:' + hem);
            }
            imageUrl.searchParams.append('rand', current_time);

            var image = new Image();
            image.src = imageUrl.toString();
            image.style.display = "none";
            image.style.height = 0;
            image.style.width = 0;
            document.body.appendChild(image);
        });
    });
</script>



</head>

<body class="
body_class sandiego_chrome  legacy_chrome  l-allow-natural-width 
" id="forge">

    
        <!-- ew:body_top_js -->

    
        
<!-- /ew:body_top_js -->

    





<div class="off-canvas position-right" id="offCanvas" data-off-canvas>
    <!-- Menu -->
    <ul class="header-nav-menulist">
        <li class="highlight search">
            
            
                
            
            
    <form method="get" action="/directory/" class="m-search-form">
    
        <input type="text" placeholder="Search for software or solutions" autocomplete="off" name="q" >
        
        <label >
            <input type="submit" class="bt" value="">
            


<svg  data-name="search" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1216 832q0-185-131.5-316.5t-316.5-131.5-316.5 131.5-131.5 316.5 131.5 316.5 316.5 131.5 316.5-131.5 131.5-316.5zm512 832q0 52-38 90t-90 38q-54 0-90-38l-343-342q-179 124-399 124-143 0-273.5-55.5t-225-150-150-225-55.5-273.5 55.5-273.5 150-225 225-150 273.5-55.5 273.5 55.5 225 150 150 225 55.5 273.5q0 220-124 399l343 343q37 37 37 90z"/></svg>
        </label>
    </form>
        </li>
        
        <li class="highlight"><a href="/auth/">Join/Login</a></li>
        
        <li><a href="/software/">Business Software</a></li>
        <li><a href="/directory/">Open Source Software</a></li>
        <li><a  href="/software/vendors/" title="For Vendors">For Vendors</a></li>
        <li><a href="/blog/" title="Blog">Blog</a></li>
        <li><a href="/about">About</a></li>
        <li><a id="header-nav-more" data-toggle="header-nav-more header-nav-more-content" data-toggler=".toggled">More</a></li>
        <li>
            <ul id="header-nav-more-content" class="toggled" data-toggler=".toggled">
                
    

    
    
        <li><a href="/articles/">Articles</a></li>
    
    

    
 
                
                <li><a href="/create">Create</a></li>
                
                <li><a href="https://sourceforge.net/articles/category/sourceforge-podcast/">SourceForge Podcast</a></li>
                
                    <li><a href="https://sourceforge.net/p/forge/documentation/Docs%20Home/">Site Documentation</a></li>
                
                <li><a href="/user/newsletters">Subscribe to our Newsletter</a></li>
                <li><a href="/support">Support Request</a></li>
            </ul>
        </li>
    </ul>
</div>
<div class="off-canvas-content" data-off-canvas-content>

    




<script>
    SF.linkout_icon = '<svg  data-name="sf-linkout-icon" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 300 300" style="enable-background:new 0 0 300 300;" xml:space="preserve"><polygon class="st0" points="243.2,243.2 56.8,243.2 56.8,56.8 123,56.8 123,9 9,9 9,291 291,291 291,179.4 243.2,179 "/><polygon class="st0" points="128.5,213 155,186.5 176,165.5 206.7,196.3 235.5,132.5 248.9,102.6 290.6,9.8 291,9 290.6,9.2 197.4,51.1 169.1,63.8 103.7,93.3 137,126.5 115.9,147.5 89.5,174 "/></svg>';
</script>


<div class="l-header-nav  sandiego">

    <section class="sandiego l-header-nav-top show-for-large">
        <div class="row">
            <a href="/" title="Home" class="sf-logo">
                
    
    <img src="https://a.fsdn.com/con/images/sandiego/sf-logo-full.svg"  alt="SourceForge logo" class="sf-logo-full"/>
            </a>
            <nav class="links">
                
                    <a href="/user/newsletters" title="Subscribe to our newsletter"><span class="newsletter-icon">


<svg  data-name="mmSF_11mail" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 42 42" enable-background="new 0 0 42 42" xml:space="preserve"><path fill="#FFFFFF" d="M0,6v30h42V6H0z M24.2,21.2c-0.8,0.8-2.3,2-3.2,2c-0.9,0-2.4-1.2-3.2-2L5.8,9.7h30.3L24.2,21.2z M13.7,21l-9.9,9.4V11.6L13.7,21z M15.7,23L15.7,23c0.5,0.5,2.9,2.9,5.3,2.9c2.4,0,4.8-2.4,5.2-2.8l0.1-0.1l9.8,9.4H5.8L15.7,23z M28.3,21l9.9-9.5v18.9L28.3,21z"/></svg></span></a>
                
                <a href="/software/vendors/" title="For Vendors">For Vendors</a>
                
                
                    <a href="/support" title="Help">Help</a>
                    <a href="/create/" title="Create">Create</a>
                

                
                <a href="/user/registration" title="Join" >Join</a>
                <a href="/auth/" title="Login">Login</a>
                
            </nav>
        </div>
    </section>

    <section class="sandiego l-header-nav-top hide-for-large">
        <div class="row">
            <a href="/" title="Home" class="sf-logo">
                
    
    <img src="https://a.fsdn.com/con/images/sandiego/sf-logo-full.svg"  alt="SourceForge logo" class="sf-logo-full"/>
            </a>
            <div class="title-bar-right">
                <button type="button" aria-label="Toggle Main Menu" class="menu-icon" data-toggle="offCanvas"></button>
            </div>
        </div>
    </section>
    <section class="sandiego l-header-nav-bottom">
        <nav class="row">
            <a href="/" title="Home" class="sf-logo">
                
    
    <img src="https://a.fsdn.com/con/images/sandiego/sf-logo-full.svg"  alt="SourceForge logo" class="sf-logo-full"/>
            </a>
            <div class="links">
                
    
        <div class="nav-dropdown">
            <a href="/software/">Business Software</a>
            
        </div>
        <div class="nav-dropdown">
            <a href="/directory/" title="Browse">Open Source Software</a>
            
        </div>
        <div class="nav-dropdown">
            <a href="https://sourceforge.net/articles/category/sourceforge-podcast/">SourceForge Podcast</a>
        </div>
        <div class="nav-dropdown">
            <a>Resources</a>
            <ul class="nav-dropdown-menu">
                  <li><a href="/articles/">Articles</a></li>
                  
                  <li><a href="/software/case-studies/">Case Studies</a></li>
                  
                  <li><a href="/blog/">Blog</a></li>
            </ul>
        </div>
    

                <div class="dev-menu-when-stuck">
                    Menu
                    <ul class="dev-menu-dropdown header-nav-menulist">
                        <li><a href="/support">Help</a></li>
                        <li><a href="/create">Create</a></li>
                        <li><a href="/user/registration/" title="Join" >Join</a></li>
                        <li><a href="/auth/" title="Login">Login</a></li>
                    </ul>
                </div>
                <div class="search-toggle-when-stuck">
                    <a class="search-toggle">
                        


<svg  data-name="search" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1216 832q0-185-131.5-316.5t-316.5-131.5-316.5 131.5-131.5 316.5 131.5 316.5 316.5 131.5 316.5-131.5 131.5-316.5zm512 832q0 52-38 90t-90 38q-54 0-90-38l-343-342q-179 124-399 124-143 0-273.5-55.5t-225-150-150-225-55.5-273.5 55.5-273.5 150-225 225-150 273.5-55.5 273.5 55.5 225 150 150 225 55.5 273.5q0 220-124 399l343 343q37 37 37 90z"/></svg>
                    </a>
                </div>
            </div>

            <div class="search">
                
                
    
    
        <div class="main-nav-link">
            
            
            <a href="https://www.avast.com/lp-free-av?full_trSrc=mmm_srf_dlp_008_406_a&amp;utm_medium=referral&amp;utm_source=sourceforge&amp;utm_campaign=srf_dlp_008_406_a:site_banner" rel="nofollow" target="_blank" id="main-nav-badge-link" data-label="avastjuly">
                <img src="https://a.fsdn.com/con/assets/maxnav/sourceforge/ai-protection-32-75dd98b2.png"  srcset="https://a.fsdn.com/con/assets/maxnav/sourceforge/ai-protection-75de80f6.png 2x"  alt="" id="main-nav-image"/>
            </a>
        </div>
    


                
                    
                
                
                
                
    <form method="get" action="/directory/" class="m-search-form">
    
    <div class="typeahead__container">
      <div class="typeahead__field">
        <div class="typeahead__query">
        
        <input type="text" placeholder="Search for software or solutions" autocomplete="off" name="q" >
        
        </div>
        
        <label >
            <input type="submit" class="bt" value="">
            


<svg  data-name="search" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1216 832q0-185-131.5-316.5t-316.5-131.5-316.5 131.5-131.5 316.5 131.5 316.5 316.5 131.5 316.5-131.5 131.5-316.5zm512 832q0 52-38 90t-90 38q-54 0-90-38l-343-342q-179 124-399 124-143 0-273.5-55.5t-225-150-150-225-55.5-273.5 55.5-273.5 150-225 225-150 273.5-55.5 273.5 55.5 225 150 150 225 55.5 273.5q0 220-124 399l343 343q37 37 37 90z"/></svg>
        </label>
      </div>
    </div>
    
    </form>
                
            </div>
        </nav>
        
    </section>
    
</div>
    
    
    <div class="notification-on-project-page">
    
        
    
    
    
    </div>
    
    


    <section id="page-body" class=" neighborhood-Projects project-xsb mountpoint-src 

">
        <div id="nav_menu_holder">
            
                
                    
    <div class="sandiego"> 
            
            
            
            
<section class="project-masthead"> 
    
    

    
<div class="backdrop" style="box-sizing: content-box; padding-bottom: 24px"></div>

    <div class="content">
    
        
    <nav id="breadcrumbs" class="breadcrumbs rtl">
        <ul itemscope itemtype="http://schema.org/BreadcrumbList">
            <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
                <a itemprop="item" href="/"><span itemprop="name">Home</span></a>
                <meta itemprop="position" content="1"/>
            </li>
            <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
                <a itemprop="item" href="/directory/"><span itemprop="name">Browse</span></a>
                <meta itemprop="position" content="2"/>
            </li>
            
            
                
                
            
            
                
            
            
                <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
                    <a itemprop="item" href="/p/xsb/"><span itemprop="name">XSB</span></a>
                <meta itemprop="position" content="3"/>
                </li>
            
                <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
                    <span itemprop="name">Src  (SVN)-old</span>
                <meta itemprop="position" content="4"/>
                </li>
            
        </ul>
    </nav>
    
    
    
        
                
                
<div class="overview">
    


<div class="project-icon   " >
    
    
    <img itemprop="image" alt="XSB" title="XSB" 
    
    
    src="https://a.fsdn.com/allura/p/xsb/icon?1368563712"
    /></div>


    
    <div class="title "> 

        <meta itemprop="name" content="XSB"/>
        <h1  >XSB Src  (SVN)-old
        </h1>
        
            
            
          
        
            
            
            <div class="as-h3 brought-by">
                
                Brought to you by:
                
                    <a href="/u/carlandersen/profile/">carlandersen</a>,
                    
                
                    <a href="/u/dwarren/profile/">dwarren</a>,
                    
                
                    <a href="/u/evansbj/profile/">evansbj</a>,
                    
                
                    <a href="/u/kifer/profile/">kifer</a>,
                    
                
                    
                        and <a href="/p/xsb/_members/">3 others</a>
                    
                
            </div>
            
        

        

        
    </div>


    

</div>

                
                
    
  
            
            
        
    </div>
</section>

        </div>
    

                
            
        </div>
        <div id="top_nav" class="">
            
                
<div id="top_nav_admin">
<ul class="dropdown">
  
  
    <li class="">
        <a href="/projects/xsb/" class="tool-summary-32" >
            Summary
        </a>
        
        
    </li>
  
    <li class="">
        <a href="/projects/xsb/files/" class="tool-files-sf-32" >
            Files
        </a>
        
        
    </li>
  
    <li class="">
        <a href="/projects/xsb/reviews/" class="tool-reviews-32" >
            Reviews
        </a>
        
        
    </li>
  
    <li class="">
        <a href="/projects/xsb/support" class="tool-support-32" >
            Support
        </a>
        
        
    </li>
  
    <li class="">
        <a href="/p/xsb/mailman/" class="tool-mailman-32" >
            Mail Lists
        </a>
        
        
    </li>
  
    <li class="">
        <a href="/p/xsb/_list/tickets" class="tool-tickets-32" >
            Tickets ▾
        </a>
        
        
            <ul>
                
                    <li class=""><a href="/p/xsb/bugs/" >Bugs</a></li>
                
                    <li class=""><a href="/p/xsb/feature-requests/" >Feature Requests</a></li>
                
                    <li class=""><a href="/p/xsb/support-requests/" >Support Requests</a></li>
                
                    <li class=""><a href="/p/xsb/patches/" >Patches</a></li>
                
            </ul>
        
    </li>
  
    <li class="">
        <a href="/p/xsb/news/" class="tool-blog-32" >
            News
        </a>
        
        
    </li>
  
    <li class="">
        <a href="/p/xsb/code/" class="tool-git-32" >
            Sources (GIT)
        </a>
        
        
    </li>
  
    <li class="selected">
        <a href="/p/xsb/src/" class="tool-svn-32" >
            Src  (SVN)-old
        </a>
        
        
    </li>
  
  
</ul>
</div>


            
        </div>
        <div id="content_base">
            

    
                
                    
<a id="sidebar-activate" href="#">
    <span class="btn-label">Menu</span>
    <span class="btn-arrow-down">▾</span>
    <span class="btn-arrow-up">▴</span>
</a>

                        


<div id="sidebar">
  
    <div class="placeholder-no-searchbox">&nbsp;</div>
  
    
    
      
      
        
    
      <ul class="sidebarmenu">
      
    
  <li>
      
        <a class="icon" href="/p/xsb/src/commit_browser" rel="nofollow" title="Browse Commits"><i class="fa fa-list"></i>
      
      <span>Browse Commits</span>
      </a>
  </li>
  
      
        
    
  <li>
      
        <a href="/p/xsb/src/"  rel="nofollow" >
      
      <span>Browse Files</span>
      </a>
  </li>
  
      
    
    
      </ul>
      
    
    
</div>



<script>
$('#sidebar-admin-header').on('click', function(e){
    $("#sidebar-admin-menu").toggleClass("hidden");
    $(this).toggleClass("expanded");
    e.preventDefault();
});
</script>

                    

                    
                
                
                    
                
                <div class="grid-20 pad">
                    <h2 class="dark title">
                        <span>
<a href="/p/xsb/src/6903/" rel="nofollow">[r6903]</a>:

  
      <a href="./../../../../" rel="nofollow"><b class="fa fa-folder-open-o" title="Root directory"></b></a> /
  
  
    <a href="./../../../" rel="nofollow">trunk</a> /
  
    <a href="./../../" rel="nofollow">XSB</a> /
  
    <a href="./../" rel="nofollow">docs</a> /
  
    <a href="./" rel="nofollow">userman</a> /
  
 builtin.tex
</span>
                        <!-- actions -->
                        <small>
                            

    
    <a class="icon" href="#" id="maximize-content" title="Maximize"><i class="fa fa-expand"></i>&nbsp;Maximize</a>
    <a class="icon" href="#" id="restore-content" title="Restore"><i class="fa fa-compress"></i>&nbsp;Restore</a>
<a class="icon" href="/p/xsb/src/6903/log/?path=/trunk/XSB/docs/userman/builtin.tex" rel="nofollow" title="History"><i class="fa fa-calendar"></i>&nbsp;History</a>

                        </small>
                        <!-- /actions -->
                    </h2>
                    
                    <div>
                        
  

                        
  
    <p><a rel="nofollow" href="?format=raw">Download this file</a></p>
    <div class="clip grid-19 codebrowser">
      <h3>
        4611 lines (4026 with data), 165.4 kB
      </h3>
      
        <div class="codehilite"><table class="codehilitetable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">   1</span>
<span class="normal">   2</span>
<span class="normal">   3</span>
<span class="normal">   4</span>
<span class="normal">   5</span>
<span class="normal">   6</span>
<span class="normal">   7</span>
<span class="normal">   8</span>
<span class="normal">   9</span>
<span class="normal">  10</span>
<span class="normal">  11</span>
<span class="normal">  12</span>
<span class="normal">  13</span>
<span class="normal">  14</span>
<span class="normal">  15</span>
<span class="normal">  16</span>
<span class="normal">  17</span>
<span class="normal">  18</span>
<span class="normal">  19</span>
<span class="normal">  20</span>
<span class="normal">  21</span>
<span class="normal">  22</span>
<span class="normal">  23</span>
<span class="normal">  24</span>
<span class="normal">  25</span>
<span class="normal">  26</span>
<span class="normal">  27</span>
<span class="normal">  28</span>
<span class="normal">  29</span>
<span class="normal">  30</span>
<span class="normal">  31</span>
<span class="normal">  32</span>
<span class="normal">  33</span>
<span class="normal">  34</span>
<span class="normal">  35</span>
<span class="normal">  36</span>
<span class="normal">  37</span>
<span class="normal">  38</span>
<span class="normal">  39</span>
<span class="normal">  40</span>
<span class="normal">  41</span>
<span class="normal">  42</span>
<span class="normal">  43</span>
<span class="normal">  44</span>
<span class="normal">  45</span>
<span class="normal">  46</span>
<span class="normal">  47</span>
<span class="normal">  48</span>
<span class="normal">  49</span>
<span class="normal">  50</span>
<span class="normal">  51</span>
<span class="normal">  52</span>
<span class="normal">  53</span>
<span class="normal">  54</span>
<span class="normal">  55</span>
<span class="normal">  56</span>
<span class="normal">  57</span>
<span class="normal">  58</span>
<span class="normal">  59</span>
<span class="normal">  60</span>
<span class="normal">  61</span>
<span class="normal">  62</span>
<span class="normal">  63</span>
<span class="normal">  64</span>
<span class="normal">  65</span>
<span class="normal">  66</span>
<span class="normal">  67</span>
<span class="normal">  68</span>
<span class="normal">  69</span>
<span class="normal">  70</span>
<span class="normal">  71</span>
<span class="normal">  72</span>
<span class="normal">  73</span>
<span class="normal">  74</span>
<span class="normal">  75</span>
<span class="normal">  76</span>
<span class="normal">  77</span>
<span class="normal">  78</span>
<span class="normal">  79</span>
<span class="normal">  80</span>
<span class="normal">  81</span>
<span class="normal">  82</span>
<span class="normal">  83</span>
<span class="normal">  84</span>
<span class="normal">  85</span>
<span class="normal">  86</span>
<span class="normal">  87</span>
<span class="normal">  88</span>
<span class="normal">  89</span>
<span class="normal">  90</span>
<span class="normal">  91</span>
<span class="normal">  92</span>
<span class="normal">  93</span>
<span class="normal">  94</span>
<span class="normal">  95</span>
<span class="normal">  96</span>
<span class="normal">  97</span>
<span class="normal">  98</span>
<span class="normal">  99</span>
<span class="normal"> 100</span>
<span class="normal"> 101</span>
<span class="normal"> 102</span>
<span class="normal"> 103</span>
<span class="normal"> 104</span>
<span class="normal"> 105</span>
<span class="normal"> 106</span>
<span class="normal"> 107</span>
<span class="normal"> 108</span>
<span class="normal"> 109</span>
<span class="normal"> 110</span>
<span class="normal"> 111</span>
<span class="normal"> 112</span>
<span class="normal"> 113</span>
<span class="normal"> 114</span>
<span class="normal"> 115</span>
<span class="normal"> 116</span>
<span class="normal"> 117</span>
<span class="normal"> 118</span>
<span class="normal"> 119</span>
<span class="normal"> 120</span>
<span class="normal"> 121</span>
<span class="normal"> 122</span>
<span class="normal"> 123</span>
<span class="normal"> 124</span>
<span class="normal"> 125</span>
<span class="normal"> 126</span>
<span class="normal"> 127</span>
<span class="normal"> 128</span>
<span class="normal"> 129</span>
<span class="normal"> 130</span>
<span class="normal"> 131</span>
<span class="normal"> 132</span>
<span class="normal"> 133</span>
<span class="normal"> 134</span>
<span class="normal"> 135</span>
<span class="normal"> 136</span>
<span class="normal"> 137</span>
<span class="normal"> 138</span>
<span class="normal"> 139</span>
<span class="normal"> 140</span>
<span class="normal"> 141</span>
<span class="normal"> 142</span>
<span class="normal"> 143</span>
<span class="normal"> 144</span>
<span class="normal"> 145</span>
<span class="normal"> 146</span>
<span class="normal"> 147</span>
<span class="normal"> 148</span>
<span class="normal"> 149</span>
<span class="normal"> 150</span>
<span class="normal"> 151</span>
<span class="normal"> 152</span>
<span class="normal"> 153</span>
<span class="normal"> 154</span>
<span class="normal"> 155</span>
<span class="normal"> 156</span>
<span class="normal"> 157</span>
<span class="normal"> 158</span>
<span class="normal"> 159</span>
<span class="normal"> 160</span>
<span class="normal"> 161</span>
<span class="normal"> 162</span>
<span class="normal"> 163</span>
<span class="normal"> 164</span>
<span class="normal"> 165</span>
<span class="normal"> 166</span>
<span class="normal"> 167</span>
<span class="normal"> 168</span>
<span class="normal"> 169</span>
<span class="normal"> 170</span>
<span class="normal"> 171</span>
<span class="normal"> 172</span>
<span class="normal"> 173</span>
<span class="normal"> 174</span>
<span class="normal"> 175</span>
<span class="normal"> 176</span>
<span class="normal"> 177</span>
<span class="normal"> 178</span>
<span class="normal"> 179</span>
<span class="normal"> 180</span>
<span class="normal"> 181</span>
<span class="normal"> 182</span>
<span class="normal"> 183</span>
<span class="normal"> 184</span>
<span class="normal"> 185</span>
<span class="normal"> 186</span>
<span class="normal"> 187</span>
<span class="normal"> 188</span>
<span class="normal"> 189</span>
<span class="normal"> 190</span>
<span class="normal"> 191</span>
<span class="normal"> 192</span>
<span class="normal"> 193</span>
<span class="normal"> 194</span>
<span class="normal"> 195</span>
<span class="normal"> 196</span>
<span class="normal"> 197</span>
<span class="normal"> 198</span>
<span class="normal"> 199</span>
<span class="normal"> 200</span>
<span class="normal"> 201</span>
<span class="normal"> 202</span>
<span class="normal"> 203</span>
<span class="normal"> 204</span>
<span class="normal"> 205</span>
<span class="normal"> 206</span>
<span class="normal"> 207</span>
<span class="normal"> 208</span>
<span class="normal"> 209</span>
<span class="normal"> 210</span>
<span class="normal"> 211</span>
<span class="normal"> 212</span>
<span class="normal"> 213</span>
<span class="normal"> 214</span>
<span class="normal"> 215</span>
<span class="normal"> 216</span>
<span class="normal"> 217</span>
<span class="normal"> 218</span>
<span class="normal"> 219</span>
<span class="normal"> 220</span>
<span class="normal"> 221</span>
<span class="normal"> 222</span>
<span class="normal"> 223</span>
<span class="normal"> 224</span>
<span class="normal"> 225</span>
<span class="normal"> 226</span>
<span class="normal"> 227</span>
<span class="normal"> 228</span>
<span class="normal"> 229</span>
<span class="normal"> 230</span>
<span class="normal"> 231</span>
<span class="normal"> 232</span>
<span class="normal"> 233</span>
<span class="normal"> 234</span>
<span class="normal"> 235</span>
<span class="normal"> 236</span>
<span class="normal"> 237</span>
<span class="normal"> 238</span>
<span class="normal"> 239</span>
<span class="normal"> 240</span>
<span class="normal"> 241</span>
<span class="normal"> 242</span>
<span class="normal"> 243</span>
<span class="normal"> 244</span>
<span class="normal"> 245</span>
<span class="normal"> 246</span>
<span class="normal"> 247</span>
<span class="normal"> 248</span>
<span class="normal"> 249</span>
<span class="normal"> 250</span>
<span class="normal"> 251</span>
<span class="normal"> 252</span>
<span class="normal"> 253</span>
<span class="normal"> 254</span>
<span class="normal"> 255</span>
<span class="normal"> 256</span>
<span class="normal"> 257</span>
<span class="normal"> 258</span>
<span class="normal"> 259</span>
<span class="normal"> 260</span>
<span class="normal"> 261</span>
<span class="normal"> 262</span>
<span class="normal"> 263</span>
<span class="normal"> 264</span>
<span class="normal"> 265</span>
<span class="normal"> 266</span>
<span class="normal"> 267</span>
<span class="normal"> 268</span>
<span class="normal"> 269</span>
<span class="normal"> 270</span>
<span class="normal"> 271</span>
<span class="normal"> 272</span>
<span class="normal"> 273</span>
<span class="normal"> 274</span>
<span class="normal"> 275</span>
<span class="normal"> 276</span>
<span class="normal"> 277</span>
<span class="normal"> 278</span>
<span class="normal"> 279</span>
<span class="normal"> 280</span>
<span class="normal"> 281</span>
<span class="normal"> 282</span>
<span class="normal"> 283</span>
<span class="normal"> 284</span>
<span class="normal"> 285</span>
<span class="normal"> 286</span>
<span class="normal"> 287</span>
<span class="normal"> 288</span>
<span class="normal"> 289</span>
<span class="normal"> 290</span>
<span class="normal"> 291</span>
<span class="normal"> 292</span>
<span class="normal"> 293</span>
<span class="normal"> 294</span>
<span class="normal"> 295</span>
<span class="normal"> 296</span>
<span class="normal"> 297</span>
<span class="normal"> 298</span>
<span class="normal"> 299</span>
<span class="normal"> 300</span>
<span class="normal"> 301</span>
<span class="normal"> 302</span>
<span class="normal"> 303</span>
<span class="normal"> 304</span>
<span class="normal"> 305</span>
<span class="normal"> 306</span>
<span class="normal"> 307</span>
<span class="normal"> 308</span>
<span class="normal"> 309</span>
<span class="normal"> 310</span>
<span class="normal"> 311</span>
<span class="normal"> 312</span>
<span class="normal"> 313</span>
<span class="normal"> 314</span>
<span class="normal"> 315</span>
<span class="normal"> 316</span>
<span class="normal"> 317</span>
<span class="normal"> 318</span>
<span class="normal"> 319</span>
<span class="normal"> 320</span>
<span class="normal"> 321</span>
<span class="normal"> 322</span>
<span class="normal"> 323</span>
<span class="normal"> 324</span>
<span class="normal"> 325</span>
<span class="normal"> 326</span>
<span class="normal"> 327</span>
<span class="normal"> 328</span>
<span class="normal"> 329</span>
<span class="normal"> 330</span>
<span class="normal"> 331</span>
<span class="normal"> 332</span>
<span class="normal"> 333</span>
<span class="normal"> 334</span>
<span class="normal"> 335</span>
<span class="normal"> 336</span>
<span class="normal"> 337</span>
<span class="normal"> 338</span>
<span class="normal"> 339</span>
<span class="normal"> 340</span>
<span class="normal"> 341</span>
<span class="normal"> 342</span>
<span class="normal"> 343</span>
<span class="normal"> 344</span>
<span class="normal"> 345</span>
<span class="normal"> 346</span>
<span class="normal"> 347</span>
<span class="normal"> 348</span>
<span class="normal"> 349</span>
<span class="normal"> 350</span>
<span class="normal"> 351</span>
<span class="normal"> 352</span>
<span class="normal"> 353</span>
<span class="normal"> 354</span>
<span class="normal"> 355</span>
<span class="normal"> 356</span>
<span class="normal"> 357</span>
<span class="normal"> 358</span>
<span class="normal"> 359</span>
<span class="normal"> 360</span>
<span class="normal"> 361</span>
<span class="normal"> 362</span>
<span class="normal"> 363</span>
<span class="normal"> 364</span>
<span class="normal"> 365</span>
<span class="normal"> 366</span>
<span class="normal"> 367</span>
<span class="normal"> 368</span>
<span class="normal"> 369</span>
<span class="normal"> 370</span>
<span class="normal"> 371</span>
<span class="normal"> 372</span>
<span class="normal"> 373</span>
<span class="normal"> 374</span>
<span class="normal"> 375</span>
<span class="normal"> 376</span>
<span class="normal"> 377</span>
<span class="normal"> 378</span>
<span class="normal"> 379</span>
<span class="normal"> 380</span>
<span class="normal"> 381</span>
<span class="normal"> 382</span>
<span class="normal"> 383</span>
<span class="normal"> 384</span>
<span class="normal"> 385</span>
<span class="normal"> 386</span>
<span class="normal"> 387</span>
<span class="normal"> 388</span>
<span class="normal"> 389</span>
<span class="normal"> 390</span>
<span class="normal"> 391</span>
<span class="normal"> 392</span>
<span class="normal"> 393</span>
<span class="normal"> 394</span>
<span class="normal"> 395</span>
<span class="normal"> 396</span>
<span class="normal"> 397</span>
<span class="normal"> 398</span>
<span class="normal"> 399</span>
<span class="normal"> 400</span>
<span class="normal"> 401</span>
<span class="normal"> 402</span>
<span class="normal"> 403</span>
<span class="normal"> 404</span>
<span class="normal"> 405</span>
<span class="normal"> 406</span>
<span class="normal"> 407</span>
<span class="normal"> 408</span>
<span class="normal"> 409</span>
<span class="normal"> 410</span>
<span class="normal"> 411</span>
<span class="normal"> 412</span>
<span class="normal"> 413</span>
<span class="normal"> 414</span>
<span class="normal"> 415</span>
<span class="normal"> 416</span>
<span class="normal"> 417</span>
<span class="normal"> 418</span>
<span class="normal"> 419</span>
<span class="normal"> 420</span>
<span class="normal"> 421</span>
<span class="normal"> 422</span>
<span class="normal"> 423</span>
<span class="normal"> 424</span>
<span class="normal"> 425</span>
<span class="normal"> 426</span>
<span class="normal"> 427</span>
<span class="normal"> 428</span>
<span class="normal"> 429</span>
<span class="normal"> 430</span>
<span class="normal"> 431</span>
<span class="normal"> 432</span>
<span class="normal"> 433</span>
<span class="normal"> 434</span>
<span class="normal"> 435</span>
<span class="normal"> 436</span>
<span class="normal"> 437</span>
<span class="normal"> 438</span>
<span class="normal"> 439</span>
<span class="normal"> 440</span>
<span class="normal"> 441</span>
<span class="normal"> 442</span>
<span class="normal"> 443</span>
<span class="normal"> 444</span>
<span class="normal"> 445</span>
<span class="normal"> 446</span>
<span class="normal"> 447</span>
<span class="normal"> 448</span>
<span class="normal"> 449</span>
<span class="normal"> 450</span>
<span class="normal"> 451</span>
<span class="normal"> 452</span>
<span class="normal"> 453</span>
<span class="normal"> 454</span>
<span class="normal"> 455</span>
<span class="normal"> 456</span>
<span class="normal"> 457</span>
<span class="normal"> 458</span>
<span class="normal"> 459</span>
<span class="normal"> 460</span>
<span class="normal"> 461</span>
<span class="normal"> 462</span>
<span class="normal"> 463</span>
<span class="normal"> 464</span>
<span class="normal"> 465</span>
<span class="normal"> 466</span>
<span class="normal"> 467</span>
<span class="normal"> 468</span>
<span class="normal"> 469</span>
<span class="normal"> 470</span>
<span class="normal"> 471</span>
<span class="normal"> 472</span>
<span class="normal"> 473</span>
<span class="normal"> 474</span>
<span class="normal"> 475</span>
<span class="normal"> 476</span>
<span class="normal"> 477</span>
<span class="normal"> 478</span>
<span class="normal"> 479</span>
<span class="normal"> 480</span>
<span class="normal"> 481</span>
<span class="normal"> 482</span>
<span class="normal"> 483</span>
<span class="normal"> 484</span>
<span class="normal"> 485</span>
<span class="normal"> 486</span>
<span class="normal"> 487</span>
<span class="normal"> 488</span>
<span class="normal"> 489</span>
<span class="normal"> 490</span>
<span class="normal"> 491</span>
<span class="normal"> 492</span>
<span class="normal"> 493</span>
<span class="normal"> 494</span>
<span class="normal"> 495</span>
<span class="normal"> 496</span>
<span class="normal"> 497</span>
<span class="normal"> 498</span>
<span class="normal"> 499</span>
<span class="normal"> 500</span>
<span class="normal"> 501</span>
<span class="normal"> 502</span>
<span class="normal"> 503</span>
<span class="normal"> 504</span>
<span class="normal"> 505</span>
<span class="normal"> 506</span>
<span class="normal"> 507</span>
<span class="normal"> 508</span>
<span class="normal"> 509</span>
<span class="normal"> 510</span>
<span class="normal"> 511</span>
<span class="normal"> 512</span>
<span class="normal"> 513</span>
<span class="normal"> 514</span>
<span class="normal"> 515</span>
<span class="normal"> 516</span>
<span class="normal"> 517</span>
<span class="normal"> 518</span>
<span class="normal"> 519</span>
<span class="normal"> 520</span>
<span class="normal"> 521</span>
<span class="normal"> 522</span>
<span class="normal"> 523</span>
<span class="normal"> 524</span>
<span class="normal"> 525</span>
<span class="normal"> 526</span>
<span class="normal"> 527</span>
<span class="normal"> 528</span>
<span class="normal"> 529</span>
<span class="normal"> 530</span>
<span class="normal"> 531</span>
<span class="normal"> 532</span>
<span class="normal"> 533</span>
<span class="normal"> 534</span>
<span class="normal"> 535</span>
<span class="normal"> 536</span>
<span class="normal"> 537</span>
<span class="normal"> 538</span>
<span class="normal"> 539</span>
<span class="normal"> 540</span>
<span class="normal"> 541</span>
<span class="normal"> 542</span>
<span class="normal"> 543</span>
<span class="normal"> 544</span>
<span class="normal"> 545</span>
<span class="normal"> 546</span>
<span class="normal"> 547</span>
<span class="normal"> 548</span>
<span class="normal"> 549</span>
<span class="normal"> 550</span>
<span class="normal"> 551</span>
<span class="normal"> 552</span>
<span class="normal"> 553</span>
<span class="normal"> 554</span>
<span class="normal"> 555</span>
<span class="normal"> 556</span>
<span class="normal"> 557</span>
<span class="normal"> 558</span>
<span class="normal"> 559</span>
<span class="normal"> 560</span>
<span class="normal"> 561</span>
<span class="normal"> 562</span>
<span class="normal"> 563</span>
<span class="normal"> 564</span>
<span class="normal"> 565</span>
<span class="normal"> 566</span>
<span class="normal"> 567</span>
<span class="normal"> 568</span>
<span class="normal"> 569</span>
<span class="normal"> 570</span>
<span class="normal"> 571</span>
<span class="normal"> 572</span>
<span class="normal"> 573</span>
<span class="normal"> 574</span>
<span class="normal"> 575</span>
<span class="normal"> 576</span>
<span class="normal"> 577</span>
<span class="normal"> 578</span>
<span class="normal"> 579</span>
<span class="normal"> 580</span>
<span class="normal"> 581</span>
<span class="normal"> 582</span>
<span class="normal"> 583</span>
<span class="normal"> 584</span>
<span class="normal"> 585</span>
<span class="normal"> 586</span>
<span class="normal"> 587</span>
<span class="normal"> 588</span>
<span class="normal"> 589</span>
<span class="normal"> 590</span>
<span class="normal"> 591</span>
<span class="normal"> 592</span>
<span class="normal"> 593</span>
<span class="normal"> 594</span>
<span class="normal"> 595</span>
<span class="normal"> 596</span>
<span class="normal"> 597</span>
<span class="normal"> 598</span>
<span class="normal"> 599</span>
<span class="normal"> 600</span>
<span class="normal"> 601</span>
<span class="normal"> 602</span>
<span class="normal"> 603</span>
<span class="normal"> 604</span>
<span class="normal"> 605</span>
<span class="normal"> 606</span>
<span class="normal"> 607</span>
<span class="normal"> 608</span>
<span class="normal"> 609</span>
<span class="normal"> 610</span>
<span class="normal"> 611</span>
<span class="normal"> 612</span>
<span class="normal"> 613</span>
<span class="normal"> 614</span>
<span class="normal"> 615</span>
<span class="normal"> 616</span>
<span class="normal"> 617</span>
<span class="normal"> 618</span>
<span class="normal"> 619</span>
<span class="normal"> 620</span>
<span class="normal"> 621</span>
<span class="normal"> 622</span>
<span class="normal"> 623</span>
<span class="normal"> 624</span>
<span class="normal"> 625</span>
<span class="normal"> 626</span>
<span class="normal"> 627</span>
<span class="normal"> 628</span>
<span class="normal"> 629</span>
<span class="normal"> 630</span>
<span class="normal"> 631</span>
<span class="normal"> 632</span>
<span class="normal"> 633</span>
<span class="normal"> 634</span>
<span class="normal"> 635</span>
<span class="normal"> 636</span>
<span class="normal"> 637</span>
<span class="normal"> 638</span>
<span class="normal"> 639</span>
<span class="normal"> 640</span>
<span class="normal"> 641</span>
<span class="normal"> 642</span>
<span class="normal"> 643</span>
<span class="normal"> 644</span>
<span class="normal"> 645</span>
<span class="normal"> 646</span>
<span class="normal"> 647</span>
<span class="normal"> 648</span>
<span class="normal"> 649</span>
<span class="normal"> 650</span>
<span class="normal"> 651</span>
<span class="normal"> 652</span>
<span class="normal"> 653</span>
<span class="normal"> 654</span>
<span class="normal"> 655</span>
<span class="normal"> 656</span>
<span class="normal"> 657</span>
<span class="normal"> 658</span>
<span class="normal"> 659</span>
<span class="normal"> 660</span>
<span class="normal"> 661</span>
<span class="normal"> 662</span>
<span class="normal"> 663</span>
<span class="normal"> 664</span>
<span class="normal"> 665</span>
<span class="normal"> 666</span>
<span class="normal"> 667</span>
<span class="normal"> 668</span>
<span class="normal"> 669</span>
<span class="normal"> 670</span>
<span class="normal"> 671</span>
<span class="normal"> 672</span>
<span class="normal"> 673</span>
<span class="normal"> 674</span>
<span class="normal"> 675</span>
<span class="normal"> 676</span>
<span class="normal"> 677</span>
<span class="normal"> 678</span>
<span class="normal"> 679</span>
<span class="normal"> 680</span>
<span class="normal"> 681</span>
<span class="normal"> 682</span>
<span class="normal"> 683</span>
<span class="normal"> 684</span>
<span class="normal"> 685</span>
<span class="normal"> 686</span>
<span class="normal"> 687</span>
<span class="normal"> 688</span>
<span class="normal"> 689</span>
<span class="normal"> 690</span>
<span class="normal"> 691</span>
<span class="normal"> 692</span>
<span class="normal"> 693</span>
<span class="normal"> 694</span>
<span class="normal"> 695</span>
<span class="normal"> 696</span>
<span class="normal"> 697</span>
<span class="normal"> 698</span>
<span class="normal"> 699</span>
<span class="normal"> 700</span>
<span class="normal"> 701</span>
<span class="normal"> 702</span>
<span class="normal"> 703</span>
<span class="normal"> 704</span>
<span class="normal"> 705</span>
<span class="normal"> 706</span>
<span class="normal"> 707</span>
<span class="normal"> 708</span>
<span class="normal"> 709</span>
<span class="normal"> 710</span>
<span class="normal"> 711</span>
<span class="normal"> 712</span>
<span class="normal"> 713</span>
<span class="normal"> 714</span>
<span class="normal"> 715</span>
<span class="normal"> 716</span>
<span class="normal"> 717</span>
<span class="normal"> 718</span>
<span class="normal"> 719</span>
<span class="normal"> 720</span>
<span class="normal"> 721</span>
<span class="normal"> 722</span>
<span class="normal"> 723</span>
<span class="normal"> 724</span>
<span class="normal"> 725</span>
<span class="normal"> 726</span>
<span class="normal"> 727</span>
<span class="normal"> 728</span>
<span class="normal"> 729</span>
<span class="normal"> 730</span>
<span class="normal"> 731</span>
<span class="normal"> 732</span>
<span class="normal"> 733</span>
<span class="normal"> 734</span>
<span class="normal"> 735</span>
<span class="normal"> 736</span>
<span class="normal"> 737</span>
<span class="normal"> 738</span>
<span class="normal"> 739</span>
<span class="normal"> 740</span>
<span class="normal"> 741</span>
<span class="normal"> 742</span>
<span class="normal"> 743</span>
<span class="normal"> 744</span>
<span class="normal"> 745</span>
<span class="normal"> 746</span>
<span class="normal"> 747</span>
<span class="normal"> 748</span>
<span class="normal"> 749</span>
<span class="normal"> 750</span>
<span class="normal"> 751</span>
<span class="normal"> 752</span>
<span class="normal"> 753</span>
<span class="normal"> 754</span>
<span class="normal"> 755</span>
<span class="normal"> 756</span>
<span class="normal"> 757</span>
<span class="normal"> 758</span>
<span class="normal"> 759</span>
<span class="normal"> 760</span>
<span class="normal"> 761</span>
<span class="normal"> 762</span>
<span class="normal"> 763</span>
<span class="normal"> 764</span>
<span class="normal"> 765</span>
<span class="normal"> 766</span>
<span class="normal"> 767</span>
<span class="normal"> 768</span>
<span class="normal"> 769</span>
<span class="normal"> 770</span>
<span class="normal"> 771</span>
<span class="normal"> 772</span>
<span class="normal"> 773</span>
<span class="normal"> 774</span>
<span class="normal"> 775</span>
<span class="normal"> 776</span>
<span class="normal"> 777</span>
<span class="normal"> 778</span>
<span class="normal"> 779</span>
<span class="normal"> 780</span>
<span class="normal"> 781</span>
<span class="normal"> 782</span>
<span class="normal"> 783</span>
<span class="normal"> 784</span>
<span class="normal"> 785</span>
<span class="normal"> 786</span>
<span class="normal"> 787</span>
<span class="normal"> 788</span>
<span class="normal"> 789</span>
<span class="normal"> 790</span>
<span class="normal"> 791</span>
<span class="normal"> 792</span>
<span class="normal"> 793</span>
<span class="normal"> 794</span>
<span class="normal"> 795</span>
<span class="normal"> 796</span>
<span class="normal"> 797</span>
<span class="normal"> 798</span>
<span class="normal"> 799</span>
<span class="normal"> 800</span>
<span class="normal"> 801</span>
<span class="normal"> 802</span>
<span class="normal"> 803</span>
<span class="normal"> 804</span>
<span class="normal"> 805</span>
<span class="normal"> 806</span>
<span class="normal"> 807</span>
<span class="normal"> 808</span>
<span class="normal"> 809</span>
<span class="normal"> 810</span>
<span class="normal"> 811</span>
<span class="normal"> 812</span>
<span class="normal"> 813</span>
<span class="normal"> 814</span>
<span class="normal"> 815</span>
<span class="normal"> 816</span>
<span class="normal"> 817</span>
<span class="normal"> 818</span>
<span class="normal"> 819</span>
<span class="normal"> 820</span>
<span class="normal"> 821</span>
<span class="normal"> 822</span>
<span class="normal"> 823</span>
<span class="normal"> 824</span>
<span class="normal"> 825</span>
<span class="normal"> 826</span>
<span class="normal"> 827</span>
<span class="normal"> 828</span>
<span class="normal"> 829</span>
<span class="normal"> 830</span>
<span class="normal"> 831</span>
<span class="normal"> 832</span>
<span class="normal"> 833</span>
<span class="normal"> 834</span>
<span class="normal"> 835</span>
<span class="normal"> 836</span>
<span class="normal"> 837</span>
<span class="normal"> 838</span>
<span class="normal"> 839</span>
<span class="normal"> 840</span>
<span class="normal"> 841</span>
<span class="normal"> 842</span>
<span class="normal"> 843</span>
<span class="normal"> 844</span>
<span class="normal"> 845</span>
<span class="normal"> 846</span>
<span class="normal"> 847</span>
<span class="normal"> 848</span>
<span class="normal"> 849</span>
<span class="normal"> 850</span>
<span class="normal"> 851</span>
<span class="normal"> 852</span>
<span class="normal"> 853</span>
<span class="normal"> 854</span>
<span class="normal"> 855</span>
<span class="normal"> 856</span>
<span class="normal"> 857</span>
<span class="normal"> 858</span>
<span class="normal"> 859</span>
<span class="normal"> 860</span>
<span class="normal"> 861</span>
<span class="normal"> 862</span>
<span class="normal"> 863</span>
<span class="normal"> 864</span>
<span class="normal"> 865</span>
<span class="normal"> 866</span>
<span class="normal"> 867</span>
<span class="normal"> 868</span>
<span class="normal"> 869</span>
<span class="normal"> 870</span>
<span class="normal"> 871</span>
<span class="normal"> 872</span>
<span class="normal"> 873</span>
<span class="normal"> 874</span>
<span class="normal"> 875</span>
<span class="normal"> 876</span>
<span class="normal"> 877</span>
<span class="normal"> 878</span>
<span class="normal"> 879</span>
<span class="normal"> 880</span>
<span class="normal"> 881</span>
<span class="normal"> 882</span>
<span class="normal"> 883</span>
<span class="normal"> 884</span>
<span class="normal"> 885</span>
<span class="normal"> 886</span>
<span class="normal"> 887</span>
<span class="normal"> 888</span>
<span class="normal"> 889</span>
<span class="normal"> 890</span>
<span class="normal"> 891</span>
<span class="normal"> 892</span>
<span class="normal"> 893</span>
<span class="normal"> 894</span>
<span class="normal"> 895</span>
<span class="normal"> 896</span>
<span class="normal"> 897</span>
<span class="normal"> 898</span>
<span class="normal"> 899</span>
<span class="normal"> 900</span>
<span class="normal"> 901</span>
<span class="normal"> 902</span>
<span class="normal"> 903</span>
<span class="normal"> 904</span>
<span class="normal"> 905</span>
<span class="normal"> 906</span>
<span class="normal"> 907</span>
<span class="normal"> 908</span>
<span class="normal"> 909</span>
<span class="normal"> 910</span>
<span class="normal"> 911</span>
<span class="normal"> 912</span>
<span class="normal"> 913</span>
<span class="normal"> 914</span>
<span class="normal"> 915</span>
<span class="normal"> 916</span>
<span class="normal"> 917</span>
<span class="normal"> 918</span>
<span class="normal"> 919</span>
<span class="normal"> 920</span>
<span class="normal"> 921</span>
<span class="normal"> 922</span>
<span class="normal"> 923</span>
<span class="normal"> 924</span>
<span class="normal"> 925</span>
<span class="normal"> 926</span>
<span class="normal"> 927</span>
<span class="normal"> 928</span>
<span class="normal"> 929</span>
<span class="normal"> 930</span>
<span class="normal"> 931</span>
<span class="normal"> 932</span>
<span class="normal"> 933</span>
<span class="normal"> 934</span>
<span class="normal"> 935</span>
<span class="normal"> 936</span>
<span class="normal"> 937</span>
<span class="normal"> 938</span>
<span class="normal"> 939</span>
<span class="normal"> 940</span>
<span class="normal"> 941</span>
<span class="normal"> 942</span>
<span class="normal"> 943</span>
<span class="normal"> 944</span>
<span class="normal"> 945</span>
<span class="normal"> 946</span>
<span class="normal"> 947</span>
<span class="normal"> 948</span>
<span class="normal"> 949</span>
<span class="normal"> 950</span>
<span class="normal"> 951</span>
<span class="normal"> 952</span>
<span class="normal"> 953</span>
<span class="normal"> 954</span>
<span class="normal"> 955</span>
<span class="normal"> 956</span>
<span class="normal"> 957</span>
<span class="normal"> 958</span>
<span class="normal"> 959</span>
<span class="normal"> 960</span>
<span class="normal"> 961</span>
<span class="normal"> 962</span>
<span class="normal"> 963</span>
<span class="normal"> 964</span>
<span class="normal"> 965</span>
<span class="normal"> 966</span>
<span class="normal"> 967</span>
<span class="normal"> 968</span>
<span class="normal"> 969</span>
<span class="normal"> 970</span>
<span class="normal"> 971</span>
<span class="normal"> 972</span>
<span class="normal"> 973</span>
<span class="normal"> 974</span>
<span class="normal"> 975</span>
<span class="normal"> 976</span>
<span class="normal"> 977</span>
<span class="normal"> 978</span>
<span class="normal"> 979</span>
<span class="normal"> 980</span>
<span class="normal"> 981</span>
<span class="normal"> 982</span>
<span class="normal"> 983</span>
<span class="normal"> 984</span>
<span class="normal"> 985</span>
<span class="normal"> 986</span>
<span class="normal"> 987</span>
<span class="normal"> 988</span>
<span class="normal"> 989</span>
<span class="normal"> 990</span>
<span class="normal"> 991</span>
<span class="normal"> 992</span>
<span class="normal"> 993</span>
<span class="normal"> 994</span>
<span class="normal"> 995</span>
<span class="normal"> 996</span>
<span class="normal"> 997</span>
<span class="normal"> 998</span>
<span class="normal"> 999</span>
<span class="normal">1000</span>
<span class="normal">1001</span>
<span class="normal">1002</span>
<span class="normal">1003</span>
<span class="normal">1004</span>
<span class="normal">1005</span>
<span class="normal">1006</span>
<span class="normal">1007</span>
<span class="normal">1008</span>
<span class="normal">1009</span>
<span class="normal">1010</span>
<span class="normal">1011</span>
<span class="normal">1012</span>
<span class="normal">1013</span>
<span class="normal">1014</span>
<span class="normal">1015</span>
<span class="normal">1016</span>
<span class="normal">1017</span>
<span class="normal">1018</span>
<span class="normal">1019</span>
<span class="normal">1020</span>
<span class="normal">1021</span>
<span class="normal">1022</span>
<span class="normal">1023</span>
<span class="normal">1024</span>
<span class="normal">1025</span>
<span class="normal">1026</span>
<span class="normal">1027</span>
<span class="normal">1028</span>
<span class="normal">1029</span>
<span class="normal">1030</span>
<span class="normal">1031</span>
<span class="normal">1032</span>
<span class="normal">1033</span>
<span class="normal">1034</span>
<span class="normal">1035</span>
<span class="normal">1036</span>
<span class="normal">1037</span>
<span class="normal">1038</span>
<span class="normal">1039</span>
<span class="normal">1040</span>
<span class="normal">1041</span>
<span class="normal">1042</span>
<span class="normal">1043</span>
<span class="normal">1044</span>
<span class="normal">1045</span>
<span class="normal">1046</span>
<span class="normal">1047</span>
<span class="normal">1048</span>
<span class="normal">1049</span>
<span class="normal">1050</span>
<span class="normal">1051</span>
<span class="normal">1052</span>
<span class="normal">1053</span>
<span class="normal">1054</span>
<span class="normal">1055</span>
<span class="normal">1056</span>
<span class="normal">1057</span>
<span class="normal">1058</span>
<span class="normal">1059</span>
<span class="normal">1060</span>
<span class="normal">1061</span>
<span class="normal">1062</span>
<span class="normal">1063</span>
<span class="normal">1064</span>
<span class="normal">1065</span>
<span class="normal">1066</span>
<span class="normal">1067</span>
<span class="normal">1068</span>
<span class="normal">1069</span>
<span class="normal">1070</span>
<span class="normal">1071</span>
<span class="normal">1072</span>
<span class="normal">1073</span>
<span class="normal">1074</span>
<span class="normal">1075</span>
<span class="normal">1076</span>
<span class="normal">1077</span>
<span class="normal">1078</span>
<span class="normal">1079</span>
<span class="normal">1080</span>
<span class="normal">1081</span>
<span class="normal">1082</span>
<span class="normal">1083</span>
<span class="normal">1084</span>
<span class="normal">1085</span>
<span class="normal">1086</span>
<span class="normal">1087</span>
<span class="normal">1088</span>
<span class="normal">1089</span>
<span class="normal">1090</span>
<span class="normal">1091</span>
<span class="normal">1092</span>
<span class="normal">1093</span>
<span class="normal">1094</span>
<span class="normal">1095</span>
<span class="normal">1096</span>
<span class="normal">1097</span>
<span class="normal">1098</span>
<span class="normal">1099</span>
<span class="normal">1100</span>
<span class="normal">1101</span>
<span class="normal">1102</span>
<span class="normal">1103</span>
<span class="normal">1104</span>
<span class="normal">1105</span>
<span class="normal">1106</span>
<span class="normal">1107</span>
<span class="normal">1108</span>
<span class="normal">1109</span>
<span class="normal">1110</span>
<span class="normal">1111</span>
<span class="normal">1112</span>
<span class="normal">1113</span>
<span class="normal">1114</span>
<span class="normal">1115</span>
<span class="normal">1116</span>
<span class="normal">1117</span>
<span class="normal">1118</span>
<span class="normal">1119</span>
<span class="normal">1120</span>
<span class="normal">1121</span>
<span class="normal">1122</span>
<span class="normal">1123</span>
<span class="normal">1124</span>
<span class="normal">1125</span>
<span class="normal">1126</span>
<span class="normal">1127</span>
<span class="normal">1128</span>
<span class="normal">1129</span>
<span class="normal">1130</span>
<span class="normal">1131</span>
<span class="normal">1132</span>
<span class="normal">1133</span>
<span class="normal">1134</span>
<span class="normal">1135</span>
<span class="normal">1136</span>
<span class="normal">1137</span>
<span class="normal">1138</span>
<span class="normal">1139</span>
<span class="normal">1140</span>
<span class="normal">1141</span>
<span class="normal">1142</span>
<span class="normal">1143</span>
<span class="normal">1144</span>
<span class="normal">1145</span>
<span class="normal">1146</span>
<span class="normal">1147</span>
<span class="normal">1148</span>
<span class="normal">1149</span>
<span class="normal">1150</span>
<span class="normal">1151</span>
<span class="normal">1152</span>
<span class="normal">1153</span>
<span class="normal">1154</span>
<span class="normal">1155</span>
<span class="normal">1156</span>
<span class="normal">1157</span>
<span class="normal">1158</span>
<span class="normal">1159</span>
<span class="normal">1160</span>
<span class="normal">1161</span>
<span class="normal">1162</span>
<span class="normal">1163</span>
<span class="normal">1164</span>
<span class="normal">1165</span>
<span class="normal">1166</span>
<span class="normal">1167</span>
<span class="normal">1168</span>
<span class="normal">1169</span>
<span class="normal">1170</span>
<span class="normal">1171</span>
<span class="normal">1172</span>
<span class="normal">1173</span>
<span class="normal">1174</span>
<span class="normal">1175</span>
<span class="normal">1176</span>
<span class="normal">1177</span>
<span class="normal">1178</span>
<span class="normal">1179</span>
<span class="normal">1180</span>
<span class="normal">1181</span>
<span class="normal">1182</span>
<span class="normal">1183</span>
<span class="normal">1184</span>
<span class="normal">1185</span>
<span class="normal">1186</span>
<span class="normal">1187</span>
<span class="normal">1188</span>
<span class="normal">1189</span>
<span class="normal">1190</span>
<span class="normal">1191</span>
<span class="normal">1192</span>
<span class="normal">1193</span>
<span class="normal">1194</span>
<span class="normal">1195</span>
<span class="normal">1196</span>
<span class="normal">1197</span>
<span class="normal">1198</span>
<span class="normal">1199</span>
<span class="normal">1200</span>
<span class="normal">1201</span>
<span class="normal">1202</span>
<span class="normal">1203</span>
<span class="normal">1204</span>
<span class="normal">1205</span>
<span class="normal">1206</span>
<span class="normal">1207</span>
<span class="normal">1208</span>
<span class="normal">1209</span>
<span class="normal">1210</span>
<span class="normal">1211</span>
<span class="normal">1212</span>
<span class="normal">1213</span>
<span class="normal">1214</span>
<span class="normal">1215</span>
<span class="normal">1216</span>
<span class="normal">1217</span>
<span class="normal">1218</span>
<span class="normal">1219</span>
<span class="normal">1220</span>
<span class="normal">1221</span>
<span class="normal">1222</span>
<span class="normal">1223</span>
<span class="normal">1224</span>
<span class="normal">1225</span>
<span class="normal">1226</span>
<span class="normal">1227</span>
<span class="normal">1228</span>
<span class="normal">1229</span>
<span class="normal">1230</span>
<span class="normal">1231</span>
<span class="normal">1232</span>
<span class="normal">1233</span>
<span class="normal">1234</span>
<span class="normal">1235</span>
<span class="normal">1236</span>
<span class="normal">1237</span>
<span class="normal">1238</span>
<span class="normal">1239</span>
<span class="normal">1240</span>
<span class="normal">1241</span>
<span class="normal">1242</span>
<span class="normal">1243</span>
<span class="normal">1244</span>
<span class="normal">1245</span>
<span class="normal">1246</span>
<span class="normal">1247</span>
<span class="normal">1248</span>
<span class="normal">1249</span>
<span class="normal">1250</span>
<span class="normal">1251</span>
<span class="normal">1252</span>
<span class="normal">1253</span>
<span class="normal">1254</span>
<span class="normal">1255</span>
<span class="normal">1256</span>
<span class="normal">1257</span>
<span class="normal">1258</span>
<span class="normal">1259</span>
<span class="normal">1260</span>
<span class="normal">1261</span>
<span class="normal">1262</span>
<span class="normal">1263</span>
<span class="normal">1264</span>
<span class="normal">1265</span>
<span class="normal">1266</span>
<span class="normal">1267</span>
<span class="normal">1268</span>
<span class="normal">1269</span>
<span class="normal">1270</span>
<span class="normal">1271</span>
<span class="normal">1272</span>
<span class="normal">1273</span>
<span class="normal">1274</span>
<span class="normal">1275</span>
<span class="normal">1276</span>
<span class="normal">1277</span>
<span class="normal">1278</span>
<span class="normal">1279</span>
<span class="normal">1280</span>
<span class="normal">1281</span>
<span class="normal">1282</span>
<span class="normal">1283</span>
<span class="normal">1284</span>
<span class="normal">1285</span>
<span class="normal">1286</span>
<span class="normal">1287</span>
<span class="normal">1288</span>
<span class="normal">1289</span>
<span class="normal">1290</span>
<span class="normal">1291</span>
<span class="normal">1292</span>
<span class="normal">1293</span>
<span class="normal">1294</span>
<span class="normal">1295</span>
<span class="normal">1296</span>
<span class="normal">1297</span>
<span class="normal">1298</span>
<span class="normal">1299</span>
<span class="normal">1300</span>
<span class="normal">1301</span>
<span class="normal">1302</span>
<span class="normal">1303</span>
<span class="normal">1304</span>
<span class="normal">1305</span>
<span class="normal">1306</span>
<span class="normal">1307</span>
<span class="normal">1308</span>
<span class="normal">1309</span>
<span class="normal">1310</span>
<span class="normal">1311</span>
<span class="normal">1312</span>
<span class="normal">1313</span>
<span class="normal">1314</span>
<span class="normal">1315</span>
<span class="normal">1316</span>
<span class="normal">1317</span>
<span class="normal">1318</span>
<span class="normal">1319</span>
<span class="normal">1320</span>
<span class="normal">1321</span>
<span class="normal">1322</span>
<span class="normal">1323</span>
<span class="normal">1324</span>
<span class="normal">1325</span>
<span class="normal">1326</span>
<span class="normal">1327</span>
<span class="normal">1328</span>
<span class="normal">1329</span>
<span class="normal">1330</span>
<span class="normal">1331</span>
<span class="normal">1332</span>
<span class="normal">1333</span>
<span class="normal">1334</span>
<span class="normal">1335</span>
<span class="normal">1336</span>
<span class="normal">1337</span>
<span class="normal">1338</span>
<span class="normal">1339</span>
<span class="normal">1340</span>
<span class="normal">1341</span>
<span class="normal">1342</span>
<span class="normal">1343</span>
<span class="normal">1344</span>
<span class="normal">1345</span>
<span class="normal">1346</span>
<span class="normal">1347</span>
<span class="normal">1348</span>
<span class="normal">1349</span>
<span class="normal">1350</span>
<span class="normal">1351</span>
<span class="normal">1352</span>
<span class="normal">1353</span>
<span class="normal">1354</span>
<span class="normal">1355</span>
<span class="normal">1356</span>
<span class="normal">1357</span>
<span class="normal">1358</span>
<span class="normal">1359</span>
<span class="normal">1360</span>
<span class="normal">1361</span>
<span class="normal">1362</span>
<span class="normal">1363</span>
<span class="normal">1364</span>
<span class="normal">1365</span>
<span class="normal">1366</span>
<span class="normal">1367</span>
<span class="normal">1368</span>
<span class="normal">1369</span>
<span class="normal">1370</span>
<span class="normal">1371</span>
<span class="normal">1372</span>
<span class="normal">1373</span>
<span class="normal">1374</span>
<span class="normal">1375</span>
<span class="normal">1376</span>
<span class="normal">1377</span>
<span class="normal">1378</span>
<span class="normal">1379</span>
<span class="normal">1380</span>
<span class="normal">1381</span>
<span class="normal">1382</span>
<span class="normal">1383</span>
<span class="normal">1384</span>
<span class="normal">1385</span>
<span class="normal">1386</span>
<span class="normal">1387</span>
<span class="normal">1388</span>
<span class="normal">1389</span>
<span class="normal">1390</span>
<span class="normal">1391</span>
<span class="normal">1392</span>
<span class="normal">1393</span>
<span class="normal">1394</span>
<span class="normal">1395</span>
<span class="normal">1396</span>
<span class="normal">1397</span>
<span class="normal">1398</span>
<span class="normal">1399</span>
<span class="normal">1400</span>
<span class="normal">1401</span>
<span class="normal">1402</span>
<span class="normal">1403</span>
<span class="normal">1404</span>
<span class="normal">1405</span>
<span class="normal">1406</span>
<span class="normal">1407</span>
<span class="normal">1408</span>
<span class="normal">1409</span>
<span class="normal">1410</span>
<span class="normal">1411</span>
<span class="normal">1412</span>
<span class="normal">1413</span>
<span class="normal">1414</span>
<span class="normal">1415</span>
<span class="normal">1416</span>
<span class="normal">1417</span>
<span class="normal">1418</span>
<span class="normal">1419</span>
<span class="normal">1420</span>
<span class="normal">1421</span>
<span class="normal">1422</span>
<span class="normal">1423</span>
<span class="normal">1424</span>
<span class="normal">1425</span>
<span class="normal">1426</span>
<span class="normal">1427</span>
<span class="normal">1428</span>
<span class="normal">1429</span>
<span class="normal">1430</span>
<span class="normal">1431</span>
<span class="normal">1432</span>
<span class="normal">1433</span>
<span class="normal">1434</span>
<span class="normal">1435</span>
<span class="normal">1436</span>
<span class="normal">1437</span>
<span class="normal">1438</span>
<span class="normal">1439</span>
<span class="normal">1440</span>
<span class="normal">1441</span>
<span class="normal">1442</span>
<span class="normal">1443</span>
<span class="normal">1444</span>
<span class="normal">1445</span>
<span class="normal">1446</span>
<span class="normal">1447</span>
<span class="normal">1448</span>
<span class="normal">1449</span>
<span class="normal">1450</span>
<span class="normal">1451</span>
<span class="normal">1452</span>
<span class="normal">1453</span>
<span class="normal">1454</span>
<span class="normal">1455</span>
<span class="normal">1456</span>
<span class="normal">1457</span>
<span class="normal">1458</span>
<span class="normal">1459</span>
<span class="normal">1460</span>
<span class="normal">1461</span>
<span class="normal">1462</span>
<span class="normal">1463</span>
<span class="normal">1464</span>
<span class="normal">1465</span>
<span class="normal">1466</span>
<span class="normal">1467</span>
<span class="normal">1468</span>
<span class="normal">1469</span>
<span class="normal">1470</span>
<span class="normal">1471</span>
<span class="normal">1472</span>
<span class="normal">1473</span>
<span class="normal">1474</span>
<span class="normal">1475</span>
<span class="normal">1476</span>
<span class="normal">1477</span>
<span class="normal">1478</span>
<span class="normal">1479</span>
<span class="normal">1480</span>
<span class="normal">1481</span>
<span class="normal">1482</span>
<span class="normal">1483</span>
<span class="normal">1484</span>
<span class="normal">1485</span>
<span class="normal">1486</span>
<span class="normal">1487</span>
<span class="normal">1488</span>
<span class="normal">1489</span>
<span class="normal">1490</span>
<span class="normal">1491</span>
<span class="normal">1492</span>
<span class="normal">1493</span>
<span class="normal">1494</span>
<span class="normal">1495</span>
<span class="normal">1496</span>
<span class="normal">1497</span>
<span class="normal">1498</span>
<span class="normal">1499</span>
<span class="normal">1500</span>
<span class="normal">1501</span>
<span class="normal">1502</span>
<span class="normal">1503</span>
<span class="normal">1504</span>
<span class="normal">1505</span>
<span class="normal">1506</span>
<span class="normal">1507</span>
<span class="normal">1508</span>
<span class="normal">1509</span>
<span class="normal">1510</span>
<span class="normal">1511</span>
<span class="normal">1512</span>
<span class="normal">1513</span>
<span class="normal">1514</span>
<span class="normal">1515</span>
<span class="normal">1516</span>
<span class="normal">1517</span>
<span class="normal">1518</span>
<span class="normal">1519</span>
<span class="normal">1520</span>
<span class="normal">1521</span>
<span class="normal">1522</span>
<span class="normal">1523</span>
<span class="normal">1524</span>
<span class="normal">1525</span>
<span class="normal">1526</span>
<span class="normal">1527</span>
<span class="normal">1528</span>
<span class="normal">1529</span>
<span class="normal">1530</span>
<span class="normal">1531</span>
<span class="normal">1532</span>
<span class="normal">1533</span>
<span class="normal">1534</span>
<span class="normal">1535</span>
<span class="normal">1536</span>
<span class="normal">1537</span>
<span class="normal">1538</span>
<span class="normal">1539</span>
<span class="normal">1540</span>
<span class="normal">1541</span>
<span class="normal">1542</span>
<span class="normal">1543</span>
<span class="normal">1544</span>
<span class="normal">1545</span>
<span class="normal">1546</span>
<span class="normal">1547</span>
<span class="normal">1548</span>
<span class="normal">1549</span>
<span class="normal">1550</span>
<span class="normal">1551</span>
<span class="normal">1552</span>
<span class="normal">1553</span>
<span class="normal">1554</span>
<span class="normal">1555</span>
<span class="normal">1556</span>
<span class="normal">1557</span>
<span class="normal">1558</span>
<span class="normal">1559</span>
<span class="normal">1560</span>
<span class="normal">1561</span>
<span class="normal">1562</span>
<span class="normal">1563</span>
<span class="normal">1564</span>
<span class="normal">1565</span>
<span class="normal">1566</span>
<span class="normal">1567</span>
<span class="normal">1568</span>
<span class="normal">1569</span>
<span class="normal">1570</span>
<span class="normal">1571</span>
<span class="normal">1572</span>
<span class="normal">1573</span>
<span class="normal">1574</span>
<span class="normal">1575</span>
<span class="normal">1576</span>
<span class="normal">1577</span>
<span class="normal">1578</span>
<span class="normal">1579</span>
<span class="normal">1580</span>
<span class="normal">1581</span>
<span class="normal">1582</span>
<span class="normal">1583</span>
<span class="normal">1584</span>
<span class="normal">1585</span>
<span class="normal">1586</span>
<span class="normal">1587</span>
<span class="normal">1588</span>
<span class="normal">1589</span>
<span class="normal">1590</span>
<span class="normal">1591</span>
<span class="normal">1592</span>
<span class="normal">1593</span>
<span class="normal">1594</span>
<span class="normal">1595</span>
<span class="normal">1596</span>
<span class="normal">1597</span>
<span class="normal">1598</span>
<span class="normal">1599</span>
<span class="normal">1600</span>
<span class="normal">1601</span>
<span class="normal">1602</span>
<span class="normal">1603</span>
<span class="normal">1604</span>
<span class="normal">1605</span>
<span class="normal">1606</span>
<span class="normal">1607</span>
<span class="normal">1608</span>
<span class="normal">1609</span>
<span class="normal">1610</span>
<span class="normal">1611</span>
<span class="normal">1612</span>
<span class="normal">1613</span>
<span class="normal">1614</span>
<span class="normal">1615</span>
<span class="normal">1616</span>
<span class="normal">1617</span>
<span class="normal">1618</span>
<span class="normal">1619</span>
<span class="normal">1620</span>
<span class="normal">1621</span>
<span class="normal">1622</span>
<span class="normal">1623</span>
<span class="normal">1624</span>
<span class="normal">1625</span>
<span class="normal">1626</span>
<span class="normal">1627</span>
<span class="normal">1628</span>
<span class="normal">1629</span>
<span class="normal">1630</span>
<span class="normal">1631</span>
<span class="normal">1632</span>
<span class="normal">1633</span>
<span class="normal">1634</span>
<span class="normal">1635</span>
<span class="normal">1636</span>
<span class="normal">1637</span>
<span class="normal">1638</span>
<span class="normal">1639</span>
<span class="normal">1640</span>
<span class="normal">1641</span>
<span class="normal">1642</span>
<span class="normal">1643</span>
<span class="normal">1644</span>
<span class="normal">1645</span>
<span class="normal">1646</span>
<span class="normal">1647</span>
<span class="normal">1648</span>
<span class="normal">1649</span>
<span class="normal">1650</span>
<span class="normal">1651</span>
<span class="normal">1652</span>
<span class="normal">1653</span>
<span class="normal">1654</span>
<span class="normal">1655</span>
<span class="normal">1656</span>
<span class="normal">1657</span>
<span class="normal">1658</span>
<span class="normal">1659</span>
<span class="normal">1660</span>
<span class="normal">1661</span>
<span class="normal">1662</span>
<span class="normal">1663</span>
<span class="normal">1664</span>
<span class="normal">1665</span>
<span class="normal">1666</span>
<span class="normal">1667</span>
<span class="normal">1668</span>
<span class="normal">1669</span>
<span class="normal">1670</span>
<span class="normal">1671</span>
<span class="normal">1672</span>
<span class="normal">1673</span>
<span class="normal">1674</span>
<span class="normal">1675</span>
<span class="normal">1676</span>
<span class="normal">1677</span>
<span class="normal">1678</span>
<span class="normal">1679</span>
<span class="normal">1680</span>
<span class="normal">1681</span>
<span class="normal">1682</span>
<span class="normal">1683</span>
<span class="normal">1684</span>
<span class="normal">1685</span>
<span class="normal">1686</span>
<span class="normal">1687</span>
<span class="normal">1688</span>
<span class="normal">1689</span>
<span class="normal">1690</span>
<span class="normal">1691</span>
<span class="normal">1692</span>
<span class="normal">1693</span>
<span class="normal">1694</span>
<span class="normal">1695</span>
<span class="normal">1696</span>
<span class="normal">1697</span>
<span class="normal">1698</span>
<span class="normal">1699</span>
<span class="normal">1700</span>
<span class="normal">1701</span>
<span class="normal">1702</span>
<span class="normal">1703</span>
<span class="normal">1704</span>
<span class="normal">1705</span>
<span class="normal">1706</span>
<span class="normal">1707</span>
<span class="normal">1708</span>
<span class="normal">1709</span>
<span class="normal">1710</span>
<span class="normal">1711</span>
<span class="normal">1712</span>
<span class="normal">1713</span>
<span class="normal">1714</span>
<span class="normal">1715</span>
<span class="normal">1716</span>
<span class="normal">1717</span>
<span class="normal">1718</span>
<span class="normal">1719</span>
<span class="normal">1720</span>
<span class="normal">1721</span>
<span class="normal">1722</span>
<span class="normal">1723</span>
<span class="normal">1724</span>
<span class="normal">1725</span>
<span class="normal">1726</span>
<span class="normal">1727</span>
<span class="normal">1728</span>
<span class="normal">1729</span>
<span class="normal">1730</span>
<span class="normal">1731</span>
<span class="normal">1732</span>
<span class="normal">1733</span>
<span class="normal">1734</span>
<span class="normal">1735</span>
<span class="normal">1736</span>
<span class="normal">1737</span>
<span class="normal">1738</span>
<span class="normal">1739</span>
<span class="normal">1740</span>
<span class="normal">1741</span>
<span class="normal">1742</span>
<span class="normal">1743</span>
<span class="normal">1744</span>
<span class="normal">1745</span>
<span class="normal">1746</span>
<span class="normal">1747</span>
<span class="normal">1748</span>
<span class="normal">1749</span>
<span class="normal">1750</span>
<span class="normal">1751</span>
<span class="normal">1752</span>
<span class="normal">1753</span>
<span class="normal">1754</span>
<span class="normal">1755</span>
<span class="normal">1756</span>
<span class="normal">1757</span>
<span class="normal">1758</span>
<span class="normal">1759</span>
<span class="normal">1760</span>
<span class="normal">1761</span>
<span class="normal">1762</span>
<span class="normal">1763</span>
<span class="normal">1764</span>
<span class="normal">1765</span>
<span class="normal">1766</span>
<span class="normal">1767</span>
<span class="normal">1768</span>
<span class="normal">1769</span>
<span class="normal">1770</span>
<span class="normal">1771</span>
<span class="normal">1772</span>
<span class="normal">1773</span>
<span class="normal">1774</span>
<span class="normal">1775</span>
<span class="normal">1776</span>
<span class="normal">1777</span>
<span class="normal">1778</span>
<span class="normal">1779</span>
<span class="normal">1780</span>
<span class="normal">1781</span>
<span class="normal">1782</span>
<span class="normal">1783</span>
<span class="normal">1784</span>
<span class="normal">1785</span>
<span class="normal">1786</span>
<span class="normal">1787</span>
<span class="normal">1788</span>
<span class="normal">1789</span>
<span class="normal">1790</span>
<span class="normal">1791</span>
<span class="normal">1792</span>
<span class="normal">1793</span>
<span class="normal">1794</span>
<span class="normal">1795</span>
<span class="normal">1796</span>
<span class="normal">1797</span>
<span class="normal">1798</span>
<span class="normal">1799</span>
<span class="normal">1800</span>
<span class="normal">1801</span>
<span class="normal">1802</span>
<span class="normal">1803</span>
<span class="normal">1804</span>
<span class="normal">1805</span>
<span class="normal">1806</span>
<span class="normal">1807</span>
<span class="normal">1808</span>
<span class="normal">1809</span>
<span class="normal">1810</span>
<span class="normal">1811</span>
<span class="normal">1812</span>
<span class="normal">1813</span>
<span class="normal">1814</span>
<span class="normal">1815</span>
<span class="normal">1816</span>
<span class="normal">1817</span>
<span class="normal">1818</span>
<span class="normal">1819</span>
<span class="normal">1820</span>
<span class="normal">1821</span>
<span class="normal">1822</span>
<span class="normal">1823</span>
<span class="normal">1824</span>
<span class="normal">1825</span>
<span class="normal">1826</span>
<span class="normal">1827</span>
<span class="normal">1828</span>
<span class="normal">1829</span>
<span class="normal">1830</span>
<span class="normal">1831</span>
<span class="normal">1832</span>
<span class="normal">1833</span>
<span class="normal">1834</span>
<span class="normal">1835</span>
<span class="normal">1836</span>
<span class="normal">1837</span>
<span class="normal">1838</span>
<span class="normal">1839</span>
<span class="normal">1840</span>
<span class="normal">1841</span>
<span class="normal">1842</span>
<span class="normal">1843</span>
<span class="normal">1844</span>
<span class="normal">1845</span>
<span class="normal">1846</span>
<span class="normal">1847</span>
<span class="normal">1848</span>
<span class="normal">1849</span>
<span class="normal">1850</span>
<span class="normal">1851</span>
<span class="normal">1852</span>
<span class="normal">1853</span>
<span class="normal">1854</span>
<span class="normal">1855</span>
<span class="normal">1856</span>
<span class="normal">1857</span>
<span class="normal">1858</span>
<span class="normal">1859</span>
<span class="normal">1860</span>
<span class="normal">1861</span>
<span class="normal">1862</span>
<span class="normal">1863</span>
<span class="normal">1864</span>
<span class="normal">1865</span>
<span class="normal">1866</span>
<span class="normal">1867</span>
<span class="normal">1868</span>
<span class="normal">1869</span>
<span class="normal">1870</span>
<span class="normal">1871</span>
<span class="normal">1872</span>
<span class="normal">1873</span>
<span class="normal">1874</span>
<span class="normal">1875</span>
<span class="normal">1876</span>
<span class="normal">1877</span>
<span class="normal">1878</span>
<span class="normal">1879</span>
<span class="normal">1880</span>
<span class="normal">1881</span>
<span class="normal">1882</span>
<span class="normal">1883</span>
<span class="normal">1884</span>
<span class="normal">1885</span>
<span class="normal">1886</span>
<span class="normal">1887</span>
<span class="normal">1888</span>
<span class="normal">1889</span>
<span class="normal">1890</span>
<span class="normal">1891</span>
<span class="normal">1892</span>
<span class="normal">1893</span>
<span class="normal">1894</span>
<span class="normal">1895</span>
<span class="normal">1896</span>
<span class="normal">1897</span>
<span class="normal">1898</span>
<span class="normal">1899</span>
<span class="normal">1900</span>
<span class="normal">1901</span>
<span class="normal">1902</span>
<span class="normal">1903</span>
<span class="normal">1904</span>
<span class="normal">1905</span>
<span class="normal">1906</span>
<span class="normal">1907</span>
<span class="normal">1908</span>
<span class="normal">1909</span>
<span class="normal">1910</span>
<span class="normal">1911</span>
<span class="normal">1912</span>
<span class="normal">1913</span>
<span class="normal">1914</span>
<span class="normal">1915</span>
<span class="normal">1916</span>
<span class="normal">1917</span>
<span class="normal">1918</span>
<span class="normal">1919</span>
<span class="normal">1920</span>
<span class="normal">1921</span>
<span class="normal">1922</span>
<span class="normal">1923</span>
<span class="normal">1924</span>
<span class="normal">1925</span>
<span class="normal">1926</span>
<span class="normal">1927</span>
<span class="normal">1928</span>
<span class="normal">1929</span>
<span class="normal">1930</span>
<span class="normal">1931</span>
<span class="normal">1932</span>
<span class="normal">1933</span>
<span class="normal">1934</span>
<span class="normal">1935</span>
<span class="normal">1936</span>
<span class="normal">1937</span>
<span class="normal">1938</span>
<span class="normal">1939</span>
<span class="normal">1940</span>
<span class="normal">1941</span>
<span class="normal">1942</span>
<span class="normal">1943</span>
<span class="normal">1944</span>
<span class="normal">1945</span>
<span class="normal">1946</span>
<span class="normal">1947</span>
<span class="normal">1948</span>
<span class="normal">1949</span>
<span class="normal">1950</span>
<span class="normal">1951</span>
<span class="normal">1952</span>
<span class="normal">1953</span>
<span class="normal">1954</span>
<span class="normal">1955</span>
<span class="normal">1956</span>
<span class="normal">1957</span>
<span class="normal">1958</span>
<span class="normal">1959</span>
<span class="normal">1960</span>
<span class="normal">1961</span>
<span class="normal">1962</span>
<span class="normal">1963</span>
<span class="normal">1964</span>
<span class="normal">1965</span>
<span class="normal">1966</span>
<span class="normal">1967</span>
<span class="normal">1968</span>
<span class="normal">1969</span>
<span class="normal">1970</span>
<span class="normal">1971</span>
<span class="normal">1972</span>
<span class="normal">1973</span>
<span class="normal">1974</span>
<span class="normal">1975</span>
<span class="normal">1976</span>
<span class="normal">1977</span>
<span class="normal">1978</span>
<span class="normal">1979</span>
<span class="normal">1980</span>
<span class="normal">1981</span>
<span class="normal">1982</span>
<span class="normal">1983</span>
<span class="normal">1984</span>
<span class="normal">1985</span>
<span class="normal">1986</span>
<span class="normal">1987</span>
<span class="normal">1988</span>
<span class="normal">1989</span>
<span class="normal">1990</span>
<span class="normal">1991</span>
<span class="normal">1992</span>
<span class="normal">1993</span>
<span class="normal">1994</span>
<span class="normal">1995</span>
<span class="normal">1996</span>
<span class="normal">1997</span>
<span class="normal">1998</span>
<span class="normal">1999</span>
<span class="normal">2000</span>
<span class="normal">2001</span>
<span class="normal">2002</span>
<span class="normal">2003</span>
<span class="normal">2004</span>
<span class="normal">2005</span>
<span class="normal">2006</span>
<span class="normal">2007</span>
<span class="normal">2008</span>
<span class="normal">2009</span>
<span class="normal">2010</span>
<span class="normal">2011</span>
<span class="normal">2012</span>
<span class="normal">2013</span>
<span class="normal">2014</span>
<span class="normal">2015</span>
<span class="normal">2016</span>
<span class="normal">2017</span>
<span class="normal">2018</span>
<span class="normal">2019</span>
<span class="normal">2020</span>
<span class="normal">2021</span>
<span class="normal">2022</span>
<span class="normal">2023</span>
<span class="normal">2024</span>
<span class="normal">2025</span>
<span class="normal">2026</span>
<span class="normal">2027</span>
<span class="normal">2028</span>
<span class="normal">2029</span>
<span class="normal">2030</span>
<span class="normal">2031</span>
<span class="normal">2032</span>
<span class="normal">2033</span>
<span class="normal">2034</span>
<span class="normal">2035</span>
<span class="normal">2036</span>
<span class="normal">2037</span>
<span class="normal">2038</span>
<span class="normal">2039</span>
<span class="normal">2040</span>
<span class="normal">2041</span>
<span class="normal">2042</span>
<span class="normal">2043</span>
<span class="normal">2044</span>
<span class="normal">2045</span>
<span class="normal">2046</span>
<span class="normal">2047</span>
<span class="normal">2048</span>
<span class="normal">2049</span>
<span class="normal">2050</span>
<span class="normal">2051</span>
<span class="normal">2052</span>
<span class="normal">2053</span>
<span class="normal">2054</span>
<span class="normal">2055</span>
<span class="normal">2056</span>
<span class="normal">2057</span>
<span class="normal">2058</span>
<span class="normal">2059</span>
<span class="normal">2060</span>
<span class="normal">2061</span>
<span class="normal">2062</span>
<span class="normal">2063</span>
<span class="normal">2064</span>
<span class="normal">2065</span>
<span class="normal">2066</span>
<span class="normal">2067</span>
<span class="normal">2068</span>
<span class="normal">2069</span>
<span class="normal">2070</span>
<span class="normal">2071</span>
<span class="normal">2072</span>
<span class="normal">2073</span>
<span class="normal">2074</span>
<span class="normal">2075</span>
<span class="normal">2076</span>
<span class="normal">2077</span>
<span class="normal">2078</span>
<span class="normal">2079</span>
<span class="normal">2080</span>
<span class="normal">2081</span>
<span class="normal">2082</span>
<span class="normal">2083</span>
<span class="normal">2084</span>
<span class="normal">2085</span>
<span class="normal">2086</span>
<span class="normal">2087</span>
<span class="normal">2088</span>
<span class="normal">2089</span>
<span class="normal">2090</span>
<span class="normal">2091</span>
<span class="normal">2092</span>
<span class="normal">2093</span>
<span class="normal">2094</span>
<span class="normal">2095</span>
<span class="normal">2096</span>
<span class="normal">2097</span>
<span class="normal">2098</span>
<span class="normal">2099</span>
<span class="normal">2100</span>
<span class="normal">2101</span>
<span class="normal">2102</span>
<span class="normal">2103</span>
<span class="normal">2104</span>
<span class="normal">2105</span>
<span class="normal">2106</span>
<span class="normal">2107</span>
<span class="normal">2108</span>
<span class="normal">2109</span>
<span class="normal">2110</span>
<span class="normal">2111</span>
<span class="normal">2112</span>
<span class="normal">2113</span>
<span class="normal">2114</span>
<span class="normal">2115</span>
<span class="normal">2116</span>
<span class="normal">2117</span>
<span class="normal">2118</span>
<span class="normal">2119</span>
<span class="normal">2120</span>
<span class="normal">2121</span>
<span class="normal">2122</span>
<span class="normal">2123</span>
<span class="normal">2124</span>
<span class="normal">2125</span>
<span class="normal">2126</span>
<span class="normal">2127</span>
<span class="normal">2128</span>
<span class="normal">2129</span>
<span class="normal">2130</span>
<span class="normal">2131</span>
<span class="normal">2132</span>
<span class="normal">2133</span>
<span class="normal">2134</span>
<span class="normal">2135</span>
<span class="normal">2136</span>
<span class="normal">2137</span>
<span class="normal">2138</span>
<span class="normal">2139</span>
<span class="normal">2140</span>
<span class="normal">2141</span>
<span class="normal">2142</span>
<span class="normal">2143</span>
<span class="normal">2144</span>
<span class="normal">2145</span>
<span class="normal">2146</span>
<span class="normal">2147</span>
<span class="normal">2148</span>
<span class="normal">2149</span>
<span class="normal">2150</span>
<span class="normal">2151</span>
<span class="normal">2152</span>
<span class="normal">2153</span>
<span class="normal">2154</span>
<span class="normal">2155</span>
<span class="normal">2156</span>
<span class="normal">2157</span>
<span class="normal">2158</span>
<span class="normal">2159</span>
<span class="normal">2160</span>
<span class="normal">2161</span>
<span class="normal">2162</span>
<span class="normal">2163</span>
<span class="normal">2164</span>
<span class="normal">2165</span>
<span class="normal">2166</span>
<span class="normal">2167</span>
<span class="normal">2168</span>
<span class="normal">2169</span>
<span class="normal">2170</span>
<span class="normal">2171</span>
<span class="normal">2172</span>
<span class="normal">2173</span>
<span class="normal">2174</span>
<span class="normal">2175</span>
<span class="normal">2176</span>
<span class="normal">2177</span>
<span class="normal">2178</span>
<span class="normal">2179</span>
<span class="normal">2180</span>
<span class="normal">2181</span>
<span class="normal">2182</span>
<span class="normal">2183</span>
<span class="normal">2184</span>
<span class="normal">2185</span>
<span class="normal">2186</span>
<span class="normal">2187</span>
<span class="normal">2188</span>
<span class="normal">2189</span>
<span class="normal">2190</span>
<span class="normal">2191</span>
<span class="normal">2192</span>
<span class="normal">2193</span>
<span class="normal">2194</span>
<span class="normal">2195</span>
<span class="normal">2196</span>
<span class="normal">2197</span>
<span class="normal">2198</span>
<span class="normal">2199</span>
<span class="normal">2200</span>
<span class="normal">2201</span>
<span class="normal">2202</span>
<span class="normal">2203</span>
<span class="normal">2204</span>
<span class="normal">2205</span>
<span class="normal">2206</span>
<span class="normal">2207</span>
<span class="normal">2208</span>
<span class="normal">2209</span>
<span class="normal">2210</span>
<span class="normal">2211</span>
<span class="normal">2212</span>
<span class="normal">2213</span>
<span class="normal">2214</span>
<span class="normal">2215</span>
<span class="normal">2216</span>
<span class="normal">2217</span>
<span class="normal">2218</span>
<span class="normal">2219</span>
<span class="normal">2220</span>
<span class="normal">2221</span>
<span class="normal">2222</span>
<span class="normal">2223</span>
<span class="normal">2224</span>
<span class="normal">2225</span>
<span class="normal">2226</span>
<span class="normal">2227</span>
<span class="normal">2228</span>
<span class="normal">2229</span>
<span class="normal">2230</span>
<span class="normal">2231</span>
<span class="normal">2232</span>
<span class="normal">2233</span>
<span class="normal">2234</span>
<span class="normal">2235</span>
<span class="normal">2236</span>
<span class="normal">2237</span>
<span class="normal">2238</span>
<span class="normal">2239</span>
<span class="normal">2240</span>
<span class="normal">2241</span>
<span class="normal">2242</span>
<span class="normal">2243</span>
<span class="normal">2244</span>
<span class="normal">2245</span>
<span class="normal">2246</span>
<span class="normal">2247</span>
<span class="normal">2248</span>
<span class="normal">2249</span>
<span class="normal">2250</span>
<span class="normal">2251</span>
<span class="normal">2252</span>
<span class="normal">2253</span>
<span class="normal">2254</span>
<span class="normal">2255</span>
<span class="normal">2256</span>
<span class="normal">2257</span>
<span class="normal">2258</span>
<span class="normal">2259</span>
<span class="normal">2260</span>
<span class="normal">2261</span>
<span class="normal">2262</span>
<span class="normal">2263</span>
<span class="normal">2264</span>
<span class="normal">2265</span>
<span class="normal">2266</span>
<span class="normal">2267</span>
<span class="normal">2268</span>
<span class="normal">2269</span>
<span class="normal">2270</span>
<span class="normal">2271</span>
<span class="normal">2272</span>
<span class="normal">2273</span>
<span class="normal">2274</span>
<span class="normal">2275</span>
<span class="normal">2276</span>
<span class="normal">2277</span>
<span class="normal">2278</span>
<span class="normal">2279</span>
<span class="normal">2280</span>
<span class="normal">2281</span>
<span class="normal">2282</span>
<span class="normal">2283</span>
<span class="normal">2284</span>
<span class="normal">2285</span>
<span class="normal">2286</span>
<span class="normal">2287</span>
<span class="normal">2288</span>
<span class="normal">2289</span>
<span class="normal">2290</span>
<span class="normal">2291</span>
<span class="normal">2292</span>
<span class="normal">2293</span>
<span class="normal">2294</span>
<span class="normal">2295</span>
<span class="normal">2296</span>
<span class="normal">2297</span>
<span class="normal">2298</span>
<span class="normal">2299</span>
<span class="normal">2300</span>
<span class="normal">2301</span>
<span class="normal">2302</span>
<span class="normal">2303</span>
<span class="normal">2304</span>
<span class="normal">2305</span>
<span class="normal">2306</span>
<span class="normal">2307</span>
<span class="normal">2308</span>
<span class="normal">2309</span>
<span class="normal">2310</span>
<span class="normal">2311</span>
<span class="normal">2312</span>
<span class="normal">2313</span>
<span class="normal">2314</span>
<span class="normal">2315</span>
<span class="normal">2316</span>
<span class="normal">2317</span>
<span class="normal">2318</span>
<span class="normal">2319</span>
<span class="normal">2320</span>
<span class="normal">2321</span>
<span class="normal">2322</span>
<span class="normal">2323</span>
<span class="normal">2324</span>
<span class="normal">2325</span>
<span class="normal">2326</span>
<span class="normal">2327</span>
<span class="normal">2328</span>
<span class="normal">2329</span>
<span class="normal">2330</span>
<span class="normal">2331</span>
<span class="normal">2332</span>
<span class="normal">2333</span>
<span class="normal">2334</span>
<span class="normal">2335</span>
<span class="normal">2336</span>
<span class="normal">2337</span>
<span class="normal">2338</span>
<span class="normal">2339</span>
<span class="normal">2340</span>
<span class="normal">2341</span>
<span class="normal">2342</span>
<span class="normal">2343</span>
<span class="normal">2344</span>
<span class="normal">2345</span>
<span class="normal">2346</span>
<span class="normal">2347</span>
<span class="normal">2348</span>
<span class="normal">2349</span>
<span class="normal">2350</span>
<span class="normal">2351</span>
<span class="normal">2352</span>
<span class="normal">2353</span>
<span class="normal">2354</span>
<span class="normal">2355</span>
<span class="normal">2356</span>
<span class="normal">2357</span>
<span class="normal">2358</span>
<span class="normal">2359</span>
<span class="normal">2360</span>
<span class="normal">2361</span>
<span class="normal">2362</span>
<span class="normal">2363</span>
<span class="normal">2364</span>
<span class="normal">2365</span>
<span class="normal">2366</span>
<span class="normal">2367</span>
<span class="normal">2368</span>
<span class="normal">2369</span>
<span class="normal">2370</span>
<span class="normal">2371</span>
<span class="normal">2372</span>
<span class="normal">2373</span>
<span class="normal">2374</span>
<span class="normal">2375</span>
<span class="normal">2376</span>
<span class="normal">2377</span>
<span class="normal">2378</span>
<span class="normal">2379</span>
<span class="normal">2380</span>
<span class="normal">2381</span>
<span class="normal">2382</span>
<span class="normal">2383</span>
<span class="normal">2384</span>
<span class="normal">2385</span>
<span class="normal">2386</span>
<span class="normal">2387</span>
<span class="normal">2388</span>
<span class="normal">2389</span>
<span class="normal">2390</span>
<span class="normal">2391</span>
<span class="normal">2392</span>
<span class="normal">2393</span>
<span class="normal">2394</span>
<span class="normal">2395</span>
<span class="normal">2396</span>
<span class="normal">2397</span>
<span class="normal">2398</span>
<span class="normal">2399</span>
<span class="normal">2400</span>
<span class="normal">2401</span>
<span class="normal">2402</span>
<span class="normal">2403</span>
<span class="normal">2404</span>
<span class="normal">2405</span>
<span class="normal">2406</span>
<span class="normal">2407</span>
<span class="normal">2408</span>
<span class="normal">2409</span>
<span class="normal">2410</span>
<span class="normal">2411</span>
<span class="normal">2412</span>
<span class="normal">2413</span>
<span class="normal">2414</span>
<span class="normal">2415</span>
<span class="normal">2416</span>
<span class="normal">2417</span>
<span class="normal">2418</span>
<span class="normal">2419</span>
<span class="normal">2420</span>
<span class="normal">2421</span>
<span class="normal">2422</span>
<span class="normal">2423</span>
<span class="normal">2424</span>
<span class="normal">2425</span>
<span class="normal">2426</span>
<span class="normal">2427</span>
<span class="normal">2428</span>
<span class="normal">2429</span>
<span class="normal">2430</span>
<span class="normal">2431</span>
<span class="normal">2432</span>
<span class="normal">2433</span>
<span class="normal">2434</span>
<span class="normal">2435</span>
<span class="normal">2436</span>
<span class="normal">2437</span>
<span class="normal">2438</span>
<span class="normal">2439</span>
<span class="normal">2440</span>
<span class="normal">2441</span>
<span class="normal">2442</span>
<span class="normal">2443</span>
<span class="normal">2444</span>
<span class="normal">2445</span>
<span class="normal">2446</span>
<span class="normal">2447</span>
<span class="normal">2448</span>
<span class="normal">2449</span>
<span class="normal">2450</span>
<span class="normal">2451</span>
<span class="normal">2452</span>
<span class="normal">2453</span>
<span class="normal">2454</span>
<span class="normal">2455</span>
<span class="normal">2456</span>
<span class="normal">2457</span>
<span class="normal">2458</span>
<span class="normal">2459</span>
<span class="normal">2460</span>
<span class="normal">2461</span>
<span class="normal">2462</span>
<span class="normal">2463</span>
<span class="normal">2464</span>
<span class="normal">2465</span>
<span class="normal">2466</span>
<span class="normal">2467</span>
<span class="normal">2468</span>
<span class="normal">2469</span>
<span class="normal">2470</span>
<span class="normal">2471</span>
<span class="normal">2472</span>
<span class="normal">2473</span>
<span class="normal">2474</span>
<span class="normal">2475</span>
<span class="normal">2476</span>
<span class="normal">2477</span>
<span class="normal">2478</span>
<span class="normal">2479</span>
<span class="normal">2480</span>
<span class="normal">2481</span>
<span class="normal">2482</span>
<span class="normal">2483</span>
<span class="normal">2484</span>
<span class="normal">2485</span>
<span class="normal">2486</span>
<span class="normal">2487</span>
<span class="normal">2488</span>
<span class="normal">2489</span>
<span class="normal">2490</span>
<span class="normal">2491</span>
<span class="normal">2492</span>
<span class="normal">2493</span>
<span class="normal">2494</span>
<span class="normal">2495</span>
<span class="normal">2496</span>
<span class="normal">2497</span>
<span class="normal">2498</span>
<span class="normal">2499</span>
<span class="normal">2500</span>
<span class="normal">2501</span>
<span class="normal">2502</span>
<span class="normal">2503</span>
<span class="normal">2504</span>
<span class="normal">2505</span>
<span class="normal">2506</span>
<span class="normal">2507</span>
<span class="normal">2508</span>
<span class="normal">2509</span>
<span class="normal">2510</span>
<span class="normal">2511</span>
<span class="normal">2512</span>
<span class="normal">2513</span>
<span class="normal">2514</span>
<span class="normal">2515</span>
<span class="normal">2516</span>
<span class="normal">2517</span>
<span class="normal">2518</span>
<span class="normal">2519</span>
<span class="normal">2520</span>
<span class="normal">2521</span>
<span class="normal">2522</span>
<span class="normal">2523</span>
<span class="normal">2524</span>
<span class="normal">2525</span>
<span class="normal">2526</span>
<span class="normal">2527</span>
<span class="normal">2528</span>
<span class="normal">2529</span>
<span class="normal">2530</span>
<span class="normal">2531</span>
<span class="normal">2532</span>
<span class="normal">2533</span>
<span class="normal">2534</span>
<span class="normal">2535</span>
<span class="normal">2536</span>
<span class="normal">2537</span>
<span class="normal">2538</span>
<span class="normal">2539</span>
<span class="normal">2540</span>
<span class="normal">2541</span>
<span class="normal">2542</span>
<span class="normal">2543</span>
<span class="normal">2544</span>
<span class="normal">2545</span>
<span class="normal">2546</span>
<span class="normal">2547</span>
<span class="normal">2548</span>
<span class="normal">2549</span>
<span class="normal">2550</span>
<span class="normal">2551</span>
<span class="normal">2552</span>
<span class="normal">2553</span>
<span class="normal">2554</span>
<span class="normal">2555</span>
<span class="normal">2556</span>
<span class="normal">2557</span>
<span class="normal">2558</span>
<span class="normal">2559</span>
<span class="normal">2560</span>
<span class="normal">2561</span>
<span class="normal">2562</span>
<span class="normal">2563</span>
<span class="normal">2564</span>
<span class="normal">2565</span>
<span class="normal">2566</span>
<span class="normal">2567</span>
<span class="normal">2568</span>
<span class="normal">2569</span>
<span class="normal">2570</span>
<span class="normal">2571</span>
<span class="normal">2572</span>
<span class="normal">2573</span>
<span class="normal">2574</span>
<span class="normal">2575</span>
<span class="normal">2576</span>
<span class="normal">2577</span>
<span class="normal">2578</span>
<span class="normal">2579</span>
<span class="normal">2580</span>
<span class="normal">2581</span>
<span class="normal">2582</span>
<span class="normal">2583</span>
<span class="normal">2584</span>
<span class="normal">2585</span>
<span class="normal">2586</span>
<span class="normal">2587</span>
<span class="normal">2588</span>
<span class="normal">2589</span>
<span class="normal">2590</span>
<span class="normal">2591</span>
<span class="normal">2592</span>
<span class="normal">2593</span>
<span class="normal">2594</span>
<span class="normal">2595</span>
<span class="normal">2596</span>
<span class="normal">2597</span>
<span class="normal">2598</span>
<span class="normal">2599</span>
<span class="normal">2600</span>
<span class="normal">2601</span>
<span class="normal">2602</span>
<span class="normal">2603</span>
<span class="normal">2604</span>
<span class="normal">2605</span>
<span class="normal">2606</span>
<span class="normal">2607</span>
<span class="normal">2608</span>
<span class="normal">2609</span>
<span class="normal">2610</span>
<span class="normal">2611</span>
<span class="normal">2612</span>
<span class="normal">2613</span>
<span class="normal">2614</span>
<span class="normal">2615</span>
<span class="normal">2616</span>
<span class="normal">2617</span>
<span class="normal">2618</span>
<span class="normal">2619</span>
<span class="normal">2620</span>
<span class="normal">2621</span>
<span class="normal">2622</span>
<span class="normal">2623</span>
<span class="normal">2624</span>
<span class="normal">2625</span>
<span class="normal">2626</span>
<span class="normal">2627</span>
<span class="normal">2628</span>
<span class="normal">2629</span>
<span class="normal">2630</span>
<span class="normal">2631</span>
<span class="normal">2632</span>
<span class="normal">2633</span>
<span class="normal">2634</span>
<span class="normal">2635</span>
<span class="normal">2636</span>
<span class="normal">2637</span>
<span class="normal">2638</span>
<span class="normal">2639</span>
<span class="normal">2640</span>
<span class="normal">2641</span>
<span class="normal">2642</span>
<span class="normal">2643</span>
<span class="normal">2644</span>
<span class="normal">2645</span>
<span class="normal">2646</span>
<span class="normal">2647</span>
<span class="normal">2648</span>
<span class="normal">2649</span>
<span class="normal">2650</span>
<span class="normal">2651</span>
<span class="normal">2652</span>
<span class="normal">2653</span>
<span class="normal">2654</span>
<span class="normal">2655</span>
<span class="normal">2656</span>
<span class="normal">2657</span>
<span class="normal">2658</span>
<span class="normal">2659</span>
<span class="normal">2660</span>
<span class="normal">2661</span>
<span class="normal">2662</span>
<span class="normal">2663</span>
<span class="normal">2664</span>
<span class="normal">2665</span>
<span class="normal">2666</span>
<span class="normal">2667</span>
<span class="normal">2668</span>
<span class="normal">2669</span>
<span class="normal">2670</span>
<span class="normal">2671</span>
<span class="normal">2672</span>
<span class="normal">2673</span>
<span class="normal">2674</span>
<span class="normal">2675</span>
<span class="normal">2676</span>
<span class="normal">2677</span>
<span class="normal">2678</span>
<span class="normal">2679</span>
<span class="normal">2680</span>
<span class="normal">2681</span>
<span class="normal">2682</span>
<span class="normal">2683</span>
<span class="normal">2684</span>
<span class="normal">2685</span>
<span class="normal">2686</span>
<span class="normal">2687</span>
<span class="normal">2688</span>
<span class="normal">2689</span>
<span class="normal">2690</span>
<span class="normal">2691</span>
<span class="normal">2692</span>
<span class="normal">2693</span>
<span class="normal">2694</span>
<span class="normal">2695</span>
<span class="normal">2696</span>
<span class="normal">2697</span>
<span class="normal">2698</span>
<span class="normal">2699</span>
<span class="normal">2700</span>
<span class="normal">2701</span>
<span class="normal">2702</span>
<span class="normal">2703</span>
<span class="normal">2704</span>
<span class="normal">2705</span>
<span class="normal">2706</span>
<span class="normal">2707</span>
<span class="normal">2708</span>
<span class="normal">2709</span>
<span class="normal">2710</span>
<span class="normal">2711</span>
<span class="normal">2712</span>
<span class="normal">2713</span>
<span class="normal">2714</span>
<span class="normal">2715</span>
<span class="normal">2716</span>
<span class="normal">2717</span>
<span class="normal">2718</span>
<span class="normal">2719</span>
<span class="normal">2720</span>
<span class="normal">2721</span>
<span class="normal">2722</span>
<span class="normal">2723</span>
<span class="normal">2724</span>
<span class="normal">2725</span>
<span class="normal">2726</span>
<span class="normal">2727</span>
<span class="normal">2728</span>
<span class="normal">2729</span>
<span class="normal">2730</span>
<span class="normal">2731</span>
<span class="normal">2732</span>
<span class="normal">2733</span>
<span class="normal">2734</span>
<span class="normal">2735</span>
<span class="normal">2736</span>
<span class="normal">2737</span>
<span class="normal">2738</span>
<span class="normal">2739</span>
<span class="normal">2740</span>
<span class="normal">2741</span>
<span class="normal">2742</span>
<span class="normal">2743</span>
<span class="normal">2744</span>
<span class="normal">2745</span>
<span class="normal">2746</span>
<span class="normal">2747</span>
<span class="normal">2748</span>
<span class="normal">2749</span>
<span class="normal">2750</span>
<span class="normal">2751</span>
<span class="normal">2752</span>
<span class="normal">2753</span>
<span class="normal">2754</span>
<span class="normal">2755</span>
<span class="normal">2756</span>
<span class="normal">2757</span>
<span class="normal">2758</span>
<span class="normal">2759</span>
<span class="normal">2760</span>
<span class="normal">2761</span>
<span class="normal">2762</span>
<span class="normal">2763</span>
<span class="normal">2764</span>
<span class="normal">2765</span>
<span class="normal">2766</span>
<span class="normal">2767</span>
<span class="normal">2768</span>
<span class="normal">2769</span>
<span class="normal">2770</span>
<span class="normal">2771</span>
<span class="normal">2772</span>
<span class="normal">2773</span>
<span class="normal">2774</span>
<span class="normal">2775</span>
<span class="normal">2776</span>
<span class="normal">2777</span>
<span class="normal">2778</span>
<span class="normal">2779</span>
<span class="normal">2780</span>
<span class="normal">2781</span>
<span class="normal">2782</span>
<span class="normal">2783</span>
<span class="normal">2784</span>
<span class="normal">2785</span>
<span class="normal">2786</span>
<span class="normal">2787</span>
<span class="normal">2788</span>
<span class="normal">2789</span>
<span class="normal">2790</span>
<span class="normal">2791</span>
<span class="normal">2792</span>
<span class="normal">2793</span>
<span class="normal">2794</span>
<span class="normal">2795</span>
<span class="normal">2796</span>
<span class="normal">2797</span>
<span class="normal">2798</span>
<span class="normal">2799</span>
<span class="normal">2800</span>
<span class="normal">2801</span>
<span class="normal">2802</span>
<span class="normal">2803</span>
<span class="normal">2804</span>
<span class="normal">2805</span>
<span class="normal">2806</span>
<span class="normal">2807</span>
<span class="normal">2808</span>
<span class="normal">2809</span>
<span class="normal">2810</span>
<span class="normal">2811</span>
<span class="normal">2812</span>
<span class="normal">2813</span>
<span class="normal">2814</span>
<span class="normal">2815</span>
<span class="normal">2816</span>
<span class="normal">2817</span>
<span class="normal">2818</span>
<span class="normal">2819</span>
<span class="normal">2820</span>
<span class="normal">2821</span>
<span class="normal">2822</span>
<span class="normal">2823</span>
<span class="normal">2824</span>
<span class="normal">2825</span>
<span class="normal">2826</span>
<span class="normal">2827</span>
<span class="normal">2828</span>
<span class="normal">2829</span>
<span class="normal">2830</span>
<span class="normal">2831</span>
<span class="normal">2832</span>
<span class="normal">2833</span>
<span class="normal">2834</span>
<span class="normal">2835</span>
<span class="normal">2836</span>
<span class="normal">2837</span>
<span class="normal">2838</span>
<span class="normal">2839</span>
<span class="normal">2840</span>
<span class="normal">2841</span>
<span class="normal">2842</span>
<span class="normal">2843</span>
<span class="normal">2844</span>
<span class="normal">2845</span>
<span class="normal">2846</span>
<span class="normal">2847</span>
<span class="normal">2848</span>
<span class="normal">2849</span>
<span class="normal">2850</span>
<span class="normal">2851</span>
<span class="normal">2852</span>
<span class="normal">2853</span>
<span class="normal">2854</span>
<span class="normal">2855</span>
<span class="normal">2856</span>
<span class="normal">2857</span>
<span class="normal">2858</span>
<span class="normal">2859</span>
<span class="normal">2860</span>
<span class="normal">2861</span>
<span class="normal">2862</span>
<span class="normal">2863</span>
<span class="normal">2864</span>
<span class="normal">2865</span>
<span class="normal">2866</span>
<span class="normal">2867</span>
<span class="normal">2868</span>
<span class="normal">2869</span>
<span class="normal">2870</span>
<span class="normal">2871</span>
<span class="normal">2872</span>
<span class="normal">2873</span>
<span class="normal">2874</span>
<span class="normal">2875</span>
<span class="normal">2876</span>
<span class="normal">2877</span>
<span class="normal">2878</span>
<span class="normal">2879</span>
<span class="normal">2880</span>
<span class="normal">2881</span>
<span class="normal">2882</span>
<span class="normal">2883</span>
<span class="normal">2884</span>
<span class="normal">2885</span>
<span class="normal">2886</span>
<span class="normal">2887</span>
<span class="normal">2888</span>
<span class="normal">2889</span>
<span class="normal">2890</span>
<span class="normal">2891</span>
<span class="normal">2892</span>
<span class="normal">2893</span>
<span class="normal">2894</span>
<span class="normal">2895</span>
<span class="normal">2896</span>
<span class="normal">2897</span>
<span class="normal">2898</span>
<span class="normal">2899</span>
<span class="normal">2900</span>
<span class="normal">2901</span>
<span class="normal">2902</span>
<span class="normal">2903</span>
<span class="normal">2904</span>
<span class="normal">2905</span>
<span class="normal">2906</span>
<span class="normal">2907</span>
<span class="normal">2908</span>
<span class="normal">2909</span>
<span class="normal">2910</span>
<span class="normal">2911</span>
<span class="normal">2912</span>
<span class="normal">2913</span>
<span class="normal">2914</span>
<span class="normal">2915</span>
<span class="normal">2916</span>
<span class="normal">2917</span>
<span class="normal">2918</span>
<span class="normal">2919</span>
<span class="normal">2920</span>
<span class="normal">2921</span>
<span class="normal">2922</span>
<span class="normal">2923</span>
<span class="normal">2924</span>
<span class="normal">2925</span>
<span class="normal">2926</span>
<span class="normal">2927</span>
<span class="normal">2928</span>
<span class="normal">2929</span>
<span class="normal">2930</span>
<span class="normal">2931</span>
<span class="normal">2932</span>
<span class="normal">2933</span>
<span class="normal">2934</span>
<span class="normal">2935</span>
<span class="normal">2936</span>
<span class="normal">2937</span>
<span class="normal">2938</span>
<span class="normal">2939</span>
<span class="normal">2940</span>
<span class="normal">2941</span>
<span class="normal">2942</span>
<span class="normal">2943</span>
<span class="normal">2944</span>
<span class="normal">2945</span>
<span class="normal">2946</span>
<span class="normal">2947</span>
<span class="normal">2948</span>
<span class="normal">2949</span>
<span class="normal">2950</span>
<span class="normal">2951</span>
<span class="normal">2952</span>
<span class="normal">2953</span>
<span class="normal">2954</span>
<span class="normal">2955</span>
<span class="normal">2956</span>
<span class="normal">2957</span>
<span class="normal">2958</span>
<span class="normal">2959</span>
<span class="normal">2960</span>
<span class="normal">2961</span>
<span class="normal">2962</span>
<span class="normal">2963</span>
<span class="normal">2964</span>
<span class="normal">2965</span>
<span class="normal">2966</span>
<span class="normal">2967</span>
<span class="normal">2968</span>
<span class="normal">2969</span>
<span class="normal">2970</span>
<span class="normal">2971</span>
<span class="normal">2972</span>
<span class="normal">2973</span>
<span class="normal">2974</span>
<span class="normal">2975</span>
<span class="normal">2976</span>
<span class="normal">2977</span>
<span class="normal">2978</span>
<span class="normal">2979</span>
<span class="normal">2980</span>
<span class="normal">2981</span>
<span class="normal">2982</span>
<span class="normal">2983</span>
<span class="normal">2984</span>
<span class="normal">2985</span>
<span class="normal">2986</span>
<span class="normal">2987</span>
<span class="normal">2988</span>
<span class="normal">2989</span>
<span class="normal">2990</span>
<span class="normal">2991</span>
<span class="normal">2992</span>
<span class="normal">2993</span>
<span class="normal">2994</span>
<span class="normal">2995</span>
<span class="normal">2996</span>
<span class="normal">2997</span>
<span class="normal">2998</span>
<span class="normal">2999</span>
<span class="normal">3000</span>
<span class="normal">3001</span>
<span class="normal">3002</span>
<span class="normal">3003</span>
<span class="normal">3004</span>
<span class="normal">3005</span>
<span class="normal">3006</span>
<span class="normal">3007</span>
<span class="normal">3008</span>
<span class="normal">3009</span>
<span class="normal">3010</span>
<span class="normal">3011</span>
<span class="normal">3012</span>
<span class="normal">3013</span>
<span class="normal">3014</span>
<span class="normal">3015</span>
<span class="normal">3016</span>
<span class="normal">3017</span>
<span class="normal">3018</span>
<span class="normal">3019</span>
<span class="normal">3020</span>
<span class="normal">3021</span>
<span class="normal">3022</span>
<span class="normal">3023</span>
<span class="normal">3024</span>
<span class="normal">3025</span>
<span class="normal">3026</span>
<span class="normal">3027</span>
<span class="normal">3028</span>
<span class="normal">3029</span>
<span class="normal">3030</span>
<span class="normal">3031</span>
<span class="normal">3032</span>
<span class="normal">3033</span>
<span class="normal">3034</span>
<span class="normal">3035</span>
<span class="normal">3036</span>
<span class="normal">3037</span>
<span class="normal">3038</span>
<span class="normal">3039</span>
<span class="normal">3040</span>
<span class="normal">3041</span>
<span class="normal">3042</span>
<span class="normal">3043</span>
<span class="normal">3044</span>
<span class="normal">3045</span>
<span class="normal">3046</span>
<span class="normal">3047</span>
<span class="normal">3048</span>
<span class="normal">3049</span>
<span class="normal">3050</span>
<span class="normal">3051</span>
<span class="normal">3052</span>
<span class="normal">3053</span>
<span class="normal">3054</span>
<span class="normal">3055</span>
<span class="normal">3056</span>
<span class="normal">3057</span>
<span class="normal">3058</span>
<span class="normal">3059</span>
<span class="normal">3060</span>
<span class="normal">3061</span>
<span class="normal">3062</span>
<span class="normal">3063</span>
<span class="normal">3064</span>
<span class="normal">3065</span>
<span class="normal">3066</span>
<span class="normal">3067</span>
<span class="normal">3068</span>
<span class="normal">3069</span>
<span class="normal">3070</span>
<span class="normal">3071</span>
<span class="normal">3072</span>
<span class="normal">3073</span>
<span class="normal">3074</span>
<span class="normal">3075</span>
<span class="normal">3076</span>
<span class="normal">3077</span>
<span class="normal">3078</span>
<span class="normal">3079</span>
<span class="normal">3080</span>
<span class="normal">3081</span>
<span class="normal">3082</span>
<span class="normal">3083</span>
<span class="normal">3084</span>
<span class="normal">3085</span>
<span class="normal">3086</span>
<span class="normal">3087</span>
<span class="normal">3088</span>
<span class="normal">3089</span>
<span class="normal">3090</span>
<span class="normal">3091</span>
<span class="normal">3092</span>
<span class="normal">3093</span>
<span class="normal">3094</span>
<span class="normal">3095</span>
<span class="normal">3096</span>
<span class="normal">3097</span>
<span class="normal">3098</span>
<span class="normal">3099</span>
<span class="normal">3100</span>
<span class="normal">3101</span>
<span class="normal">3102</span>
<span class="normal">3103</span>
<span class="normal">3104</span>
<span class="normal">3105</span>
<span class="normal">3106</span>
<span class="normal">3107</span>
<span class="normal">3108</span>
<span class="normal">3109</span>
<span class="normal">3110</span>
<span class="normal">3111</span>
<span class="normal">3112</span>
<span class="normal">3113</span>
<span class="normal">3114</span>
<span class="normal">3115</span>
<span class="normal">3116</span>
<span class="normal">3117</span>
<span class="normal">3118</span>
<span class="normal">3119</span>
<span class="normal">3120</span>
<span class="normal">3121</span>
<span class="normal">3122</span>
<span class="normal">3123</span>
<span class="normal">3124</span>
<span class="normal">3125</span>
<span class="normal">3126</span>
<span class="normal">3127</span>
<span class="normal">3128</span>
<span class="normal">3129</span>
<span class="normal">3130</span>
<span class="normal">3131</span>
<span class="normal">3132</span>
<span class="normal">3133</span>
<span class="normal">3134</span>
<span class="normal">3135</span>
<span class="normal">3136</span>
<span class="normal">3137</span>
<span class="normal">3138</span>
<span class="normal">3139</span>
<span class="normal">3140</span>
<span class="normal">3141</span>
<span class="normal">3142</span>
<span class="normal">3143</span>
<span class="normal">3144</span>
<span class="normal">3145</span>
<span class="normal">3146</span>
<span class="normal">3147</span>
<span class="normal">3148</span>
<span class="normal">3149</span>
<span class="normal">3150</span>
<span class="normal">3151</span>
<span class="normal">3152</span>
<span class="normal">3153</span>
<span class="normal">3154</span>
<span class="normal">3155</span>
<span class="normal">3156</span>
<span class="normal">3157</span>
<span class="normal">3158</span>
<span class="normal">3159</span>
<span class="normal">3160</span>
<span class="normal">3161</span>
<span class="normal">3162</span>
<span class="normal">3163</span>
<span class="normal">3164</span>
<span class="normal">3165</span>
<span class="normal">3166</span>
<span class="normal">3167</span>
<span class="normal">3168</span>
<span class="normal">3169</span>
<span class="normal">3170</span>
<span class="normal">3171</span>
<span class="normal">3172</span>
<span class="normal">3173</span>
<span class="normal">3174</span>
<span class="normal">3175</span>
<span class="normal">3176</span>
<span class="normal">3177</span>
<span class="normal">3178</span>
<span class="normal">3179</span>
<span class="normal">3180</span>
<span class="normal">3181</span>
<span class="normal">3182</span>
<span class="normal">3183</span>
<span class="normal">3184</span>
<span class="normal">3185</span>
<span class="normal">3186</span>
<span class="normal">3187</span>
<span class="normal">3188</span>
<span class="normal">3189</span>
<span class="normal">3190</span>
<span class="normal">3191</span>
<span class="normal">3192</span>
<span class="normal">3193</span>
<span class="normal">3194</span>
<span class="normal">3195</span>
<span class="normal">3196</span>
<span class="normal">3197</span>
<span class="normal">3198</span>
<span class="normal">3199</span>
<span class="normal">3200</span>
<span class="normal">3201</span>
<span class="normal">3202</span>
<span class="normal">3203</span>
<span class="normal">3204</span>
<span class="normal">3205</span>
<span class="normal">3206</span>
<span class="normal">3207</span>
<span class="normal">3208</span>
<span class="normal">3209</span>
<span class="normal">3210</span>
<span class="normal">3211</span>
<span class="normal">3212</span>
<span class="normal">3213</span>
<span class="normal">3214</span>
<span class="normal">3215</span>
<span class="normal">3216</span>
<span class="normal">3217</span>
<span class="normal">3218</span>
<span class="normal">3219</span>
<span class="normal">3220</span>
<span class="normal">3221</span>
<span class="normal">3222</span>
<span class="normal">3223</span>
<span class="normal">3224</span>
<span class="normal">3225</span>
<span class="normal">3226</span>
<span class="normal">3227</span>
<span class="normal">3228</span>
<span class="normal">3229</span>
<span class="normal">3230</span>
<span class="normal">3231</span>
<span class="normal">3232</span>
<span class="normal">3233</span>
<span class="normal">3234</span>
<span class="normal">3235</span>
<span class="normal">3236</span>
<span class="normal">3237</span>
<span class="normal">3238</span>
<span class="normal">3239</span>
<span class="normal">3240</span>
<span class="normal">3241</span>
<span class="normal">3242</span>
<span class="normal">3243</span>
<span class="normal">3244</span>
<span class="normal">3245</span>
<span class="normal">3246</span>
<span class="normal">3247</span>
<span class="normal">3248</span>
<span class="normal">3249</span>
<span class="normal">3250</span>
<span class="normal">3251</span>
<span class="normal">3252</span>
<span class="normal">3253</span>
<span class="normal">3254</span>
<span class="normal">3255</span>
<span class="normal">3256</span>
<span class="normal">3257</span>
<span class="normal">3258</span>
<span class="normal">3259</span>
<span class="normal">3260</span>
<span class="normal">3261</span>
<span class="normal">3262</span>
<span class="normal">3263</span>
<span class="normal">3264</span>
<span class="normal">3265</span>
<span class="normal">3266</span>
<span class="normal">3267</span>
<span class="normal">3268</span>
<span class="normal">3269</span>
<span class="normal">3270</span>
<span class="normal">3271</span>
<span class="normal">3272</span>
<span class="normal">3273</span>
<span class="normal">3274</span>
<span class="normal">3275</span>
<span class="normal">3276</span>
<span class="normal">3277</span>
<span class="normal">3278</span>
<span class="normal">3279</span>
<span class="normal">3280</span>
<span class="normal">3281</span>
<span class="normal">3282</span>
<span class="normal">3283</span>
<span class="normal">3284</span>
<span class="normal">3285</span>
<span class="normal">3286</span>
<span class="normal">3287</span>
<span class="normal">3288</span>
<span class="normal">3289</span>
<span class="normal">3290</span>
<span class="normal">3291</span>
<span class="normal">3292</span>
<span class="normal">3293</span>
<span class="normal">3294</span>
<span class="normal">3295</span>
<span class="normal">3296</span>
<span class="normal">3297</span>
<span class="normal">3298</span>
<span class="normal">3299</span>
<span class="normal">3300</span>
<span class="normal">3301</span>
<span class="normal">3302</span>
<span class="normal">3303</span>
<span class="normal">3304</span>
<span class="normal">3305</span>
<span class="normal">3306</span>
<span class="normal">3307</span>
<span class="normal">3308</span>
<span class="normal">3309</span>
<span class="normal">3310</span>
<span class="normal">3311</span>
<span class="normal">3312</span>
<span class="normal">3313</span>
<span class="normal">3314</span>
<span class="normal">3315</span>
<span class="normal">3316</span>
<span class="normal">3317</span>
<span class="normal">3318</span>
<span class="normal">3319</span>
<span class="normal">3320</span>
<span class="normal">3321</span>
<span class="normal">3322</span>
<span class="normal">3323</span>
<span class="normal">3324</span>
<span class="normal">3325</span>
<span class="normal">3326</span>
<span class="normal">3327</span>
<span class="normal">3328</span>
<span class="normal">3329</span>
<span class="normal">3330</span>
<span class="normal">3331</span>
<span class="normal">3332</span>
<span class="normal">3333</span>
<span class="normal">3334</span>
<span class="normal">3335</span>
<span class="normal">3336</span>
<span class="normal">3337</span>
<span class="normal">3338</span>
<span class="normal">3339</span>
<span class="normal">3340</span>
<span class="normal">3341</span>
<span class="normal">3342</span>
<span class="normal">3343</span>
<span class="normal">3344</span>
<span class="normal">3345</span>
<span class="normal">3346</span>
<span class="normal">3347</span>
<span class="normal">3348</span>
<span class="normal">3349</span>
<span class="normal">3350</span>
<span class="normal">3351</span>
<span class="normal">3352</span>
<span class="normal">3353</span>
<span class="normal">3354</span>
<span class="normal">3355</span>
<span class="normal">3356</span>
<span class="normal">3357</span>
<span class="normal">3358</span>
<span class="normal">3359</span>
<span class="normal">3360</span>
<span class="normal">3361</span>
<span class="normal">3362</span>
<span class="normal">3363</span>
<span class="normal">3364</span>
<span class="normal">3365</span>
<span class="normal">3366</span>
<span class="normal">3367</span>
<span class="normal">3368</span>
<span class="normal">3369</span>
<span class="normal">3370</span>
<span class="normal">3371</span>
<span class="normal">3372</span>
<span class="normal">3373</span>
<span class="normal">3374</span>
<span class="normal">3375</span>
<span class="normal">3376</span>
<span class="normal">3377</span>
<span class="normal">3378</span>
<span class="normal">3379</span>
<span class="normal">3380</span>
<span class="normal">3381</span>
<span class="normal">3382</span>
<span class="normal">3383</span>
<span class="normal">3384</span>
<span class="normal">3385</span>
<span class="normal">3386</span>
<span class="normal">3387</span>
<span class="normal">3388</span>
<span class="normal">3389</span>
<span class="normal">3390</span>
<span class="normal">3391</span>
<span class="normal">3392</span>
<span class="normal">3393</span>
<span class="normal">3394</span>
<span class="normal">3395</span>
<span class="normal">3396</span>
<span class="normal">3397</span>
<span class="normal">3398</span>
<span class="normal">3399</span>
<span class="normal">3400</span>
<span class="normal">3401</span>
<span class="normal">3402</span>
<span class="normal">3403</span>
<span class="normal">3404</span>
<span class="normal">3405</span>
<span class="normal">3406</span>
<span class="normal">3407</span>
<span class="normal">3408</span>
<span class="normal">3409</span>
<span class="normal">3410</span>
<span class="normal">3411</span>
<span class="normal">3412</span>
<span class="normal">3413</span>
<span class="normal">3414</span>
<span class="normal">3415</span>
<span class="normal">3416</span>
<span class="normal">3417</span>
<span class="normal">3418</span>
<span class="normal">3419</span>
<span class="normal">3420</span>
<span class="normal">3421</span>
<span class="normal">3422</span>
<span class="normal">3423</span>
<span class="normal">3424</span>
<span class="normal">3425</span>
<span class="normal">3426</span>
<span class="normal">3427</span>
<span class="normal">3428</span>
<span class="normal">3429</span>
<span class="normal">3430</span>
<span class="normal">3431</span>
<span class="normal">3432</span>
<span class="normal">3433</span>
<span class="normal">3434</span>
<span class="normal">3435</span>
<span class="normal">3436</span>
<span class="normal">3437</span>
<span class="normal">3438</span>
<span class="normal">3439</span>
<span class="normal">3440</span>
<span class="normal">3441</span>
<span class="normal">3442</span>
<span class="normal">3443</span>
<span class="normal">3444</span>
<span class="normal">3445</span>
<span class="normal">3446</span>
<span class="normal">3447</span>
<span class="normal">3448</span>
<span class="normal">3449</span>
<span class="normal">3450</span>
<span class="normal">3451</span>
<span class="normal">3452</span>
<span class="normal">3453</span>
<span class="normal">3454</span>
<span class="normal">3455</span>
<span class="normal">3456</span>
<span class="normal">3457</span>
<span class="normal">3458</span>
<span class="normal">3459</span>
<span class="normal">3460</span>
<span class="normal">3461</span>
<span class="normal">3462</span>
<span class="normal">3463</span>
<span class="normal">3464</span>
<span class="normal">3465</span>
<span class="normal">3466</span>
<span class="normal">3467</span>
<span class="normal">3468</span>
<span class="normal">3469</span>
<span class="normal">3470</span>
<span class="normal">3471</span>
<span class="normal">3472</span>
<span class="normal">3473</span>
<span class="normal">3474</span>
<span class="normal">3475</span>
<span class="normal">3476</span>
<span class="normal">3477</span>
<span class="normal">3478</span>
<span class="normal">3479</span>
<span class="normal">3480</span>
<span class="normal">3481</span>
<span class="normal">3482</span>
<span class="normal">3483</span>
<span class="normal">3484</span>
<span class="normal">3485</span>
<span class="normal">3486</span>
<span class="normal">3487</span>
<span class="normal">3488</span>
<span class="normal">3489</span>
<span class="normal">3490</span>
<span class="normal">3491</span>
<span class="normal">3492</span>
<span class="normal">3493</span>
<span class="normal">3494</span>
<span class="normal">3495</span>
<span class="normal">3496</span>
<span class="normal">3497</span>
<span class="normal">3498</span>
<span class="normal">3499</span>
<span class="normal">3500</span>
<span class="normal">3501</span>
<span class="normal">3502</span>
<span class="normal">3503</span>
<span class="normal">3504</span>
<span class="normal">3505</span>
<span class="normal">3506</span>
<span class="normal">3507</span>
<span class="normal">3508</span>
<span class="normal">3509</span>
<span class="normal">3510</span>
<span class="normal">3511</span>
<span class="normal">3512</span>
<span class="normal">3513</span>
<span class="normal">3514</span>
<span class="normal">3515</span>
<span class="normal">3516</span>
<span class="normal">3517</span>
<span class="normal">3518</span>
<span class="normal">3519</span>
<span class="normal">3520</span>
<span class="normal">3521</span>
<span class="normal">3522</span>
<span class="normal">3523</span>
<span class="normal">3524</span>
<span class="normal">3525</span>
<span class="normal">3526</span>
<span class="normal">3527</span>
<span class="normal">3528</span>
<span class="normal">3529</span>
<span class="normal">3530</span>
<span class="normal">3531</span>
<span class="normal">3532</span>
<span class="normal">3533</span>
<span class="normal">3534</span>
<span class="normal">3535</span>
<span class="normal">3536</span>
<span class="normal">3537</span>
<span class="normal">3538</span>
<span class="normal">3539</span>
<span class="normal">3540</span>
<span class="normal">3541</span>
<span class="normal">3542</span>
<span class="normal">3543</span>
<span class="normal">3544</span>
<span class="normal">3545</span>
<span class="normal">3546</span>
<span class="normal">3547</span>
<span class="normal">3548</span>
<span class="normal">3549</span>
<span class="normal">3550</span>
<span class="normal">3551</span>
<span class="normal">3552</span>
<span class="normal">3553</span>
<span class="normal">3554</span>
<span class="normal">3555</span>
<span class="normal">3556</span>
<span class="normal">3557</span>
<span class="normal">3558</span>
<span class="normal">3559</span>
<span class="normal">3560</span>
<span class="normal">3561</span>
<span class="normal">3562</span>
<span class="normal">3563</span>
<span class="normal">3564</span>
<span class="normal">3565</span>
<span class="normal">3566</span>
<span class="normal">3567</span>
<span class="normal">3568</span>
<span class="normal">3569</span>
<span class="normal">3570</span>
<span class="normal">3571</span>
<span class="normal">3572</span>
<span class="normal">3573</span>
<span class="normal">3574</span>
<span class="normal">3575</span>
<span class="normal">3576</span>
<span class="normal">3577</span>
<span class="normal">3578</span>
<span class="normal">3579</span>
<span class="normal">3580</span>
<span class="normal">3581</span>
<span class="normal">3582</span>
<span class="normal">3583</span>
<span class="normal">3584</span>
<span class="normal">3585</span>
<span class="normal">3586</span>
<span class="normal">3587</span>
<span class="normal">3588</span>
<span class="normal">3589</span>
<span class="normal">3590</span>
<span class="normal">3591</span>
<span class="normal">3592</span>
<span class="normal">3593</span>
<span class="normal">3594</span>
<span class="normal">3595</span>
<span class="normal">3596</span>
<span class="normal">3597</span>
<span class="normal">3598</span>
<span class="normal">3599</span>
<span class="normal">3600</span>
<span class="normal">3601</span>
<span class="normal">3602</span>
<span class="normal">3603</span>
<span class="normal">3604</span>
<span class="normal">3605</span>
<span class="normal">3606</span>
<span class="normal">3607</span>
<span class="normal">3608</span>
<span class="normal">3609</span>
<span class="normal">3610</span>
<span class="normal">3611</span>
<span class="normal">3612</span>
<span class="normal">3613</span>
<span class="normal">3614</span>
<span class="normal">3615</span>
<span class="normal">3616</span>
<span class="normal">3617</span>
<span class="normal">3618</span>
<span class="normal">3619</span>
<span class="normal">3620</span>
<span class="normal">3621</span>
<span class="normal">3622</span>
<span class="normal">3623</span>
<span class="normal">3624</span>
<span class="normal">3625</span>
<span class="normal">3626</span>
<span class="normal">3627</span>
<span class="normal">3628</span>
<span class="normal">3629</span>
<span class="normal">3630</span>
<span class="normal">3631</span>
<span class="normal">3632</span>
<span class="normal">3633</span>
<span class="normal">3634</span>
<span class="normal">3635</span>
<span class="normal">3636</span>
<span class="normal">3637</span>
<span class="normal">3638</span>
<span class="normal">3639</span>
<span class="normal">3640</span>
<span class="normal">3641</span>
<span class="normal">3642</span>
<span class="normal">3643</span>
<span class="normal">3644</span>
<span class="normal">3645</span>
<span class="normal">3646</span>
<span class="normal">3647</span>
<span class="normal">3648</span>
<span class="normal">3649</span>
<span class="normal">3650</span>
<span class="normal">3651</span>
<span class="normal">3652</span>
<span class="normal">3653</span>
<span class="normal">3654</span>
<span class="normal">3655</span>
<span class="normal">3656</span>
<span class="normal">3657</span>
<span class="normal">3658</span>
<span class="normal">3659</span>
<span class="normal">3660</span>
<span class="normal">3661</span>
<span class="normal">3662</span>
<span class="normal">3663</span>
<span class="normal">3664</span>
<span class="normal">3665</span>
<span class="normal">3666</span>
<span class="normal">3667</span>
<span class="normal">3668</span>
<span class="normal">3669</span>
<span class="normal">3670</span>
<span class="normal">3671</span>
<span class="normal">3672</span>
<span class="normal">3673</span>
<span class="normal">3674</span>
<span class="normal">3675</span>
<span class="normal">3676</span>
<span class="normal">3677</span>
<span class="normal">3678</span>
<span class="normal">3679</span>
<span class="normal">3680</span>
<span class="normal">3681</span>
<span class="normal">3682</span>
<span class="normal">3683</span>
<span class="normal">3684</span>
<span class="normal">3685</span>
<span class="normal">3686</span>
<span class="normal">3687</span>
<span class="normal">3688</span>
<span class="normal">3689</span>
<span class="normal">3690</span>
<span class="normal">3691</span>
<span class="normal">3692</span>
<span class="normal">3693</span>
<span class="normal">3694</span>
<span class="normal">3695</span>
<span class="normal">3696</span>
<span class="normal">3697</span>
<span class="normal">3698</span>
<span class="normal">3699</span>
<span class="normal">3700</span>
<span class="normal">3701</span>
<span class="normal">3702</span>
<span class="normal">3703</span>
<span class="normal">3704</span>
<span class="normal">3705</span>
<span class="normal">3706</span>
<span class="normal">3707</span>
<span class="normal">3708</span>
<span class="normal">3709</span>
<span class="normal">3710</span>
<span class="normal">3711</span>
<span class="normal">3712</span>
<span class="normal">3713</span>
<span class="normal">3714</span>
<span class="normal">3715</span>
<span class="normal">3716</span>
<span class="normal">3717</span>
<span class="normal">3718</span>
<span class="normal">3719</span>
<span class="normal">3720</span>
<span class="normal">3721</span>
<span class="normal">3722</span>
<span class="normal">3723</span>
<span class="normal">3724</span>
<span class="normal">3725</span>
<span class="normal">3726</span>
<span class="normal">3727</span>
<span class="normal">3728</span>
<span class="normal">3729</span>
<span class="normal">3730</span>
<span class="normal">3731</span>
<span class="normal">3732</span>
<span class="normal">3733</span>
<span class="normal">3734</span>
<span class="normal">3735</span>
<span class="normal">3736</span>
<span class="normal">3737</span>
<span class="normal">3738</span>
<span class="normal">3739</span>
<span class="normal">3740</span>
<span class="normal">3741</span>
<span class="normal">3742</span>
<span class="normal">3743</span>
<span class="normal">3744</span>
<span class="normal">3745</span>
<span class="normal">3746</span>
<span class="normal">3747</span>
<span class="normal">3748</span>
<span class="normal">3749</span>
<span class="normal">3750</span>
<span class="normal">3751</span>
<span class="normal">3752</span>
<span class="normal">3753</span>
<span class="normal">3754</span>
<span class="normal">3755</span>
<span class="normal">3756</span>
<span class="normal">3757</span>
<span class="normal">3758</span>
<span class="normal">3759</span>
<span class="normal">3760</span>
<span class="normal">3761</span>
<span class="normal">3762</span>
<span class="normal">3763</span>
<span class="normal">3764</span>
<span class="normal">3765</span>
<span class="normal">3766</span>
<span class="normal">3767</span>
<span class="normal">3768</span>
<span class="normal">3769</span>
<span class="normal">3770</span>
<span class="normal">3771</span>
<span class="normal">3772</span>
<span class="normal">3773</span>
<span class="normal">3774</span>
<span class="normal">3775</span>
<span class="normal">3776</span>
<span class="normal">3777</span>
<span class="normal">3778</span>
<span class="normal">3779</span>
<span class="normal">3780</span>
<span class="normal">3781</span>
<span class="normal">3782</span>
<span class="normal">3783</span>
<span class="normal">3784</span>
<span class="normal">3785</span>
<span class="normal">3786</span>
<span class="normal">3787</span>
<span class="normal">3788</span>
<span class="normal">3789</span>
<span class="normal">3790</span>
<span class="normal">3791</span>
<span class="normal">3792</span>
<span class="normal">3793</span>
<span class="normal">3794</span>
<span class="normal">3795</span>
<span class="normal">3796</span>
<span class="normal">3797</span>
<span class="normal">3798</span>
<span class="normal">3799</span>
<span class="normal">3800</span>
<span class="normal">3801</span>
<span class="normal">3802</span>
<span class="normal">3803</span>
<span class="normal">3804</span>
<span class="normal">3805</span>
<span class="normal">3806</span>
<span class="normal">3807</span>
<span class="normal">3808</span>
<span class="normal">3809</span>
<span class="normal">3810</span>
<span class="normal">3811</span>
<span class="normal">3812</span>
<span class="normal">3813</span>
<span class="normal">3814</span>
<span class="normal">3815</span>
<span class="normal">3816</span>
<span class="normal">3817</span>
<span class="normal">3818</span>
<span class="normal">3819</span>
<span class="normal">3820</span>
<span class="normal">3821</span>
<span class="normal">3822</span>
<span class="normal">3823</span>
<span class="normal">3824</span>
<span class="normal">3825</span>
<span class="normal">3826</span>
<span class="normal">3827</span>
<span class="normal">3828</span>
<span class="normal">3829</span>
<span class="normal">3830</span>
<span class="normal">3831</span>
<span class="normal">3832</span>
<span class="normal">3833</span>
<span class="normal">3834</span>
<span class="normal">3835</span>
<span class="normal">3836</span>
<span class="normal">3837</span>
<span class="normal">3838</span>
<span class="normal">3839</span>
<span class="normal">3840</span>
<span class="normal">3841</span>
<span class="normal">3842</span>
<span class="normal">3843</span>
<span class="normal">3844</span>
<span class="normal">3845</span>
<span class="normal">3846</span>
<span class="normal">3847</span>
<span class="normal">3848</span>
<span class="normal">3849</span>
<span class="normal">3850</span>
<span class="normal">3851</span>
<span class="normal">3852</span>
<span class="normal">3853</span>
<span class="normal">3854</span>
<span class="normal">3855</span>
<span class="normal">3856</span>
<span class="normal">3857</span>
<span class="normal">3858</span>
<span class="normal">3859</span>
<span class="normal">3860</span>
<span class="normal">3861</span>
<span class="normal">3862</span>
<span class="normal">3863</span>
<span class="normal">3864</span>
<span class="normal">3865</span>
<span class="normal">3866</span>
<span class="normal">3867</span>
<span class="normal">3868</span>
<span class="normal">3869</span>
<span class="normal">3870</span>
<span class="normal">3871</span>
<span class="normal">3872</span>
<span class="normal">3873</span>
<span class="normal">3874</span>
<span class="normal">3875</span>
<span class="normal">3876</span>
<span class="normal">3877</span>
<span class="normal">3878</span>
<span class="normal">3879</span>
<span class="normal">3880</span>
<span class="normal">3881</span>
<span class="normal">3882</span>
<span class="normal">3883</span>
<span class="normal">3884</span>
<span class="normal">3885</span>
<span class="normal">3886</span>
<span class="normal">3887</span>
<span class="normal">3888</span>
<span class="normal">3889</span>
<span class="normal">3890</span>
<span class="normal">3891</span>
<span class="normal">3892</span>
<span class="normal">3893</span>
<span class="normal">3894</span>
<span class="normal">3895</span>
<span class="normal">3896</span>
<span class="normal">3897</span>
<span class="normal">3898</span>
<span class="normal">3899</span>
<span class="normal">3900</span>
<span class="normal">3901</span>
<span class="normal">3902</span>
<span class="normal">3903</span>
<span class="normal">3904</span>
<span class="normal">3905</span>
<span class="normal">3906</span>
<span class="normal">3907</span>
<span class="normal">3908</span>
<span class="normal">3909</span>
<span class="normal">3910</span>
<span class="normal">3911</span>
<span class="normal">3912</span>
<span class="normal">3913</span>
<span class="normal">3914</span>
<span class="normal">3915</span>
<span class="normal">3916</span>
<span class="normal">3917</span>
<span class="normal">3918</span>
<span class="normal">3919</span>
<span class="normal">3920</span>
<span class="normal">3921</span>
<span class="normal">3922</span>
<span class="normal">3923</span>
<span class="normal">3924</span>
<span class="normal">3925</span>
<span class="normal">3926</span>
<span class="normal">3927</span>
<span class="normal">3928</span>
<span class="normal">3929</span>
<span class="normal">3930</span>
<span class="normal">3931</span>
<span class="normal">3932</span>
<span class="normal">3933</span>
<span class="normal">3934</span>
<span class="normal">3935</span>
<span class="normal">3936</span>
<span class="normal">3937</span>
<span class="normal">3938</span>
<span class="normal">3939</span>
<span class="normal">3940</span>
<span class="normal">3941</span>
<span class="normal">3942</span>
<span class="normal">3943</span>
<span class="normal">3944</span>
<span class="normal">3945</span>
<span class="normal">3946</span>
<span class="normal">3947</span>
<span class="normal">3948</span>
<span class="normal">3949</span>
<span class="normal">3950</span>
<span class="normal">3951</span>
<span class="normal">3952</span>
<span class="normal">3953</span>
<span class="normal">3954</span>
<span class="normal">3955</span>
<span class="normal">3956</span>
<span class="normal">3957</span>
<span class="normal">3958</span>
<span class="normal">3959</span>
<span class="normal">3960</span>
<span class="normal">3961</span>
<span class="normal">3962</span>
<span class="normal">3963</span>
<span class="normal">3964</span>
<span class="normal">3965</span>
<span class="normal">3966</span>
<span class="normal">3967</span>
<span class="normal">3968</span>
<span class="normal">3969</span>
<span class="normal">3970</span>
<span class="normal">3971</span>
<span class="normal">3972</span>
<span class="normal">3973</span>
<span class="normal">3974</span>
<span class="normal">3975</span>
<span class="normal">3976</span>
<span class="normal">3977</span>
<span class="normal">3978</span>
<span class="normal">3979</span>
<span class="normal">3980</span>
<span class="normal">3981</span>
<span class="normal">3982</span>
<span class="normal">3983</span>
<span class="normal">3984</span>
<span class="normal">3985</span>
<span class="normal">3986</span>
<span class="normal">3987</span>
<span class="normal">3988</span>
<span class="normal">3989</span>
<span class="normal">3990</span>
<span class="normal">3991</span>
<span class="normal">3992</span>
<span class="normal">3993</span>
<span class="normal">3994</span>
<span class="normal">3995</span>
<span class="normal">3996</span>
<span class="normal">3997</span>
<span class="normal">3998</span>
<span class="normal">3999</span>
<span class="normal">4000</span>
<span class="normal">4001</span>
<span class="normal">4002</span>
<span class="normal">4003</span>
<span class="normal">4004</span>
<span class="normal">4005</span>
<span class="normal">4006</span>
<span class="normal">4007</span>
<span class="normal">4008</span>
<span class="normal">4009</span>
<span class="normal">4010</span>
<span class="normal">4011</span>
<span class="normal">4012</span>
<span class="normal">4013</span>
<span class="normal">4014</span>
<span class="normal">4015</span>
<span class="normal">4016</span>
<span class="normal">4017</span>
<span class="normal">4018</span>
<span class="normal">4019</span>
<span class="normal">4020</span>
<span class="normal">4021</span>
<span class="normal">4022</span>
<span class="normal">4023</span>
<span class="normal">4024</span>
<span class="normal">4025</span>
<span class="normal">4026</span>
<span class="normal">4027</span>
<span class="normal">4028</span>
<span class="normal">4029</span>
<span class="normal">4030</span>
<span class="normal">4031</span>
<span class="normal">4032</span>
<span class="normal">4033</span>
<span class="normal">4034</span>
<span class="normal">4035</span>
<span class="normal">4036</span>
<span class="normal">4037</span>
<span class="normal">4038</span>
<span class="normal">4039</span>
<span class="normal">4040</span>
<span class="normal">4041</span>
<span class="normal">4042</span>
<span class="normal">4043</span>
<span class="normal">4044</span>
<span class="normal">4045</span>
<span class="normal">4046</span>
<span class="normal">4047</span>
<span class="normal">4048</span>
<span class="normal">4049</span>
<span class="normal">4050</span>
<span class="normal">4051</span>
<span class="normal">4052</span>
<span class="normal">4053</span>
<span class="normal">4054</span>
<span class="normal">4055</span>
<span class="normal">4056</span>
<span class="normal">4057</span>
<span class="normal">4058</span>
<span class="normal">4059</span>
<span class="normal">4060</span>
<span class="normal">4061</span>
<span class="normal">4062</span>
<span class="normal">4063</span>
<span class="normal">4064</span>
<span class="normal">4065</span>
<span class="normal">4066</span>
<span class="normal">4067</span>
<span class="normal">4068</span>
<span class="normal">4069</span>
<span class="normal">4070</span>
<span class="normal">4071</span>
<span class="normal">4072</span>
<span class="normal">4073</span>
<span class="normal">4074</span>
<span class="normal">4075</span>
<span class="normal">4076</span>
<span class="normal">4077</span>
<span class="normal">4078</span>
<span class="normal">4079</span>
<span class="normal">4080</span>
<span class="normal">4081</span>
<span class="normal">4082</span>
<span class="normal">4083</span>
<span class="normal">4084</span>
<span class="normal">4085</span>
<span class="normal">4086</span>
<span class="normal">4087</span>
<span class="normal">4088</span>
<span class="normal">4089</span>
<span class="normal">4090</span>
<span class="normal">4091</span>
<span class="normal">4092</span>
<span class="normal">4093</span>
<span class="normal">4094</span>
<span class="normal">4095</span>
<span class="normal">4096</span>
<span class="normal">4097</span>
<span class="normal">4098</span>
<span class="normal">4099</span>
<span class="normal">4100</span>
<span class="normal">4101</span>
<span class="normal">4102</span>
<span class="normal">4103</span>
<span class="normal">4104</span>
<span class="normal">4105</span>
<span class="normal">4106</span>
<span class="normal">4107</span>
<span class="normal">4108</span>
<span class="normal">4109</span>
<span class="normal">4110</span>
<span class="normal">4111</span>
<span class="normal">4112</span>
<span class="normal">4113</span>
<span class="normal">4114</span>
<span class="normal">4115</span>
<span class="normal">4116</span>
<span class="normal">4117</span>
<span class="normal">4118</span>
<span class="normal">4119</span>
<span class="normal">4120</span>
<span class="normal">4121</span>
<span class="normal">4122</span>
<span class="normal">4123</span>
<span class="normal">4124</span>
<span class="normal">4125</span>
<span class="normal">4126</span>
<span class="normal">4127</span>
<span class="normal">4128</span>
<span class="normal">4129</span>
<span class="normal">4130</span>
<span class="normal">4131</span>
<span class="normal">4132</span>
<span class="normal">4133</span>
<span class="normal">4134</span>
<span class="normal">4135</span>
<span class="normal">4136</span>
<span class="normal">4137</span>
<span class="normal">4138</span>
<span class="normal">4139</span>
<span class="normal">4140</span>
<span class="normal">4141</span>
<span class="normal">4142</span>
<span class="normal">4143</span>
<span class="normal">4144</span>
<span class="normal">4145</span>
<span class="normal">4146</span>
<span class="normal">4147</span>
<span class="normal">4148</span>
<span class="normal">4149</span>
<span class="normal">4150</span>
<span class="normal">4151</span>
<span class="normal">4152</span>
<span class="normal">4153</span>
<span class="normal">4154</span>
<span class="normal">4155</span>
<span class="normal">4156</span>
<span class="normal">4157</span>
<span class="normal">4158</span>
<span class="normal">4159</span>
<span class="normal">4160</span>
<span class="normal">4161</span>
<span class="normal">4162</span>
<span class="normal">4163</span>
<span class="normal">4164</span>
<span class="normal">4165</span>
<span class="normal">4166</span>
<span class="normal">4167</span>
<span class="normal">4168</span>
<span class="normal">4169</span>
<span class="normal">4170</span>
<span class="normal">4171</span>
<span class="normal">4172</span>
<span class="normal">4173</span>
<span class="normal">4174</span>
<span class="normal">4175</span>
<span class="normal">4176</span>
<span class="normal">4177</span>
<span class="normal">4178</span>
<span class="normal">4179</span>
<span class="normal">4180</span>
<span class="normal">4181</span>
<span class="normal">4182</span>
<span class="normal">4183</span>
<span class="normal">4184</span>
<span class="normal">4185</span>
<span class="normal">4186</span>
<span class="normal">4187</span>
<span class="normal">4188</span>
<span class="normal">4189</span>
<span class="normal">4190</span>
<span class="normal">4191</span>
<span class="normal">4192</span>
<span class="normal">4193</span>
<span class="normal">4194</span>
<span class="normal">4195</span>
<span class="normal">4196</span>
<span class="normal">4197</span>
<span class="normal">4198</span>
<span class="normal">4199</span>
<span class="normal">4200</span>
<span class="normal">4201</span>
<span class="normal">4202</span>
<span class="normal">4203</span>
<span class="normal">4204</span>
<span class="normal">4205</span>
<span class="normal">4206</span>
<span class="normal">4207</span>
<span class="normal">4208</span>
<span class="normal">4209</span>
<span class="normal">4210</span>
<span class="normal">4211</span>
<span class="normal">4212</span>
<span class="normal">4213</span>
<span class="normal">4214</span>
<span class="normal">4215</span>
<span class="normal">4216</span>
<span class="normal">4217</span>
<span class="normal">4218</span>
<span class="normal">4219</span>
<span class="normal">4220</span>
<span class="normal">4221</span>
<span class="normal">4222</span>
<span class="normal">4223</span>
<span class="normal">4224</span>
<span class="normal">4225</span>
<span class="normal">4226</span>
<span class="normal">4227</span>
<span class="normal">4228</span>
<span class="normal">4229</span>
<span class="normal">4230</span>
<span class="normal">4231</span>
<span class="normal">4232</span>
<span class="normal">4233</span>
<span class="normal">4234</span>
<span class="normal">4235</span>
<span class="normal">4236</span>
<span class="normal">4237</span>
<span class="normal">4238</span>
<span class="normal">4239</span>
<span class="normal">4240</span>
<span class="normal">4241</span>
<span class="normal">4242</span>
<span class="normal">4243</span>
<span class="normal">4244</span>
<span class="normal">4245</span>
<span class="normal">4246</span>
<span class="normal">4247</span>
<span class="normal">4248</span>
<span class="normal">4249</span>
<span class="normal">4250</span>
<span class="normal">4251</span>
<span class="normal">4252</span>
<span class="normal">4253</span>
<span class="normal">4254</span>
<span class="normal">4255</span>
<span class="normal">4256</span>
<span class="normal">4257</span>
<span class="normal">4258</span>
<span class="normal">4259</span>
<span class="normal">4260</span>
<span class="normal">4261</span>
<span class="normal">4262</span>
<span class="normal">4263</span>
<span class="normal">4264</span>
<span class="normal">4265</span>
<span class="normal">4266</span>
<span class="normal">4267</span>
<span class="normal">4268</span>
<span class="normal">4269</span>
<span class="normal">4270</span>
<span class="normal">4271</span>
<span class="normal">4272</span>
<span class="normal">4273</span>
<span class="normal">4274</span>
<span class="normal">4275</span>
<span class="normal">4276</span>
<span class="normal">4277</span>
<span class="normal">4278</span>
<span class="normal">4279</span>
<span class="normal">4280</span>
<span class="normal">4281</span>
<span class="normal">4282</span>
<span class="normal">4283</span>
<span class="normal">4284</span>
<span class="normal">4285</span>
<span class="normal">4286</span>
<span class="normal">4287</span>
<span class="normal">4288</span>
<span class="normal">4289</span>
<span class="normal">4290</span>
<span class="normal">4291</span>
<span class="normal">4292</span>
<span class="normal">4293</span>
<span class="normal">4294</span>
<span class="normal">4295</span>
<span class="normal">4296</span>
<span class="normal">4297</span>
<span class="normal">4298</span>
<span class="normal">4299</span>
<span class="normal">4300</span>
<span class="normal">4301</span>
<span class="normal">4302</span>
<span class="normal">4303</span>
<span class="normal">4304</span>
<span class="normal">4305</span>
<span class="normal">4306</span>
<span class="normal">4307</span>
<span class="normal">4308</span>
<span class="normal">4309</span>
<span class="normal">4310</span>
<span class="normal">4311</span>
<span class="normal">4312</span>
<span class="normal">4313</span>
<span class="normal">4314</span>
<span class="normal">4315</span>
<span class="normal">4316</span>
<span class="normal">4317</span>
<span class="normal">4318</span>
<span class="normal">4319</span>
<span class="normal">4320</span>
<span class="normal">4321</span>
<span class="normal">4322</span>
<span class="normal">4323</span>
<span class="normal">4324</span>
<span class="normal">4325</span>
<span class="normal">4326</span>
<span class="normal">4327</span>
<span class="normal">4328</span>
<span class="normal">4329</span>
<span class="normal">4330</span>
<span class="normal">4331</span>
<span class="normal">4332</span>
<span class="normal">4333</span>
<span class="normal">4334</span>
<span class="normal">4335</span>
<span class="normal">4336</span>
<span class="normal">4337</span>
<span class="normal">4338</span>
<span class="normal">4339</span>
<span class="normal">4340</span>
<span class="normal">4341</span>
<span class="normal">4342</span>
<span class="normal">4343</span>
<span class="normal">4344</span>
<span class="normal">4345</span>
<span class="normal">4346</span>
<span class="normal">4347</span>
<span class="normal">4348</span>
<span class="normal">4349</span>
<span class="normal">4350</span>
<span class="normal">4351</span>
<span class="normal">4352</span>
<span class="normal">4353</span>
<span class="normal">4354</span>
<span class="normal">4355</span>
<span class="normal">4356</span>
<span class="normal">4357</span>
<span class="normal">4358</span>
<span class="normal">4359</span>
<span class="normal">4360</span>
<span class="normal">4361</span>
<span class="normal">4362</span>
<span class="normal">4363</span>
<span class="normal">4364</span>
<span class="normal">4365</span>
<span class="normal">4366</span>
<span class="normal">4367</span>
<span class="normal">4368</span>
<span class="normal">4369</span>
<span class="normal">4370</span>
<span class="normal">4371</span>
<span class="normal">4372</span>
<span class="normal">4373</span>
<span class="normal">4374</span>
<span class="normal">4375</span>
<span class="normal">4376</span>
<span class="normal">4377</span>
<span class="normal">4378</span>
<span class="normal">4379</span>
<span class="normal">4380</span>
<span class="normal">4381</span>
<span class="normal">4382</span>
<span class="normal">4383</span>
<span class="normal">4384</span>
<span class="normal">4385</span>
<span class="normal">4386</span>
<span class="normal">4387</span>
<span class="normal">4388</span>
<span class="normal">4389</span>
<span class="normal">4390</span>
<span class="normal">4391</span>
<span class="normal">4392</span>
<span class="normal">4393</span>
<span class="normal">4394</span>
<span class="normal">4395</span>
<span class="normal">4396</span>
<span class="normal">4397</span>
<span class="normal">4398</span>
<span class="normal">4399</span>
<span class="normal">4400</span>
<span class="normal">4401</span>
<span class="normal">4402</span>
<span class="normal">4403</span>
<span class="normal">4404</span>
<span class="normal">4405</span>
<span class="normal">4406</span>
<span class="normal">4407</span>
<span class="normal">4408</span>
<span class="normal">4409</span>
<span class="normal">4410</span>
<span class="normal">4411</span>
<span class="normal">4412</span>
<span class="normal">4413</span>
<span class="normal">4414</span>
<span class="normal">4415</span>
<span class="normal">4416</span>
<span class="normal">4417</span>
<span class="normal">4418</span>
<span class="normal">4419</span>
<span class="normal">4420</span>
<span class="normal">4421</span>
<span class="normal">4422</span>
<span class="normal">4423</span>
<span class="normal">4424</span>
<span class="normal">4425</span>
<span class="normal">4426</span>
<span class="normal">4427</span>
<span class="normal">4428</span>
<span class="normal">4429</span>
<span class="normal">4430</span>
<span class="normal">4431</span>
<span class="normal">4432</span>
<span class="normal">4433</span>
<span class="normal">4434</span>
<span class="normal">4435</span>
<span class="normal">4436</span>
<span class="normal">4437</span>
<span class="normal">4438</span>
<span class="normal">4439</span>
<span class="normal">4440</span>
<span class="normal">4441</span>
<span class="normal">4442</span>
<span class="normal">4443</span>
<span class="normal">4444</span>
<span class="normal">4445</span>
<span class="normal">4446</span>
<span class="normal">4447</span>
<span class="normal">4448</span>
<span class="normal">4449</span>
<span class="normal">4450</span>
<span class="normal">4451</span>
<span class="normal">4452</span>
<span class="normal">4453</span>
<span class="normal">4454</span>
<span class="normal">4455</span>
<span class="normal">4456</span>
<span class="normal">4457</span>
<span class="normal">4458</span>
<span class="normal">4459</span>
<span class="normal">4460</span>
<span class="normal">4461</span>
<span class="normal">4462</span>
<span class="normal">4463</span>
<span class="normal">4464</span>
<span class="normal">4465</span>
<span class="normal">4466</span>
<span class="normal">4467</span>
<span class="normal">4468</span>
<span class="normal">4469</span>
<span class="normal">4470</span>
<span class="normal">4471</span>
<span class="normal">4472</span>
<span class="normal">4473</span>
<span class="normal">4474</span>
<span class="normal">4475</span>
<span class="normal">4476</span>
<span class="normal">4477</span>
<span class="normal">4478</span>
<span class="normal">4479</span>
<span class="normal">4480</span>
<span class="normal">4481</span>
<span class="normal">4482</span>
<span class="normal">4483</span>
<span class="normal">4484</span>
<span class="normal">4485</span>
<span class="normal">4486</span>
<span class="normal">4487</span>
<span class="normal">4488</span>
<span class="normal">4489</span>
<span class="normal">4490</span>
<span class="normal">4491</span>
<span class="normal">4492</span>
<span class="normal">4493</span>
<span class="normal">4494</span>
<span class="normal">4495</span>
<span class="normal">4496</span>
<span class="normal">4497</span>
<span class="normal">4498</span>
<span class="normal">4499</span>
<span class="normal">4500</span>
<span class="normal">4501</span>
<span class="normal">4502</span>
<span class="normal">4503</span>
<span class="normal">4504</span>
<span class="normal">4505</span>
<span class="normal">4506</span>
<span class="normal">4507</span>
<span class="normal">4508</span>
<span class="normal">4509</span>
<span class="normal">4510</span>
<span class="normal">4511</span>
<span class="normal">4512</span>
<span class="normal">4513</span>
<span class="normal">4514</span>
<span class="normal">4515</span>
<span class="normal">4516</span>
<span class="normal">4517</span>
<span class="normal">4518</span>
<span class="normal">4519</span>
<span class="normal">4520</span>
<span class="normal">4521</span>
<span class="normal">4522</span>
<span class="normal">4523</span>
<span class="normal">4524</span>
<span class="normal">4525</span>
<span class="normal">4526</span>
<span class="normal">4527</span>
<span class="normal">4528</span>
<span class="normal">4529</span>
<span class="normal">4530</span>
<span class="normal">4531</span>
<span class="normal">4532</span>
<span class="normal">4533</span>
<span class="normal">4534</span>
<span class="normal">4535</span>
<span class="normal">4536</span>
<span class="normal">4537</span>
<span class="normal">4538</span>
<span class="normal">4539</span>
<span class="normal">4540</span>
<span class="normal">4541</span>
<span class="normal">4542</span>
<span class="normal">4543</span>
<span class="normal">4544</span>
<span class="normal">4545</span>
<span class="normal">4546</span>
<span class="normal">4547</span>
<span class="normal">4548</span>
<span class="normal">4549</span>
<span class="normal">4550</span>
<span class="normal">4551</span>
<span class="normal">4552</span>
<span class="normal">4553</span>
<span class="normal">4554</span>
<span class="normal">4555</span>
<span class="normal">4556</span>
<span class="normal">4557</span>
<span class="normal">4558</span>
<span class="normal">4559</span>
<span class="normal">4560</span>
<span class="normal">4561</span>
<span class="normal">4562</span>
<span class="normal">4563</span>
<span class="normal">4564</span>
<span class="normal">4565</span>
<span class="normal">4566</span>
<span class="normal">4567</span>
<span class="normal">4568</span>
<span class="normal">4569</span>
<span class="normal">4570</span>
<span class="normal">4571</span>
<span class="normal">4572</span>
<span class="normal">4573</span>
<span class="normal">4574</span>
<span class="normal">4575</span>
<span class="normal">4576</span>
<span class="normal">4577</span>
<span class="normal">4578</span>
<span class="normal">4579</span>
<span class="normal">4580</span>
<span class="normal">4581</span>
<span class="normal">4582</span>
<span class="normal">4583</span>
<span class="normal">4584</span>
<span class="normal">4585</span>
<span class="normal">4586</span>
<span class="normal">4587</span>
<span class="normal">4588</span>
<span class="normal">4589</span>
<span class="normal">4590</span>
<span class="normal">4591</span>
<span class="normal">4592</span>
<span class="normal">4593</span>
<span class="normal">4594</span>
<span class="normal">4595</span>
<span class="normal">4596</span>
<span class="normal">4597</span>
<span class="normal">4598</span>
<span class="normal">4599</span>
<span class="normal">4600</span>
<span class="normal">4601</span>
<span class="normal">4602</span>
<span class="normal">4603</span>
<span class="normal">4604</span>
<span class="normal">4605</span>
<span class="normal">4606</span>
<span class="normal">4607</span>
<span class="normal">4608</span>
<span class="normal">4609</span></pre></div></td><td class="code"><div><pre><div id="l1" class="code_block"><span class="k">\chapter</span><span class="nb">{</span>Standard Predicates and Predicates of General Use<span class="nb">}</span> <span class="k">\label</span><span class="nb">{</span>standard<span class="nb">}</span>
</div><div id="l2" class="code_block"><span class="c">%=============================================</span>
</div><div id="l3" class="code_block">
</div><div id="l4" class="code_block">This chapter describes standard predicates, which are always available
</div><div id="l5" class="code_block">to the Prolog interpreter, and do not need to be imported or loaded
</div><div id="l6" class="code_block">explicitly as do other Prolog predicates.  By default, it is a
</div><div id="l7" class="code_block">compiler error to redefine standard predicates.  
</div><div id="l8" class="code_block">
</div><div id="l9" class="code_block"><span class="k">\comment</span><span class="nb">{</span>This behavior can be overridden by allowing explicit
</div><div id="l10" class="code_block">  redefinition of standard predicates (see Section~<span class="k">\ref</span><span class="nb">{}</span>); or
</div><div id="l11" class="code_block">  alternatively the set of standard predicates can be easily
</div><div id="l12" class="code_block">  reconfigured (Section~<span class="k">\ref</span><span class="nb">{}</span>).<span class="nb">}</span>
</div><div id="l13" class="code_block">
</div><div id="l14" class="code_block">In the description below, certain standard predicates depend on HiLog
</div><div id="l15" class="code_block">semantics; the description of such predicates have the token <span class="nb">{</span><span class="k">\sf</span>
</div><div id="l16" class="code_block">HiLog<span class="nb">}</span> at the right of the page.  Similarly predicates that depend on
</div><div id="l17" class="code_block">SLG evaluation are marked as <span class="nb">{</span><span class="k">\sf</span> Tabling<span class="nb">}</span>, and predicates whose
</div><div id="l18" class="code_block">semantics is defined by the ISO standard (or whose implementation is
</div><div id="l19" class="code_block">reasonably close to that definition) are marked as <span class="nb">{</span><span class="k">\tt</span> ISO<span class="nb">}</span>.
</div><div id="l20" class="code_block">Occasionally, however, we include in this section predicates that are
</div><div id="l21" class="code_block">not standard.  In such cases we denote their module in <span class="nb">{</span><span class="k">\tt</span> text<span class="nb">}</span> font
</div><div id="l22" class="code_block">towards the middle of the page.
</div><div id="l23" class="code_block">
</div><div id="l24" class="code_block"><span class="k">\comment</span><span class="nb">{</span>
</div><div id="l25" class="code_block"><span class="k">\paragraph*</span><span class="nb">{</span>A Note on Types<span class="nb">}</span> <span class="k">\label</span><span class="nb">{</span>sec:types<span class="nb">}</span>
</div><div id="l26" class="code_block">
</div><div id="l27" class="code_block">Numerous proposals have been made concerning typing systems for Prolog
</div><div id="l28" class="code_block">for the purposes of program analysis, correctness checking, etc.
</div><div id="l29" class="code_block">Analysis-based typing systems are typically lattice-based, following
</div><div id="l30" class="code_block">from their need to compare types to understand whether one type
</div><div id="l31" class="code_block">includes another, or from the need to determine the most specific type
</div><div id="l32" class="code_block">that is more general than two types.  In addition the ISO standard
</div><div id="l33" class="code_block">specifies various types of allowable input or output arguments for
</div><div id="l34" class="code_block">various predicates.
</div><div id="l35" class="code_block">
</div><div id="l36" class="code_block"><span class="k">\version</span><span class="nb">{}</span> of XSB has the following approach to program typing.
</div><div id="l37" class="code_block">Typing in an XSB program is done through a <span class="nb">{</span><span class="k">\em</span> type lattice<span class="nb">}</span>,
</div><div id="l38" class="code_block">generated by <span class="nb">{</span><span class="k">\em</span> primitive type elements<span class="nb">}</span>.  How a primitive type is
</div><div id="l39" class="code_block">defined is somewhat separate from how it is used by a type lattice.
</div><div id="l40" class="code_block">For our purposes we assume that each 1-ary type element is defined by
</div><div id="l41" class="code_block">a predicate of arity 1 that is written in a pure enough style so that
</div><div id="l42" class="code_block">its success or failure does not depend on the state of XSB or of any
</div><div id="l43" class="code_block">external state.  Whether these types are recursive or not has no
</div><div id="l44" class="code_block">bearing on the type lattice.  For instance, <span class="nb">{</span><span class="k">\tt</span> integer<span class="nb">}</span> or <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l45" class="code_block">listOfAtoms<span class="nb">}</span> are primitive type elements.  Similarly, <span class="nb">{</span><span class="k">\tt</span> variable<span class="nb">}</span>,
</div><div id="l46" class="code_block"><span class="nb">{</span><span class="k">\tt</span> ground<span class="nb">}</span> are also type elements.  We say that a given term <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l47" class="code_block">Term<span class="nb">}</span> satisfies a primitive type element <span class="nb">{</span><span class="k">\tt</span> t<span class="nb">}</span> if <span class="nb">{</span><span class="k">\tt</span> t(Term)<span class="nb">}</span>
</div><div id="l48" class="code_block">succeeds.  Given primitive type elements, complex type elements can be
</div><div id="l49" class="code_block">formed using the boolean operations, <span class="nb">{</span><span class="k">\tt</span> and<span class="nb">}</span>, <span class="nb">{</span><span class="k">\tt</span> or<span class="nb">}</span> and <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l50" class="code_block">not<span class="nb">}</span>.  As an example, <span class="nb">{</span><span class="k">\tt</span> integer or not(listOfAtoms)<span class="nb">}</span> is a
</div><div id="l51" class="code_block">non-primitive type element.  There is also a product operation (<span class="nb">{</span><span class="k">\tt</span>
</div><div id="l52" class="code_block">,<span class="nb">}</span>) on type elements, so that <span class="nb">{</span><span class="k">\tt</span> variable, integer or
</div><div id="l53" class="code_block">not(listOfAtoms)<span class="nb">}</span> is a product of the above two types.  
</div><div id="l54" class="code_block">Satisfiability is extended to complex type elements in the obvious
</div><div id="l55" class="code_block">manner, and an n-ary tuple of terms satisfies a n-ary product type if
</div><div id="l56" class="code_block">each argument in the tuple satisfies the corresponding argument of the
</div><div id="l57" class="code_block">product type.
</div><div id="l58" class="code_block">
</div><div id="l59" class="code_block">The above description is not yet suitable for a type system as it
</div><div id="l60" class="code_block">could not determine, for instance, that <span class="nb">{</span><span class="k">\tt</span> integer<span class="nb">}</span> is a subtype of
</div><div id="l61" class="code_block"><span class="nb">{</span><span class="k">\tt</span> number<span class="nb">}</span>.  To determine this, an explicit <span class="nb">{</span><span class="k">\em</span> inclusion
</div><div id="l62" class="code_block">statement<span class="nb">}</span> can be made indicating that one type is included in
</div><div id="l63" class="code_block">another.  Thus given two elements in a type lattice with inclusion
</div><div id="l64" class="code_block">statements, determining whether one element is more specific than
</div><div id="l65" class="code_block">another can be done using techniques for propositional satisfiability
</div><div id="l66" class="code_block">or stable model generation.
</div><div id="l67" class="code_block">
</div><div id="l68" class="code_block">From an implementational level, types can be defined using the Cold
</div><div id="l69" class="code_block">Dead Fish (CDF) package and inclusion can be detected using the CDF
</div><div id="l70" class="code_block">theorem prover or XSB&#39;s Smodels interface.  However, for the
</div><div id="l71" class="code_block">purposes in this section we use type elements to define inputs and
</div><div id="l72" class="code_block">outputs of predicates, via <span class="nb">{</span><span class="k">\tt</span> usage statements<span class="nb">}</span>.  A usage statement
</div><div id="l73" class="code_block">for an n-ary predicate <span class="nb">{</span><span class="k">\tt</span> p/n<span class="nb">}</span> consists of an n-ary product of
</div><div id="l74" class="code_block">primitive types that should be satisfied on a call to <span class="nb">{</span><span class="k">\tt</span> p/n<span class="nb">}</span> along
</div><div id="l75" class="code_block">with a n-ary product of primitive types that should hold on success of
</div><div id="l76" class="code_block"><span class="nb">{</span><span class="k">\tt</span> p/n<span class="nb">}</span> given the types that hold at call.  If both the the product
</div><div id="l77" class="code_block">types hold, the usage statement is satisfied.  Each successful call to
</div><div id="l78" class="code_block"><span class="nb">{</span><span class="k">\tt</span> p/n<span class="nb">}</span> should satisfy one of the usage statements.
</div><div id="l79" class="code_block">
</div><div id="l80" class="code_block">As defined, usage statements are very general: they can check not only
</div><div id="l81" class="code_block">traditional Prolog types (<span class="nb">{</span><span class="k">\tt</span> atom<span class="nb">}</span>, <span class="nb">{</span><span class="k">\tt</span> integer<span class="nb">}</span>, etc), but also
</div><div id="l82" class="code_block">non-Prolog types, such as the fact that the input to a given argument
</div><div id="l83" class="code_block">should be a positive integer, and even instantiation patterns.  For
</div><div id="l84" class="code_block">the various predicates defined in this section, we use the following
</div><div id="l85" class="code_block">conventions for usages and error reporting.  <span class="nb">{</span><span class="k">\bf</span> domain<span class="nb">}</span>, <span class="nb">{</span><span class="k">\bf</span> type<span class="nb">}</span>
</div><div id="l86" class="code_block">and <span class="nb">{</span><span class="k">\bf</span> instantiation<span class="nb">}</span> errors arise from the failure of an argument
</div><div id="l87" class="code_block">of a predicate to satisfy the corresponding type element in the input
</div><div id="l88" class="code_block">term of the usage statements.  All of these could be called type
</div><div id="l89" class="code_block">errors given the system described above.  However to (partially)
</div><div id="l90" class="code_block">conform to the ISO standard, we reserve the <span class="nb">{</span><span class="k">\bf</span> instantiation error<span class="nb">}</span>
</div><div id="l91" class="code_block">to mean failure that occurs when an argument does not satisfy a type
</div><div id="l92" class="code_block">in a boolean lattice generated by <span class="nb">{</span><span class="k">\tt</span> var<span class="nb">}</span> and <span class="nb">{</span><span class="k">\tt</span> ground<span class="nb">}</span>.  A <span class="nb">{</span><span class="k">\bf</span>
</div><div id="l93" class="code_block">  type error<span class="nb">}</span> occurs when an argument does not satisfy a type in a
</div><div id="l94" class="code_block">boolean lattice generated by other ISO types, such as <span class="nb">{</span><span class="k">\tt</span> integer<span class="nb">}</span>,
</div><div id="l95" class="code_block"><span class="nb">{</span><span class="k">\tt</span> atom<span class="nb">}</span>, etc.  A <span class="nb">{</span><span class="k">\bf</span> domain error<span class="nb">}</span> arises from other such errors.
</div><div id="l96" class="code_block">We note that in certain cases, our designation of an error type may
</div><div id="l97" class="code_block">differ from the ISO standard.
</div><div id="l98" class="code_block"><span class="nb">}</span>
</div><div id="l99" class="code_block">
</div><div id="l100" class="code_block"><span class="c">%--------------------------------------------------------------------------------------------------</span>
</div><div id="l101" class="code_block"><span class="k">\section</span><span class="nb">{</span>Input and Output<span class="nb">}</span>
</div><div id="l102" class="code_block"><span class="k">\index</span><span class="nb">{</span>streams<span class="nb">}</span>
</div><div id="l103" class="code_block">
</div><div id="l104" class="code_block">XSB&#39;s I/O is based on ISO-style streams, although it also supports
</div><div id="l105" class="code_block">older DEC-10 style file handling.  The use of streams provides a
</div><div id="l106" class="code_block">unified interface to a number of different classes of sources and
</div><div id="l107" class="code_block">sinks.  Currently these classes include textual and binary files,
</div><div id="l108" class="code_block">console input and output, pipes, and atoms; in the future sockets and
</div><div id="l109" class="code_block">urls may be handled under the stream interface.  When streams are
</div><div id="l110" class="code_block">opened, certain actions may occur depending on the class of the source
</div><div id="l111" class="code_block">or sink and on the wishes of the user.  For instance when a file <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l112" class="code_block">F<span class="nb">}</span> is opened for output mode, an existing file <span class="nb">{</span><span class="k">\tt</span> F<span class="nb">}</span> may be
</div><div id="l113" class="code_block">truncated (in write mode) or not (in append mode).  In addition,
</div><div id="l114" class="code_block">various operations may or may not be valid depending on the class of
</div><div id="l115" class="code_block">stream.  For instance, repositioning is valid for an atom or file but
</div><div id="l116" class="code_block">not a pipe or console.
</div><div id="l117" class="code_block">
</div><div id="l118" class="code_block">XSB provides several default I/O streams, which make it easier for a
</div><div id="l119" class="code_block">user to embed XSB in other applications.  These streams include the
</div><div id="l120" class="code_block">default input and output streams.  They also include the standard
</div><div id="l121" class="code_block">error stream, to which XSB writes all error messages.  By default the
</div><div id="l122" class="code_block">standard error stream is the same as the standard output stream, but
</div><div id="l123" class="code_block">it can be redirected either by UNIX shell-style I/O redirection or by
</div><div id="l124" class="code_block">the predicates <span class="nb">{</span><span class="k">\tt</span> file<span class="k">\_reopen</span>/4<span class="nb">}</span> and <span class="nb">{</span><span class="k">\tt</span> file<span class="k">\_clone</span>/3<span class="nb">}</span>.
</div><div id="l125" class="code_block">Similarly there is the standard warning stream (to which all system
</div><div id="l126" class="code_block">warnings are written), the standard message stream, the standard
</div><div id="l127" class="code_block">debugging stream (to which debugging information is written), and the
</div><div id="l128" class="code_block">standard feedback stream (for interpreter prompts, yes/no answers,
</div><div id="l129" class="code_block">etc).  All of these streams are aliased by default to standard output,
</div><div id="l130" class="code_block">and can be redirected by the predicates the predicates <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l131" class="code_block">  file<span class="k">\_reopen</span>/4<span class="nb">}</span> and <span class="nb">{</span><span class="k">\tt</span> file<span class="k">\_clone</span>/3<span class="nb">}</span>.
</div><div id="l132" class="code_block">
</div><div id="l133" class="code_block"><span class="k">\index</span><span class="nb">{</span>aliases!streams<span class="nb">}</span>
</div><div id="l134" class="code_block"><span class="k">\index</span><span class="nb">{</span>aliases!streams!user<span class="k">\_input</span><span class="nb">}</span>
</div><div id="l135" class="code_block"><span class="k">\index</span><span class="nb">{</span>aliases!streams!user<span class="k">\_output</span><span class="nb">}</span>
</div><div id="l136" class="code_block"><span class="k">\index</span><span class="nb">{</span>aliases!streams!user<span class="k">\_error</span><span class="nb">}</span>
</div><div id="l137" class="code_block"><span class="k">\index</span><span class="nb">{</span>aliases!streams!user<span class="k">\_warning</span><span class="nb">}</span>
</div><div id="l138" class="code_block"><span class="k">\index</span><span class="nb">{</span>aliases!streams!user<span class="k">\_message</span><span class="nb">}</span>
</div><div id="l139" class="code_block">
</div><div id="l140" class="code_block">Streams may also be aliased: the default input and output streams can
</div><div id="l141" class="code_block">be denoted by <span class="nb">{</span><span class="k">\tt</span> user<span class="k">\_input</span><span class="nb">}</span> and <span class="nb">{</span><span class="k">\tt</span> user<span class="k">\_output</span><span class="nb">}</span> and they refer
</div><div id="l142" class="code_block">to the standard input and standard output streams of the
</div><div id="l143" class="code_block">process <span class="k">\footnote</span><span class="nb">{</span>For backwards compatibility, the default input
</div><div id="l144" class="code_block">  stream can also be aliased by <span class="nb">{</span><span class="k">\tt</span> user<span class="nb">}</span> or <span class="nb">{</span><span class="k">\tt</span> userin<span class="nb">}</span>, and the
</div><div id="l145" class="code_block">  default output stream by <span class="nb">{</span><span class="k">\tt</span> user<span class="nb">}</span> or <span class="nb">{</span><span class="k">\tt</span> userout<span class="nb">}</span>.<span class="nb">}</span>.  Similarly,
</div><div id="l146" class="code_block">XSB&#39;s error, warning and message streams uses the aliases <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l147" class="code_block">  user<span class="k">\_error</span><span class="nb">}</span>, <span class="nb">{</span><span class="k">\tt</span> user<span class="k">\_warning</span><span class="nb">}</span> and <span class="nb">{</span><span class="k">\tt</span> user<span class="k">\_message</span><span class="nb">}</span>
</div><div id="l148" class="code_block">respectively.
</div><div id="l149" class="code_block">
</div><div id="l150" class="code_block">Streams are distinguished by their <span class="nb">{</span><span class="k">\tt</span> class<span class="nb">}</span> -- whether they are
</div><div id="l151" class="code_block">file or atom, etc.; as well as by various properties.  These
</div><div id="l152" class="code_block">properties include whether a stream is positionable or not and whether
</div><div id="l153" class="code_block">a (file) stream is textual or binary.
</div><div id="l154" class="code_block">
</div><div id="l155" class="code_block"><span class="k">\bi</span>
</div><div id="l156" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> Console<span class="nb">}</span> The default streams mentioned above are
</div><div id="l157" class="code_block">console streams, which are textual and not repositionable.
</div><div id="l158" class="code_block"><span class="c">%</span>
</div><div id="l159" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> File<span class="nb">}</span>  A file stream corresponds to an operating system
</div><div id="l160" class="code_block">file and is repositionable.  On Windows, binary files and textual
</div><div id="l161" class="code_block">files differ, while on UNIX they are the same.  
</div><div id="l162" class="code_block"><span class="c">%</span>
</div><div id="l163" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> Atom<span class="nb">}</span> XSB can read from an atom, just as it can from a file.
</div><div id="l164" class="code_block">Atoms are considered to be textual and repositionable.  Writing to
</div><div id="l165" class="code_block">atoms via streams is not currently available in XSB, although 
</div><div id="l166" class="code_block">the predicate <span class="nb">{</span><span class="k">\tt</span> term<span class="k">\_to\_atom</span>/[2,3]<span class="nb">}</span> contains much of the
</div><div id="l167" class="code_block">functionality that such streams would provide.
</div><div id="l168" class="code_block">
</div><div id="l169" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> Pipe<span class="nb">}</span> XSB can also open pipes either directly, or as part
</div><div id="l170" class="code_block">of its ability to spawn processes.  When made into streams, pipes are
</div><div id="l171" class="code_block">textual and not repositionable.
</div><div id="l172" class="code_block"><span class="k">\ei</span>
</div><div id="l173" class="code_block">
</div><div id="l174" class="code_block"><span class="c">%------------------------------------------------------------------------------------------------</span>
</div><div id="l175" class="code_block"><span class="k">\subsection</span><span class="nb">{</span>I/O Stream Implementation<span class="nb">}</span> <span class="k">\label</span><span class="nb">{</span>sec:IO-streams<span class="nb">}</span>
</div><div id="l176" class="code_block">
</div><div id="l177" class="code_block">A user may note that XSB&#39;s I/O streams are small integers, but they
</div><div id="l178" class="code_block">should not be confused with the file descriptors used by the OS.  The
</div><div id="l179" class="code_block">OS file descriptors are objects returned by the C <span class="nb">{</span><span class="k">\tt</span> open<span class="nb">}</span> function;
</div><div id="l180" class="code_block">XSB I/O streams indices into the internal XSB table of open files and
</div><div id="l181" class="code_block">associated information. The OS does not know about XSB I/O streams,
</div><div id="l182" class="code_block">while XSB (obviously) does know about the OS file descriptors. An OS
</div><div id="l183" class="code_block">file descriptor may be returned by certain predicates (e.g.  <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l184" class="code_block">pipe<span class="k">\_open</span>/2<span class="nb">}</span> or user-defined I/O).  In the former case, a file
</div><div id="l185" class="code_block">descriptor can be promoted to XSB stream by <span class="nb">{</span><span class="k">\tt</span> open/<span class="k">\{</span>3,4<span class="k">\}</span><span class="nb">}</span> and in
</div><div id="l186" class="code_block">the latter by using the predicate <span class="nb">{</span><span class="k">\tt</span> fd2iostream/2<span class="nb">}</span>.
</div><div id="l187" class="code_block">
</div><div id="l188" class="code_block">When it starts, XSB opens a number of standard I/O streams that it
</div><div id="l189" class="code_block">uses to print results, errors, debugging info, etc. The descriptors
</div><div id="l190" class="code_block">are described in the file <span class="nb">{</span><span class="k">\tt</span> prolog<span class="k">\_includes</span>/standard.h<span class="nb">}</span>. This file
</div><div id="l191" class="code_block">provides the following symbolic definitions:
</div><div id="l192" class="code_block"><span class="c">%%</span>
</div><div id="l193" class="code_block"><span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l194" class="code_block">    #define STDIN            0
</div><div id="l195" class="code_block">    #define STDOUT           1
</div><div id="l196" class="code_block">    #define STDERR           2
</div><div id="l197" class="code_block">    #define STDWARN          3    /* output stream for xsb warnings  */
</div><div id="l198" class="code_block">    #define STDMSG           4    /* output for regular xsb messages */
</div><div id="l199" class="code_block">    #define STDDBG           5    /* output for debugging info       */
</div><div id="l200" class="code_block">    #define STDFDBK          6    /* output for XSB feedback
</div><div id="l201" class="code_block">                                     (prompt/yes/no/Aborting/answers) */
</div><div id="l202" class="code_block">
</div><div id="l203" class="code_block">    #define AF<span class="nb">_</span>INET     0     /* XSB-side socket request for Internet domain */
</div><div id="l204" class="code_block">    #define AF<span class="nb">_</span>UNIX     1     /* XSB-side socket request for UNIX domain */
</div><div id="l205" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l206" class="code_block"><span class="c">%%</span>
</div><div id="l207" class="code_block"><span class="c">%------------------------------------------------------------------------------------------</span>
</div><div id="l208" class="code_block"><span class="k">\comment</span><span class="nb">{</span>
</div><div id="l209" class="code_block">In addition, the file <span class="k">\verb</span>|emu/file<span class="nb">_</span>modes<span class="nb">_</span>xsb.h| provides the definitions
</div><div id="l210" class="code_block">for the file opening modes:
</div><div id="l211" class="code_block"><span class="c">%%</span>
</div><div id="l212" class="code_block"><span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l213" class="code_block">    #define OREAD          0    /* open for read           */
</div><div id="l214" class="code_block">    #define OWRITE         1    /* open for write          */
</div><div id="l215" class="code_block">    #define OAPPEND        2    /* open for append         */
</div><div id="l216" class="code_block">    #define OSTRINGR       3    /* open string for reading */
</div><div id="l217" class="code_block">    #define OSTRINGW       4    /* open string for writing (not implemented) */
</div><div id="l218" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l219" class="code_block"><span class="c">%%</span>
</div><div id="l220" class="code_block"><span class="nb">}</span>
</div><div id="l221" class="code_block"><span class="c">%------------------------------------------------------------------------------------------</span>
</div><div id="l222" class="code_block">These definitions can be used in user programs, if the following is
</div><div id="l223" class="code_block">provided at the top of the source file:
</div><div id="l224" class="code_block"><span class="c">%%</span>
</div><div id="l225" class="code_block"><span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l226" class="code_block">    compiler<span class="nb">_</span>options([xpp<span class="nb">_</span>on]).
</div><div id="l227" class="code_block">    #include &quot;standard.h&quot;
</div><div id="l228" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l229" class="code_block"><span class="c">%%</span>
</div><div id="l230" class="code_block">If this header is used, the various streams can be used as any other output stream -- e.g. 
</div><div id="l231" class="code_block"><span class="nb">{</span><span class="k">\tt</span> ?- write(STDWARN,&#39;watch it!&#39;)<span class="nb">}</span>.
</div><div id="l232" class="code_block"><span class="c">%</span>
</div><div id="l233" class="code_block">(Note: the XSB preprocessor is not invoked on clauses typed into an
</div><div id="l234" class="code_block">interactive XSB session, so the above applies only to programs loaded from
</div><div id="l235" class="code_block">a file using <span class="nb">{</span><span class="k">\tt</span> consult<span class="nb">}</span> and such.)
</div><div id="l236" class="code_block">
</div><div id="l237" class="code_block"><span class="k">\subsection</span><span class="nb">{</span>ISO Streams<span class="nb">}</span>
</div><div id="l238" class="code_block">
</div><div id="l239" class="code_block"><span class="k">\begin</span><span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l240" class="code_block">
</div><div id="l241" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>open(+SourceSink,+Mode,-Stream)<span class="nb">}{</span>open/3<span class="nb">}</span>
</div><div id="l242" class="code_block"><span class="c">%</span>
</div><div id="l243" class="code_block"><span class="nb">{</span><span class="k">\tt</span> open/1<span class="nb">}</span> creates a stream for the source or sink designated in
</div><div id="l244" class="code_block"><span class="nb">{</span><span class="k">\tt</span> SourceSink<span class="nb">}</span>, and binds <span class="nb">{</span><span class="k">\tt</span> Stream<span class="nb">}</span> to a structure representing
</div><div id="l245" class="code_block">that stream.  
</div><div id="l246" class="code_block"><span class="c">%</span>
</div><div id="l247" class="code_block"><span class="k">\bi</span>
</div><div id="l248" class="code_block"><span class="k">\item</span> If <span class="nb">{</span><span class="k">\tt</span> SourceSink<span class="nb">}</span> is an atom, or the term <span class="nb">{</span><span class="k">\tt</span> file(File)<span class="nb">}</span>
</div><div id="l249" class="code_block">where <span class="nb">{</span><span class="k">\tt</span> File<span class="nb">}</span> is an atom, the stream is a file stream.  In this
</div><div id="l250" class="code_block">case <span class="nb">{</span><span class="k">\tt</span> Mode<span class="nb">}</span> can be 
</div><div id="l251" class="code_block"><span class="k">\bi</span>
</div><div id="l252" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> read<span class="nb">}</span> to create an input stream.  In Windows, whether the
</div><div id="l253" class="code_block">file is textual or binary is determined by the file&#39;s properties.
</div><div id="l254" class="code_block"><span class="c">%</span>
</div><div id="l255" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> write<span class="nb">}</span> to create an output stream.  Any previous file with
</div><div id="l256" class="code_block">a similar path is removed and a (textual) file is created which becomes
</div><div id="l257" class="code_block">a record of the output stream.  
</div><div id="l258" class="code_block"><span class="c">%</span>
</div><div id="l259" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> write<span class="k">\_binary</span><span class="nb">}</span> to create an output stream.  Any previous file with
</div><div id="l260" class="code_block">a similar path is removed and a file is created which becomes
</div><div id="l261" class="code_block">a record of the output stream.  The file created is binary in Windows,
</div><div id="l262" class="code_block">while in UNIX <span class="nb">{</span><span class="k">\tt</span> write<span class="k">\_binary</span><span class="nb">}</span> has the same effect as <span class="nb">{</span><span class="k">\tt</span> write<span class="nb">}</span>.
</div><div id="l263" class="code_block"><span class="c">%</span>
</div><div id="l264" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> append<span class="nb">}</span> to create an output stream.  In this case the
</div><div id="l265" class="code_block">output stream is appended to the contents of the file, if it exists,
</div><div id="l266" class="code_block">and otherwise a new file is created for (textual) output
</div><div id="l267" class="code_block"><span class="c">%</span>
</div><div id="l268" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> append<span class="k">\_binary</span><span class="nb">}</span> to create an output stream.  In this case the
</div><div id="l269" class="code_block">output stream is appended to the contents of the file, if it exists,
</div><div id="l270" class="code_block">and otherwise a new file is created for (binary) output
</div><div id="l271" class="code_block"><span class="k">\ei</span>
</div><div id="l272" class="code_block"><span class="k">\item</span> If <span class="nb">{</span><span class="k">\tt</span> SourceSink<span class="nb">}</span> is the term <span class="nb">{</span><span class="k">\tt</span> atom(Atom)<span class="nb">}</span> where <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l273" class="code_block">Atom<span class="nb">}</span> is an atom, the stream is an atom stream.  In this case <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l274" class="code_block">Mode<span class="nb">}</span> currently can only be <span class="nb">{</span><span class="k">\tt</span> read<span class="nb">}</span>.  This stream class, which
</div><div id="l275" class="code_block">reads from interned atoms, is analogous to C&#39;s <span class="nb">{</span><span class="k">\tt</span> sscanf()<span class="nb">}</span>
</div><div id="l276" class="code_block">function.
</div><div id="l277" class="code_block"><span class="c">%</span>
</div><div id="l278" class="code_block"><span class="k">\item</span> If <span class="nb">{</span><span class="k">\tt</span> SourceSink<span class="nb">}</span> is the term <span class="nb">{</span><span class="k">\tt</span> pipe(FIleDescriptor)<span class="nb">}</span>
</div><div id="l279" class="code_block">where <span class="nb">{</span><span class="k">\tt</span> FileDescriptor<span class="nb">}</span> is an integer, then a pipe stream is opened
</div><div id="l280" class="code_block">in the mode for <span class="nb">{</span><span class="k">\tt</span> FileDescriptor<span class="nb">}</span>.
</div><div id="l281" class="code_block"><span class="k">\ei</span>
</div><div id="l282" class="code_block">
</div><div id="l283" class="code_block"><span class="k">\compatability</span> This predicate extends the ISO definition of <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l284" class="code_block">open/3<span class="nb">}</span> to include strings and pipes as well as the file modes <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l285" class="code_block">write<span class="k">\_binary</span><span class="nb">}</span> and <span class="nb">{</span><span class="k">\tt</span> append<span class="k">\_binary</span><span class="nb">}</span>.
</div><div id="l286" class="code_block">
</div><div id="l287" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>
</div><div id="l288" class="code_block"><span class="k">\bi</span>
</div><div id="l289" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> SourceSink<span class="nb">}</span> or <span class="nb">{</span><span class="k">\tt</span> Mode<span class="nb">}</span> is not instantiated
</div><div id="l290" class="code_block"><span class="k">\bi</span>
</div><div id="l291" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> instantiation<span class="k">\_error</span><span class="nb">}</span>
</div><div id="l292" class="code_block"><span class="k">\ei</span>
</div><div id="l293" class="code_block"><span class="c">%</span>
</div><div id="l294" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Mode<span class="nb">}</span> is not a valid I/O mode
</div><div id="l295" class="code_block"><span class="k">\bi</span>
</div><div id="l296" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(io<span class="k">\_mode</span>,Mode)<span class="nb">}</span>
</div><div id="l297" class="code_block"><span class="k">\ei</span>
</div><div id="l298" class="code_block"><span class="c">%</span>
</div><div id="l299" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> SourceSink<span class="nb">}</span> is a file and cannot be opened, or opened in
</div><div id="l300" class="code_block">the desired mode 
</div><div id="l301" class="code_block"><span class="k">\bi</span>
</div><div id="l302" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> permission<span class="k">\_error</span>(open,file,SourceSink)<span class="nb">}</span>
</div><div id="l303" class="code_block"><span class="k">\ei</span>
</div><div id="l304" class="code_block"><span class="k">\ei</span>
</div><div id="l305" class="code_block">
</div><div id="l306" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>open(+File,+Mode,-Stream,+Options)<span class="nb">}{</span>open/4<span class="nb">}</span>
</div><div id="l307" class="code_block"><span class="c">%</span>
</div><div id="l308" class="code_block"><span class="nb">{</span><span class="k">\tt</span> open/4<span class="nb">}</span> behaves as does <span class="nb">{</span><span class="k">\tt</span> open/3<span class="nb">}</span>, but allows a list of
</div><div id="l309" class="code_block">options to be given.  The current options are a subset of ISO options
</div><div id="l310" class="code_block">and are:
</div><div id="l311" class="code_block"><span class="k">\bi</span>
</div><div id="l312" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> alias(A)<span class="nb">}</span> allows the stream to be aliased to an atom <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l313" class="code_block">  A<span class="nb">}</span>.
</div><div id="l314" class="code_block"><span class="c">%</span>
</div><div id="l315" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> type(T)<span class="nb">}</span> has no effect on file streams in UNIX, which are
</div><div id="l316" class="code_block">  always textual, but in Windows if <span class="nb">{</span><span class="k">\tt</span> T<span class="nb">}</span> is <span class="nb">{</span><span class="k">\tt</span> binary<span class="nb">}</span> a binary
</div><div id="l317" class="code_block">  file is opened.
</div><div id="l318" class="code_block"><span class="k">\ei</span>
</div><div id="l319" class="code_block"><span class="c">%</span>
</div><div id="l320" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>  Error cases are the same as <span class="nb">{</span><span class="k">\tt</span> open/3<span class="nb">}</span> but with
</div><div id="l321" class="code_block">the addition: 
</div><div id="l322" class="code_block"><span class="k">\bi</span>
</div><div id="l323" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> Option<span class="k">\_list</span><span class="nb">}</span> contains an option <span class="nb">{</span><span class="k">\tt</span> O<span class="nb">}</span> that is not a
</div><div id="l324" class="code_block">  (currently implemented) stream option.  
</div><div id="l325" class="code_block"><span class="k">\bi</span>
</div><div id="l326" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(stream<span class="k">\_option</span>,O)<span class="nb">}</span>
</div><div id="l327" class="code_block"><span class="k">\ei</span>
</div><div id="l328" class="code_block"><span class="k">\item</span> An element of <span class="nb">{</span><span class="k">\tt</span> OptionsList<span class="nb">}</span> is alias(A) and A is already
</div><div id="l329" class="code_block">  associated with an existing thread, queue, mutex or stream 
</div><div id="l330" class="code_block"><span class="k">\bi</span>
</div><div id="l331" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> permission<span class="k">\_error</span>(create,alias, A)<span class="nb">}</span>
</div><div id="l332" class="code_block"><span class="k">\ei</span>
</div><div id="l333" class="code_block"><span class="k">\item</span> An element of <span class="nb">{</span><span class="k">\tt</span> OptionsList<span class="nb">}</span> is alias(A) and A is not an atom
</div><div id="l334" class="code_block"><span class="k">\bi</span>
</div><div id="l335" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> type<span class="k">\_error</span>(atom,A)<span class="nb">}</span>
</div><div id="l336" class="code_block"><span class="k">\ei</span>
</div><div id="l337" class="code_block"><span class="k">\ei</span>
</div><div id="l338" class="code_block"><span class="c">%</span>
</div><div id="l339" class="code_block"><span class="k">\compatability</span> 
</div><div id="l340" class="code_block"><span class="c">%</span>
</div><div id="l341" class="code_block">The ISO option <span class="nb">{</span><span class="k">\tt</span> reposition(Boolean)<span class="nb">}</span> currently has no effect on
</div><div id="l342" class="code_block">streams, because whether or not the stream is repositionable or not
</div><div id="l343" class="code_block">depends on the stream class.  The ISO option <span class="nb">{</span><span class="k">\tt</span> eof<span class="k">\_action</span>(Action)<span class="nb">}</span>
</div><div id="l344" class="code_block">currently has no effect on file streams.  If these options are
</div><div id="l345" class="code_block">encountered in <span class="nb">{</span><span class="k">\tt</span> Options<span class="nb">}</span>, a warning is issued to <span class="nb">{</span><span class="k">\tt</span> STDWARN<span class="nb">}</span>.
</div><div id="l346" class="code_block">
</div><div id="l347" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>close(+Stream<span class="k">\_or\_alias</span>,+OptionsList)<span class="nb">}{</span>close/2<span class="nb">}</span>
</div><div id="l348" class="code_block"><span class="c">%</span>
</div><div id="l349" class="code_block"><span class="nb">{</span><span class="k">\tt</span> close/2<span class="nb">}</span> closes the stream or alias <span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span>.
</div><div id="l350" class="code_block"><span class="nb">{</span><span class="k">\tt</span> OptionsList<span class="nb">}</span> allows the user to declare whether a permission
</div><div id="l351" class="code_block">error will be raised in XSB upon a resource or system error from the
</div><div id="l352" class="code_block">closing function (e.g. <span class="nb">{</span><span class="k">\tt</span> fclose()<span class="nb">}</span> or other system function).  If
</div><div id="l353" class="code_block"><span class="nb">{</span><span class="k">\tt</span> OptionsList<span class="nb">}</span> is non-empty and contains only terms unifying with
</div><div id="l354" class="code_block"><span class="nb">{</span><span class="k">\tt</span> force(true)<span class="nb">}</span> then such an error will be ignored (possibly leading
</div><div id="l355" class="code_block">to unacknowledged loss of data).  Otherwise, a permission error is
</div><div id="l356" class="code_block">thrown if <span class="nb">{</span><span class="k">\tt</span> fclose()<span class="nb">}</span> or other system function returns an error
</div><div id="l357" class="code_block">condition.  If the stream class of <span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is an atom,
</div><div id="l358" class="code_block">then the only action taken is to close the stream itself -- the
</div><div id="l359" class="code_block">interned atom itself is not affected.
</div><div id="l360" class="code_block">
</div><div id="l361" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>
</div><div id="l362" class="code_block"><span class="k">\bi</span>
</div><div id="l363" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is a variable
</div><div id="l364" class="code_block"><span class="k">\bi</span>
</div><div id="l365" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> instantiation<span class="k">\_error</span><span class="nb">}</span>
</div><div id="l366" class="code_block"><span class="k">\ei</span>
</div><div id="l367" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is neither a variable, nor a stream term
</div><div id="l368" class="code_block">  nor an alias.  
</div><div id="l369" class="code_block"><span class="k">\bi</span>
</div><div id="l370" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(stream<span class="k">\_or\_alias</span>,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l371" class="code_block"><span class="k">\ei</span>
</div><div id="l372" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is not associated with an open stream
</div><div id="l373" class="code_block"><span class="k">\bi</span>
</div><div id="l374" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> existence<span class="k">\_error</span>(stream,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l375" class="code_block"><span class="k">\ei</span>
</div><div id="l376" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> OptionList<span class="nb">}</span> contains an option <span class="nb">{</span><span class="k">\tt</span> O<span class="nb">}</span> that is not a closing
</div><div id="l377" class="code_block">option.
</div><div id="l378" class="code_block"><span class="k">\bi</span>
</div><div id="l379" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(close<span class="k">\_option</span>,O)<span class="nb">}</span>
</div><div id="l380" class="code_block"><span class="k">\ei</span>
</div><div id="l381" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> OptionList<span class="nb">}</span> contains conflicting options
</div><div id="l382" class="code_block"><span class="k">\bi</span>
</div><div id="l383" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(close<span class="k">\_option</span>,OptionList)<span class="nb">}</span>
</div><div id="l384" class="code_block"><span class="k">\ei</span>
</div><div id="l385" class="code_block"><span class="k">\item</span> 	Closing the stream produces an error (and <span class="nb">{</span><span class="k">\tt</span> OptionsList<span class="nb">}</span> is
</div><div id="l386" class="code_block">	a non-empty list containing terms of the form <span class="nb">{</span><span class="k">\tt</span> force(true)<span class="nb">}</span>).
</div><div id="l387" class="code_block"><span class="k">\bi</span>
</div><div id="l388" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> permission<span class="k">\_error</span>(close,file,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l389" class="code_block"><span class="k">\ei</span>
</div><div id="l390" class="code_block"><span class="k">\ei</span>
</div><div id="l391" class="code_block">
</div><div id="l392" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>close(+Stream<span class="k">\_or\_alias</span>)<span class="nb">}{</span>close/1<span class="nb">}</span>
</div><div id="l393" class="code_block"><span class="c">%</span>
</div><div id="l394" class="code_block"><span class="nb">{</span><span class="k">\tt</span> close/1<span class="nb">}</span> closes the stream or alias <span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span>.<span class="k">\\</span>
</div><div id="l395" class="code_block">Behaves as <span class="nb">{</span><span class="k">\tt</span> close(Stream<span class="k">\_or\_alias</span>,[force(false)])<span class="nb">}</span>.
</div><div id="l396" class="code_block">
</div><div id="l397" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>set<span class="k">\_input</span>(+Stream<span class="k">\_or\_alias</span>)<span class="nb">}{</span>set<span class="k">\_input</span>/1<span class="nb">}</span>
</div><div id="l398" class="code_block">    Makes file <span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> the current input stream. 
</div><div id="l399" class="code_block">
</div><div id="l400" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>
</div><div id="l401" class="code_block"><span class="k">\bi</span>
</div><div id="l402" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is a variable
</div><div id="l403" class="code_block"><span class="k">\bi</span>
</div><div id="l404" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> instantiation<span class="k">\_error</span><span class="nb">}</span>
</div><div id="l405" class="code_block"><span class="k">\ei</span>
</div><div id="l406" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is neither a variable, nor a a stream
</div><div id="l407" class="code_block">  term nor an alias.  
</div><div id="l408" class="code_block"><span class="k">\bi</span>
</div><div id="l409" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(stream<span class="k">\_or\_alias</span>,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l410" class="code_block"><span class="k">\ei</span>
</div><div id="l411" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is not an open input stream
</div><div id="l412" class="code_block"><span class="k">\bi</span>
</div><div id="l413" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> existence<span class="k">\_error</span>(stream,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l414" class="code_block"><span class="k">\ei</span>
</div><div id="l415" class="code_block"><span class="k">\ei</span>
</div><div id="l416" class="code_block">
</div><div id="l417" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>set<span class="k">\_output</span>(+Stream<span class="k">\_or\_alias</span>)<span class="nb">}{</span>set<span class="k">\_output</span>/1<span class="nb">}</span>
</div><div id="l418" class="code_block">    Makes file <span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> the current output stream. 
</div><div id="l419" class="code_block">
</div><div id="l420" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>
</div><div id="l421" class="code_block"><span class="k">\bi</span>
</div><div id="l422" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is a variable
</div><div id="l423" class="code_block"><span class="k">\bi</span>
</div><div id="l424" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> instantiation<span class="k">\_error</span><span class="nb">}</span>
</div><div id="l425" class="code_block"><span class="k">\ei</span>
</div><div id="l426" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is neither a variable, nor a a stream
</div><div id="l427" class="code_block">  term nor an alias.  
</div><div id="l428" class="code_block"><span class="k">\bi</span>
</div><div id="l429" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(stream<span class="k">\_or\_alias</span>,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l430" class="code_block"><span class="k">\ei</span>
</div><div id="l431" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is not associated with an open output stream
</div><div id="l432" class="code_block"><span class="k">\bi</span>
</div><div id="l433" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> existence<span class="k">\_error</span>(stream,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l434" class="code_block"><span class="k">\ei</span>
</div><div id="l435" class="code_block"><span class="k">\ei</span>
</div><div id="l436" class="code_block">
</div><div id="l437" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>stream<span class="k">\_property</span>(?Stream,?Property)<span class="nb">}{</span>stream<span class="k">\_property</span>/2<span class="nb">}</span>
</div><div id="l438" class="code_block"><span class="c">%</span>
</div><div id="l439" class="code_block">This predicate backtracks through the various stream properties that
</div><div id="l440" class="code_block">unify with <span class="nb">{</span><span class="k">\tt</span> Property<span class="nb">}</span> for the stream <span class="nb">{</span><span class="k">\tt</span> Stream<span class="nb">}</span>.  Currently,
</div><div id="l441" class="code_block">the following properties are defined.
</div><div id="l442" class="code_block">
</div><div id="l443" class="code_block"><span class="k">\bi</span>
</div><div id="l444" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> stream<span class="k">\_class</span>(C)<span class="nb">}</span> gives the stream class for a file:
</div><div id="l445" class="code_block">i.e. <span class="nb">{</span><span class="k">\tt</span> file<span class="nb">}</span>, <span class="nb">{</span><span class="k">\tt</span> atom<span class="nb">}</span>, <span class="nb">{</span><span class="k">\tt</span> console<span class="nb">}</span> or <span class="nb">{</span><span class="k">\tt</span> pipe<span class="nb">}</span>.
</div><div id="l446" class="code_block">
</div><div id="l447" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> file<span class="k">\_name</span>(F)<span class="nb">}</span> is a property of <span class="nb">{</span><span class="k">\tt</span> Stream<span class="nb">}</span>, if
</div><div id="l448" class="code_block"><span class="nb">{</span><span class="k">\tt</span> Stream<span class="nb">}</span> is a file stream and <span class="nb">{</span><span class="k">\tt</span> F<span class="nb">}</span> is the file name
</div><div id="l449" class="code_block">associate with <span class="nb">{</span><span class="k">\tt</span> Stream<span class="nb">}</span>.  The full operating system
</div><div id="l450" class="code_block">path is used.
</div><div id="l451" class="code_block"><span class="c">%</span>
</div><div id="l452" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> type(T)<span class="nb">}</span> is a property of <span class="nb">{</span><span class="k">\tt</span> Stream<span class="nb">}</span>, if
</div><div id="l453" class="code_block"><span class="nb">{</span><span class="k">\tt</span> Stream<span class="nb">}</span> is a file stream and <span class="nb">{</span><span class="k">\tt</span> T<span class="nb">}</span> is the file type
</div><div id="l454" class="code_block">of <span class="nb">{</span><span class="k">\tt</span> Stream<span class="nb">}</span>: <span class="nb">{</span><span class="k">\tt</span> text<span class="nb">}</span> or <span class="nb">{</span><span class="k">\tt</span> binary<span class="nb">}</span>.
</div><div id="l455" class="code_block"><span class="c">%</span>
</div><div id="l456" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> mode(M)<span class="nb">}</span> is a property of <span class="nb">{</span><span class="k">\tt</span> Stream<span class="nb">}</span>, if <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l457" class="code_block">M<span class="nb">}</span> represents the I/O mode with which <span class="nb">{</span><span class="k">\tt</span> Stream<span class="nb">}</span> was
</div><div id="l458" class="code_block">opened: i.e. <span class="nb">{</span><span class="k">\tt</span> read<span class="nb">}</span>, <span class="nb">{</span><span class="k">\tt</span> write<span class="nb">}</span>, <span class="nb">{</span><span class="k">\tt</span> append<span class="nb">}</span>, <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l459" class="code_block">write<span class="k">\_binary</span><span class="nb">}</span>, etc., as appropriate for the class of <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l460" class="code_block">Stream<span class="nb">}</span>.
</div><div id="l461" class="code_block"><span class="c">%</span>
</div><div id="l462" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> alias(A)<span class="nb">}</span>  is a property of <span class="nb">{</span><span class="k">\tt</span> Stream<span class="nb">}</span>, if
</div><div id="l463" class="code_block"><span class="nb">{</span><span class="k">\tt</span> Stream<span class="nb">}</span> was opened with alias <span class="nb">{</span><span class="k">\tt</span> A<span class="nb">}</span>.
</div><div id="l464" class="code_block"><span class="c">%</span>
</div><div id="l465" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> input<span class="nb">}</span>  is a property of <span class="nb">{</span><span class="k">\tt</span> Stream<span class="nb">}</span>, if <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l466" class="code_block">Stream<span class="nb">}</span> was opened in the I/O mode: <span class="nb">{</span><span class="k">\tt</span> read<span class="nb">}</span>.
</div><div id="l467" class="code_block"><span class="c">% </span>
</div><div id="l468" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> output<span class="nb">}</span>  is a property of <span class="nb">{</span><span class="k">\tt</span> Stream<span class="nb">}</span>, if <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l469" class="code_block">Stream<span class="nb">}</span> was opened in the I/O mode: <span class="nb">{</span><span class="k">\tt</span> write<span class="nb">}</span>, <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l470" class="code_block">append<span class="nb">}</span>, <span class="nb">{</span><span class="k">\tt</span> write<span class="k">\_binary</span><span class="nb">}</span>, or <span class="nb">{</span><span class="k">\tt</span> append<span class="k">\_binary</span><span class="nb">}</span>.
</div><div id="l471" class="code_block"><span class="c">%</span>
</div><div id="l472" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> reposition(Bool)<span class="nb">}</span> is true, if <span class="nb">{</span><span class="k">\tt</span> Stream<span class="nb">}</span> is
</div><div id="l473" class="code_block">repositionable, and false otherwise. 
</div><div id="l474" class="code_block"><span class="c">%</span>
</div><div id="l475" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> end<span class="k">\_of\_stream</span>(E)<span class="nb">}</span> returns <span class="nb">{</span><span class="k">\tt</span> at<span class="nb">}</span> if the end of stream
</div><div id="l476" class="code_block">condition for <span class="nb">{</span><span class="k">\tt</span> Stream<span class="nb">}</span> is true, and <span class="nb">{</span><span class="k">\tt</span> not<span class="nb">}</span> otherwise.
</div><div id="l477" class="code_block"><span class="c">%</span>
</div><div id="l478" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> position(Pos)<span class="nb">}</span> returns the current position of the stream
</div><div id="l479" class="code_block">as determined by <span class="nb">{</span><span class="k">\tt</span> fseek<span class="nb">{}}</span> or the byte-offset of the current
</div><div id="l480" class="code_block">stream within an atom.  In either case, if an end-of-stream condition
</div><div id="l481" class="code_block">occurs, the token <span class="nb">{</span><span class="k">\tt</span> end<span class="k">\_of\_file</span><span class="nb">}</span> is returned.
</div><div id="l482" class="code_block"><span class="c">%</span>
</div><div id="l483" class="code_block">
</div><div id="l484" class="code_block"><span class="c">%</span>
</div><div id="l485" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> eof<span class="k">\_action</span>(Action)<span class="nb">}</span> is <span class="nb">{</span><span class="k">\tt</span> reposition<span class="nb">}</span> if the stream class
</div><div id="l486" class="code_block">is <span class="nb">{</span><span class="k">\tt</span> console<span class="nb">}</span>, <span class="nb">{</span><span class="k">\tt</span> eof<span class="k">\_code</span><span class="nb">}</span> if the stream class is <span class="nb">{</span><span class="k">\tt</span> file<span class="nb">}</span>,
</div><div id="l487" class="code_block">and <span class="nb">{</span><span class="k">\tt</span> error<span class="nb">}</span> is the stream class is <span class="nb">{</span><span class="k">\tt</span> pipe<span class="nb">}</span> or <span class="nb">{</span><span class="k">\tt</span> atom<span class="nb">}</span>.
</div><div id="l488" class="code_block"><span class="k">\end</span><span class="nb">{</span>itemize<span class="nb">}</span>
</div><div id="l489" class="code_block">
</div><div id="l490" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>flush<span class="k">\_output</span>(+Stream<span class="k">\_or\_alias</span>)<span class="nb">}{</span>flush<span class="k">\_output</span>/1<span class="nb">}</span>
</div><div id="l491" class="code_block"><span class="c">%</span>
</div><div id="l492" class="code_block">Any buffered data in <span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span>  gets flushed.  If
</div><div id="l493" class="code_block"><span class="nb">{</span><span class="k">\tt</span> Stream<span class="nb">}</span> is not buffered (i.e. if it is of class <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l494" class="code_block">atom<span class="nb">}</span>), no action is taken.
</div><div id="l495" class="code_block">
</div><div id="l496" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>
</div><div id="l497" class="code_block"><span class="k">\bi</span>
</div><div id="l498" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is a variable
</div><div id="l499" class="code_block"><span class="k">\bi</span>
</div><div id="l500" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> instantiation<span class="k">\_error</span><span class="nb">}</span>
</div><div id="l501" class="code_block"><span class="k">\ei</span>
</div><div id="l502" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is neither a variable, nor a a stream
</div><div id="l503" class="code_block">  term nor an alias.  
</div><div id="l504" class="code_block"><span class="k">\bi</span>
</div><div id="l505" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(Stream<span class="k">\_or\_alias</span>,Stream)<span class="nb">}</span>
</div><div id="l506" class="code_block"><span class="k">\ei</span>
</div><div id="l507" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="nb">}</span> is not associated with an open output stream 
</div><div id="l508" class="code_block"><span class="k">\bi</span>
</div><div id="l509" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> existence<span class="k">\_error</span>(Stream<span class="k">\_or\_alias</span>,Stream)<span class="nb">}</span>
</div><div id="l510" class="code_block"><span class="k">\ei</span>
</div><div id="l511" class="code_block"><span class="k">\item</span> 	Flushing (i.e. <span class="nb">{</span><span class="k">\tt</span> fflush()<span class="nb">}</span>) returns an error.
</div><div id="l512" class="code_block"><span class="k">\bi</span>
</div><div id="l513" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> permission<span class="k">\_error</span>(flush,stream,Stream)<span class="nb">}</span>
</div><div id="l514" class="code_block"><span class="k">\ei</span>
</div><div id="l515" class="code_block"><span class="k">\ei</span>
</div><div id="l516" class="code_block">
</div><div id="l517" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>flush<span class="k">\_output</span><span class="nb">}{</span>flush<span class="k">\_output</span>/0<span class="nb">}</span>
</div><div id="l518" class="code_block"><span class="c">%</span>
</div><div id="l519" class="code_block">Any buffered data in the current output stream gets flushed.
</div><div id="l520" class="code_block">
</div><div id="l521" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>set<span class="k">\_stream\_position</span>(+Stream<span class="k">\_or\_alias</span>,+Position)<span class="nb">}{</span>set<span class="k">\_stream\_position</span>/2<span class="nb">}</span>
</div><div id="l522" class="code_block"><span class="c">%</span>
</div><div id="l523" class="code_block">If the stream associated with <span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is
</div><div id="l524" class="code_block">repositionable (i.e. is a file or atom), sets the stream position
</div><div id="l525" class="code_block">indicator for the next input or output operation. Position is a
</div><div id="l526" class="code_block">positive integer, taken to be the number of bytes the stream is to be
</div><div id="l527" class="code_block">placed from the origin.
</div><div id="l528" class="code_block">
</div><div id="l529" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>
</div><div id="l530" class="code_block"><span class="k">\bi</span>
</div><div id="l531" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is a variable
</div><div id="l532" class="code_block"><span class="k">\bi</span>
</div><div id="l533" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> instantiation<span class="k">\_error</span><span class="nb">}</span>
</div><div id="l534" class="code_block"><span class="k">\ei</span>
</div><div id="l535" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is neither a variable, nor a a stream
</div><div id="l536" class="code_block">  term nor an alias.  
</div><div id="l537" class="code_block"><span class="k">\bi</span>
</div><div id="l538" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(stream<span class="k">\_or\_alias</span>,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l539" class="code_block"><span class="k">\ei</span>
</div><div id="l540" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Position<span class="nb">}</span> is not instantiated to a positive integer.
</div><div id="l541" class="code_block"><span class="k">\bi</span>
</div><div id="l542" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(stream<span class="k">\_position</span>,Position)<span class="nb">}</span>
</div><div id="l543" class="code_block"><span class="k">\ei</span>
</div><div id="l544" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is not associated with an open stream
</div><div id="l545" class="code_block"><span class="k">\bi</span>
</div><div id="l546" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> existence<span class="k">\_error</span>(stream,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l547" class="code_block"><span class="k">\ei</span>
</div><div id="l548" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is not repositionable, or
</div><div id="l549" class="code_block">	repositioning returns an error. 
</div><div id="l550" class="code_block"><span class="k">\bi</span>
</div><div id="l551" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> permission<span class="k">\_error</span>(resposition,stream,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l552" class="code_block"><span class="k">\ei</span>
</div><div id="l553" class="code_block"><span class="k">\ei</span>
</div><div id="l554" class="code_block">
</div><div id="l555" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>at<span class="k">\_end\_of\_stream</span>(+Stream<span class="k">\_or\_alias</span>)<span class="nb">}{</span>at<span class="k">\_end\_of\_stream</span>/1<span class="nb">}</span>
</div><div id="l556" class="code_block"><span class="c">%</span>
</div><div id="l557" class="code_block">Succeeds if <span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> has position at or past the end of
</div><div id="l558" class="code_block">stream.
</div><div id="l559" class="code_block">
</div><div id="l560" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>
</div><div id="l561" class="code_block"><span class="k">\bi</span>
</div><div id="l562" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is a variable
</div><div id="l563" class="code_block"><span class="k">\bi</span>
</div><div id="l564" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> instantiation<span class="k">\_error</span><span class="nb">}</span>
</div><div id="l565" class="code_block"><span class="k">\ei</span>
</div><div id="l566" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is neither a variable, nor a a stream
</div><div id="l567" class="code_block">  term nor an alias.  
</div><div id="l568" class="code_block"><span class="k">\bi</span>
</div><div id="l569" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(stream,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l570" class="code_block"><span class="k">\ei</span>
</div><div id="l571" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is not an open stream
</div><div id="l572" class="code_block"><span class="k">\bi</span>
</div><div id="l573" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> existence<span class="k">\_error</span>(stream,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l574" class="code_block"><span class="k">\ei</span>
</div><div id="l575" class="code_block"><span class="k">\ei</span>
</div><div id="l576" class="code_block"><span class="c">%</span>
</div><div id="l577" class="code_block">
</div><div id="l578" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>at<span class="k">\_end\_of\_stream</span><span class="nb">}{</span>at<span class="k">\_end\_of\_stream</span>/0<span class="nb">}</span>
</div><div id="l579" class="code_block"><span class="c">%</span>
</div><div id="l580" class="code_block">Acts as <span class="nb">{</span><span class="k">\tt</span> at<span class="k">\_end\_of\_stream</span>/1<span class="nb">}</span> but using the current input
</div><div id="l581" class="code_block">stream.
</div><div id="l582" class="code_block">
</div><div id="l583" class="code_block"><span class="k">\end</span><span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l584" class="code_block">
</div><div id="l585" class="code_block"><span class="k">\subsubsection</span><span class="nb">{</span>Other Predicates using ISO Streams<span class="nb">}</span>
</div><div id="l586" class="code_block">
</div><div id="l587" class="code_block"><span class="k">\begin</span><span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l588" class="code_block">
</div><div id="l589" class="code_block"><span class="k">\standarditem</span><span class="nb">{</span>file<span class="k">\_reopen</span>(+FileName,+Mode,+Stream,-RetCode)<span class="nb">}{</span>file<span class="k">\_reopen</span>/3<span class="nb">}</span>
</div><div id="l590" class="code_block"><span class="c">%</span>
</div><div id="l591" class="code_block">    Takes an existing I/O stream, closes it, then opens it and
</div><div id="l592" class="code_block">    attaches it to a file. This can be used to redirect I/O from any of the
</div><div id="l593" class="code_block">    standard streams to a file. For instance, 
</div><div id="l594" class="code_block"><span class="c">%%</span>
</div><div id="l595" class="code_block"><span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l596" class="code_block">    | ?- file<span class="nb">_</span>reopen(&#39;/dev/null&#39;, w, 3, Error).
</div><div id="l597" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l598" class="code_block"><span class="c">%%</span>
</div><div id="l599" class="code_block">    redirects all warnings to the Unix black hole. 
</div><div id="l600" class="code_block">
</div><div id="l601" class="code_block">    On success, <span class="nb">{</span><span class="k">\tt</span> RetCode<span class="nb">}</span> is 0; on error, the return code is negative.
</div><div id="l602" class="code_block">
</div><div id="l603" class="code_block"><span class="c">%-----------------------------------------------------------------------------</span>
</div><div id="l604" class="code_block">
</div><div id="l605" class="code_block"><span class="k">\standarditem</span><span class="nb">{</span>file<span class="k">\_clone</span>(+SrcStream,?DestStream,-RetCode)<span class="nb">}{</span>file<span class="k">\_clone</span>/3<span class="nb">}</span>
</div><div id="l606" class="code_block"><span class="c">%</span>
</div><div id="l607" class="code_block">This is yet another way to redirect I/O. It is a Prolog interface to
</div><div id="l608" class="code_block">the C <span class="nb">{</span><span class="k">\tt</span> dup<span class="nb">}</span> and <span class="nb">{</span><span class="k">\tt</span> dup2<span class="nb">}</span> system calls. If <span class="nb">{</span><span class="k">\tt</span> DestStream<span class="nb">}</span> is a
</div><div id="l609" class="code_block">variable, then this call creates a new XSB I/O stream that is a clone
</div><div id="l610" class="code_block">of <span class="nb">{</span><span class="k">\tt</span> SrcStream<span class="nb">}</span>. This means that I/O sent to either stream goes
</div><div id="l611" class="code_block">to the same place. If <span class="nb">{</span><span class="k">\tt</span> DestStream<span class="nb">}</span> is not a variable, then it must
</div><div id="l612" class="code_block">be a number corresponding to a valid I/O stream. In this case, XSB
</div><div id="l613" class="code_block">closes <span class="nb">{</span><span class="k">\tt</span> DestStream<span class="nb">}</span> and makes it into a clone of <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l614" class="code_block">SrcStream<span class="nb">}</span>. 
</div><div id="l615" class="code_block">
</div><div id="l616" class="code_block">For instance, suppose that 10 is a I/O Stream that is currently open
</div><div id="l617" class="code_block">for writing to file <span class="nb">{</span><span class="k">\tt</span> foo.bar<span class="nb">}</span>.  Then 
</div><div id="l618" class="code_block"><span class="c">%%</span>
</div><div id="l619" class="code_block"><span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span> 
</div><div id="l620" class="code_block">| ?- file<span class="nb">_</span>clone(10,3,<span class="nb">_</span>).  
</div><div id="l621" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span> 
</div><div id="l622" class="code_block"><span class="c">%% </span>
</div><div id="l623" class="code_block">causes all messages sent to XSB standard warnings stream to go to file
</div><div id="l624" class="code_block"><span class="nb">{</span><span class="k">\tt</span> foo.bar<span class="nb">}</span>. While this could be also done with <span class="nb">{</span><span class="k">\tt</span> file<span class="k">\_reopen</span><span class="nb">}</span>,
</div><div id="l625" class="code_block">there are things that only <span class="nb">{</span><span class="k">\tt</span> file<span class="k">\_clone</span><span class="nb">}</span> can do: 
</div><div id="l626" class="code_block"><span class="c">%%</span>
</div><div id="l627" class="code_block"><span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span> 
</div><div id="l628" class="code_block">| ?- file<span class="nb">_</span>clone(1,10,<span class="nb">_</span>). 
</div><div id="l629" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span> 
</div><div id="l630" class="code_block"><span class="c">%% </span>
</div><div id="l631" class="code_block">This means that I/O stream 10 now becomes clone of standard
</div><div id="l632" class="code_block">output. So, all subsequent I/O will now go to standard output instead
</div><div id="l633" class="code_block">of <span class="nb">{</span><span class="k">\tt</span> foo.bar<span class="nb">}</span>.
</div><div id="l634" class="code_block">
</div><div id="l635" class="code_block">On success, <span class="nb">{</span><span class="k">\tt</span> RetCode<span class="nb">}</span> is 0; on error, the return code is negative.
</div><div id="l636" class="code_block">
</div><div id="l637" class="code_block"><span class="c">%-----------------------------------------------------------------------------</span>
</div><div id="l638" class="code_block">
</div><div id="l639" class="code_block"><span class="k">\ourmoditem</span><span class="nb">{</span>file<span class="k">\_truncate</span>(+Stream, +Length, -Return)<span class="nb">}{</span>file<span class="k">\_truncate</span>/3<span class="nb">}{</span>file<span class="k">\_io</span><span class="nb">}</span>
</div><div id="l640" class="code_block">    The regular file  referenced by the Stream<span class="nb">{</span><span class="k">\tt</span> Stream<span class="nb">}</span>
</div><div id="l641" class="code_block">    is chopped to have the size of <span class="nb">{</span><span class="k">\tt</span> Length<span class="nb">}</span> bytes. Upon successful
</div><div id="l642" class="code_block">    completion <span class="nb">{</span><span class="k">\tt</span> Return<span class="nb">}</span> is set to zero.
</div><div id="l643" class="code_block">
</div><div id="l644" class="code_block"><span class="k">\portability</span> Under Windows (including Cygwin) <span class="nb">{</span><span class="k">\tt</span> file<span class="k">\_truncate</span>/2<span class="nb">}</span>
</div><div id="l645" class="code_block">is implemented using <span class="nb">{</span><span class="k">\tt</span> <span class="k">\_chsize</span>()<span class="nb">}</span>, while on Unix <span class="nb">{</span><span class="k">\tt</span> ftruncate()<span class="nb">}</span>
</div><div id="l646" class="code_block">is used.  There are minor semantic differences between these two
</div><div id="l647" class="code_block">system calls, which are reflected by the behavior of <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l648" class="code_block">file<span class="k">\_truncate</span>/2<span class="nb">}</span> on different platforms.
</div><div id="l649" class="code_block">
</div><div id="l650" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>
</div><div id="l651" class="code_block"><span class="k">\bi</span>
</div><div id="l652" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is a variable
</div><div id="l653" class="code_block"><span class="k">\bi</span>
</div><div id="l654" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> instantiation<span class="k">\_error</span><span class="nb">}</span>
</div><div id="l655" class="code_block"><span class="k">\ei</span>
</div><div id="l656" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is neither a variable, nor a a stream
</div><div id="l657" class="code_block">  term nor an alias.  
</div><div id="l658" class="code_block"><span class="k">\bi</span>
</div><div id="l659" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(stream<span class="k">\_or\_alias</span>,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l660" class="code_block"><span class="k">\ei</span>
</div><div id="l661" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is not associated with an open stream
</div><div id="l662" class="code_block"><span class="k">\bi</span>
</div><div id="l663" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> existence<span class="k">\_error</span>(stream,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l664" class="code_block"><span class="k">\ei</span>
</div><div id="l665" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> Length<span class="nb">}</span> is a variable
</div><div id="l666" class="code_block"><span class="k">\bi</span>
</div><div id="l667" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> instantiation<span class="k">\_error</span><span class="nb">}</span>
</div><div id="l668" class="code_block"><span class="k">\ei</span>
</div><div id="l669" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> Length<span class="nb">}</span> is neither a variable nor an integer
</div><div id="l670" class="code_block"><span class="k">\bi</span>
</div><div id="l671" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> type<span class="k">\_error</span>(integer,Length)<span class="nb">}</span>
</div><div id="l672" class="code_block"><span class="k">\ei</span>
</div><div id="l673" class="code_block"><span class="k">\ei</span>
</div><div id="l674" class="code_block"><span class="k">\comment</span><span class="nb">{</span>Not checking for uninstantiated Return or for negative Length<span class="nb">}</span>
</div><div id="l675" class="code_block">
</div><div id="l676" class="code_block"><span class="k">\standarditem</span><span class="nb">{</span>tmpfile<span class="k">\_open</span>(-Stream)<span class="nb">}{</span>tmpfile<span class="k">\_open</span>/1<span class="nb">}</span>
</div><div id="l677" class="code_block">    Opens a temporary file with a unique filename. The file is deleted
</div><div id="l678" class="code_block">    when it is closed or when the program terminates.
</div><div id="l679" class="code_block">
</div><div id="l680" class="code_block"><span class="k">\end</span><span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l681" class="code_block">
</div><div id="l682" class="code_block"><span class="k">\subsection</span><span class="nb">{</span>DEC-IO Style File Handling<span class="nb">}</span>
</div><div id="l683" class="code_block">
</div><div id="l684" class="code_block"><span class="k">\begin</span><span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l685" class="code_block"><span class="k">\standarditem</span><span class="nb">{</span>see(+File<span class="k">\_or\_stream</span>)<span class="nb">}{</span>see/1<span class="nb">}</span>
</div><div id="l686" class="code_block"><span class="c">%</span>
</div><div id="l687" class="code_block">Makes <span class="nb">{</span><span class="k">\tt</span> File<span class="k">\_or\_stream</span><span class="nb">}</span> the current input stream. 
</div><div id="l688" class="code_block"><span class="c">%</span>
</div><div id="l689" class="code_block"><span class="k">\begin</span><span class="nb">{</span>itemize<span class="nb">}</span>
</div><div id="l690" class="code_block"><span class="k">\item</span> If there is an open input stream associated with the file that
</div><div id="l691" class="code_block">  has <span class="nb">{</span><span class="k">\tt</span> File<span class="k">\_or\_stream</span><span class="nb">}</span> as its file name, and that stream was
</div><div id="l692" class="code_block">  opened previously, then it is made the current input stream.
</div><div id="l693" class="code_block"><span class="c">%</span>
</div><div id="l694" class="code_block"><span class="k">\item</span> Otherwise, the specified file is opened for input and made the
</div><div id="l695" class="code_block">  current input stream. If the file does not exist, <span class="nb">{</span><span class="k">\tt</span> see/1<span class="nb">}</span> throws
</div><div id="l696" class="code_block">  a permission error.
</div><div id="l697" class="code_block"><span class="k">\end</span><span class="nb">{</span>itemize<span class="nb">}</span>
</div><div id="l698" class="code_block"><span class="c">%</span>
</div><div id="l699" class="code_block">Note that <span class="nb">{</span><span class="k">\tt</span> see/1<span class="nb">}</span> is incompatible with ISO aliases -- calling <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l700" class="code_block">  see(Alias)<span class="nb">}</span> with an ISO alias will try to open a file named <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l701" class="code_block">  Alias<span class="nb">}</span> rather than using the alias.  Also note that different file
</div><div id="l702" class="code_block">names (that is, names which do not unify) represent different input
</div><div id="l703" class="code_block">streams (even if these different file names correspond to the same
</div><div id="l704" class="code_block">file).
</div><div id="l705" class="code_block">
</div><div id="l706" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>
</div><div id="l707" class="code_block"><span class="k">\bi</span>
</div><div id="l708" class="code_block"><span class="k">\item</span>  <span class="nb">{</span><span class="k">\tt</span> File<span class="k">\_or\_stream</span><span class="nb">}</span> is  a variable
</div><div id="l709" class="code_block"><span class="k">\bi</span>
</div><div id="l710" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> instantiation<span class="k">\_error</span><span class="nb">}</span>
</div><div id="l711" class="code_block"><span class="k">\ei</span>
</div><div id="l712" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> File<span class="k">\_or\_stream</span><span class="nb">}</span> is neither a variable nor an atomic file identifier nor
</div><div id="l713" class="code_block">  a stream identifier.
</div><div id="l714" class="code_block"><span class="k">\bi</span>
</div><div id="l715" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(stream<span class="k">\_or\_path</span>,F)<span class="nb">}</span>
</div><div id="l716" class="code_block"><span class="k">\ei</span>
</div><div id="l717" class="code_block"><span class="k">\item</span> File <span class="nb">{</span><span class="k">\tt</span> File<span class="k">\_or\_stream</span><span class="nb">}</span> is directory or file is not readable. 
</div><div id="l718" class="code_block"><span class="k">\bi</span>
</div><div id="l719" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> permission<span class="k">\_error</span>(open,file,F)<span class="nb">}</span>
</div><div id="l720" class="code_block"><span class="k">\ei</span>
</div><div id="l721" class="code_block"><span class="k">\item</span> File <span class="nb">{</span><span class="k">\tt</span> File<span class="k">\_or\_stream</span><span class="nb">}</span> does not exist. 
</div><div id="l722" class="code_block"><span class="k">\bi</span>
</div><div id="l723" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> existence<span class="k">\_error</span>(stream<span class="k">\_or\_path</span>,F)<span class="nb">}</span>
</div><div id="l724" class="code_block"><span class="k">\ei</span>
</div><div id="l725" class="code_block"><span class="k">\ei</span>
</div><div id="l726" class="code_block">
</div><div id="l727" class="code_block"><span class="k">\standarditem</span><span class="nb">{</span>seeing(?F)<span class="nb">}{</span>seeing/1<span class="nb">}</span>
</div><div id="l728" class="code_block">    <span class="nb">{</span><span class="k">\tt</span> F<span class="nb">}</span> is unified with the name of the current input stream.
</div><div id="l729" class="code_block">    This is exactly the same with predicate <span class="nb">{</span><span class="k">\tt</span> current<span class="k">\_input</span>/1<span class="nb">}</span>
</div><div id="l730" class="code_block">    described in Section~<span class="k">\ref</span><span class="nb">{</span>State<span class="nb">}</span>, and it is only provided for
</div><div id="l731" class="code_block">    upwards compatibility reasons.
</div><div id="l732" class="code_block">
</div><div id="l733" class="code_block"><span class="k">\standarditem</span><span class="nb">{</span>seen<span class="nb">}{</span>seen/0<span class="nb">}</span>
</div><div id="l734" class="code_block">    Closes the current input stream. 
</div><div id="l735" class="code_block">    Current input reverts to <span class="nb">{</span><span class="k">\tt</span> ``userin&#39;&#39;<span class="nb">}</span> (the standard input stream).
</div><div id="l736" class="code_block">
</div><div id="l737" class="code_block"><span class="k">\standarditem</span><span class="nb">{</span>tell(+F)<span class="nb">}{</span>tell/1<span class="nb">}</span>
</div><div id="l738" class="code_block">    Makes file <span class="nb">{</span><span class="k">\tt</span> F<span class="nb">}</span> the current output stream. 
</div><div id="l739" class="code_block">    <span class="k">\begin</span><span class="nb">{</span>itemize<span class="nb">}</span>
</div><div id="l740" class="code_block">    <span class="k">\item</span> If there is an open output stream associated with <span class="nb">{</span><span class="k">\em</span> F<span class="nb">}</span>  
</div><div id="l741" class="code_block">          and that was opened previously 
</div><div id="l742" class="code_block">          by <span class="nb">{</span><span class="k">\tt</span> tell/1<span class="nb">}</span>, then that stream is made the current output 
</div><div id="l743" class="code_block">	  stream. 
</div><div id="l744" class="code_block">    <span class="k">\item</span> Otherwise, the specified file is opened for output and made the
</div><div id="l745" class="code_block">          current output stream. If the file does not exist, it is created.
</div><div id="l746" class="code_block">    <span class="k">\end</span><span class="nb">{</span>itemize<span class="nb">}</span>
</div><div id="l747" class="code_block">
</div><div id="l748" class="code_block">    Also note that different file names (that is, names which do not unify) 
</div><div id="l749" class="code_block">    represent different output streams (even if these different file names 
</div><div id="l750" class="code_block">    correspond to the same file).
</div><div id="l751" class="code_block">
</div><div id="l752" class="code_block">    The implementation of the ISO predicate <span class="nb">{</span><span class="k">\tt</span> set<span class="k">\_output</span>/1<span class="nb">}</span>, is
</div><div id="l753" class="code_block">    essentially that of <span class="nb">{</span><span class="k">\tt</span> tell/1<span class="nb">}</span>.
</div><div id="l754" class="code_block">
</div><div id="l755" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>
</div><div id="l756" class="code_block"><span class="k">\bi</span>
</div><div id="l757" class="code_block"><span class="k">\item</span>  <span class="nb">{</span><span class="k">\tt</span> File<span class="k">\_or\_stream</span><span class="nb">}</span> is  a variable
</div><div id="l758" class="code_block"><span class="k">\bi</span>
</div><div id="l759" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> instantiation<span class="k">\_error</span><span class="nb">}</span>
</div><div id="l760" class="code_block"><span class="k">\ei</span>
</div><div id="l761" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> File<span class="k">\_or\_stream</span><span class="nb">}</span> is neither a variable nor an atomic file identifier nor
</div><div id="l762" class="code_block">  a stream identifier.
</div><div id="l763" class="code_block"><span class="k">\bi</span>
</div><div id="l764" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(stream<span class="k">\_or\_path</span>,F)<span class="nb">}</span>
</div><div id="l765" class="code_block"><span class="k">\ei</span>
</div><div id="l766" class="code_block"><span class="k">\item</span> File <span class="nb">{</span><span class="k">\tt</span> File<span class="k">\_or\_stream</span><span class="nb">}</span> is directory or file is not readable. 
</div><div id="l767" class="code_block"><span class="k">\bi</span>
</div><div id="l768" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> permission<span class="k">\_error</span>(open,file,F)<span class="nb">}</span>
</div><div id="l769" class="code_block"><span class="k">\ei</span>
</div><div id="l770" class="code_block"><span class="k">\item</span> File <span class="nb">{</span><span class="k">\tt</span> File<span class="k">\_or\_stream</span><span class="nb">}</span> does not exist. 
</div><div id="l771" class="code_block"><span class="k">\bi</span>
</div><div id="l772" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> existence<span class="k">\_error</span>(stream<span class="k">\_or\_path</span>,F)<span class="nb">}</span>
</div><div id="l773" class="code_block"><span class="k">\ei</span>
</div><div id="l774" class="code_block"><span class="k">\ei</span>
</div><div id="l775" class="code_block">
</div><div id="l776" class="code_block"><span class="k">\standarditem</span><span class="nb">{</span>telling(?F)<span class="nb">}{</span>telling/1<span class="nb">}</span>
</div><div id="l777" class="code_block">    <span class="nb">{</span><span class="k">\tt</span> F<span class="nb">}</span> is unified with the name of the current output stream.
</div><div id="l778" class="code_block">    This predicate is exactly the same with predicate <span class="nb">{</span><span class="k">\tt</span> current<span class="k">\_output</span>/1<span class="nb">}</span>
</div><div id="l779" class="code_block">    described in Section~<span class="k">\ref</span><span class="nb">{</span>State<span class="nb">}</span>, and it is only provided for
</div><div id="l780" class="code_block">    upwards compatibility reasons.
</div><div id="l781" class="code_block">
</div><div id="l782" class="code_block"><span class="k">\standarditem</span><span class="nb">{</span>told<span class="nb">}{</span>told/0<span class="nb">}</span>
</div><div id="l783" class="code_block">    Closes the current output stream. 
</div><div id="l784" class="code_block">    Current output stream reverts to ``userout&#39;&#39; (the standard output stream).
</div><div id="l785" class="code_block">
</div><div id="l786" class="code_block"><span class="k">\standarditem</span><span class="nb">{</span>file<span class="k">\_exists</span>(+F)<span class="nb">}{</span>file<span class="k">\_exists</span>/1<span class="nb">}</span>
</div><div id="l787" class="code_block">    Succeeds if file <span class="nb">{</span><span class="k">\tt</span> F<span class="nb">}</span> exists. <span class="nb">{</span><span class="k">\tt</span> F<span class="nb">}</span> must be instantiated to
</div><div id="l788" class="code_block">    an atom at the time of the call, or an error message is displayed on
</div><div id="l789" class="code_block">    the standard error stream and the predicate aborts.
</div><div id="l790" class="code_block">
</div><div id="l791" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>
</div><div id="l792" class="code_block">    <span class="k">\begin</span> <span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l793" class="code_block">    <span class="k">\item</span><span class="na">[{\tt instantiation\_error}]</span>
</div><div id="l794" class="code_block">	<span class="nb">{</span><span class="k">\tt</span> F<span class="nb">}</span> is uninstantiated.
</div><div id="l795" class="code_block">    <span class="k">\end</span><span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l796" class="code_block">
</div><div id="l797" class="code_block"><span class="k">\end</span><span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l798" class="code_block">
</div><div id="l799" class="code_block">
</div><div id="l800" class="code_block"><span class="k">\subsection</span><span class="nb">{</span>Character I/O<span class="nb">}</span>
</div><div id="l801" class="code_block"><span class="k">\begin</span><span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l802" class="code_block">
</div><div id="l803" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>nl<span class="nb">}{</span>nl/0<span class="nb">}</span>
</div><div id="l804" class="code_block">A new line character is sent to the current output stream.
</div><div id="l805" class="code_block">
</div><div id="l806" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>nl(+Stream<span class="k">\_or\_alias</span>)<span class="nb">}{</span>nl/1<span class="nb">}</span>
</div><div id="l807" class="code_block">A new line character is sent to the designated output stream.
</div><div id="l808" class="code_block">
</div><div id="l809" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>
</div><div id="l810" class="code_block"><span class="k">\bi</span>
</div><div id="l811" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is a variable
</div><div id="l812" class="code_block"><span class="k">\bi</span>
</div><div id="l813" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> instantiation<span class="k">\_error</span><span class="nb">}</span>
</div><div id="l814" class="code_block"><span class="k">\ei</span>
</div><div id="l815" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is neither a variable nor a stream term nor an alias.
</div><div id="l816" class="code_block"><span class="k">\bi</span>
</div><div id="l817" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(stream<span class="k">\_or\_alias</span>,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l818" class="code_block"><span class="k">\ei</span>
</div><div id="l819" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is not associated with an open stream
</div><div id="l820" class="code_block"><span class="k">\bi</span>
</div><div id="l821" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> existence<span class="k">\_error</span>(stream,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l822" class="code_block"><span class="k">\ei</span>
</div><div id="l823" class="code_block"><span class="k">\ei</span>
</div><div id="l824" class="code_block">
</div><div id="l825" class="code_block"><span class="c">%-----------------------------</span>
</div><div id="l826" class="code_block"><span class="c">% Gets</span>
</div><div id="l827" class="code_block">
</div><div id="l828" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>get<span class="k">\_char</span>(+Stream<span class="k">\_or\_alias</span>,?Char)<span class="nb">}{</span>get<span class="k">\_char</span>/2<span class="nb">}</span>
</div><div id="l829" class="code_block">   Unifies <span class="nb">{</span><span class="k">\tt</span> Char<span class="nb">}</span> with the next ASCII character from <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l830" class="code_block">   Stream<span class="k">\_or\_alias</span><span class="nb">}</span>, advancing the position of the stream.  <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l831" class="code_block">   Char<span class="nb">}</span> is unified with -1 if an end of file condition is detected.
</div><div id="l832" class="code_block">
</div><div id="l833" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>
</div><div id="l834" class="code_block"><span class="k">\bi</span>
</div><div id="l835" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is a variable
</div><div id="l836" class="code_block"><span class="k">\bi</span>
</div><div id="l837" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> instantiation<span class="k">\_error</span><span class="nb">}</span>
</div><div id="l838" class="code_block"><span class="k">\ei</span>
</div><div id="l839" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is neither a variable nor a stream term nor an alias.
</div><div id="l840" class="code_block"><span class="k">\bi</span>
</div><div id="l841" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(stream<span class="k">\_or\_alias</span>,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l842" class="code_block"><span class="k">\ei</span>
</div><div id="l843" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is not associated with an open input stream
</div><div id="l844" class="code_block"><span class="k">\bi</span>
</div><div id="l845" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> existence<span class="k">\_error</span>(stream,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l846" class="code_block"><span class="k">\ei</span>
</div><div id="l847" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Char<span class="nb">}</span> is not a variable or character.
</div><div id="l848" class="code_block"><span class="k">\bi</span>
</div><div id="l849" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(character<span class="k">\_or\_variable</span>,Char)<span class="nb">}</span>
</div><div id="l850" class="code_block"><span class="k">\ei</span>
</div><div id="l851" class="code_block"><span class="k">\ei</span>
</div><div id="l852" class="code_block">
</div><div id="l853" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>get<span class="k">\_char</span>(?Char)<span class="nb">}{</span>get<span class="k">\_char</span>/1<span class="nb">}</span>
</div><div id="l854" class="code_block"><span class="c">%</span>
</div><div id="l855" class="code_block">Behaves as <span class="nb">{</span><span class="k">\tt</span> get<span class="k">\_char</span>/2<span class="nb">}</span>, but reads from the current input stream.
</div><div id="l856" class="code_block">
</div><div id="l857" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>
</div><div id="l858" class="code_block"><span class="k">\bi</span>
</div><div id="l859" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Char<span class="nb">}</span> is not a variable or character.
</div><div id="l860" class="code_block"><span class="k">\bi</span>
</div><div id="l861" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(character<span class="k">\_or\_variable</span>,Char)<span class="nb">}</span>
</div><div id="l862" class="code_block"><span class="k">\ei</span>
</div><div id="l863" class="code_block"><span class="k">\ei</span>
</div><div id="l864" class="code_block">
</div><div id="l865" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>get<span class="k">\_code</span>(+Stream<span class="k">\_or\_alias</span>,?Code)<span class="nb">}{</span>get<span class="k">\_code</span>/2<span class="nb">}</span>
</div><div id="l866" class="code_block"><span class="c">%</span>
</div><div id="l867" class="code_block">   <span class="nb">{</span><span class="k">\tt</span> Code<span class="nb">}</span> unifies with the ASCII code of the next character from
</div><div id="l868" class="code_block">   <span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span>.  The position of the stream is advanced.
</div><div id="l869" class="code_block">
</div><div id="l870" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>
</div><div id="l871" class="code_block"><span class="k">\bi</span>
</div><div id="l872" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is a variable
</div><div id="l873" class="code_block"><span class="k">\bi</span>
</div><div id="l874" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> instantiation<span class="k">\_error</span><span class="nb">}</span>
</div><div id="l875" class="code_block"><span class="k">\ei</span>
</div><div id="l876" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is neither a variable nor a stream term nor an alias.
</div><div id="l877" class="code_block"><span class="k">\bi</span>
</div><div id="l878" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(stream<span class="k">\_or\_alias</span>,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l879" class="code_block"><span class="k">\ei</span>
</div><div id="l880" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is not associated with an open input stream
</div><div id="l881" class="code_block"><span class="k">\bi</span>
</div><div id="l882" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> existence<span class="k">\_error</span>(stream,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l883" class="code_block"><span class="k">\ei</span>
</div><div id="l884" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Code<span class="nb">}</span> is not a variable or character code
</div><div id="l885" class="code_block"><span class="k">\bi</span>
</div><div id="l886" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(character<span class="k">\_code\_or\_variable</span>,Code)<span class="nb">}</span>
</div><div id="l887" class="code_block"><span class="k">\ei</span>
</div><div id="l888" class="code_block"><span class="k">\ei</span>
</div><div id="l889" class="code_block">
</div><div id="l890" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>get<span class="k">\_code</span>(?Code)<span class="nb">}{</span>get<span class="k">\_code</span>/1<span class="nb">}</span>
</div><div id="l891" class="code_block"><span class="c">%</span>
</div><div id="l892" class="code_block">Behaves as <span class="nb">{</span><span class="k">\tt</span> get<span class="k">\_code</span>/2<span class="nb">}</span>, but reads from the current input stream.
</div><div id="l893" class="code_block">
</div><div id="l894" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>
</div><div id="l895" class="code_block"><span class="k">\bi</span>
</div><div id="l896" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Code<span class="nb">}</span> is not a variable or character code
</div><div id="l897" class="code_block"><span class="k">\bi</span>
</div><div id="l898" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(character<span class="k">\_code\_or\_variable</span>,Code)<span class="nb">}</span>
</div><div id="l899" class="code_block"><span class="k">\ei</span>
</div><div id="l900" class="code_block"><span class="k">\ei</span>
</div><div id="l901" class="code_block">
</div><div id="l902" class="code_block"><span class="k">\standarditem</span><span class="nb">{</span>get0(?N)<span class="nb">}{</span>get0/1<span class="nb">}</span>
</div><div id="l903" class="code_block"><span class="c">%</span>
</div><div id="l904" class="code_block"><span class="nb">{</span><span class="k">\tt</span> N<span class="nb">}</span> is the ASCII code of the next character read from the current
</div><div id="l905" class="code_block">input stream (regarded as a text stream). If the current input stream
</div><div id="l906" class="code_block">reaches its end of file, a <span class="nb">{</span><span class="k">\tt</span> -1<span class="nb">}</span> is returned.  This predicate does
</div><div id="l907" class="code_block">not check for errors, so that it is faster (and potentially less safe)
</div><div id="l908" class="code_block">than, e.g. <span class="nb">{</span><span class="k">\tt</span> get<span class="k">\_code</span>/1<span class="nb">}</span>.
</div><div id="l909" class="code_block">
</div><div id="l910" class="code_block"><span class="k">\standarditem</span><span class="nb">{</span>get(?N)<span class="nb">}{</span>get/1<span class="nb">}</span>
</div><div id="l911" class="code_block">    <span class="nb">{</span><span class="k">\tt</span> N<span class="nb">}</span> is the ASCII code of the next non-blank printable
</div><div id="l912" class="code_block">    character from the current input stream (regarded as a text
</div><div id="l913" class="code_block">    stream).  If the current input stream reaches its end of file, a
</div><div id="l914" class="code_block">    <span class="nb">{</span><span class="k">\tt</span> -1<span class="nb">}</span> is returned.
</div><div id="l915" class="code_block">
</div><div id="l916" class="code_block"><span class="c">%------------------------------------</span>
</div><div id="l917" class="code_block"><span class="c">% Peeks</span>
</div><div id="l918" class="code_block">
</div><div id="l919" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>peek<span class="k">\_char</span>(+Stream<span class="k">\_or\_alias</span>,?Char)<span class="nb">}{</span>peek<span class="k">\_char</span>/2<span class="nb">}</span>
</div><div id="l920" class="code_block"><span class="c">%</span>
</div><div id="l921" class="code_block"><span class="nb">{</span><span class="k">\tt</span> Char<span class="nb">}</span> is the next ASCII character from <span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span>.
</div><div id="l922" class="code_block">The position in <span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is unchanged.  <span class="nb">{</span><span class="k">\tt</span> Char<span class="nb">}</span> is
</div><div id="l923" class="code_block">unified with -1 if an end of file condition is detected.
</div><div id="l924" class="code_block">
</div><div id="l925" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>
</div><div id="l926" class="code_block"><span class="k">\bi</span>
</div><div id="l927" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is a variable
</div><div id="l928" class="code_block"><span class="k">\bi</span>
</div><div id="l929" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> instantiation<span class="k">\_error</span><span class="nb">}</span>
</div><div id="l930" class="code_block"><span class="k">\ei</span>
</div><div id="l931" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is neither a variable nor a stream term nor an alias.
</div><div id="l932" class="code_block"><span class="k">\bi</span>
</div><div id="l933" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(stream<span class="k">\_or\_alias</span>,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l934" class="code_block"><span class="k">\ei</span>
</div><div id="l935" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is not associated with an open input stream
</div><div id="l936" class="code_block"><span class="k">\bi</span>
</div><div id="l937" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> existence<span class="k">\_error</span>(stream,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l938" class="code_block"><span class="k">\ei</span>
</div><div id="l939" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Char<span class="nb">}</span> is not a variable or character.
</div><div id="l940" class="code_block"><span class="k">\bi</span>
</div><div id="l941" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(character<span class="k">\_or\_variable</span>,Char)<span class="nb">}</span>
</div><div id="l942" class="code_block"><span class="k">\ei</span>
</div><div id="l943" class="code_block"><span class="k">\ei</span>
</div><div id="l944" class="code_block">
</div><div id="l945" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>peek<span class="k">\_char</span>(?Char)<span class="nb">}{</span>peek<span class="k">\_char</span>/1<span class="nb">}</span>
</div><div id="l946" class="code_block"><span class="c">%</span>
</div><div id="l947" class="code_block"><span class="nb">{</span><span class="k">\tt</span> Char<span class="nb">}</span> is the next ASCII character from the current input stream.
</div><div id="l948" class="code_block">The position in the current input stream is unchanged.  <span class="nb">{</span><span class="k">\tt</span> Char<span class="nb">}</span> is
</div><div id="l949" class="code_block">unified with -1 if an end of file condition is detected.
</div><div id="l950" class="code_block">
</div><div id="l951" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>
</div><div id="l952" class="code_block"><span class="k">\bi</span>
</div><div id="l953" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Char<span class="nb">}</span> is not a variable or character.
</div><div id="l954" class="code_block"><span class="k">\bi</span>
</div><div id="l955" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(character<span class="k">\_or\_variable</span>,Char)<span class="nb">}</span>
</div><div id="l956" class="code_block"><span class="k">\ei</span>
</div><div id="l957" class="code_block"><span class="k">\ei</span>
</div><div id="l958" class="code_block">
</div><div id="l959" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>peek<span class="k">\_code</span>(+Stream<span class="k">\_or\_alias</span>,?Code)<span class="nb">}{</span>peek<span class="k">\_code</span>/2<span class="nb">}</span>
</div><div id="l960" class="code_block"><span class="c">%</span>
</div><div id="l961" class="code_block"><span class="nb">{</span><span class="k">\tt</span> Code<span class="nb">}</span> is the next ASCII coder from <span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span>.
</div><div id="l962" class="code_block">The position in <span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is unchanged.  <span class="nb">{</span><span class="k">\tt</span> Code<span class="nb">}</span> is
</div><div id="l963" class="code_block">unified with -1 if an end of file condition is detected.
</div><div id="l964" class="code_block">
</div><div id="l965" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>
</div><div id="l966" class="code_block"><span class="k">\bi</span>
</div><div id="l967" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is a variable
</div><div id="l968" class="code_block"><span class="k">\bi</span>
</div><div id="l969" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> instantiation<span class="k">\_error</span><span class="nb">}</span>
</div><div id="l970" class="code_block"><span class="k">\ei</span>
</div><div id="l971" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is neither a variable nor a stream term nor an alias.
</div><div id="l972" class="code_block"><span class="k">\bi</span>
</div><div id="l973" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(stream<span class="k">\_or\_alias</span>,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l974" class="code_block"><span class="k">\ei</span>
</div><div id="l975" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is not associated with an open input stream
</div><div id="l976" class="code_block"><span class="k">\bi</span>
</div><div id="l977" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> existence<span class="k">\_error</span>(stream,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l978" class="code_block"><span class="k">\ei</span>
</div><div id="l979" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Code<span class="nb">}</span> is not a variable or character.
</div><div id="l980" class="code_block"><span class="k">\bi</span>
</div><div id="l981" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(character<span class="k">\_code\_or\_variable</span>,Code)<span class="nb">}</span>
</div><div id="l982" class="code_block"><span class="k">\ei</span>
</div><div id="l983" class="code_block"><span class="k">\ei</span>
</div><div id="l984" class="code_block">
</div><div id="l985" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>peek<span class="k">\_code</span>(?Code)<span class="nb">}{</span>peek<span class="k">\_code</span>/1<span class="nb">}</span>
</div><div id="l986" class="code_block"><span class="c">%</span>
</div><div id="l987" class="code_block">Behaves as <span class="nb">{</span><span class="k">\tt</span> peek<span class="k">\_code</span>/1<span class="nb">}</span>, but the current input stream is used.
</div><div id="l988" class="code_block">
</div><div id="l989" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>
</div><div id="l990" class="code_block"><span class="k">\bi</span>
</div><div id="l991" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Char<span class="nb">}</span> is not a variable or character.
</div><div id="l992" class="code_block"><span class="k">\bi</span>
</div><div id="l993" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(character<span class="k">\_code\_or\_variable</span>,Code)<span class="nb">}</span>
</div><div id="l994" class="code_block"><span class="k">\ei</span>
</div><div id="l995" class="code_block"><span class="k">\ei</span>
</div><div id="l996" class="code_block">
</div><div id="l997" class="code_block"><span class="c">%----------------------------------------------</span>
</div><div id="l998" class="code_block"><span class="c">% Puts</span>
</div><div id="l999" class="code_block"><span class="c">%----------------------------------------------</span>
</div><div id="l1000" class="code_block">
</div><div id="l1001" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>put<span class="k">\_char</span>(+Stream,+Char)<span class="nb">}{</span>put<span class="k">\_char</span>/2<span class="nb">}</span>
</div><div id="l1002" class="code_block"><span class="c">%</span>
</div><div id="l1003" class="code_block">Puts the ASCII character <span class="nb">{</span><span class="k">\tt</span> Char<span class="nb">}</span> to <span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span>.
</div><div id="l1004" class="code_block">
</div><div id="l1005" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>
</div><div id="l1006" class="code_block"><span class="k">\bi</span>
</div><div id="l1007" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is a variable
</div><div id="l1008" class="code_block"><span class="k">\bi</span>
</div><div id="l1009" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> instantiation<span class="k">\_error</span><span class="nb">}</span>
</div><div id="l1010" class="code_block"><span class="k">\ei</span>
</div><div id="l1011" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is neither a variable nor a stream term nor an alias.
</div><div id="l1012" class="code_block"><span class="k">\bi</span>
</div><div id="l1013" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(stream<span class="k">\_or\_alias</span>,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l1014" class="code_block"><span class="k">\ei</span>
</div><div id="l1015" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is not associated with an open input stream
</div><div id="l1016" class="code_block"><span class="k">\bi</span>
</div><div id="l1017" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> existence<span class="k">\_error</span>(stream,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l1018" class="code_block"><span class="k">\ei</span>
</div><div id="l1019" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Char<span class="nb">}</span> is a not a character
</div><div id="l1020" class="code_block"><span class="k">\bi</span>
</div><div id="l1021" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> type<span class="k">\_error</span>(character,Char)<span class="nb">}</span>
</div><div id="l1022" class="code_block"><span class="k">\ei</span>
</div><div id="l1023" class="code_block"><span class="k">\ei</span>
</div><div id="l1024" class="code_block">
</div><div id="l1025" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>put<span class="k">\_char</span>(+Char)<span class="nb">}{</span>put<span class="k">\_char</span>/1<span class="nb">}</span>
</div><div id="l1026" class="code_block"><span class="c">%</span>
</div><div id="l1027" class="code_block">Puts the ASCII code of the character <span class="nb">{</span><span class="k">\tt</span> Char<span class="nb">}</span> to the current output
</div><div id="l1028" class="code_block">stream.
</div><div id="l1029" class="code_block">
</div><div id="l1030" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>
</div><div id="l1031" class="code_block"><span class="k">\bi</span>
</div><div id="l1032" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Code<span class="nb">}</span> is a not a character.
</div><div id="l1033" class="code_block"><span class="k">\bi</span>
</div><div id="l1034" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> type<span class="k">\_error</span>(character,Char)<span class="nb">}</span>
</div><div id="l1035" class="code_block"><span class="k">\ei</span>
</div><div id="l1036" class="code_block"><span class="k">\ei</span>
</div><div id="l1037" class="code_block">
</div><div id="l1038" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>put<span class="k">\_code</span>(+Stream,+Code)<span class="nb">}{</span>put<span class="k">\_code</span>/2<span class="nb">}</span>
</div><div id="l1039" class="code_block"><span class="c">%</span>
</div><div id="l1040" class="code_block">Puts the ASCII code of the character <span class="nb">{</span><span class="k">\tt</span> Char<span class="nb">}</span> to <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l1041" class="code_block">Stream<span class="k">\_or\_alias</span><span class="nb">}</span>.
</div><div id="l1042" class="code_block">
</div><div id="l1043" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>
</div><div id="l1044" class="code_block"><span class="k">\bi</span>
</div><div id="l1045" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is a variable
</div><div id="l1046" class="code_block"><span class="k">\bi</span>
</div><div id="l1047" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> instantiation<span class="k">\_error</span><span class="nb">}</span>
</div><div id="l1048" class="code_block"><span class="k">\ei</span>
</div><div id="l1049" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is neither a variable nor a stream term nor an alias.
</div><div id="l1050" class="code_block"><span class="k">\bi</span>
</div><div id="l1051" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(stream<span class="k">\_or\_alias</span>,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l1052" class="code_block"><span class="k">\ei</span>
</div><div id="l1053" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is not associated with an open input stream
</div><div id="l1054" class="code_block"><span class="k">\bi</span>
</div><div id="l1055" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> existence<span class="k">\_error</span>(stream,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l1056" class="code_block"><span class="k">\ei</span>
</div><div id="l1057" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Code<span class="nb">}</span> is a not a character code
</div><div id="l1058" class="code_block"><span class="k">\bi</span>
</div><div id="l1059" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> type<span class="k">\_error</span>(character<span class="k">\_code</span>,Code)<span class="nb">}</span>
</div><div id="l1060" class="code_block"><span class="k">\ei</span>
</div><div id="l1061" class="code_block"><span class="k">\ei</span>
</div><div id="l1062" class="code_block">
</div><div id="l1063" class="code_block">
</div><div id="l1064" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>put<span class="k">\_code</span>(+Code)<span class="nb">}{</span>put<span class="k">\_code</span>/1<span class="nb">}</span>
</div><div id="l1065" class="code_block"><span class="c">%</span>
</div><div id="l1066" class="code_block">Puts the ASCII code <span class="nb">{</span><span class="k">\tt</span> Code<span class="nb">}</span> to the current output stream.
</div><div id="l1067" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>
</div><div id="l1068" class="code_block"><span class="k">\bi</span>
</div><div id="l1069" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Code<span class="nb">}</span> is a not a character code.
</div><div id="l1070" class="code_block"><span class="k">\bi</span>
</div><div id="l1071" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> type<span class="k">\_error</span>(character<span class="k">\_code</span>,Code)<span class="nb">}</span>
</div><div id="l1072" class="code_block"><span class="k">\ei</span>
</div><div id="l1073" class="code_block"><span class="k">\ei</span>
</div><div id="l1074" class="code_block">
</div><div id="l1075" class="code_block"><span class="k">\standarditem</span><span class="nb">{</span>put(+Code)<span class="nb">}{</span>put/1<span class="nb">}</span>
</div><div id="l1076" class="code_block">    Puts the ASCII character code <span class="nb">{</span><span class="k">\tt</span> N<span class="nb">}</span> to the current output stream.
</div><div id="l1077" class="code_block">
</div><div id="l1078" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>
</div><div id="l1079" class="code_block"><span class="k">\bi</span>
</div><div id="l1080" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Code<span class="nb">}</span> is a not a character code.
</div><div id="l1081" class="code_block"><span class="k">\bi</span>
</div><div id="l1082" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> type<span class="k">\_error</span>(character<span class="k">\_code</span>,Code)<span class="nb">}</span>
</div><div id="l1083" class="code_block"><span class="k">\ei</span>
</div><div id="l1084" class="code_block"><span class="k">\ei</span>
</div><div id="l1085" class="code_block">
</div><div id="l1086" class="code_block"><span class="k">\standarditem</span><span class="nb">{</span>tab(+N)<span class="nb">}{</span>tab/1<span class="nb">}</span>
</div><div id="l1087" class="code_block">    Puts <span class="nb">{</span><span class="k">\tt</span> N<span class="nb">}</span> spaces to the current output stream. 
</div><div id="l1088" class="code_block">
</div><div id="l1089" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>
</div><div id="l1090" class="code_block"><span class="k">\bi</span>
</div><div id="l1091" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Code<span class="nb">}</span> is a not a positiveInteger
</div><div id="l1092" class="code_block"><span class="k">\bi</span>
</div><div id="l1093" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(positiveInteger,Code)<span class="nb">}</span>
</div><div id="l1094" class="code_block"><span class="k">\ei</span>
</div><div id="l1095" class="code_block"><span class="k">\ei</span>
</div><div id="l1096" class="code_block">
</div><div id="l1097" class="code_block"><span class="k">\isorepeatitem</span><span class="nb">{</span>get<span class="k">\_byte</span>/1<span class="nb">}{</span>get<span class="k">\_byte</span>/1<span class="nb">}</span>
</div><div id="l1098" class="code_block"><span class="k">\isorepeatitem</span><span class="nb">{</span>get<span class="k">\_byte</span>/2<span class="nb">}{</span>get<span class="k">\_byte</span>/2<span class="nb">}</span>
</div><div id="l1099" class="code_block"><span class="k">\isorepeatitem</span><span class="nb">{</span>put<span class="k">\_byte</span>/1<span class="nb">}{</span>peek<span class="k">\_byte</span>/1<span class="nb">}</span>
</div><div id="l1100" class="code_block"><span class="k">\isorepeatitem</span><span class="nb">{</span>put<span class="k">\_byte</span>/2<span class="nb">}{</span>peek<span class="k">\_byte</span>/2<span class="nb">}</span>
</div><div id="l1101" class="code_block"><span class="k">\isorepeatitem</span><span class="nb">{</span>put<span class="k">\_byte</span>/1<span class="nb">}{</span>put<span class="k">\_byte</span>/1<span class="nb">}</span>
</div><div id="l1102" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>put<span class="k">\_byte</span>/2<span class="nb">}{</span>put<span class="k">\_byte</span>/2<span class="nb">}</span>
</div><div id="l1103" class="code_block"><span class="c">%</span>
</div><div id="l1104" class="code_block">In XSB, these predicates are simply aliases for the associated <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l1105" class="code_block">  xxx<span class="k">\_code</span><span class="nb">}</span> predicates and behave accordingly.  This is safe to do
</div><div id="l1106" class="code_block">since the reader for <span class="k">\version</span><span class="nb">{}</span> of XSB supports only ASCII character
</div><div id="l1107" class="code_block">codes, which are themselves single bytes.  
</div><div id="l1108" class="code_block"><span class="c">%</span>
</div><div id="l1109" class="code_block"><span class="k">\end</span><span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l1110" class="code_block">
</div><div id="l1111" class="code_block"><span class="c">%---------------------------------------------------------------------------------------------------------</span>
</div><div id="l1112" class="code_block"><span class="k">\subsection</span><span class="nb">{</span>Term I/O<span class="nb">}</span>
</div><div id="l1113" class="code_block"><span class="k">\begin</span><span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l1114" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>read(?Term)<span class="nb">}{</span>read/1<span class="nb">}</span>
</div><div id="l1115" class="code_block">    A HiLog term is read from the current or designated input stream,
</div><div id="l1116" class="code_block">    and unified with <span class="nb">{</span><span class="k">\tt</span> Term<span class="nb">}</span> according to the operator declarations
</div><div id="l1117" class="code_block">    in force.  (See Section~<span class="k">\ref</span><span class="nb">{</span>TermSyntax<span class="nb">}</span> for the definition and
</div><div id="l1118" class="code_block">    syntax of HiLog terms). The term must be delimited by a full stop
</div><div id="l1119" class="code_block">    (i.e. a ``.&#39;&#39; followed by a carriage-return, space or tab).
</div><div id="l1120" class="code_block">    Predicate <span class="nb">{</span><span class="k">\tt</span> read/1<span class="nb">}</span> does not return until a valid HiLog term is
</div><div id="l1121" class="code_block">    successfully read; that is, in the presence of syntax errors <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l1122" class="code_block">    read/1<span class="nb">}</span> does not fail but continues reading terms until a term
</div><div id="l1123" class="code_block">    with no syntax errors is encountered.  If a call to <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l1124" class="code_block">    read(Term)<span class="nb">}</span> causes the end of the current input stream to be
</div><div id="l1125" class="code_block">    reached, variable <span class="nb">{</span><span class="k">\tt</span> Term<span class="nb">}</span> is unified with the term <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l1126" class="code_block">    end<span class="k">\_of\_file</span><span class="nb">}</span>.  In that case, further calls to <span class="nb">{</span><span class="k">\tt</span> read/1<span class="nb">}</span> for
</div><div id="l1127" class="code_block">    the same input stream will cause an error failure.
</div><div id="l1128" class="code_block">
</div><div id="l1129" class="code_block"><span class="c">%TLS: This doesn&#39;t actually seem to be the behavior.  Exceptions:</span>
</div><div id="l1130" class="code_block"><span class="c">% \begin{description} </span>
</div><div id="l1131" class="code_block"><span class="c">% \item[{\tt existence\_error}] {\tt end\_of\_file}</span>
</div><div id="l1132" class="code_block"><span class="c">%  is reached before the current term is read.  </span>
</div><div id="l1133" class="code_block"><span class="c">%\end{description} </span>
</div><div id="l1134" class="code_block"><span class="c">%</span>
</div><div id="l1135" class="code_block">In <span class="k">\version</span>, <span class="nb">{</span><span class="k">\tt</span> read/[1,2]<span class="nb">}</span> are non ISO-compliant in how they
</div><div id="l1136" class="code_block">handle syntax errors or their behavior when encountering an end of
</div><div id="l1137" class="code_block">file indicator.
</div><div id="l1138" class="code_block">
</div><div id="l1139" class="code_block"><span class="c">%--------</span>
</div><div id="l1140" class="code_block">
</div><div id="l1141" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>read(+Stream<span class="k">\_or\_alias</span>, ?Term)<span class="nb">}{</span>read/2<span class="nb">}</span>
</div><div id="l1142" class="code_block">	<span class="nb">{</span><span class="k">\tt</span> read/2<span class="nb">}</span> has the same behavior as <span class="nb">{</span><span class="k">\tt</span> read/1<span class="nb">}</span> but the
</div><div id="l1143" class="code_block">	input stream is explicitly designated by <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l1144" class="code_block">	Stream<span class="k">\_or\_alias</span><span class="nb">}</span>.
</div><div id="l1145" class="code_block">
</div><div id="l1146" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>
</div><div id="l1147" class="code_block"><span class="k">\bi</span>
</div><div id="l1148" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is a variable
</div><div id="l1149" class="code_block"><span class="k">\bi</span>
</div><div id="l1150" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> instantiation<span class="k">\_error</span><span class="nb">}</span>
</div><div id="l1151" class="code_block"><span class="k">\ei</span>
</div><div id="l1152" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is neither a variable nor a stream term nor an alias.
</div><div id="l1153" class="code_block"><span class="k">\bi</span>
</div><div id="l1154" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(stream<span class="k">\_or\_alias</span>,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l1155" class="code_block"><span class="k">\ei</span>
</div><div id="l1156" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is not associated with an open stream
</div><div id="l1157" class="code_block"><span class="k">\bi</span>
</div><div id="l1158" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> existence<span class="k">\_error</span>(stream,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l1159" class="code_block"><span class="k">\ei</span>
</div><div id="l1160" class="code_block"><span class="k">\ei</span>
</div><div id="l1161" class="code_block">
</div><div id="l1162" class="code_block"><span class="c">%--------</span>
</div><div id="l1163" class="code_block"><span class="k">\standarditem</span><span class="nb">{</span>read<span class="k">\_canonical</span>(-Term)<span class="nb">}{</span>read<span class="k">\_canonical</span>/1<span class="nb">}</span>
</div><div id="l1164" class="code_block">Reads a term that is in canonical format from the current input stream
</div><div id="l1165" class="code_block">and returns it in <span class="nb">{</span><span class="k">\tt</span> Term<span class="nb">}</span>. On end-of-file, it returns the atom <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l1166" class="code_block">end<span class="k">\_of\_file</span><span class="nb">}</span>.  If it encounters an error, it prints an error message
</div><div id="l1167" class="code_block">on stderr and returns the atom <span class="nb">{</span><span class="k">\tt</span> read<span class="k">\_canonical\_error</span><span class="nb">}</span>. This is
</div><div id="l1168" class="code_block">significantly faster than <span class="nb">{</span><span class="k">\tt</span> read/1<span class="nb">}</span>, but requires the input to be
</div><div id="l1169" class="code_block">in canonical form.
</div><div id="l1170" class="code_block">
</div><div id="l1171" class="code_block"><span class="c">%In \version, {\tt read\_canonical/[1,2]} are non ISO-compliant in how they</span>
</div><div id="l1172" class="code_block"><span class="c">%handle syntax errors or their behavior when encountering an end of</span>
</div><div id="l1173" class="code_block"><span class="c">%file indicator.</span>
</div><div id="l1174" class="code_block">
</div><div id="l1175" class="code_block"><span class="k">\standarditem</span><span class="nb">{</span>read<span class="k">\_canonical</span>(+Stream<span class="k">\_or\_alias</span>),-Term)<span class="nb">}{</span>read<span class="k">\_canonical</span>/2<span class="nb">}</span>
</div><div id="l1176" class="code_block">Behaves as <span class="nb">{</span><span class="k">\tt</span> read<span class="k">\_canonical</span>/1<span class="nb">}</span>, but reads from <span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span>.
</div><div id="l1177" class="code_block">
</div><div id="l1178" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>
</div><div id="l1179" class="code_block"><span class="k">\bi</span>
</div><div id="l1180" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is a variable
</div><div id="l1181" class="code_block"><span class="k">\bi</span>
</div><div id="l1182" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> instantiation<span class="k">\_error</span><span class="nb">}</span>
</div><div id="l1183" class="code_block"><span class="k">\ei</span>
</div><div id="l1184" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is neither a variable nor a stream term nor an alias.
</div><div id="l1185" class="code_block"><span class="k">\bi</span>
</div><div id="l1186" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(stream<span class="k">\_or\_alias</span>,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l1187" class="code_block"><span class="k">\ei</span>
</div><div id="l1188" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is not associated with an open input stream
</div><div id="l1189" class="code_block"><span class="k">\bi</span>
</div><div id="l1190" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> existence<span class="k">\_error</span>(stream,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l1191" class="code_block"><span class="k">\ei</span>
</div><div id="l1192" class="code_block"><span class="k">\ei</span>
</div><div id="l1193" class="code_block">
</div><div id="l1194" class="code_block"><span class="c">%--------</span>
</div><div id="l1195" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>read<span class="k">\_term</span>(?Term,?OptionsList)<span class="nb">}{</span>read<span class="k">\_term</span>/2<span class="nb">}</span>
</div><div id="l1196" class="code_block"><span class="c">%</span>
</div><div id="l1197" class="code_block">A term is read from the current input stream as in <span class="nb">{</span><span class="k">\tt</span> read/1<span class="nb">}</span>; but
</div><div id="l1198" class="code_block"><span class="nb">{</span><span class="k">\tt</span> OptionsList<span class="nb">}</span> is a (possibly empty) list of <span class="nb">{</span><span class="k">\em</span> read options<span class="nb">}</span>
</div><div id="l1199" class="code_block">that specifies additional behavior.  The read options include
</div><div id="l1200" class="code_block"><span class="k">\begin</span><span class="nb">{</span>itemize<span class="nb">}</span>
</div><div id="l1201" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> variables(Vars)<span class="nb">}</span>: once a term has been read, <span class="nb">{</span><span class="k">\tt</span> Vars<span class="nb">}</span> is a
</div><div id="l1202" class="code_block">list of the variables in the term, in left-to-right order. 
</div><div id="l1203" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> variable<span class="k">\_names</span>(VN<span class="k">\_List</span>)<span class="nb">}</span>: once a term has been read <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l1204" class="code_block">VN<span class="k">\_List</span><span class="nb">}</span> is a list of non-anonymous variables in the term.  The
</div><div id="l1205" class="code_block">elements of the list have the form <span class="nb">{</span><span class="k">\tt</span> A = V<span class="nb">}</span> where <span class="nb">{</span><span class="k">\tt</span> V<span class="nb">}</span> is a
</div><div id="l1206" class="code_block">non-anonymous variable of the term, and <span class="nb">{</span><span class="k">\tt</span> A<span class="nb">}</span> is the string used to
</div><div id="l1207" class="code_block">denote the variable in the input stream.
</div><div id="l1208" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> singletons(VS<span class="k">\_List</span>)<span class="nb">}</span>: once a term has been read <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l1209" class="code_block">VN<span class="k">\_List</span><span class="nb">}</span> is a list of the non-anonymous <span class="nb">{</span><span class="k">\tt</span> singleton<span class="nb">}</span> variables in
</div><div id="l1210" class="code_block">the term.  The elements of the list have the form <span class="nb">{</span><span class="k">\tt</span> A = V<span class="nb">}</span> where
</div><div id="l1211" class="code_block"><span class="nb">{</span><span class="k">\tt</span> V<span class="nb">}</span> is a non-anonymous variable of the term, and <span class="nb">{</span><span class="k">\tt</span> A<span class="nb">}</span> is the
</div><div id="l1212" class="code_block">string used to denote the variable in the input stream.
</div><div id="l1213" class="code_block"><span class="k">\end</span><span class="nb">{</span>itemize<span class="nb">}</span>
</div><div id="l1214" class="code_block">
</div><div id="l1215" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>
</div><div id="l1216" class="code_block"><span class="k">\bi</span>
</div><div id="l1217" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> OptionsList<span class="nb">}</span> is a variable, or is a list containing a
</div><div id="l1218" class="code_block">	variable element. 
</div><div id="l1219" class="code_block"><span class="k">\bi</span> 
</div><div id="l1220" class="code_block"><span class="k">\item</span> instantiation<span class="k">\_error</span>
</div><div id="l1221" class="code_block"><span class="k">\ei</span>
</div><div id="l1222" class="code_block"><span class="k">\item</span>     <span class="nb">{</span><span class="k">\tt</span> OptionsList<span class="nb">}</span> contains a non-variable element <span class="nb">{</span><span class="k">\tt</span> O<span class="nb">}</span> that is not
</div><div id="l1223" class="code_block">	a read option.
</div><div id="l1224" class="code_block"><span class="k">\bi</span>
</div><div id="l1225" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(read<span class="k">\_option</span>,O)<span class="nb">}</span>
</div><div id="l1226" class="code_block"><span class="k">\ei</span>
</div><div id="l1227" class="code_block"><span class="k">\ei</span>
</div><div id="l1228" class="code_block">
</div><div id="l1229" class="code_block"><span class="c">%--------</span>
</div><div id="l1230" class="code_block">
</div><div id="l1231" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>read<span class="k">\_term</span>(+Stream<span class="k">\_or\_alias</span>, ?Term,?OptionsList)<span class="nb">}{</span>read<span class="k">\_term</span>/3<span class="nb">}</span>
</div><div id="l1232" class="code_block"><span class="c">%</span>
</div><div id="l1233" class="code_block"><span class="nb">{</span><span class="k">\tt</span> read<span class="k">\_term</span>/3<span class="nb">}</span> has the same behavior as <span class="nb">{</span><span class="k">\tt</span> read<span class="k">\_term</span>/2<span class="nb">}</span> but
</div><div id="l1234" class="code_block">the input stream is explicitly designated using the first argument.
</div><div id="l1235" class="code_block">
</div><div id="l1236" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span> are the same as <span class="nb">{</span><span class="k">\tt</span> read<span class="k">\_term</span>/2<span class="nb">}</span>, but with the
</div><div id="l1237" class="code_block">additional errors that may arise in stream checking.
</div><div id="l1238" class="code_block"><span class="k">\bi</span>
</div><div id="l1239" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is a variable
</div><div id="l1240" class="code_block"><span class="k">\bi</span>
</div><div id="l1241" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> instantiation<span class="k">\_error</span><span class="nb">}</span>
</div><div id="l1242" class="code_block"><span class="k">\ei</span>
</div><div id="l1243" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is neither a variable nor a stream term nor an alias.
</div><div id="l1244" class="code_block"><span class="k">\bi</span>
</div><div id="l1245" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(stream<span class="k">\_or\_alias</span>,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l1246" class="code_block"><span class="k">\ei</span>
</div><div id="l1247" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is not associated with an open stream
</div><div id="l1248" class="code_block"><span class="k">\bi</span>
</div><div id="l1249" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> existence<span class="k">\_error</span>(stream,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l1250" class="code_block"><span class="k">\ei</span>
</div><div id="l1251" class="code_block"><span class="k">\ei</span>
</div><div id="l1252" class="code_block">
</div><div id="l1253" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>write<span class="k">\_term</span>(?Term,+Options)<span class="nb">}{</span>write<span class="k">\_term</span>/2<span class="nb">}</span>
</div><div id="l1254" class="code_block"><span class="c">%</span>
</div><div id="l1255" class="code_block">Outputs <span class="nb">{</span><span class="k">\tt</span> +Term<span class="nb">}</span> to the current output stream.
</div><div id="l1256" class="code_block"><span class="nb">{</span><span class="k">\tt</span> Stream<span class="nb">}</span> (<span class="nb">{</span><span class="k">\tt</span> write<span class="k">\_term</span>/3<span class="nb">}</span>) according to the list of write
</div><div id="l1257" class="code_block">options, <span class="nb">{</span><span class="k">\tt</span> Options<span class="nb">}</span>.  The current set of write options which form a
</div><div id="l1258" class="code_block">superset of the ISO-standard write options, are as follows:
</div><div id="l1259" class="code_block"><span class="c">%</span>
</div><div id="l1260" class="code_block"><span class="k">\begin</span><span class="nb">{</span>itemize<span class="nb">}</span>
</div><div id="l1261" class="code_block"><span class="c">%</span>
</div><div id="l1262" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> quoted(+Bool)<span class="nb">}</span>.  If <span class="nb">{</span><span class="k">\tt</span> Bool = true<span class="nb">}</span>, then atoms and
</div><div id="l1263" class="code_block">    functors that can&#39;t be read back by <span class="nb">{</span><span class="k">\tt</span> read/1<span class="nb">}</span> are quoted, if
</div><div id="l1264" class="code_block">    <span class="nb">{</span><span class="k">\tt</span> Bool = false<span class="nb">}</span>, each atom and functor is written as its
</div><div id="l1265" class="code_block">    unquoted name. Default value is <span class="nb">{</span><span class="k">\tt</span> false<span class="nb">}</span>.
</div><div id="l1266" class="code_block"><span class="c">%</span>
</div><div id="l1267" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> ignore<span class="k">\_ops</span>(+Bool)<span class="nb">}</span>. If <span class="nb">{</span><span class="k">\tt</span> Bool = true<span class="nb">}</span> each compound term
</div><div id="l1268" class="code_block">is output in functional notation; curly brackets and list braces are
</div><div id="l1269" class="code_block">ignored, as are all explicitly defined operators.  If <span class="nb">{</span><span class="k">\tt</span> Bool =
</div><div id="l1270" class="code_block">false<span class="nb">}</span>, curly bracketed notation and list notation is enabled when
</div><div id="l1271" class="code_block">outputting compound terms, and all other operator notation is
</div><div id="l1272" class="code_block">enabled.  Default value is <span class="nb">{</span><span class="k">\tt</span> false<span class="nb">}</span>.
</div><div id="l1273" class="code_block"><span class="c">%</span>
</div><div id="l1274" class="code_block"> <span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> numbervars(+Bool)<span class="nb">}</span>.  If <span class="nb">{</span><span class="k">\tt</span> Bool = true<span class="nb">}</span>, a term of the
</div><div id="l1275" class="code_block">form <span class="nb">{</span><span class="k">\tt</span> &#39;<span class="k">\$</span>VAR&#39;(N)<span class="nb">}</span> where <span class="nb">{</span><span class="k">\tt</span> N<span class="nb">}</span> is an integer, is output as a
</div><div id="l1276" class="code_block">variable name consisting of a capital letter possibly followed by an
</div><div id="l1277" class="code_block">integer.  A term of the form <span class="nb">{</span><span class="k">\tt</span> &#39;<span class="k">\$</span>VAR&#39;(Atom)<span class="nb">}</span> where <span class="nb">{</span><span class="k">\tt</span> Atom<span class="nb">}</span> is an
</div><div id="l1278" class="code_block">atom, is output as itself (without quotes).  Finally, a term of the
</div><div id="l1279" class="code_block">form <span class="nb">{</span><span class="k">\tt</span> &#39;<span class="k">\$</span>VAR&#39;(String)<span class="nb">}</span> where <span class="nb">{</span><span class="k">\tt</span> String<span class="nb">}</span> is a character string, is
</div><div id="l1280" class="code_block">output as the atom corresponding to this character string.  If
</div><div id="l1281" class="code_block"><span class="nb">{</span><span class="k">\tt</span> bool<span class="nb">}</span> is <span class="nb">{</span><span class="k">\tt</span> false<span class="nb">}</span> this cases are not treated in any special
</div><div id="l1282" class="code_block">way.  Default value is <span class="nb">{</span><span class="k">\tt</span> false<span class="nb">}</span>.
</div><div id="l1283" class="code_block"><span class="c">%</span>
</div><div id="l1284" class="code_block"><span class="c">% TLS: need predicate portray attribute, if we dont have it.</span>
</div><div id="l1285" class="code_block"><span class="c">%</span>
</div><div id="l1286" class="code_block"><span class="k">\comment</span><span class="nb">{</span>
</div><div id="l1287" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> portrayed(+Bool)<span class="nb">}</span>. If <span class="nb">{</span><span class="k">\tt</span> Bool = true<span class="nb">}</span>, then a call is made
</div><div id="l1288" class="code_block">to the predicate @pred<span class="nb">{</span>portray/1<span class="nb">}</span>, to
</div><div id="l1289" class="code_block">provide the user handlers for pretty printing some terms.  <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l1290" class="code_block">portray<span class="nb">_</span>attribute/1<span class="nb">}</span> is called whenever an attributed variable is to
</div><div id="l1291" class="code_block">be printed, <span class="nb">{</span><span class="k">\tt</span> portray/1<span class="nb">}</span> is called whenever a non-variable term is
</div><div id="l1292" class="code_block">to be printed.  If either call succeeds, then it is assumed that the
</div><div id="l1293" class="code_block">term has been output, else it is printed as usual.  If <span class="nb">{</span><span class="k">\tt</span> bool<span class="nb">}</span> is
</div><div id="l1294" class="code_block"><span class="nb">{</span><span class="k">\tt</span> false<span class="nb">}</span>, these predicates are not called. Default value is <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l1295" class="code_block">false<span class="nb">}</span>.  This option is set by the top-level when writing the final
</div><div id="l1296" class="code_block">values of variables, and by the debugging package when writing the
</div><div id="l1297" class="code_block">goals in the tracing messages.  Thus you can vary the forms of these
</div><div id="l1298" class="code_block">messages if you wish.
</div><div id="l1299" class="code_block"><span class="nb">}</span>
</div><div id="l1300" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> max<span class="k">\_depth</span>(+Depth)<span class="nb">}</span>. <span class="nb">{</span><span class="k">\tt</span> Depth<span class="nb">}</span> is a positive integer or
</div><div id="l1301" class="code_block">zero. If positive, it denotes the depth limit on printing compound
</div><div id="l1302" class="code_block">terms. If <span class="nb">{</span><span class="k">\tt</span> Depth<span class="nb">}</span> is zero, there is no limit. Default value is
</div><div id="l1303" class="code_block"><span class="nb">{</span><span class="k">\tt</span> 0<span class="nb">}</span> (no limit).
</div><div id="l1304" class="code_block"><span class="c">%</span>
</div><div id="l1305" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> priority(+Prio)<span class="nb">}</span> <span class="nb">{</span><span class="k">\tt</span> Prio<span class="nb">}</span> is an integer between 1 and
</div><div id="l1306" class="code_block">1200.  If the term to be printed has higher priority than <span class="nb">{</span><span class="k">\tt</span> Prio<span class="nb">}</span>,
</div><div id="l1307" class="code_block">it will be printed parenthesized.  Default value is 1200 (no term
</div><div id="l1308" class="code_block">parenthesized).
</div><div id="l1309" class="code_block"><span class="k">\end</span><span class="nb">{</span>itemize<span class="nb">}</span>
</div><div id="l1310" class="code_block">
</div><div id="l1311" class="code_block">From the following examples it can be seen that <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l1312" class="code_block">write<span class="k">\_term</span>/[2,3]<span class="nb">}</span> can duplicate the behavior of a number of other
</div><div id="l1313" class="code_block">I/O predicates such as <span class="nb">{</span><span class="k">\tt</span> write/[1,2]<span class="nb">}</span>, <span class="nb">{</span><span class="k">\tt</span> writeq/[1,2]<span class="nb">}</span>, <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l1314" class="code_block">write<span class="k">\_canonical</span>/[1,2]<span class="nb">}</span>, etc.
</div><div id="l1315" class="code_block"><span class="nb">{</span><span class="k">\small</span>
</div><div id="l1316" class="code_block"><span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l1317" class="code_block">
</div><div id="l1318" class="code_block">| ?- write<span class="nb">_</span>term(f(1+2,&#39;A&#39;,&quot;string&quot;,&#39;<span class="s">$</span><span class="nb">VAR&#39;</span><span class="o">(</span><span class="m">3</span><span class="o">)</span><span class="nb">,&#39;</span><span class="s">$</span>VAR&#39;(&#39;Temp&#39;),(multifile foo)),[]).
</div><div id="l1319" class="code_block">f(1 + 2,A,&quot;string&quot;,<span class="s">$</span><span class="nb">VAR</span><span class="o">(</span><span class="m">3</span><span class="o">)</span><span class="nb">,</span><span class="s">$</span>VAR(Temp),(multifile foo))
</div><div id="l1320" class="code_block">yes
</div><div id="l1321" class="code_block">
</div><div id="l1322" class="code_block">| ?- write<span class="nb">_</span>term(f(1+2,&#39;A&#39;,&quot;string&quot;,&#39;<span class="s">$</span><span class="nb">VAR&#39;</span><span class="o">(</span><span class="m">3</span><span class="o">)</span><span class="nb">,&#39;</span><span class="s">$</span>VAR&#39;(&#39;Temp&#39;),(multifile foo)),
</div><div id="l1323" class="code_block">                [quoted(true)]).
</div><div id="l1324" class="code_block">f(1 + 2,&#39;A&#39;,&quot;string&quot;,&#39;<span class="s">$</span><span class="nb">VAR&#39;</span><span class="o">(</span><span class="m">3</span><span class="o">)</span><span class="nb">,&#39;</span><span class="s">$</span>VAR&#39;(&#39;Temp&#39;),(multifile foo))
</div><div id="l1325" class="code_block">yes
</div><div id="l1326" class="code_block">
</div><div id="l1327" class="code_block">| ?- write<span class="nb">_</span>term(f(1+2,&#39;A&#39;,&quot;string&quot;,&#39;<span class="s">$</span><span class="nb">VAR&#39;</span><span class="o">(</span><span class="m">3</span><span class="o">)</span><span class="nb">,&#39;</span><span class="s">$</span>VAR&#39;(&#39;Temp&#39;),(multifile foo)),
</div><div id="l1328" class="code_block">                [quoted(true),ignore<span class="nb">_</span>ops(true),numbervars(true)]).
</div><div id="l1329" class="code_block">f(+(1,2),&#39;A&#39;,&#39;.&#39;(115,&#39;.&#39;(116,&#39;.&#39;(114,&#39;.&#39;(105,&#39;.&#39;(110,&#39;.&#39;(103,[])))))),D,Temp,(multifile foo))
</div><div id="l1330" class="code_block">yes
</div><div id="l1331" class="code_block">
</div><div id="l1332" class="code_block">| ?- write<span class="nb">_</span>term(f(1+2,&#39;A&#39;,&quot;string&quot;,&#39;<span class="s">$</span><span class="nb">VAR&#39;</span><span class="o">(</span><span class="m">3</span><span class="o">)</span><span class="nb">,&#39;</span><span class="s">$</span>VAR&#39;(&#39;Temp&#39;),(multifile foo)),
</div><div id="l1333" class="code_block">                [quoted(true),ignore<span class="nb">_</span>ops(true),numbervars(true),priority(1000)]).
</div><div id="l1334" class="code_block">f(+(1,2),&#39;A&#39;,&#39;.&#39;(115,&#39;.&#39;(116,&#39;.&#39;(114,&#39;.&#39;(105,&#39;.&#39;(110,&#39;.&#39;(103,[])))))),D,Temp,multifile(foo))
</div><div id="l1335" class="code_block">yes
</div><div id="l1336" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l1337" class="code_block"><span class="nb">}</span>
</div><div id="l1338" class="code_block">
</div><div id="l1339" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span> 
</div><div id="l1340" class="code_block"><span class="k">\bi</span>
</div><div id="l1341" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Options<span class="nb">}</span> is a variable
</div><div id="l1342" class="code_block"><span class="k">\bi</span>
</div><div id="l1343" class="code_block"><span class="k">\item</span>    <span class="nb">{</span><span class="k">\tt</span> instantiation<span class="k">\_error</span><span class="nb">}</span>
</div><div id="l1344" class="code_block"><span class="k">\ei</span>
</div><div id="l1345" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Options<span class="nb">}</span> neither a variable nor a list
</div><div id="l1346" class="code_block"><span class="k">\bi</span>
</div><div id="l1347" class="code_block"><span class="k">\item</span>    <span class="nb">{</span><span class="k">\tt</span> type<span class="k">\_error</span>(list,Options)<span class="nb">}</span>
</div><div id="l1348" class="code_block"><span class="k">\ei</span>
</div><div id="l1349" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Options<span class="nb">}</span> contains a variable element, <span class="nb">{</span><span class="k">\tt</span> O<span class="nb">}</span>
</div><div id="l1350" class="code_block"><span class="k">\bi</span>
</div><div id="l1351" class="code_block"><span class="k">\item</span>    <span class="nb">{</span><span class="k">\tt</span> instantiation<span class="k">\_error</span><span class="nb">}</span>
</div><div id="l1352" class="code_block"><span class="k">\ei</span>
</div><div id="l1353" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Options<span class="nb">}</span> contains an element <span class="nb">{</span><span class="k">\tt</span> O<span class="nb">}</span> that is neither a variable
</div><div id="l1354" class="code_block">nor a write option.
</div><div id="l1355" class="code_block"><span class="k">\bi</span>
</div><div id="l1356" class="code_block"><span class="k">\item</span>    <span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(write<span class="k">\_option</span>,O)<span class="nb">}</span>
</div><div id="l1357" class="code_block"><span class="k">\ei</span>
</div><div id="l1358" class="code_block"><span class="k">\ei</span>
</div><div id="l1359" class="code_block">
</div><div id="l1360" class="code_block"><span class="k">\compatability</span> In <span class="k">\version</span><span class="nb">{}</span>, <span class="nb">{</span><span class="k">\tt</span> write<span class="k">\_term</span>/[2,3]<span class="nb">}</span> do not properly
</div><div id="l1361" class="code_block">handle operators.
</div><div id="l1362" class="code_block">
</div><div id="l1363" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>write<span class="k">\_term</span>(+Stream<span class="k">\_or\_alias</span>,?Term,+Options)<span class="nb">}{</span>write<span class="k">\_term</span>/3<span class="nb">}</span>
</div><div id="l1364" class="code_block"><span class="c">% </span>
</div><div id="l1365" class="code_block">Behaves as <span class="nb">{</span><span class="k">\tt</span> write<span class="k">\_term</span>/2<span class="nb">}</span>, but writes to <span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span>.
</div><div id="l1366" class="code_block">
</div><div id="l1367" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span> are the same as <span class="nb">{</span><span class="k">\tt</span> write<span class="k">\_term</span>/2<span class="nb">}</span> but with these
</div><div id="l1368" class="code_block">additions.
</div><div id="l1369" class="code_block"><span class="k">\bi</span>
</div><div id="l1370" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is a variable
</div><div id="l1371" class="code_block"><span class="k">\bi</span>
</div><div id="l1372" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> instantiation<span class="k">\_error</span><span class="nb">}</span>
</div><div id="l1373" class="code_block"><span class="k">\ei</span>
</div><div id="l1374" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is neither a variable nor a stream term nor an alias.
</div><div id="l1375" class="code_block"><span class="k">\bi</span>
</div><div id="l1376" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(stream<span class="k">\_or\_alias</span>,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l1377" class="code_block"><span class="k">\ei</span>
</div><div id="l1378" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is not associated with an open output stream
</div><div id="l1379" class="code_block"><span class="k">\bi</span>
</div><div id="l1380" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> existence<span class="k">\_error</span>(stream,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l1381" class="code_block"><span class="k">\ei</span>
</div><div id="l1382" class="code_block"><span class="k">\ei</span>
</div><div id="l1383" class="code_block">
</div><div id="l1384" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>write(?Term)<span class="nb">}{</span>write/1<span class="nb">}</span>
</div><div id="l1385" class="code_block"><span class="c">% </span>
</div><div id="l1386" class="code_block">Semantically, <span class="nb">{</span><span class="k">\tt</span> write/1<span class="nb">}</span> behaves as if <span class="nb">{</span><span class="k">\tt</span> write<span class="k">\_term</span>/1<span class="nb">}</span> were
</div><div id="l1387" class="code_block">invoked using <span class="nb">{</span><span class="k">\tt</span> quoted(false)<span class="nb">}</span>, <span class="nb">{</span><span class="k">\tt</span> ignore<span class="k">\_ops</span>(false)<span class="nb">}</span>, and <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l1388" class="code_block">  numbervars(false)<span class="nb">}</span>.  Attributed variables are written according to
</div><div id="l1389" class="code_block">the value of the Prolog flag <span class="nb">{</span><span class="k">\tt</span> write<span class="k">\_attributes</span>/2<span class="nb">}</span> (cf. <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l1390" class="code_block">  current<span class="k">\_prolog\_flag</span>/2<span class="nb">}</span>).
</div><div id="l1391" class="code_block">
</div><div id="l1392" class="code_block">The HiLog term <span class="nb">{</span><span class="k">\tt</span> Term<span class="nb">}</span> is written to the current output stream,
</div><div id="l1393" class="code_block">according to the operator declarations in force.  Any uninstantiated
</div><div id="l1394" class="code_block">subterm of term <span class="nb">{</span><span class="k">\tt</span> Term<span class="nb">}</span> is written as an anonymous variable (an
</div><div id="l1395" class="code_block">underscore followed by a token).  
</div><div id="l1396" class="code_block">
</div><div id="l1397" class="code_block">All <span class="nb">{</span><span class="k">\em</span> proper HiLog terms<span class="nb">}</span> (HiLog terms which are not also Prolog
</div><div id="l1398" class="code_block">terms) are not written in their internal Prolog representation.  <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l1399" class="code_block">  write/1<span class="nb">}</span> always succeeds without producing an error.
</div><div id="l1400" class="code_block">
</div><div id="l1401" class="code_block">HiLog (or Prolog) terms that are output by <span class="nb">{</span><span class="k">\tt</span> write/1<span class="nb">}</span> cannot in
</div><div id="l1402" class="code_block">general be read back using <span class="nb">{</span><span class="k">\tt</span> read/1<span class="nb">}</span>.  This happens for two
</div><div id="l1403" class="code_block">reasons:
</div><div id="l1404" class="code_block">    <span class="k">\begin</span><span class="nb">{</span>itemize<span class="nb">}</span>
</div><div id="l1405" class="code_block">    <span class="k">\item</span> The atoms appearing in term <span class="nb">{</span><span class="k">\tt</span> Term<span class="nb">}</span> are not quoted. In that case 
</div><div id="l1406" class="code_block">          the user must use <span class="nb">{</span><span class="k">\tt</span> writeq/1<span class="nb">}</span> or 
</div><div id="l1407" class="code_block">          <span class="nb">{</span><span class="k">\tt</span> write<span class="k">\_canonical</span>/1<span class="nb">}</span> described below, which quote around atoms 
</div><div id="l1408" class="code_block">          whenever necessary.
</div><div id="l1409" class="code_block">    <span class="k">\item</span> The output of <span class="nb">{</span><span class="k">\tt</span> write/1<span class="nb">}</span> is not terminated by a full-stop;
</div><div id="l1410" class="code_block">          therefore, if the user wants the term to be accepted as input to
</div><div id="l1411" class="code_block">          <span class="nb">{</span><span class="k">\tt</span> read/1<span class="nb">}</span>, the terminating full-stop must be explicitly sent 
</div><div id="l1412" class="code_block">          to the current output stream. 
</div><div id="l1413" class="code_block">    <span class="k">\end</span><span class="nb">{</span>itemize<span class="nb">}</span>
</div><div id="l1414" class="code_block">
</div><div id="l1415" class="code_block"><span class="nb">{</span><span class="k">\tt</span> write/1<span class="nb">}</span> treats terms of the form <span class="k">\verb</span>|&#39;<span class="s">$</span><span class="nb">VAR&#39;</span><span class="o">(</span><span class="nb">N</span><span class="o">)</span><span class="nb">|, which may be</span>
</div><div id="l1416" class="code_block"><span class="nb">generated by {</span><span class="nv">\tt</span><span class="nb"> numbervars</span><span class="o">/[</span><span class="m">1</span><span class="nb">,</span><span class="m">3</span><span class="o">]</span><span class="nb">} specially: it writes {</span><span class="nv">\tt</span><span class="nb"> &#39;A&#39;} if</span>
</div><div id="l1417" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> N}</span><span class="o">=</span><span class="m">0</span><span class="nb">, {</span><span class="nv">\tt</span><span class="nb"> &#39;B&#39;} if {</span><span class="nv">\tt</span><span class="nb"> N}</span><span class="o">=</span><span class="m">1</span><span class="nb">, </span><span class="s">$</span><span class="k">\ldots</span><span class="s">$</span><span class="nb">, {</span><span class="nv">\tt</span><span class="nb"> &#39;Z&#39;} if {</span><span class="nv">\tt</span><span class="nb"> N}</span><span class="o">=</span><span class="m">25</span><span class="nb">,</span>
</div><div id="l1418" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> &#39;A</span><span class="m">1</span><span class="nb">&#39;} if {</span><span class="nv">\tt</span><span class="nb"> N}</span><span class="o">=</span><span class="m">26</span><span class="nb">, etc.  </span><span class="nv">\verb</span><span class="nb">|&#39;</span><span class="s">$</span>VAR&#39;(-1)| is written as the
</div><div id="l1419" class="code_block">anonymous variable <span class="k">\verb</span>|&#39;<span class="nb">_</span>&#39;|.
</div><div id="l1420" class="code_block">
</div><div id="l1421" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>write(+Stream<span class="k">\_or\_alias</span>, ?Term)<span class="nb">}{</span>write/2<span class="nb">}</span>
</div><div id="l1422" class="code_block">	<span class="nb">{</span><span class="k">\tt</span> write/2<span class="nb">}</span> has the same behavior as <span class="nb">{</span><span class="k">\tt</span> write/1<span class="nb">}</span> but the
</div><div id="l1423" class="code_block">	output stream is explicitly designated using the first argument.
</div><div id="l1424" class="code_block">
</div><div id="l1425" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span> are the same as <span class="nb">{</span><span class="k">\tt</span> read<span class="k">\_term</span>/2<span class="nb">}</span>, but with the
</div><div id="l1426" class="code_block">additional errors that may arise in stream checking.
</div><div id="l1427" class="code_block"><span class="k">\bi</span>
</div><div id="l1428" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is a variable
</div><div id="l1429" class="code_block"><span class="k">\bi</span>
</div><div id="l1430" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> instantiation<span class="k">\_error</span><span class="nb">}</span>
</div><div id="l1431" class="code_block"><span class="k">\ei</span>
</div><div id="l1432" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is neither a variable nor a stream term nor an alias.
</div><div id="l1433" class="code_block"><span class="k">\bi</span>
</div><div id="l1434" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(stream<span class="k">\_or\_alias</span>,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l1435" class="code_block"><span class="k">\ei</span>
</div><div id="l1436" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is not associated with an open output stream
</div><div id="l1437" class="code_block"><span class="k">\bi</span>
</div><div id="l1438" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> existence<span class="k">\_error</span>(stream,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l1439" class="code_block"><span class="k">\ei</span>
</div><div id="l1440" class="code_block"><span class="k">\ei</span>
</div><div id="l1441" class="code_block">
</div><div id="l1442" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>writeq(?Term)<span class="nb">}{</span>writeq/1<span class="nb">}</span>
</div><div id="l1443" class="code_block"><span class="c">%</span>
</div><div id="l1444" class="code_block">Acts as <span class="nb">{</span><span class="k">\tt</span> write<span class="k">\_term</span>/1<span class="nb">}</span> when defined with the options <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l1445" class="code_block">  quoted(true)<span class="nb">}</span>, <span class="nb">{</span><span class="k">\tt</span> numbervars(true)<span class="nb">}</span>, and <span class="nb">{</span><span class="k">\tt</span> ignore<span class="k">\_ops</span>(false)<span class="nb">}</span>.
</div><div id="l1446" class="code_block">In other words, atoms and functors are quoted whenever necessary to
</div><div id="l1447" class="code_block">make the result acceptable as input to <span class="nb">{</span><span class="k">\tt</span> read/1<span class="nb">}</span> <span class="nb">{</span><span class="k">\tt</span> writeq/1<span class="nb">}</span>
</div><div id="l1448" class="code_block">also treats terms of the form <span class="k">\verb</span>|&#39;<span class="k">\VAR</span>&#39;(N)| specially, writing <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l1449" class="code_block">  A<span class="nb">}</span> if <span class="nb">{</span><span class="k">\tt</span> N<span class="nb">}</span>= 0, etc., and output is in accordance with current
</div><div id="l1450" class="code_block">operator definitions.  <span class="nb">{</span><span class="k">\tt</span> writeq/1<span class="nb">}</span> always succeeds without
</div><div id="l1451" class="code_block">producing an error.
</div><div id="l1452" class="code_block">
</div><div id="l1453" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>writeq(+Stream<span class="k">\_or\_alias</span>, ?Term)<span class="nb">}{</span>writeq/2<span class="nb">}</span>
</div><div id="l1454" class="code_block"><span class="c">%</span>
</div><div id="l1455" class="code_block">	<span class="nb">{</span><span class="k">\tt</span> writeq/2<span class="nb">}</span> has the same behavior as <span class="nb">{</span><span class="k">\tt</span> writeq/1<span class="nb">}</span> but the
</div><div id="l1456" class="code_block">	output stream is explicitly designated using the first argument.
</div><div id="l1457" class="code_block">
</div><div id="l1458" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span> 
</div><div id="l1459" class="code_block"><span class="k">\bi</span>
</div><div id="l1460" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is a variable
</div><div id="l1461" class="code_block"><span class="k">\bi</span>
</div><div id="l1462" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> instantiation<span class="k">\_error</span><span class="nb">}</span>
</div><div id="l1463" class="code_block"><span class="k">\ei</span>
</div><div id="l1464" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is neither a variable nor a stream term nor an alias.
</div><div id="l1465" class="code_block"><span class="k">\bi</span>
</div><div id="l1466" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> domain<span class="k">\_error</span>(stream<span class="k">\_or\_alias</span>,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l1467" class="code_block"><span class="k">\ei</span>
</div><div id="l1468" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> Stream<span class="k">\_or\_alias</span><span class="nb">}</span> is not associated with an open output stream
</div><div id="l1469" class="code_block"><span class="k">\bi</span>
</div><div id="l1470" class="code_block"><span class="k">\item</span> 	<span class="nb">{</span><span class="k">\tt</span> existence<span class="k">\_error</span>(stream,Stream<span class="k">\_or\_alias</span>)<span class="nb">}</span>
</div><div id="l1471" class="code_block"><span class="k">\ei</span>
</div><div id="l1472" class="code_block"><span class="k">\ei</span>
</div><div id="l1473" class="code_block">
</div><div id="l1474" class="code_block"><span class="k">\index</span><span class="nb">{</span>canonical format<span class="nb">}</span>
</div><div id="l1475" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>write<span class="k">\_canonical</span>(?Term)<span class="nb">}{</span>write<span class="k">\_canonical</span>/1<span class="nb">}</span>
</div><div id="l1476" class="code_block"><span class="c">%</span>
</div><div id="l1477" class="code_block">This predicate is provided so that the HiLog term <span class="nb">{</span><span class="k">\tt</span> Term<span class="nb">}</span>, if
</div><div id="l1478" class="code_block">written to a file, can be read back using <span class="nb">{</span><span class="k">\tt</span> read<span class="k">\_canonical</span>/[1,2]<span class="nb">}</span>
</div><div id="l1479" class="code_block">or <span class="nb">{</span><span class="k">\tt</span> read/[1,2]<span class="nb">}</span> regardless of special characters appearing in <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l1480" class="code_block">  Term<span class="nb">}</span> or prevailing operator declarations. Like <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l1481" class="code_block">  write<span class="k">\_prolog</span>/1<span class="nb">}</span>, <span class="nb">{</span><span class="k">\tt</span> write<span class="k">\_canonical</span>/1<span class="nb">}</span> writes all proper HiLog
</div><div id="l1482" class="code_block">terms to the current output stream using the standard Prolog syntax
</div><div id="l1483" class="code_block">(see Section~<span class="k">\ref</span><span class="nb">{</span>TermSyntax<span class="nb">}</span> on the standard syntax of HiLog
</div><div id="l1484" class="code_block">terms). <span class="nb">{</span><span class="k">\tt</span> write<span class="k">\_canonical</span>/1<span class="nb">}</span> also quotes atoms and functors as
</div><div id="l1485" class="code_block"><span class="nb">{</span><span class="k">\tt</span> writeq/1<span class="nb">}</span> does, to make them acceptable as input of <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l1486" class="code_block">  read/1<span class="nb">}</span><span class="k">\@</span>.  Except for list-notation (<span class="nb">{</span><span class="k">\tt</span> []<span class="nb">}</span>) and infix comma-list
</div><div id="l1487" class="code_block">notation, operator declarations are not taken into consideration, so
</div><div id="l1488" class="code_block">that apart from these exceptions compound terms are written in the
</div><div id="l1489" class="code_block">form:
</div><div id="l1490" class="code_block"><span class="c">%</span>
</div><div id="l1491" class="code_block">		<span class="sb">\[</span><span class="nb"> </span><span class="nv">\langle</span><span class="nb"> predicate</span><span class="nv">\</span><span class="nb"> name </span><span class="nv">\rangle</span>
</div><div id="l1492" class="code_block"><span class="nb">			</span><span class="o">(</span><span class="nv">\langle</span><span class="nb"> arg_</span><span class="m">1</span><span class="nb"> </span><span class="nv">\rangle</span><span class="nb">, </span><span class="nv">\ldots</span><span class="nb">,</span>
</div><div id="l1493" class="code_block"><span class="nb">			 </span><span class="nv">\langle</span><span class="nb"> arg_n </span><span class="nv">\rangle</span><span class="o">)</span><span class="nb"> </span><span class="s">\]</span>
</div><div id="l1494" class="code_block"><span class="c">%</span>
</div><div id="l1495" class="code_block">Unlike <span class="nb">{</span><span class="k">\tt</span> writeq/1<span class="nb">}</span>, <span class="nb">{</span><span class="k">\tt</span> write<span class="k">\_canonical</span>/1<span class="nb">}</span> does not treat terms
</div><div id="l1496" class="code_block">of the form <span class="k">\verb</span>|&#39;<span class="s">$</span><span class="nb">VAR&#39;</span><span class="o">(</span><span class="nb">N</span><span class="o">)</span><span class="nb">| specially. It writes square bracket lists</span>
</div><div id="l1497" class="code_block"><span class="nb">using {</span><span class="nv">\tt</span><span class="nb"> &#39;.&#39;</span><span class="o">/</span><span class="m">2</span><span class="nb">} and {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">[]</span><span class="nb">} </span><span class="o">(</span><span class="nb">that is, {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">[</span><span class="nb">foo, bar</span><span class="o">]</span><span class="nb">} is written</span>
</div><div id="l1498" class="code_block"><span class="nb">as </span><span class="nv">\verb</span><span class="nb">|&#39;.&#39;</span><span class="o">(</span><span class="nb">foo,&#39;.&#39;</span><span class="o">(</span><span class="nb">bar,</span><span class="o">[]))</span><span class="nb">|</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l1499" class="code_block">
</div><div id="l1500" class="code_block"><span class="nb">Finally, {</span><span class="nv">\tt</span><span class="nb"> write canonical</span><span class="o">/</span><span class="m">2</span><span class="nb">} writes attributed variables as simple</span>
</div><div id="l1501" class="code_block"><span class="nb">variables.</span>
</div><div id="l1502" class="code_block">
</div><div id="l1503" class="code_block"><span class="nv">\compatability</span>
</div><div id="l1504" class="code_block"><span class="c">%</span>
</div><div id="l1505" class="code_block"><span class="nb">In XSB, list notation and infix comma</span><span class="o">-</span><span class="nb">list notation are considered</span>
</div><div id="l1506" class="code_block"><span class="nb">canonical both for reading and writing.  We find that this improves</span>
</div><div id="l1507" class="code_block"><span class="nb">readability, and that these operators are so standard that there is</span>
</div><div id="l1508" class="code_block"><span class="nb">little likelihood that they will not be in effect by any Prolog</span>
</div><div id="l1509" class="code_block"><span class="nb">reader.  We therefore deviate from the ISO standard definition of</span>
</div><div id="l1510" class="code_block"><span class="nb">canonical in these cases.</span>
</div><div id="l1511" class="code_block">
</div><div id="l1512" class="code_block"><span class="nv">\isoitem</span><span class="nb">{write</span><span class="nv">\_</span><span class="nb">canonical</span><span class="o">(+</span><span class="nb">Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias, ?Term</span><span class="o">)</span><span class="nb">}{write</span><span class="nv">\_</span><span class="nb">canonical</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l1513" class="code_block"><span class="c">%</span>
</div><div id="l1514" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> write</span><span class="nv">\_</span><span class="nb">canonical</span><span class="o">/</span><span class="m">2</span><span class="nb">} has the same behavior as {</span><span class="nv">\tt</span>
</div><div id="l1515" class="code_block"><span class="nb">write</span><span class="nv">\_</span><span class="nb">canonical</span><span class="o">/</span><span class="m">1</span><span class="nb">} but the output stream is explicitly designated</span>
</div><div id="l1516" class="code_block"><span class="nb">using the first argument.</span>
</div><div id="l1517" class="code_block">
</div><div id="l1518" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Error Cases} </span>
</div><div id="l1519" class="code_block"><span class="nv">\bi</span>
</div><div id="l1520" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias} is a variable</span>
</div><div id="l1521" class="code_block"><span class="nv">\bi</span>
</div><div id="l1522" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> instantiation</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l1523" class="code_block"><span class="nv">\ei</span>
</div><div id="l1524" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias} is neither a variable nor a stream term nor an alias.</span>
</div><div id="l1525" class="code_block"><span class="nv">\bi</span>
</div><div id="l1526" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> domain</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias,Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l1527" class="code_block"><span class="nv">\ei</span>
</div><div id="l1528" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias} is not associated with an open output stream</span>
</div><div id="l1529" class="code_block"><span class="nv">\bi</span>
</div><div id="l1530" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> existence</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">stream,Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l1531" class="code_block"><span class="nv">\ei</span>
</div><div id="l1532" class="code_block"><span class="nv">\ei</span>
</div><div id="l1533" class="code_block">
</div><div id="l1534" class="code_block"><span class="nv">\standarditem</span><span class="nb">{writeln</span><span class="o">(</span><span class="nb">?Term</span><span class="o">)</span><span class="nb">}{writeln</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span>
</div><div id="l1535" class="code_block"><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> writeln</span><span class="o">(</span><span class="nb">Term</span><span class="o">)</span><span class="nb">} can be defined as {</span><span class="nv">\tt</span><span class="nb"> write</span><span class="o">(</span><span class="nb">Term</span><span class="o">)</span><span class="nb">, nl}.</span>
</div><div id="l1536" class="code_block">
</div><div id="l1537" class="code_block"><span class="nv">\standarditem</span><span class="nb">{writeln</span><span class="o">(+</span><span class="nb">Stream,?Term</span><span class="o">)</span><span class="nb">}{writeln</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l1538" class="code_block"><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> writeln</span><span class="o">(</span><span class="nb">Term</span><span class="o">)</span><span class="nb">} can be defined as {</span><span class="nv">\tt</span><span class="nb"> write</span><span class="o">(</span><span class="nb">Stream,Term</span><span class="o">)</span><span class="nb">,</span>
</div><div id="l1539" class="code_block"><span class="nb">    nl</span><span class="o">(</span><span class="nb">Stream</span><span class="o">)</span><span class="nb">}.</span>
</div><div id="l1540" class="code_block">
</div><div id="l1541" class="code_block"><span class="nv">\comment</span><span class="nb">{</span>
</div><div id="l1542" class="code_block"><span class="nb">TLS I dont think we still need this </span><span class="o">--</span><span class="nb"> console_write seems better for that.</span>
</div><div id="l1543" class="code_block"><span class="nv">\standarditem</span><span class="nb">{display</span><span class="o">(</span><span class="nb">?Term</span><span class="o">)</span><span class="nb">}{display</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span>
</div><div id="l1544" class="code_block"><span class="nb">    The HiLog term {</span><span class="nv">\tt</span><span class="nb"> Term} is displayed on the terminal </span><span class="o">(</span><span class="nb">standard output </span>
</div><div id="l1545" class="code_block"><span class="nb">    stream</span><span class="o">)</span><span class="nb">, according to the operator declarations in force. In other words,</span>
</div><div id="l1546" class="code_block"><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> display</span><span class="o">/</span><span class="m">1</span><span class="nb">} is similar to {</span><span class="nv">\tt</span><span class="nb"> write</span><span class="o">/</span><span class="m">1</span><span class="nb">} but the result is always</span>
</div><div id="l1547" class="code_block"><span class="nb">    written on {</span><span class="nv">\tt</span><span class="nb"> ``userout&#39;&#39;}</span><span class="nv">\@</span><span class="nb">.  Like {</span><span class="nv">\tt</span><span class="nb"> write</span><span class="o">/</span><span class="m">1</span><span class="nb">}, {</span><span class="nv">\tt</span><span class="nb"> display</span><span class="o">/</span><span class="m">1</span><span class="nb">} </span>
</div><div id="l1548" class="code_block"><span class="nb">    always succeeds without producing an error. After returning from a call </span>
</div><div id="l1549" class="code_block"><span class="nb">    to this predicate, the current output stream remains unchanged.</span>
</div><div id="l1550" class="code_block"><span class="nb">}</span>
</div><div id="l1551" class="code_block">
</div><div id="l1552" class="code_block"><span class="nv">\ourrepeatstandarditem</span><span class="nb">{write</span><span class="nv">\_</span><span class="nb">prolog</span><span class="o">(</span><span class="nb">?Term</span><span class="o">)</span><span class="nb">}{write</span><span class="nv">\_</span><span class="nb">prolog</span><span class="o">/</span><span class="m">1</span><span class="nb">}{HiLog}</span>
</div><div id="l1553" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{write</span><span class="nv">\_</span><span class="nb">prolog</span><span class="o">(+</span><span class="nb">Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias,?Term</span><span class="o">)</span><span class="nb">}{write</span><span class="nv">\_</span><span class="nb">prolog</span><span class="o">/</span><span class="m">1</span><span class="nb">}{HiLog}</span>
</div><div id="l1554" class="code_block"><span class="c">%</span>
</div><div id="l1555" class="code_block"><span class="nb">   {</span><span class="nv">\tt</span><span class="nb"> write</span><span class="nv">\_</span><span class="nb">prolog</span><span class="o">/</span><span class="m">1</span><span class="nb">} acts as {</span><span class="nv">\tt</span><span class="nb"> write</span><span class="o">/</span><span class="m">1</span><span class="nb">} except that any proper</span>
</div><div id="l1556" class="code_block"><span class="nb">   HiLog term {</span><span class="nv">\tt</span><span class="nb"> Term} is written using Prolog syntax </span><span class="o">--</span><span class="nb"> i.e. as a</span>
</div><div id="l1557" class="code_block"><span class="nb">   term whose outer functor is apply.  {</span><span class="nv">\tt</span><span class="nb"> write</span><span class="nv">\_</span><span class="nb">prolog</span><span class="o">/</span><span class="m">1</span><span class="nb">} outputs</span>
</div><div id="l1558" class="code_block"><span class="nb">   {</span><span class="nv">\tt</span><span class="nb"> Term} according to the operator declarations in force.</span>
</div><div id="l1559" class="code_block"><span class="nb">   Because of this, it differs from {</span><span class="nv">\tt</span><span class="nb"> write</span><span class="nv">\_</span><span class="nb">canonical</span><span class="o">/</span><span class="m">1</span><span class="nb">} described</span>
</div><div id="l1560" class="code_block"><span class="nb">   above, despite the fact that both predicates write HiLog terms as</span>
</div><div id="l1561" class="code_block"><span class="nb">   Prolog terms.</span>
</div><div id="l1562" class="code_block">
</div><div id="l1563" class="code_block"><span class="nb">   {</span><span class="nv">\tt</span><span class="nb"> write</span><span class="nv">\_</span><span class="nb">prolog</span><span class="o">/</span><span class="m">2</span><span class="nb">} has the same behavior as {</span><span class="nv">\tt</span>
</div><div id="l1564" class="code_block"><span class="nb">     write</span><span class="nv">\_</span><span class="nb">prolog</span><span class="o">/</span><span class="m">1</span><span class="nb">} but the output stream is explicitly designated</span>
</div><div id="l1565" class="code_block"><span class="nb">   using the first argument.  Error Cases for {</span><span class="nv">\tt</span><span class="nb"> write</span><span class="nv">\_</span><span class="nb">prolog</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l1566" class="code_block"><span class="nb">   are the same as for {</span><span class="nv">\tt</span><span class="nb"> write</span><span class="o">/</span><span class="m">2</span><span class="nb">}.</span>
</div><div id="l1567" class="code_block">
</div><div id="l1568" class="code_block"><span class="nb">    Examples:</span>
</div><div id="l1569" class="code_block"><span class="nb">    {</span><span class="nv">\footnotesize</span>
</div><div id="l1570" class="code_block"><span class="nb">     </span><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l1571" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> write_prolog</span><span class="o">(</span><span class="nb">X</span><span class="o">(</span><span class="nb">a,</span><span class="m">1</span><span class="o">+</span><span class="m">2</span><span class="o">))</span><span class="nb">.</span>
</div><div id="l1572" class="code_block"><span class="nb">                apply</span><span class="o">(</span><span class="nb">_h</span><span class="m">120</span><span class="nb">,a,</span><span class="m">1</span><span class="nb"> </span><span class="o">+</span><span class="nb"> </span><span class="m">2</span><span class="o">)</span>
</div><div id="l1573" class="code_block">
</div><div id="l1574" class="code_block"><span class="nb">                yes</span>
</div><div id="l1575" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> write</span><span class="o">(</span><span class="nb">X</span><span class="o">(</span><span class="nb">a,</span><span class="m">1</span><span class="o">+</span><span class="m">2</span><span class="o">))</span><span class="nb">.</span>
</div><div id="l1576" class="code_block"><span class="nb">                _h</span><span class="m">120</span><span class="o">(</span><span class="nb">a,</span><span class="m">1</span><span class="nb"> </span><span class="o">+</span><span class="nb"> </span><span class="m">2</span><span class="o">)</span>
</div><div id="l1577" class="code_block">
</div><div id="l1578" class="code_block"><span class="nb">                yes</span>
</div><div id="l1579" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> write_canonical</span><span class="o">(</span><span class="nb">X</span><span class="o">(</span><span class="nb">a,</span><span class="m">1</span><span class="o">+</span><span class="m">2</span><span class="o">))</span><span class="nb">.</span>
</div><div id="l1580" class="code_block"><span class="nb">                apply</span><span class="o">(</span><span class="nb">_h</span><span class="m">120</span><span class="nb">,a,</span><span class="o">+(</span><span class="m">1</span><span class="nb">,</span><span class="m">2</span><span class="o">))</span>
</div><div id="l1581" class="code_block">
</div><div id="l1582" class="code_block"><span class="nb">                yes</span>
</div><div id="l1583" class="code_block"><span class="nb">     </span><span class="nv">\end</span><span class="nb">{verbatim}}</span>
</div><div id="l1584" class="code_block">
</div><div id="l1585" class="code_block">
</div><div id="l1586" class="code_block"><span class="nv">\ourmoditem</span><span class="nb">{numbervars</span><span class="o">(+</span><span class="nb">Term, </span><span class="o">+</span><span class="nb">FirstN,?LastN,</span><span class="o">+</span><span class="nb">Options</span><span class="o">)</span><span class="nb">}{numbervars</span><span class="o">/</span><span class="m">4</span><span class="nb">}{num</span><span class="nv">\_</span><span class="nb">vars} </span>
</div><div id="l1587" class="code_block"><span class="c">%</span>
</div><div id="l1588" class="code_block"><span class="nb">This predicate provides a mechanism for grounding a </span><span class="o">(</span><span class="nb">HiLog</span><span class="o">)</span><span class="nb"> term so</span>
</div><div id="l1589" class="code_block"><span class="nb">that it may be analyzed.  Each variable in the </span><span class="o">(</span><span class="nb">HiLog</span><span class="o">)</span><span class="nb"> term {</span><span class="nv">\tt</span><span class="nb"> Term}</span>
</div><div id="l1590" class="code_block"><span class="nb">is instantiated to a term of the form </span><span class="nv">\verb</span><span class="nb">|&#39;</span><span class="s">$</span>VAR&#39;(N)|, where <span class="nb">{</span><span class="k">\tt</span> N<span class="nb">}</span>
</div><div id="l1591" class="code_block">is an integer starting from <span class="nb">{</span><span class="k">\tt</span> FirstN<span class="nb">}</span>.  <span class="nb">{</span><span class="k">\tt</span> FirstN<span class="nb">}</span> is used as the
</div><div id="l1592" class="code_block">value of <span class="nb">{</span><span class="k">\tt</span> N<span class="nb">}</span> for the first variable in <span class="nb">{</span><span class="k">\tt</span> Term<span class="nb">}</span> (starting from
</div><div id="l1593" class="code_block">the left). The second distinct variable in <span class="nb">{</span><span class="k">\tt</span> Term<span class="nb">}</span> is given a value
</div><div id="l1594" class="code_block">of <span class="nb">{</span><span class="k">\tt</span> N<span class="nb">}</span> satisfying <span class="nb">{</span><span class="k">\tt</span> &quot;N is FirstN + 1&quot;<span class="nb">}</span> and so on.  The last
</div><div id="l1595" class="code_block">variable in <span class="nb">{</span><span class="k">\tt</span> Term<span class="nb">}</span> has the value <span class="nb">{</span><span class="k">\tt</span> LastN-1<span class="nb">}</span>.
</div><div id="l1596" class="code_block">
</div><div id="l1597" class="code_block">In <span class="nb">{</span><span class="k">\tt</span> numbervars/4<span class="nb">}</span>, <span class="nb">{</span><span class="k">\tt</span> Options<span class="nb">}</span> can be used to indicate the
</div><div id="l1598" class="code_block">action to take upon encountering an attributed variable.  Currently,
</div><div id="l1599" class="code_block"><span class="nb">{</span><span class="k">\tt</span> Options<span class="nb">}</span> must be either be the empty list, or the list <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l1600" class="code_block">  [attvar(Action)]<span class="nb">}</span> or the term <span class="nb">{</span><span class="k">\tt</span> attvar(Action)<span class="nb">}</span>, where <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l1601" class="code_block">  Action<span class="nb">}</span> is 
</div><div id="l1602" class="code_block"><span class="k">\bi</span>
</div><div id="l1603" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> error<span class="nb">}</span> Throw a type error if an attributed variable is
</div><div id="l1604" class="code_block">  encountered.
</div><div id="l1605" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> bind<span class="nb">}</span> Bind attributed variables by unifying them with terms
</div><div id="l1606" class="code_block">  of the form <span class="k">\verb</span>|&#39;<span class="s">$</span><span class="nb">VAR&#39;</span><span class="o">(</span><span class="nb">N</span><span class="o">)</span><span class="nb">|.</span>
</div><div id="l1607" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> skip} Skip over attributed variables, performing no action</span>
</div><div id="l1608" class="code_block"><span class="nb">  on these variables.</span>
</div><div id="l1609" class="code_block"><span class="nv">\ei</span>
</div><div id="l1610" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Error Cases}</span>
</div><div id="l1611" class="code_block"><span class="nv">\bi</span>
</div><div id="l1612" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Options} is a variable</span>
</div><div id="l1613" class="code_block"><span class="nv">\bi</span>
</div><div id="l1614" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> instantiation</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l1615" class="code_block"><span class="nv">\ei</span>
</div><div id="l1616" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Options} is not an empty list, the list {</span><span class="nv">\tt</span>
</div><div id="l1617" class="code_block"><span class="nb">  </span><span class="o">[</span><span class="nb">attvar</span><span class="o">(</span><span class="nb">Action</span><span class="o">)]</span><span class="nb">} or the term {</span><span class="nv">\tt</span><span class="nb"> attvar</span><span class="o">(</span><span class="nb">Action</span><span class="o">)</span><span class="nb">} where {</span><span class="nv">\tt</span>
</div><div id="l1618" class="code_block"><span class="nb">  Action} is one of {</span><span class="nv">\tt</span><span class="nb"> bind}, {</span><span class="nv">\tt</span><span class="nb"> error} or {</span><span class="nv">\tt</span><span class="nb"> skip}:</span>
</div><div id="l1619" class="code_block"><span class="nb"> </span><span class="nv">\bi</span>
</div><div id="l1620" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> domain</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l1621" class="code_block"><span class="nv">\ei</span>
</div><div id="l1622" class="code_block"><span class="nv">\ei</span>
</div><div id="l1623" class="code_block">
</div><div id="l1624" class="code_block"><span class="nv">\ourmoditem</span><span class="nb">{numbervars</span><span class="o">(+</span><span class="nb">Term, </span><span class="o">+</span><span class="nb">FirstN, ?LastN</span><span class="o">)</span><span class="nb">}{numbervars</span><span class="o">/</span><span class="m">3</span><span class="nb">}{num</span><span class="nv">\_</span><span class="nb">vars}</span>
</div><div id="l1625" class="code_block"><span class="c">%</span>
</div><div id="l1626" class="code_block"><span class="nb">Acts as {</span><span class="nv">\tt</span><span class="nb"> numbervars</span><span class="o">(+</span><span class="nb">Term, </span><span class="o">+</span><span class="nb">FirstN, ?LastN,attvar</span><span class="o">(</span><span class="nb">error</span><span class="o">))</span><span class="nb">}.</span>
</div><div id="l1627" class="code_block">
</div><div id="l1628" class="code_block"><span class="nv">\ourmoditem</span><span class="nb">{numbervars</span><span class="o">(+</span><span class="nb">Term</span><span class="o">)</span><span class="nb">}{numbervars</span><span class="o">/</span><span class="m">1</span><span class="nb">}{num</span><span class="nv">\_</span><span class="nb">vars}</span>
</div><div id="l1629" class="code_block"><span class="nb">    This predicate is defined as: {</span><span class="nv">\tt</span><span class="nb"> numbervars</span><span class="o">(</span><span class="nb">Term, </span><span class="m">0</span><span class="nb">, </span><span class="nv">\_</span><span class="o">)</span><span class="nb">}.  It</span>
</div><div id="l1630" class="code_block"><span class="nb">    is included solely for convenience.</span>
</div><div id="l1631" class="code_block">
</div><div id="l1632" class="code_block"><span class="nv">\ourmoditem</span><span class="nb">{unnumbervars</span><span class="o">(+</span><span class="nb">Term, </span><span class="o">+</span><span class="nb">FirstN, ?Copy</span><span class="o">)</span><span class="nb">}{unnumbervars</span><span class="o">/</span><span class="m">3</span><span class="nb">}{num</span><span class="nv">\_</span><span class="nb">vars}</span>
</div><div id="l1633" class="code_block"><span class="nb">    This predicate is a partial inverse of predicate {</span><span class="nv">\tt</span>
</div><div id="l1634" class="code_block"><span class="nb">    numbervars</span><span class="o">/</span><span class="m">3</span><span class="nb">}.  It creates a copy of Term in which all subterms of</span>
</div><div id="l1635" class="code_block"><span class="nb">    the form </span><span class="nv">\verb</span><span class="nb">|&#39;</span><span class="s">$</span>VAR&#39;(&lt;int&gt;)| where <span class="k">\verb</span>|&lt;int&gt;| is not less than
</div><div id="l1636" class="code_block">    <span class="nb">{</span><span class="k">\tt</span> FirstN<span class="nb">}</span> are uniformly replaced by variables.  <span class="k">\verb</span>|&#39;<span class="s">$</span><span class="nb">VAR&#39;&#39;|</span>
</div><div id="l1637" class="code_block"><span class="nb">    subterms with the same integer are replaced by the same variable.</span>
</div><div id="l1638" class="code_block"><span class="nb">    Also a version {</span><span class="nv">\tt</span><span class="nb"> unnumbervars</span><span class="o">/</span><span class="m">2</span><span class="nb">} is provided which calls {</span><span class="nv">\tt</span>
</div><div id="l1639" class="code_block"><span class="nb">    unnumbervars</span><span class="o">/</span><span class="m">3</span><span class="nb">} with the second parameter set to </span><span class="m">0</span><span class="nb">.</span>
</div><div id="l1640" class="code_block">
</div><div id="l1641" class="code_block"><span class="nv">\end</span><span class="nb">{description}</span>
</div><div id="l1642" class="code_block">
</div><div id="l1643" class="code_block"><span class="nv">\subsubsection</span><span class="nb">{Term Writing to Designated I</span><span class="o">/</span><span class="nb">O Streams}</span>
</div><div id="l1644" class="code_block"><span class="c">%</span>
</div><div id="l1645" class="code_block"><span class="nb">While XSB has standard I</span><span class="o">/</span><span class="nb">O streams for errors, warnings, messages, and</span>
</div><div id="l1646" class="code_block"><span class="nb">feedback </span><span class="o">(</span><span class="nb">cf. Section~</span><span class="nv">\ref</span><span class="nb">{sec:IO</span><span class="o">-</span><span class="nb">streams}</span><span class="o">)</span><span class="nb">, the predicates above</span>
</div><div id="l1647" class="code_block"><span class="nb">write to {</span><span class="nv">\tt</span><span class="nb"> STDOUT} which is the standard output for the process.</span>
</div><div id="l1648" class="code_block"><span class="nb">Most of the time there is no issue with this as these streams are</span>
</div><div id="l1649" class="code_block"><span class="nb">aliased to {</span><span class="nv">\tt</span><span class="nb"> STDOUT}.  However in a number of circumstances, {</span><span class="nv">\tt</span>
</div><div id="l1650" class="code_block"><span class="nb">  STDOUT} may be redirected: a user may have invoked {</span><span class="nv">\tt</span><span class="nb"> tell</span><span class="o">/</span><span class="m">1</span><span class="nb">}, XSB</span>
</div><div id="l1651" class="code_block"><span class="nb">may be invoked through C or interprolog, etc.  In such cases, it may</span>
</div><div id="l1652" class="code_block"><span class="nb">be useful to ensure that output goes to one of the other I</span><span class="o">/</span><span class="nb">O streams.  </span>
</div><div id="l1653" class="code_block">
</div><div id="l1654" class="code_block"><span class="nv">\begin</span><span class="nb">{description}</span>
</div><div id="l1655" class="code_block">
</div><div id="l1656" class="code_block"><span class="nv">\ourrepeatmoditem</span><span class="nb">{error</span><span class="nv">\_</span><span class="nb">write</span><span class="o">(</span><span class="nb">?Message</span><span class="o">)</span><span class="nb">}{error</span><span class="nv">\_</span><span class="nb">write</span><span class="o">/</span><span class="m">1</span><span class="nb">}{standard}</span>
</div><div id="l1657" class="code_block"><span class="nv">\ourmoditem</span><span class="nb">{error</span><span class="nv">\_</span><span class="nb">writeln</span><span class="o">(</span><span class="nb">?Message</span><span class="o">)</span><span class="nb">}{error</span><span class="nv">\_</span><span class="nb">writeln</span><span class="o">/</span><span class="m">1</span><span class="nb">}{standard}</span>
</div><div id="l1658" class="code_block"><span class="c">%</span>
</div><div id="l1659" class="code_block"><span class="nb">These predicates output {</span><span class="nv">\tt</span><span class="nb"> Message} to XSB&#39;s {</span><span class="nv">\tt</span><span class="nb"> STDERR} stream,</span>
</div><div id="l1660" class="code_block"><span class="nb">rather than to XSB&#39;s {</span><span class="nv">\tt</span><span class="nb"> STDOUT} stream, as does {</span><span class="nv">\tt</span><span class="nb"> write</span><span class="o">/</span><span class="m">1</span><span class="nb">} and</span>
</div><div id="l1661" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> writeln</span><span class="o">/</span><span class="m">1</span><span class="nb">}.  In addition, if {</span><span class="nv">\tt</span><span class="nb"> Message} is a list or comma</span>
</div><div id="l1662" class="code_block"><span class="nb">list, the elements in the comma list are output as if they were</span>
</div><div id="l1663" class="code_block"><span class="nb">concatenated together.  Each of these predicates must be imported from</span>
</div><div id="l1664" class="code_block"><span class="nb">the module {</span><span class="nv">\tt</span><span class="nb"> standard}.</span>
</div><div id="l1665" class="code_block">
</div><div id="l1666" class="code_block"><span class="nv">\ourrepeatmoditem</span><span class="nb">{console</span><span class="nv">\_</span><span class="nb">write</span><span class="o">(</span><span class="nb">?Message</span><span class="o">)</span><span class="nb">}{console</span><span class="nv">\_</span><span class="nb">write</span><span class="o">/</span><span class="m">1</span><span class="nb">}{standard}</span>
</div><div id="l1667" class="code_block"><span class="nv">\ourmoditem</span><span class="nb">{console</span><span class="nv">\_</span><span class="nb">writeln</span><span class="o">(</span><span class="nb">?Message</span><span class="o">)</span><span class="nb">}{console</span><span class="nv">\_</span><span class="nb">writeln</span><span class="o">/</span><span class="m">1</span><span class="nb">}{standard}</span>
</div><div id="l1668" class="code_block"><span class="c">%</span>
</div><div id="l1669" class="code_block"><span class="nb">As above, but writes to {</span><span class="nv">\tt</span><span class="nb"> STDFDBK}, the console feedback stream.</span>
</div><div id="l1670" class="code_block">
</div><div id="l1671" class="code_block"><span class="nv">\ourmoditem</span><span class="nb">{warning</span><span class="o">(</span><span class="nb">?Message</span><span class="o">)</span><span class="nb">}{warning</span><span class="o">/</span><span class="m">1</span><span class="nb">}{standard}</span>
</div><div id="l1672" class="code_block"><span class="c">%\ourmoditem{warningln(?Message)}{warningln/1}{standard}</span>
</div><div id="l1673" class="code_block"><span class="c">%</span>
</div><div id="l1674" class="code_block"><span class="nb">By default, this predicate outputs {</span><span class="nv">\tt</span><span class="nb"> Message} to XSB&#39;s {</span><span class="nv">\tt</span>
</div><div id="l1675" class="code_block"><span class="nb">  STDWARN} stream, rather than to XSB&#39;s {</span><span class="nv">\tt</span><span class="nb"> STDOUT} stream, as does</span>
</div><div id="l1676" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> write</span><span class="o">/</span><span class="m">1</span><span class="nb">} and {</span><span class="nv">\tt</span><span class="nb"> writeln</span><span class="o">/</span><span class="m">1</span><span class="nb">}.  In addition, if {</span><span class="nv">\tt</span><span class="nb"> Message} is a</span>
</div><div id="l1677" class="code_block"><span class="nb">list or comma list, the elements in the comma list are output as if</span>
</div><div id="l1678" class="code_block"><span class="nb">they were concatenated together.  Each of these predicates must be</span>
</div><div id="l1679" class="code_block"><span class="nb">imported from the module {</span><span class="nv">\tt</span><span class="nb"> standard}.</span>
</div><div id="l1680" class="code_block">
</div><div id="l1681" class="code_block"><span class="nb">The default behavior for warnings can be altered by setting the value</span>
</div><div id="l1682" class="code_block"><span class="nb">of the XSB flag {</span><span class="nv">\tt</span><span class="nb"> warning</span><span class="nv">\_</span><span class="nb">action} to either {</span><span class="nv">\tt</span><span class="nb"> silent</span><span class="nv">\_</span><span class="nb">warning}</span>
</div><div id="l1683" class="code_block"><span class="nb">which performs no action when {</span><span class="nv">\tt</span><span class="nb"> warning</span><span class="o">/</span><span class="m">1</span><span class="nb">} is called. or {</span><span class="nv">\tt</span>
</div><div id="l1684" class="code_block"><span class="nb">  error</span><span class="nv">\_</span><span class="nb">warning} which throws a miscellaneous exception when {</span><span class="nv">\tt</span>
</div><div id="l1685" class="code_block"><span class="nb">  warning</span><span class="o">/</span><span class="m">1</span><span class="nb">} is called </span><span class="o">(</span><span class="nb">WARNING: this includes compiler warnings</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l1686" class="code_block"><span class="nb">The default behavior can be restored by setting {</span><span class="nv">\tt</span><span class="nb"> warning</span><span class="nv">\_</span><span class="nb">action}</span>
</div><div id="l1687" class="code_block"><span class="nb">to {</span><span class="nv">\tt</span><span class="nb"> print</span><span class="nv">\_</span><span class="nb">warning}.</span>
</div><div id="l1688" class="code_block">
</div><div id="l1689" class="code_block"><span class="nv">\ourrepeatmoditem</span><span class="nb">{message</span><span class="o">(</span><span class="nb">?Message</span><span class="o">)</span><span class="nb">}{message</span><span class="o">/</span><span class="m">1</span><span class="nb">}{standard}</span>
</div><div id="l1690" class="code_block"><span class="nv">\ourmoditem</span><span class="nb">{messageln</span><span class="o">(</span><span class="nb">?Message</span><span class="o">)</span><span class="nb">}{messageln</span><span class="o">/</span><span class="m">1</span><span class="nb">}{standard}</span>
</div><div id="l1691" class="code_block"><span class="c">%</span>
</div><div id="l1692" class="code_block"><span class="nb">As above, but writes to {</span><span class="nv">\tt</span><span class="nb"> STDMSG} the standard stream for messages.</span>
</div><div id="l1693" class="code_block">
</div><div id="l1694" class="code_block"><span class="nv">\end</span><span class="nb">{description}</span>
</div><div id="l1695" class="code_block">
</div><div id="l1696" class="code_block"><span class="nv">\subsection</span><span class="nb">{Special I</span><span class="o">/</span><span class="nb">O}</span>
</div><div id="l1697" class="code_block">
</div><div id="l1698" class="code_block"><span class="nv">\begin</span><span class="nb">{description}</span>
</div><div id="l1699" class="code_block"><span class="nv">\standarditem</span><span class="nb">{fmt</span><span class="nv">\_</span><span class="nb">read</span><span class="o">(+</span><span class="nb">Fmt,</span><span class="o">-</span><span class="nb">Term,</span><span class="o">-</span><span class="nb">Ret</span><span class="o">)</span><span class="nb">}{fmt</span><span class="nv">\_</span><span class="nb">read</span><span class="o">/</span><span class="m">3</span><span class="nb">}</span>
</div><div id="l1700" class="code_block"><span class="nv">\vspace</span><span class="nb">{</span><span class="o">-</span><span class="m">7</span><span class="nb">mm}</span>
</div><div id="l1701" class="code_block"><span class="nv">\standarditem</span><span class="nb">{fmt</span><span class="nv">\_</span><span class="nb">read</span><span class="o">(+</span><span class="nb">Stream,</span><span class="o">+</span><span class="nb">Fmt,</span><span class="o">-</span><span class="nb">Term,</span><span class="o">-</span><span class="nb">Ret</span><span class="o">)</span><span class="nb">}{fmt</span><span class="nv">\_</span><span class="nb">read</span><span class="o">/</span><span class="m">4</span><span class="nb">}</span>
</div><div id="l1702" class="code_block"><span class="c">%</span>
</div><div id="l1703" class="code_block"><span class="nb">    These predicates provides a routine for reading data from the</span>
</div><div id="l1704" class="code_block"><span class="nb">    current input file </span><span class="o">(</span><span class="nb">which must have been already opened by using</span>
</div><div id="l1705" class="code_block"><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> see</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span><span class="o">)</span><span class="nb"> according to a C format, as used in the C function</span>
</div><div id="l1706" class="code_block"><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> scanf}. {</span><span class="nv">\tt</span><span class="nb"> Fmt} must be a string of characters </span><span class="o">(</span><span class="nb">enclosed in</span>
</div><div id="l1707" class="code_block"><span class="nb">    &quot;</span><span class="o">)</span><span class="nb"> representing the format that will be passed to the C call to</span>
</div><div id="l1708" class="code_block"><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> scanf}.  See the C documentation for {</span><span class="nv">\tt</span><span class="nb"> scanf} for the</span>
</div><div id="l1709" class="code_block"><span class="nb">    meaning of this string.  The usual alphabetical C escape</span>
</div><div id="l1710" class="code_block"><span class="nb">    characters </span><span class="o">(</span><span class="nb">{</span><span class="nv">\it</span><span class="nb"> e.g.}, </span><span class="s">$</span><span class="k">\backslash</span> n<span class="s">$</span><span class="o">)</span><span class="nb"> are recognized, but not</span>
</div><div id="l1711" class="code_block"><span class="nb">    the octal or the hexadecimal ones.  Another difference with C is</span>
</div><div id="l1712" class="code_block"><span class="nb">    that, unlike most C compilers, XSB insists that a single {</span><span class="nv">\tt</span><span class="nb"> </span><span class="nv">\%</span><span class="nb">}</span>
</div><div id="l1713" class="code_block"><span class="nb">    in the format string signifies format conversion</span>
</div><div id="l1714" class="code_block"><span class="nb">    specification. </span><span class="o">(</span><span class="nb">Some C compilers might output {</span><span class="nv">\tt</span><span class="nb"> </span><span class="nv">\%</span><span class="nb">} if it is</span>
</div><div id="l1715" class="code_block"><span class="nb">    not followed by a valid type conversion spec.</span><span class="o">)</span><span class="nb"> So, to output {</span><span class="nv">\tt</span>
</div><div id="l1716" class="code_block"><span class="nb">    </span><span class="nv">\%</span><span class="nb">} you must type {</span><span class="nv">\tt</span><span class="nb"> </span><span class="nv">\%\%</span><span class="nb">}.  Format can also be an atom enclosed</span>
</div><div id="l1717" class="code_block"><span class="nb">    in single quotes. However, in that case, escape sequences are not</span>
</div><div id="l1718" class="code_block"><span class="nb">    recognized and are printed as is.</span>
</div><div id="l1719" class="code_block">
</div><div id="l1720" class="code_block"><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> Term} is a term </span><span class="o">(</span><span class="nb">{</span><span class="nv">\it</span><span class="nb"> e.g.}, {</span><span class="nv">\tt</span><span class="nb"> args</span><span class="o">(</span><span class="nb">X,Y,Z</span><span class="o">)</span><span class="nb">}</span><span class="o">)</span><span class="nb">  whose arguments</span>
</div><div id="l1721" class="code_block"><span class="nb">    will be unified with the field values read in.  </span><span class="o">(</span><span class="nb">The functor symbol of {</span><span class="nv">\tt</span>
</div><div id="l1722" class="code_block"><span class="nb">    Term} is ignored.</span><span class="o">)</span><span class="nb">  Special syntactic sugar is provided for the case</span>
</div><div id="l1723" class="code_block"><span class="nb">    when the format string contains only one format specifier: If {</span><span class="nv">\tt</span>
</div><div id="l1724" class="code_block"><span class="nb">    Term} is a variable, {</span><span class="nv">\tt</span><span class="nb"> X}, then the predicate behaves as if {</span><span class="nv">\tt</span>
</div><div id="l1725" class="code_block"><span class="nb">    Term} were {</span><span class="nv">\tt</span><span class="nb"> arg</span><span class="o">(</span><span class="nb">X</span><span class="o">)</span><span class="nb">}.</span>
</div><div id="l1726" class="code_block">
</div><div id="l1727" class="code_block"><span class="nb">  If the number of arguments exceeds the number of format specifiers, a</span>
</div><div id="l1728" class="code_block"><span class="nb">  warning is produced and the extra arguments remain uninstantiated.</span>
</div><div id="l1729" class="code_block"><span class="nb">  If the number of format specifiers exceeds the number of arguments, then</span>
</div><div id="l1730" class="code_block"><span class="nb">  the remainder of the format string </span><span class="o">(</span><span class="nb">after the last matching specifier</span><span class="o">)</span><span class="nb"> is</span>
</div><div id="l1731" class="code_block"><span class="nb">  ignored.</span>
</div><div id="l1732" class="code_block"><span class="nb">  </span>
</div><div id="l1733" class="code_block"><span class="nb">  Note that floats do not unify with anything.  {</span><span class="nv">\tt</span><span class="nb"> Ret} must be a</span>
</div><div id="l1734" class="code_block"><span class="nb">  variable and it will be assigned a return value by the predicate: a</span>
</div><div id="l1735" class="code_block"><span class="nb">  negative integer if end</span><span class="o">-</span><span class="nb">of</span><span class="o">-</span><span class="nb">file is encountered; otherwise the number of</span>
</div><div id="l1736" class="code_block"><span class="nb">  fields read </span><span class="o">(</span><span class="nb">as returned by {</span><span class="nv">\tt</span><span class="nb"> scanf}.</span><span class="o">)</span>
</div><div id="l1737" class="code_block"><span class="nb">  </span>
</div><div id="l1738" class="code_block"><span class="nb">  {</span><span class="nv">\tt</span><span class="nb"> fmt</span><span class="nv">\_</span><span class="nb">read} cannot read strings </span><span class="o">(</span><span class="nb">that correspond to the {</span><span class="nv">\tt</span><span class="nb"> </span><span class="nv">\%</span><span class="nb">s}</span>
</div><div id="l1739" class="code_block"><span class="nb">  format specifier</span><span class="o">)</span><span class="nb"> that are longer than </span><span class="m">16</span><span class="nb">K. Attempting to read longer</span>
</div><div id="l1740" class="code_block"><span class="nb">  strings will cause buffer overflow. It is therefore recommended that one</span>
</div><div id="l1741" class="code_block"><span class="nb">  should use size modifiers in format strings </span><span class="o">(</span><span class="nb">{</span><span class="nv">\it</span><span class="nb"> e.g.}, {</span><span class="nv">\tt</span><span class="nb"> </span><span class="nv">\%</span><span class="m">2000</span><span class="nb">s}</span><span class="o">)</span><span class="nb">,</span>
</div><div id="l1742" class="code_block"><span class="nb">  if such long strings might occur in the input.</span>
</div><div id="l1743" class="code_block">
</div><div id="l1744" class="code_block"><span class="c">% Maybe some other error cases, who knows?</span>
</div><div id="l1745" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Error Cases}</span>
</div><div id="l1746" class="code_block"><span class="nv">\bi</span>
</div><div id="l1747" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias} is a variable</span>
</div><div id="l1748" class="code_block"><span class="nv">\bi</span>
</div><div id="l1749" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> instantiation</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l1750" class="code_block"><span class="nv">\ei</span>
</div><div id="l1751" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias} is neither a variable nor a stream term nor an alias.</span>
</div><div id="l1752" class="code_block"><span class="nv">\bi</span>
</div><div id="l1753" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> domain</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias,Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l1754" class="code_block"><span class="nv">\ei</span>
</div><div id="l1755" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias} is not associated with an open output stream</span>
</div><div id="l1756" class="code_block"><span class="nv">\bi</span>
</div><div id="l1757" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> existence</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">stream,Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l1758" class="code_block"><span class="nv">\ei</span>
</div><div id="l1759" class="code_block"><span class="nv">\ei</span>
</div><div id="l1760" class="code_block">
</div><div id="l1761" class="code_block"><span class="nb">If the number of arguments in {</span><span class="nv">\tt</span><span class="nb"> Term} is greater than the number of</span>
</div><div id="l1762" class="code_block"><span class="nb">conversion specifiers in {</span><span class="nv">\tt</span><span class="nb"> Fmt} no error is thrown, but a warning</span>
</div><div id="l1763" class="code_block"><span class="nb">is issued.</span>
</div><div id="l1764" class="code_block">
</div><div id="l1765" class="code_block"><span class="nv">\standarditem</span><span class="nb">{fmt</span><span class="nv">\_</span><span class="nb">write</span><span class="o">(+</span><span class="nb">Fmt,</span><span class="o">+</span><span class="nb">Term</span><span class="o">)</span><span class="nb">}{fmt</span><span class="nv">\_</span><span class="nb">write</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l1766" class="code_block"><span class="nv">\vspace</span><span class="nb">{</span><span class="o">-</span><span class="m">7</span><span class="nb">mm}</span>
</div><div id="l1767" class="code_block"><span class="nv">\standarditem</span><span class="nb">{fmt</span><span class="nv">\_</span><span class="nb">write</span><span class="o">(+</span><span class="nb">Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias,</span><span class="o">+</span><span class="nb">Fmt,</span><span class="o">+</span><span class="nb">Term</span><span class="o">)</span><span class="nb">}{fmt</span><span class="nv">\_</span><span class="nb">write</span><span class="o">/</span><span class="m">3</span><span class="nb">} </span>
</div><div id="l1768" class="code_block"><span class="c">%</span>
</div><div id="l1769" class="code_block"><span class="nb">These predicates provide routines for writing formatted data to a</span>
</div><div id="l1770" class="code_block"><span class="nb">given output stream </span><span class="o">(</span><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> fmt</span><span class="nv">\_</span><span class="nb">write</span><span class="o">/</span><span class="m">3</span><span class="nb">}</span><span class="o">)</span><span class="nb"> or the current output stream</span>
</div><div id="l1771" class="code_block"><span class="o">(</span><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> fmt</span><span class="nv">\_</span><span class="nb">write</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l1772" class="code_block">
</div><div id="l1773" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> Fmt} should be a Prolog character list </span><span class="o">(</span><span class="nb">string</span><span class="o">)</span><span class="nb"> or atom.  A</span>
</div><div id="l1774" class="code_block"><span class="nb">Prolog character list is preferred, as space can be more easily</span>
</div><div id="l1775" class="code_block"><span class="nb">reclaimed for character lists than for atoms.  {</span><span class="nv">\tt</span><span class="nb"> Term} is a Prolog</span>
</div><div id="l1776" class="code_block"><span class="nb">term </span><span class="o">(</span><span class="nb">{</span><span class="nv">\it</span><span class="nb"> e.g.}, {</span><span class="nv">\tt</span><span class="nb"> args</span><span class="o">(</span><span class="nb">X,Y,Z</span><span class="o">)</span><span class="nb">}</span><span class="o">)</span><span class="nb"> whose arguments will be</span>
</div><div id="l1777" class="code_block"><span class="nb">output. The number of arguments in {</span><span class="nv">\tt</span><span class="nb"> Term} should equal the number</span>
</div><div id="l1778" class="code_block"><span class="nb">of conversion specifiers in {</span><span class="nv">\tt</span><span class="nb"> Fmt}.  The functor symbol of {</span><span class="nv">\tt</span>
</div><div id="l1779" class="code_block"><span class="nb">  Term} is ignored~</span><span class="nv">\footnote</span><span class="nb">{In the case where {</span><span class="nv">\tt</span><span class="nb"> Fmt} contains only</span>
</div><div id="l1780" class="code_block"><span class="nb">  a single conversion specifier, {</span><span class="nv">\tt</span><span class="nb"> Term} may be a string, integer</span>
</div><div id="l1781" class="code_block"><span class="nb">  or a float, and is considered to be equivalent to specifying {</span><span class="nv">\tt</span>
</div><div id="l1782" class="code_block"><span class="nb">    arg</span><span class="o">(</span><span class="nb">Term</span><span class="o">)</span><span class="nb">}.}.</span>
</div><div id="l1783" class="code_block"><span class="nb">    </span>
</div><div id="l1784" class="code_block"><span class="nb">Allowable syntaxes for {</span><span class="nv">\tt</span><span class="nb"> Fmt} reflect the syntax of the C function</span>
</div><div id="l1785" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> printf</span><span class="o">()</span><span class="nb">} on a given platform, with the following exceptions</span>
</div><div id="l1786" class="code_block"><span class="c">%</span>
</div><div id="l1787" class="code_block"><span class="nv">\bi</span>
</div><div id="l1788" class="code_block"><span class="nv">\item</span><span class="nb"> The usual alphabetical C escape characters </span><span class="o">(</span><span class="nb">{</span><span class="nv">\it</span><span class="nb"> e.g.},</span>
</div><div id="l1789" class="code_block"><span class="nb">  </span><span class="s">$</span><span class="k">\backslash</span> n<span class="s">$</span><span class="o">)</span><span class="nb"> are recognized, but not the octal or the hexadecimal</span>
</div><div id="l1790" class="code_block"><span class="nb">  ones.</span>
</div><div id="l1791" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> </span><span class="nv">\%</span><span class="nb">S} is supported, in addition to the usual C conversion</span>
</div><div id="l1792" class="code_block"><span class="nb">  specifiers.  The corresponding argument can be any Prolog term. This</span>
</div><div id="l1793" class="code_block"><span class="nb">  provides an easy way to print the values of Prolog variables, etc.</span>
</div><div id="l1794" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> </span><span class="nv">\%</span><span class="o">!</span><span class="nb">} is supported and indicates that the corresponding</span>
</div><div id="l1795" class="code_block"><span class="nb">  argument is to be ignored and will generate nothing in the output.</span>
</div><div id="l1796" class="code_block"><span class="nv">\item</span><span class="nb"> A single {</span><span class="nv">\tt</span><span class="nb"> </span><span class="nv">\%</span><span class="nb">} in the format string must be followed by a</span>
</div><div id="l1797" class="code_block"><span class="nb">  conversion operator </span><span class="o">(</span><span class="nb">e.g. {</span><span class="nv">\tt</span><span class="nb"> d}, {</span><span class="nv">\tt</span><span class="nb"> s}, etc.</span><span class="o">)</span><span class="nb">. </span><span class="o">(</span><span class="nb">Some C compilers</span>
</div><div id="l1798" class="code_block"><span class="nb">  output {</span><span class="nv">\tt</span><span class="nb"> </span><span class="nv">\%</span><span class="nb">} if the percentage character is not followed by a</span>
</div><div id="l1799" class="code_block"><span class="nb">  valid type conversion spec.</span><span class="o">)</span><span class="nb">  However, to output {</span><span class="nv">\tt</span><span class="nb"> </span><span class="nv">\%</span><span class="nb">}, {</span><span class="nv">\tt</span>
</div><div id="l1800" class="code_block"><span class="nb">    fmt</span><span class="nv">\_</span><span class="nb">write} must contain {</span><span class="nv">\tt</span><span class="nb"> </span><span class="nv">\%\%</span><span class="nb">}.</span>
</div><div id="l1801" class="code_block"><span class="nv">\ei</span><span class="nb">    </span>
</div><div id="l1802" class="code_block"><span class="c">%</span>
</div><div id="l1803" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Example}</span>
</div><div id="l1804" class="code_block"><span class="nb">{</span><span class="nv">\small</span>
</div><div id="l1805" class="code_block"><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l1806" class="code_block"><span class="nb">| ?</span><span class="o">-</span><span class="nb"> fmt_write</span><span class="o">(</span><span class="nb">&quot;</span><span class="c">%d %f %s %S \n&quot;,args(1,3.14159,ready,hello(world))).</span>
</div><div id="l1807" class="code_block"><span class="m">1</span><span class="nb"> </span><span class="m">3</span><span class="nb">.</span><span class="m">141590</span><span class="nb"> ready hello</span><span class="o">(</span><span class="nb">world</span><span class="o">)</span>
</div><div id="l1808" class="code_block">
</div><div id="l1809" class="code_block"><span class="nb">yes</span>
</div><div id="l1810" class="code_block"><span class="nv">\end</span><span class="nb">{verbatim}</span>
</div><div id="l1811" class="code_block"><span class="nb">}</span>
</div><div id="l1812" class="code_block"><span class="c">%</span>
</div><div id="l1813" class="code_block"><span class="nb">XSB also offers an alternate version of formatted output in the {</span><span class="nv">\tt</span>
</div><div id="l1814" class="code_block"><span class="nb">  format} library described in volume </span><span class="m">2</span><span class="nb">.  While not as efficient as</span>
</div><div id="l1815" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> fmt</span><span class="nv">\_</span><span class="nb">write</span><span class="o">/[</span><span class="m">2</span><span class="nb">,</span><span class="m">3</span><span class="o">]</span><span class="nb">}, the {</span><span class="nv">\tt</span><span class="nb"> format} library is more compatable</span>
</div><div id="l1816" class="code_block"><span class="nb">with the formatted output found in other Prologs.</span>
</div><div id="l1817" class="code_block">
</div><div id="l1818" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Error Cases}</span>
</div><div id="l1819" class="code_block"><span class="nv">\bi</span>
</div><div id="l1820" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias} is a variable</span>
</div><div id="l1821" class="code_block"><span class="nv">\bi</span>
</div><div id="l1822" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> instantiation</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l1823" class="code_block"><span class="nv">\ei</span>
</div><div id="l1824" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias} is neither a variable nor a stream term nor an alias.</span>
</div><div id="l1825" class="code_block"><span class="nv">\bi</span>
</div><div id="l1826" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> domain</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias,Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l1827" class="code_block"><span class="nv">\ei</span>
</div><div id="l1828" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias} is not associated with an open output stream</span>
</div><div id="l1829" class="code_block"><span class="nv">\bi</span>
</div><div id="l1830" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> existence</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">stream,Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l1831" class="code_block"><span class="nv">\ei</span>
</div><div id="l1832" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Fmt} is uninstantiated or not a character string or atom</span>
</div><div id="l1833" class="code_block"><span class="nv">\bi</span>
</div><div id="l1834" class="code_block"><span class="nv">\item</span><span class="nb">   {</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">&#39;character string or atom&#39;,Fmt</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l1835" class="code_block"><span class="nv">\ei</span>
</div><div id="l1836" class="code_block"><span class="nv">\item</span><span class="nb"> A format specifier in {</span><span class="nv">\tt</span><span class="nb"> Fmt} and its corresponding argument</span>
</div><div id="l1837" class="code_block"><span class="nb">  in {</span><span class="nv">\tt</span><span class="nb"> Term} are of incompatable types.</span>
</div><div id="l1838" class="code_block"><span class="nv">\bi</span>
</div><div id="l1839" class="code_block"><span class="nv">\item</span><span class="nb">   {</span><span class="nv">\tt</span><span class="nb"> misc</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l1840" class="code_block"><span class="nv">\ei</span>
</div><div id="l1841" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Term} contains fewer arguments than {</span><span class="nv">\tt</span><span class="nb"> Fmt} has format</span>
</div><div id="l1842" class="code_block"><span class="nb">  specifiers or {</span><span class="nv">\tt</span><span class="nb"> Term} is uninstantiated</span>
</div><div id="l1843" class="code_block"><span class="nv">\bi</span>
</div><div id="l1844" class="code_block"><span class="nv">\item</span><span class="nb">   {</span><span class="nv">\tt</span><span class="nb"> misc</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l1845" class="code_block"><span class="nv">\ei</span>
</div><div id="l1846" class="code_block"><span class="nv">\ei</span>
</div><div id="l1847" class="code_block">
</div><div id="l1848" class="code_block"><span class="nb">If the number of arguments in {</span><span class="nv">\tt</span><span class="nb"> Term} is greater than the number of</span>
</div><div id="l1849" class="code_block"><span class="nb">conversion specifiers in {</span><span class="nv">\tt</span><span class="nb"> Fmt} no error is thrown, but a warning</span>
</div><div id="l1850" class="code_block"><span class="nb">is issued.</span>
</div><div id="l1851" class="code_block">
</div><div id="l1852" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Caution for </span><span class="m">64</span><span class="o">-</span><span class="nb">bit Platforms}</span>
</div><div id="l1853" class="code_block"><span class="c">%</span>
</div><div id="l1854" class="code_block"><span class="nb">As discussed, {</span><span class="nv">\tt</span><span class="nb"> fmt</span><span class="nv">\_</span><span class="nb">write</span><span class="o">/[</span><span class="m">2</span><span class="nb">,</span><span class="m">3</span><span class="o">]</span><span class="nb">} calls {</span><span class="nv">\tt</span><span class="nb"> printf</span><span class="o">()</span><span class="nb">} and inherits</span>
</div><div id="l1855" class="code_block"><span class="nb">the flexibility of that function, but also its ``features&#39;&#39;.  One of</span>
</div><div id="l1856" class="code_block"><span class="nb">these features is that in most </span><span class="m">64</span><span class="o">-</span><span class="nb">bit platforms, large integers that</span>
</div><div id="l1857" class="code_block"><span class="nb">behave perfectly well otherwise are not printed out properly by {</span><span class="nv">\tt</span>
</div><div id="l1858" class="code_block"><span class="nb">  printf</span><span class="o">()</span><span class="nb">} with the {</span><span class="nv">\tt</span><span class="nb"> </span><span class="nv">\%</span><span class="nb">d} format </span><span class="o">--</span><span class="nb"> rather another format string</span>
</div><div id="l1859" class="code_block"><span class="nb">needs to be used </span><span class="o">(</span><span class="nb">such as {</span><span class="nv">\tt</span><span class="nb"> </span><span class="nv">\%</span><span class="nb">ld} on Linux</span><span class="o">)</span><span class="nb">.  {</span><span class="nv">\tt</span>
</div><div id="l1860" class="code_block"><span class="nb">  fmt</span><span class="nv">\_</span><span class="nb">write</span><span class="o">/[</span><span class="m">1</span><span class="nb">,</span><span class="m">2</span><span class="o">]</span><span class="nb">} recognizes the {</span><span class="nv">\tt</span><span class="nb"> </span><span class="nv">\%</span><span class="nb">ld} option and passes it</span>
</div><div id="l1861" class="code_block"><span class="nb">onto {</span><span class="nv">\tt</span><span class="nb"> fprintf</span><span class="o">()</span><span class="nb">}, but the proper format string for </span><span class="m">64</span><span class="o">-</span><span class="nb">bit integers</span>
</div><div id="l1862" class="code_block"><span class="nb">may be different on other platforms.</span>
</div><div id="l1863" class="code_block">
</div><div id="l1864" class="code_block"><span class="nv">\standarditem</span><span class="nb">{fmt</span><span class="nv">\_</span><span class="nb">write</span><span class="nv">\_</span><span class="nb">string</span><span class="o">(-</span><span class="nb">String,</span><span class="o">+</span><span class="nb">Fmt,</span><span class="o">+</span><span class="nb">Term</span><span class="o">)</span><span class="nb">}{fmt</span><span class="nv">\_</span><span class="nb">write</span><span class="nv">\_</span><span class="nb">string</span><span class="o">/</span><span class="m">3</span><span class="nb">}</span>
</div><div id="l1865" class="code_block"><span class="nb">    This predicate works like the C function {</span><span class="nv">\tt</span><span class="nb"> sprintf}. It takes the</span>
</div><div id="l1866" class="code_block"><span class="nb">    format string and substitutes the values from the arguments of {</span><span class="nv">\tt</span>
</div><div id="l1867" class="code_block"><span class="nb">      Term} </span><span class="o">(</span><span class="nb">{</span><span class="nv">\it</span><span class="nb"> e.g.}, {</span><span class="nv">\tt</span><span class="nb"> args</span><span class="o">(</span><span class="nb">X,Y,Z</span><span class="o">)</span><span class="nb">}</span><span class="o">)</span><span class="nb"> for the formatting instructions</span>
</div><div id="l1868" class="code_block"><span class="nb">    </span><span class="nv">\%</span><span class="nb">s, </span><span class="nv">\%</span><span class="nb">d, etc. Additional syntactic sugar, as in </span><span class="nv">\verb</span><span class="nb">|fmt_write|, is</span>
</div><div id="l1869" class="code_block"><span class="nb">    recognized. The result is available in {</span><span class="nv">\tt</span><span class="nb"> String}. {</span><span class="nv">\tt</span><span class="nb"> Fmt} is a</span>
</div><div id="l1870" class="code_block"><span class="nb">    string or an atom that represents the format, as in</span>
</div><div id="l1871" class="code_block"><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> fmt</span><span class="nv">\_</span><span class="nb">write}.</span>
</div><div id="l1872" class="code_block"><span class="nb">    </span>
</div><div id="l1873" class="code_block"><span class="nb">    If the number of format specifiers is greater than the number of</span>
</div><div id="l1874" class="code_block"><span class="nb">    arguments to be printed, an error is issued. If the number of arguments</span>
</div><div id="l1875" class="code_block"><span class="nb">    is greater, then a warning is issued.</span>
</div><div id="l1876" class="code_block">
</div><div id="l1877" class="code_block"><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> fmt</span><span class="nv">\_</span><span class="nb">write</span><span class="nv">\_</span><span class="nb">string} requires that the printed size of each</span>
</div><div id="l1878" class="code_block"><span class="nb">    argument </span><span class="o">(</span><span class="nb">{</span><span class="nv">\it</span><span class="nb"> e.g.}, X,Y,and Z above</span><span class="o">)</span><span class="nb"> must be less than </span><span class="m">16</span><span class="nb">K. Longer</span>
</div><div id="l1879" class="code_block"><span class="nb">    arguments are cut to that size, so some loss of information is possible.</span>
</div><div id="l1880" class="code_block"><span class="nb">    However, there is no limit on the total size of the output </span><span class="o">(</span><span class="nb">apart from</span>
</div><div id="l1881" class="code_block"><span class="nb">    the maximum atom size imposed by XSB</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l1882" class="code_block">
</div><div id="l1883" class="code_block"><span class="nv">\standarditem</span><span class="nb">{file</span><span class="nv">\_</span><span class="nb">read</span><span class="nv">\_</span><span class="nb">line</span><span class="nv">\_</span><span class="nb">list</span><span class="o">(-</span><span class="nb">String</span><span class="o">)</span><span class="nb">}{file</span><span class="nv">\_</span><span class="nb">read</span><span class="nv">\_</span><span class="nb">line</span><span class="nv">\_</span><span class="nb">list</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span>
</div><div id="l1884" class="code_block"><span class="nb">A line read from the current input stream is converted into a list of</span>
</div><div id="l1885" class="code_block"><span class="nb">character codes.  This predicate </span>
</div><div id="l1886" class="code_block"><span class="c">%is \emph{much} more efficient than</span>
</div><div id="l1887" class="code_block"><span class="c">%{{\tt fget\_line/3}} (see below), and </span>
</div><div id="l1888" class="code_block"><span class="nb">avoids interning an atom as does {</span><span class="nv">\tt</span><span class="nb"> file</span><span class="nv">\_</span><span class="nb">read</span><span class="nv">\_</span><span class="nb">line</span><span class="nv">\_</span><span class="nb">atom</span><span class="o">/</span><span class="m">3</span><span class="nb">}, and so is</span>
</div><div id="l1889" class="code_block"><span class="nb">recommended when speed is important.  This predicate fails on reaching</span>
</div><div id="l1890" class="code_block"><span class="nb">the end of file.</span>
</div><div id="l1891" class="code_block">
</div><div id="l1892" class="code_block"><span class="nv">\standarditem</span><span class="nb">{file</span><span class="nv">\_</span><span class="nb">read</span><span class="nv">\_</span><span class="nb">line</span><span class="nv">\_</span><span class="nb">list</span><span class="o">(</span><span class="nb">Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias,</span><span class="o">-</span><span class="nb">CharList</span><span class="o">)</span><span class="nb">}{file</span><span class="nv">\_</span><span class="nb">read</span><span class="nv">\_</span><span class="nb">line</span><span class="nv">\_</span><span class="nb">list</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l1893" class="code_block"><span class="nb">Acts as does {</span><span class="nv">\tt</span><span class="nb"> file</span><span class="nv">\_</span><span class="nb">read</span><span class="nv">\_</span><span class="nb">line</span><span class="nv">\_</span><span class="nb">list}, but uses {</span><span class="nv">\tt</span><span class="nb"> Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">atom}.</span>
</div><div id="l1894" class="code_block">
</div><div id="l1895" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Error Cases} </span>
</div><div id="l1896" class="code_block"><span class="nv">\bi</span>
</div><div id="l1897" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias} is a variable</span>
</div><div id="l1898" class="code_block"><span class="nv">\bi</span>
</div><div id="l1899" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> instantiation</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l1900" class="code_block"><span class="nv">\ei</span>
</div><div id="l1901" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias} is neither a variable nor a stream term nor an alias.</span>
</div><div id="l1902" class="code_block"><span class="nv">\bi</span>
</div><div id="l1903" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> domain</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias,Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l1904" class="code_block"><span class="nv">\ei</span>
</div><div id="l1905" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias} is not associated with an open input stream</span>
</div><div id="l1906" class="code_block"><span class="nv">\bi</span>
</div><div id="l1907" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> existence</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">stream,Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l1908" class="code_block"><span class="nv">\ei</span>
</div><div id="l1909" class="code_block"><span class="nv">\ei</span>
</div><div id="l1910" class="code_block">
</div><div id="l1911" class="code_block"><span class="nv">\standarditem</span><span class="nb">{file</span><span class="nv">\_</span><span class="nb">read</span><span class="nv">\_</span><span class="nb">line</span><span class="nv">\_</span><span class="nb">atom</span><span class="o">(-</span><span class="nb">Atom</span><span class="o">)</span><span class="nb">}{file</span><span class="nv">\_</span><span class="nb">read</span><span class="nv">\_</span><span class="nb">line</span><span class="nv">\_</span><span class="nb">atom</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span>
</div><div id="l1912" class="code_block"><span class="c">%</span>
</div><div id="l1913" class="code_block"><span class="nb">Reads a line from the current </span><span class="o">(</span><span class="nb">textual</span><span class="o">)</span><span class="nb"> input stream, returning it as</span>
</div><div id="l1914" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> Atom}.  This predicate fails on reaching the end of file.</span>
</div><div id="l1915" class="code_block">
</div><div id="l1916" class="code_block"><span class="nv">\standarditem</span><span class="nb">{file</span><span class="nv">\_</span><span class="nb">read</span><span class="nv">\_</span><span class="nb">line</span><span class="nv">\_</span><span class="nb">atom</span><span class="o">(+</span><span class="nb">Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias,</span><span class="o">-</span><span class="nb">Atom</span><span class="o">)</span><span class="nb">}{file</span><span class="nv">\_</span><span class="nb">read</span><span class="nv">\_</span><span class="nb">line</span><span class="nv">\_</span><span class="nb">atom</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l1917" class="code_block"><span class="nb">Like {</span><span class="nv">\tt</span><span class="nb"> file</span><span class="nv">\_</span><span class="nb">read</span><span class="nv">\_</span><span class="nb">line</span><span class="nv">\_</span><span class="nb">atom</span><span class="o">/</span><span class="m">1</span><span class="nb">} but reads from {</span><span class="nv">\tt</span><span class="nb"> Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias}.</span>
</div><div id="l1918" class="code_block"><span class="c">%</span>
</div><div id="l1919" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Error Cases} </span>
</div><div id="l1920" class="code_block"><span class="nv">\bi</span>
</div><div id="l1921" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias} is a variable</span>
</div><div id="l1922" class="code_block"><span class="nv">\bi</span>
</div><div id="l1923" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> instantiation</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l1924" class="code_block"><span class="nv">\ei</span>
</div><div id="l1925" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias} is neither a variable nor a stream term nor an alias.</span>
</div><div id="l1926" class="code_block"><span class="nv">\bi</span>
</div><div id="l1927" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> domain</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias,Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l1928" class="code_block"><span class="nv">\ei</span>
</div><div id="l1929" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias} is not associated with an open input stream</span>
</div><div id="l1930" class="code_block"><span class="nv">\bi</span>
</div><div id="l1931" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> existence</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">stream,Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l1932" class="code_block"><span class="nv">\ei</span>
</div><div id="l1933" class="code_block"><span class="nv">\ei</span>
</div><div id="l1934" class="code_block">
</div><div id="l1935" class="code_block"><span class="nv">\ourrepeatmoditem</span><span class="nb">{file</span><span class="nv">\_</span><span class="nb">write</span><span class="nv">\_</span><span class="nb">line</span><span class="o">(+</span><span class="nb">String, </span><span class="o">+</span><span class="nb">Offset</span><span class="o">)</span><span class="nb">}{file</span><span class="nv">\_</span><span class="nb">write</span><span class="nv">\_</span><span class="nb">line</span><span class="o">/</span><span class="m">2</span><span class="nb">}{file</span><span class="nv">\_</span><span class="nb">io}</span>
</div><div id="l1936" class="code_block"><span class="nv">\ourmoditem</span><span class="nb">{file</span><span class="nv">\_</span><span class="nb">write</span><span class="nv">\_</span><span class="nb">line</span><span class="o">(+</span><span class="nb">Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias, </span><span class="o">+</span><span class="nb">String, </span><span class="o">+</span><span class="nb">Offset</span><span class="o">)</span><span class="nb">}{file</span><span class="nv">\_</span><span class="nb">write</span><span class="nv">\_</span><span class="nb">line</span><span class="o">/</span><span class="m">3</span><span class="nb">}{file</span><span class="nv">\_</span><span class="nb">io}</span>
</div><div id="l1937" class="code_block"><span class="c">%</span>
</div><div id="l1938" class="code_block"><span class="nb">These predicates write {</span><span class="nv">\tt</span><span class="nb"> String} beginning with character {</span><span class="nv">\tt</span>
</div><div id="l1939" class="code_block"><span class="nb">  Offset} to the current output stream. {</span><span class="nv">\tt</span><span class="nb"> String} can be an atom or</span>
</div><div id="l1940" class="code_block"><span class="nb">a list of ASCII character codes. This does </span><span class="nv">\emph</span><span class="nb">{not} put the newline</span>
</div><div id="l1941" class="code_block"><span class="nb">character at the end of the string </span><span class="o">(</span><span class="nb">unless {</span><span class="nv">\tt</span><span class="nb"> String} already had</span>
</div><div id="l1942" class="code_block"><span class="nb">this character</span><span class="o">)</span><span class="nb">. Note that escape sequences, like </span><span class="nv">\verb</span><span class="nb">|</span><span class="nv">\n</span><span class="nb">|, are</span>
</div><div id="l1943" class="code_block"><span class="nb">recognized if {</span><span class="nv">\tt</span><span class="nb"> String} is a character list, but are output as is</span>
</div><div id="l1944" class="code_block"><span class="nb">if {</span><span class="nv">\tt</span><span class="nb"> String} is an atom.</span>
</div><div id="l1945" class="code_block">
</div><div id="l1946" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Error Cases}</span>
</div><div id="l1947" class="code_block"><span class="nv">\bi</span>
</div><div id="l1948" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias} is a variable</span>
</div><div id="l1949" class="code_block"><span class="nv">\bi</span>
</div><div id="l1950" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> instantiation</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l1951" class="code_block"><span class="nv">\ei</span>
</div><div id="l1952" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias} is neither a variable nor a stream term nor an alias.</span>
</div><div id="l1953" class="code_block"><span class="nv">\bi</span>
</div><div id="l1954" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> domain</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias,Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l1955" class="code_block"><span class="nv">\ei</span>
</div><div id="l1956" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias} is not associated with an open input stream</span>
</div><div id="l1957" class="code_block"><span class="nv">\bi</span>
</div><div id="l1958" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> existence</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">stream,Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l1959" class="code_block"><span class="nv">\ei</span>
</div><div id="l1960" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> String} is neither a Prolog character list not an atom</span>
</div><div id="l1961" class="code_block"><span class="nv">\bi</span>
</div><div id="l1962" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> misc</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l1963" class="code_block"><span class="nv">\ei</span>
</div><div id="l1964" class="code_block"><span class="nv">\ei</span>
</div><div id="l1965" class="code_block">
</div><div id="l1966" class="code_block"><span class="c">%----------------------------------------------------------------------------------------------</span>
</div><div id="l1967" class="code_block">
</div><div id="l1968" class="code_block"><span class="nv">\ourmoditem</span><span class="nb">{file</span><span class="nv">\_</span><span class="nb">getbuf</span><span class="nv">\_</span><span class="nb">list</span><span class="o">(+</span><span class="nb">Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias, </span><span class="o">+</span><span class="nb">BytesRequested, </span><span class="o">-</span><span class="nb">CharList, </span><span class="o">-</span><span class="nb">BytesRead</span><span class="o">)</span><span class="nb">}{file</span><span class="nv">\_</span><span class="nb">getbuf</span><span class="nv">\_</span><span class="nb">list</span><span class="o">/</span><span class="m">4</span><span class="nb">}{file</span><span class="nv">\_</span><span class="nb">io} </span>
</div><div id="l1969" class="code_block"><span class="nb">Read {</span><span class="nv">\tt</span><span class="nb"> BytesRequested} bytes from file represented by {</span><span class="nv">\tt</span>
</div><div id="l1970" class="code_block"><span class="nb">Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias} </span><span class="o">(</span><span class="nb">which must already be open for reading</span><span class="o">)</span><span class="nb"> into</span>
</div><div id="l1971" class="code_block"><span class="nb">variable {</span><span class="nv">\tt</span><span class="nb"> String} as a list of character codes. This is analogous</span>
</div><div id="l1972" class="code_block"><span class="nb">to {</span><span class="nv">\tt</span><span class="nb"> fread} in C.  This predicate always succeeds. It does not</span>
</div><div id="l1973" class="code_block"><span class="nb">distinguish between a file error and end of file.  You can determine</span>
</div><div id="l1974" class="code_block"><span class="nb">if either of these conditions has happened by verifying that </span><span class="s">$</span><span class="k">\tt</span>
</div><div id="l1975" class="code_block">BytesRead &lt; BytesRequested<span class="s">$</span><span class="nb">.</span>
</div><div id="l1976" class="code_block">
</div><div id="l1977" class="code_block"><span class="nv">\ourmoditem</span><span class="nb">{file</span><span class="nv">\_</span><span class="nb">getbuf</span><span class="nv">\_</span><span class="nb">list</span><span class="o">(+</span><span class="nb">BytesRequested, </span><span class="o">-</span><span class="nb">String, </span><span class="o">-</span><span class="nb">BytesRead</span><span class="o">)</span><span class="nb">}{file</span><span class="nv">\_</span><span class="nb">getbuf</span><span class="nv">\_</span><span class="nb">list</span><span class="o">/</span><span class="m">3</span><span class="nb">}{file</span><span class="nv">\_</span><span class="nb">io}</span>
</div><div id="l1978" class="code_block"><span class="c">%</span>
</div><div id="l1979" class="code_block"><span class="nb">Like </span><span class="nv">\verb</span><span class="nb">|file_getbuf_list</span><span class="o">/</span><span class="m">3</span><span class="nb">|, but reads from the currently open input stream</span>
</div><div id="l1980" class="code_block"><span class="o">(</span><span class="nb">{</span><span class="nv">\it</span><span class="nb"> i.e.}, with {</span><span class="nv">\tt</span><span class="nb"> see</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l1981" class="code_block">
</div><div id="l1982" class="code_block">
</div><div id="l1983" class="code_block"><span class="nv">\ourmoditem</span><span class="nb">{file</span><span class="nv">\_</span><span class="nb">getbuf</span><span class="nv">\_</span><span class="nb">atom</span><span class="o">(+</span><span class="nb">Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias, </span><span class="o">+</span><span class="nb">BytesRequested, </span><span class="o">-</span><span class="nb">String, </span><span class="o">-</span><span class="nb">BytesRead</span><span class="o">)</span><span class="nb">}{file</span><span class="nv">\_</span><span class="nb">file</span><span class="nv">\_</span><span class="nb">getbuf</span><span class="nv">\_</span><span class="nb">atom</span><span class="o">/</span><span class="m">4</span><span class="nb">}{file</span><span class="nv">\_</span><span class="nb">io}</span>
</div><div id="l1984" class="code_block">
</div><div id="l1985" class="code_block"><span class="nb">Read {</span><span class="nv">\tt</span><span class="nb"> BytesRequested} bytes from file represented by {</span><span class="nv">\tt</span>
</div><div id="l1986" class="code_block"><span class="nb">Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias} </span><span class="o">(</span><span class="nb">which must already be open for reading</span><span class="o">)</span><span class="nb"> into</span>
</div><div id="l1987" class="code_block"><span class="nb">variable {</span><span class="nv">\tt</span><span class="nb"> String}. This is analogous to {</span><span class="nv">\tt</span><span class="nb"> fread} in C.  This</span>
</div><div id="l1988" class="code_block"><span class="nb">predicate always succeeds. It does not distinguish between a file</span>
</div><div id="l1989" class="code_block"><span class="nb">error and end of file.  You can determine if either of these</span>
</div><div id="l1990" class="code_block"><span class="nb">conditions has happened by verifying that </span><span class="s">$</span><span class="k">\tt</span> BytesRead &lt;
</div><div id="l1991" class="code_block">BytesRequested<span class="s">$</span><span class="nb">.</span>
</div><div id="l1992" class="code_block">
</div><div id="l1993" class="code_block"><span class="nb">Note: because XSB does not have an atom table garbage collector yet,</span>
</div><div id="l1994" class="code_block"><span class="nb">this predicate should not be used to read large files.  Use {</span><span class="nv">\tt</span>
</div><div id="l1995" class="code_block"><span class="nb">read</span><span class="nv">\_</span><span class="nb">getbuf</span><span class="nv">\_</span><span class="nb">list} or another predicate in this case.</span>
</div><div id="l1996" class="code_block">
</div><div id="l1997" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Error Cases} </span>
</div><div id="l1998" class="code_block"><span class="nv">\bi</span>
</div><div id="l1999" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias} is a variable</span>
</div><div id="l2000" class="code_block"><span class="nv">\bi</span>
</div><div id="l2001" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> instantiation</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l2002" class="code_block"><span class="nv">\ei</span>
</div><div id="l2003" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias} is neither a variable nor a stream term nor an alias.</span>
</div><div id="l2004" class="code_block"><span class="nv">\bi</span>
</div><div id="l2005" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> domain</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias,Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2006" class="code_block"><span class="nv">\ei</span>
</div><div id="l2007" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias} is not associated with an open input stream</span>
</div><div id="l2008" class="code_block"><span class="nv">\bi</span>
</div><div id="l2009" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> existence</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">stream,Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2010" class="code_block"><span class="nv">\ei</span>
</div><div id="l2011" class="code_block"><span class="nv">\ei</span>
</div><div id="l2012" class="code_block">
</div><div id="l2013" class="code_block"><span class="nv">\ourmoditem</span><span class="nb">{file</span><span class="nv">\_</span><span class="nb">getbuf</span><span class="nv">\_</span><span class="nb">atom</span><span class="o">(+</span><span class="nb">BytesRequested, </span><span class="o">-</span><span class="nb">String, </span><span class="o">-</span><span class="nb">BytesRead</span><span class="o">)</span><span class="nb">}{file</span><span class="nv">\_</span><span class="nb">getbuf</span><span class="nv">\_</span><span class="nb">atom</span><span class="o">/</span><span class="m">3</span><span class="nb">}{file</span><span class="nv">\_</span><span class="nb">io}</span>
</div><div id="l2014" class="code_block"><span class="c">%</span>
</div><div id="l2015" class="code_block"><span class="nb">Like </span><span class="nv">\verb</span><span class="nb">|file_getbuf_atom</span><span class="o">/</span><span class="m">4</span><span class="nb">|, but reads from the currently open input stream.</span>
</div><div id="l2016" class="code_block">
</div><div id="l2017" class="code_block"><span class="nv">\ourmoditem</span><span class="nb">{file</span><span class="nv">\_</span><span class="nb">putbuf</span><span class="o">(+</span><span class="nb">Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias, </span><span class="o">+</span><span class="nb">BytesRequested, </span><span class="o">+</span><span class="nb">String, </span><span class="o">+</span><span class="nb">Offset, </span><span class="o">-</span><span class="nb">BytesWritten</span><span class="o">)</span><span class="nb">}{file</span><span class="nv">\_</span><span class="nb">putbuf</span><span class="o">/</span><span class="m">5</span><span class="nb">}{file</span><span class="nv">\_</span><span class="nb">io}</span>
</div><div id="l2018" class="code_block">
</div><div id="l2019" class="code_block"><span class="nb">Write {</span><span class="nv">\tt</span><span class="nb"> BytesRequested} bytes into file represented by I</span><span class="o">/</span><span class="nb">O port</span>
</div><div id="l2020" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias} </span><span class="o">(</span><span class="nb">which must already be open for writing</span><span class="o">)</span><span class="nb"> from</span>
</div><div id="l2021" class="code_block"><span class="nb">variable {</span><span class="nv">\tt</span><span class="nb"> String} at position {</span><span class="nv">\tt</span><span class="nb"> Offset}. This is analogous to C</span>
</div><div id="l2022" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> fwrite}.  The value of {</span><span class="nv">\tt</span><span class="nb"> String} can be an atom or a list of</span>
</div><div id="l2023" class="code_block"><span class="nb">ASCII characters.</span>
</div><div id="l2024" class="code_block">
</div><div id="l2025" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Error Cases} </span>
</div><div id="l2026" class="code_block"><span class="nv">\bi</span>
</div><div id="l2027" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias} is a variable</span>
</div><div id="l2028" class="code_block"><span class="nv">\bi</span>
</div><div id="l2029" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> instantiation</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l2030" class="code_block"><span class="nv">\ei</span>
</div><div id="l2031" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias} is neither a variable nor a stream term nor an alias.</span>
</div><div id="l2032" class="code_block"><span class="nv">\bi</span>
</div><div id="l2033" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> domain</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias,Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2034" class="code_block"><span class="nv">\ei</span>
</div><div id="l2035" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias} is not associated with an open input stream</span>
</div><div id="l2036" class="code_block"><span class="nv">\bi</span>
</div><div id="l2037" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> existence</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">stream,Stream</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">alias</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2038" class="code_block"><span class="nv">\ei</span>
</div><div id="l2039" class="code_block"><span class="nv">\ei</span>
</div><div id="l2040" class="code_block">
</div><div id="l2041" class="code_block"><span class="nv">\ourmoditem</span><span class="nb">{file</span><span class="nv">\_</span><span class="nb">putbuf</span><span class="o">(+</span><span class="nb">BytesRequested, </span><span class="o">+</span><span class="nb">String, </span><span class="o">+</span><span class="nb">Offset, </span><span class="o">-</span><span class="nb">BytesWritten</span><span class="o">)</span><span class="nb">}{file</span><span class="nv">\_</span><span class="nb">putbuf</span><span class="o">/</span><span class="m">4</span><span class="nb">}{file</span><span class="nv">\_</span><span class="nb">io}</span>
</div><div id="l2042" class="code_block"><span class="c">%</span>
</div><div id="l2043" class="code_block"><span class="nb">Like </span><span class="nv">\verb</span><span class="nb">|file_putbuf</span><span class="o">/</span><span class="m">3</span><span class="nb">|, but output goes to the currently open output stream.</span>
</div><div id="l2044" class="code_block">
</div><div id="l2045" class="code_block">
</div><div id="l2046" class="code_block"><span class="nv">\end</span><span class="nb">{description}</span>
</div><div id="l2047" class="code_block">
</div><div id="l2048" class="code_block"><span class="c">%-------------------------------------------------------------------</span>
</div><div id="l2049" class="code_block"><span class="nv">\comment</span><span class="nb">{</span>
</div><div id="l2050" class="code_block"><span class="nv">\standarditem</span><span class="nb">{fmt</span><span class="nv">\_</span><span class="nb">read</span><span class="o">(+</span><span class="nb">Format, types</span><span class="o">(+</span><span class="nb">T</span><span class="m">1</span><span class="nb">,</span><span class="o">+</span><span class="nb">T</span><span class="m">2</span><span class="nb">,...</span><span class="o">)</span><span class="nb">, args</span><span class="o">(-</span><span class="nb">A</span><span class="m">1</span><span class="nb">,</span><span class="o">-</span><span class="nb">A</span><span class="m">2</span><span class="nb">,...</span><span class="o">)</span><span class="nb">, </span><span class="o">-</span><span class="nb">RetCode</span><span class="o">)</span><span class="nb">}</span><span class="nv">\index</span><span class="nb">{</span><span class="nv">\texttt</span><span class="nb">{fmt</span><span class="nv">\_</span><span class="nb">read</span><span class="o">/</span><span class="m">4</span><span class="nb">}} </span>
</div><div id="l2051" class="code_block"><span class="nb"> This predicate implements C</span><span class="o">-</span><span class="nb">style formatted input. It reads the current</span>
</div><div id="l2052" class="code_block"><span class="nb"> input according to the {</span><span class="nv">\tt</span><span class="nb"> Format} string.  {</span><span class="nv">\tt</span><span class="nb"> Format} has the</span>
</div><div id="l2053" class="code_block"><span class="nb"> same syntax as the input format in C. The term {</span><span class="nv">\tt</span><span class="nb"> types</span><span class="o">(</span><span class="nb">...</span><span class="o">)</span><span class="nb">} lists the</span>
</div><div id="l2054" class="code_block"><span class="nb"> types of the arguments; they must match the types specified in {</span><span class="nv">\tt</span>
</div><div id="l2055" class="code_block"><span class="nb"> Format}. Here, </span><span class="m">1</span><span class="nb"> means string, </span><span class="m">2</span><span class="nb"> means integer, and </span><span class="m">3</span><span class="nb"> means float.</span>
</div><div id="l2056" class="code_block"><span class="nb"> The term {</span><span class="nv">\tt</span><span class="nb"> args</span><span class="o">()</span><span class="nb">} specifies the variables for the input. {</span><span class="nv">\tt</span><span class="nb"> RetCode}</span>
</div><div id="l2057" class="code_block"><span class="nb"> specifies the return code: </span><span class="m">0</span><span class="nb"> </span><span class="o">--</span><span class="nb"> ok; </span><span class="o">-</span><span class="m">1</span><span class="nb"> </span><span class="o">--</span><span class="nb"> end of file.</span>
</div><div id="l2058" class="code_block">
</div><div id="l2059" class="code_block"><span class="nv">\standarditem</span><span class="nb">{read</span><span class="nv">\_</span><span class="nb">line</span><span class="o">(-</span><span class="nb">Line, </span><span class="o">-</span><span class="nb">Status</span><span class="o">)</span><span class="nb">}</span><span class="nv">\index</span><span class="nb">{</span><span class="nv">\texttt</span><span class="nb">{read</span><span class="nv">\_</span><span class="nb">line</span><span class="o">/</span><span class="m">2</span><span class="nb">}} </span>
</div><div id="l2060" class="code_block"><span class="nb"> Reads the next line from the current input and puts it in {</span><span class="nv">\tt</span><span class="nb"> Line}.</span>
</div><div id="l2061" class="code_block"><span class="nb"> If the line is larger than the available buffer, then {</span><span class="nv">\tt</span><span class="nb"> Status} is </span><span class="m">0</span><span class="nb">.</span>
</div><div id="l2062" class="code_block"><span class="nb"> If the line was read in full, up to and including the newline character,</span>
</div><div id="l2063" class="code_block"><span class="nb"> then {</span><span class="nv">\tt</span><span class="nb"> Status} is </span><span class="m">1</span><span class="nb">. </span>
</div><div id="l2064" class="code_block">
</div><div id="l2065" class="code_block"><span class="nv">\standarditem</span><span class="nb">{fmt</span><span class="nv">\_</span><span class="nb">write</span><span class="o">(+</span><span class="nb">Format, args</span><span class="o">(-</span><span class="nb">A</span><span class="m">1</span><span class="nb">,</span><span class="o">-</span><span class="nb">A</span><span class="m">2</span><span class="nb">,...</span><span class="o">))</span><span class="nb">}</span><span class="nv">\index</span><span class="nb">{</span><span class="nv">\texttt</span><span class="nb">{fmt</span><span class="nv">\_</span><span class="nb">write</span><span class="o">/</span><span class="m">2</span><span class="nb">}} </span>
</div><div id="l2066" class="code_block"><span class="nb"> Similar to formatted write in C. The semantics of the arguments is the</span>
</div><div id="l2067" class="code_block"><span class="nb"> same as for {</span><span class="nv">\tt</span><span class="nb"> fmt</span><span class="nv">\_</span><span class="nb">read</span><span class="o">/</span><span class="m">4</span><span class="nb">}.</span>
</div><div id="l2068" class="code_block">
</div><div id="l2069" class="code_block"><span class="nv">\standarditem</span><span class="nb">{fmt</span><span class="nv">\_</span><span class="nb">write</span><span class="nv">\_</span><span class="nb">string</span><span class="o">(-</span><span class="nb">String, </span><span class="o">+</span><span class="nb">Format, args</span><span class="o">(-</span><span class="nb">A</span><span class="m">1</span><span class="nb">,</span><span class="o">-</span><span class="nb">A</span><span class="m">2</span><span class="nb">,...</span><span class="o">))</span><span class="nb">}</span><span class="nv">\index</span><span class="nb">{</span><span class="nv">\texttt</span><span class="nb">{fmt</span><span class="nv">\_</span><span class="nb">write</span><span class="o">/</span><span class="m">2</span><span class="nb">}} </span>
</div><div id="l2070" class="code_block"><span class="nb"> Like {</span><span class="nv">\tt</span><span class="nb"> fmt</span><span class="nv">\_</span><span class="nb">write</span><span class="o">/</span><span class="m">2</span><span class="nb">}, but the output string is placed in {</span><span class="nv">\tt</span><span class="nb"> String}.</span>
</div><div id="l2071" class="code_block"><span class="nb">}</span>
</div><div id="l2072" class="code_block">
</div><div id="l2073" class="code_block"><span class="c">%--------------------------------------------------------------------------------------------------</span>
</div><div id="l2074" class="code_block">
</div><div id="l2075" class="code_block"><span class="nv">\section</span><span class="nb">{Interactions with the Operating System}</span>
</div><div id="l2076" class="code_block">
</div><div id="l2077" class="code_block"><span class="nb">XSB provides a number of facilities for interacting with the UNIX and</span>
</div><div id="l2078" class="code_block"><span class="nb">Windows operating systems.  This section describes basic facilities</span>
</div><div id="l2079" class="code_block"><span class="nb">for invoking shell commands and file manipulation.  Chapter </span><span class="m">1</span><span class="nb"> of</span>
</div><div id="l2080" class="code_block"><span class="nb">Volume </span><span class="m">2</span><span class="nb"> discusses more advanced commands for process spawning and</span>
</div><div id="l2081" class="code_block"><span class="nb">control, along with interprocess communication.</span>
</div><div id="l2082" class="code_block">
</div><div id="l2083" class="code_block"><span class="nv">\begin</span><span class="nb">{description}</span>
</div><div id="l2084" class="code_block">
</div><div id="l2085" class="code_block"><span class="nv">\standarditem</span><span class="nb">{shell</span><span class="o">(+</span><span class="nb">SystemCall</span><span class="o">)</span><span class="nb">}{shell</span><span class="o">/</span><span class="m">1</span><span class="nb">} </span>
</div><div id="l2086" class="code_block"><span class="c">%</span>
</div><div id="l2087" class="code_block"><span class="nb">Calls the operating system with the atom {</span><span class="nv">\tt</span><span class="nb"> SystemCall} as argument,</span>
</div><div id="l2088" class="code_block"><span class="nb">using the {</span><span class="nv">\tt</span><span class="nb"> libc} function {</span><span class="nv">\tt</span><span class="nb"> system</span><span class="o">()</span><span class="nb">}.  The predicate succeeds</span>
</div><div id="l2089" class="code_block"><span class="nb">if {</span><span class="nv">\tt</span><span class="nb"> SystemCall} is executed successfully, otherwise it fails.  As</span>
</div><div id="l2090" class="code_block"><span class="nb">a notational convenience, the user can also supply {</span><span class="nv">\tt</span><span class="nb"> SystemCall}</span>
</div><div id="l2091" class="code_block"><span class="nb">either as a list.  In this case, elements of the list will be</span>
</div><div id="l2092" class="code_block"><span class="nb">concatenated together to form the system call.</span>
</div><div id="l2093" class="code_block">
</div><div id="l2094" class="code_block"><span class="nb">    For example, the call:</span>
</div><div id="l2095" class="code_block">
</div><div id="l2096" class="code_block"><span class="nb">    </span><span class="nv">\demo</span><span class="nb">{{</span><span class="nv">\tt</span><span class="nb"> </span><span class="s">$</span>|<span class="s">$</span><span class="nb"> ?</span><span class="o">-</span><span class="nb"> shell</span><span class="o">(</span><span class="nb">&#39;echo </span><span class="nv">\$</span><span class="nb">HOME&#39;</span><span class="o">)</span><span class="nb">.}}</span>
</div><div id="l2097" class="code_block">
</div><div id="l2098" class="code_block"><span class="nb">    </span><span class="nv">\noindent</span>
</div><div id="l2099" class="code_block"><span class="nb">    will output in the current output stream of XSB the name of the</span>
</div><div id="l2100" class="code_block"><span class="nb">    user&#39;s home directory; while the call:</span>
</div><div id="l2101" class="code_block">
</div><div id="l2102" class="code_block"><span class="nb">    </span><span class="nv">\demo</span><span class="nb">{{</span><span class="nv">\tt</span><span class="nb"> </span><span class="s">$</span>|<span class="s">$</span><span class="nb"> ?</span><span class="o">-</span><span class="nb"> File </span><span class="o">=</span><span class="nb"> &#39;test.c&#39;, shell</span><span class="o">([</span><span class="nb">&#39;cc </span><span class="o">-</span><span class="nb">c &#39;, File</span><span class="o">])</span><span class="nb">.}}</span>
</div><div id="l2103" class="code_block">
</div><div id="l2104" class="code_block"><span class="nb">    </span><span class="nv">\noindent</span>
</div><div id="l2105" class="code_block"><span class="nb">    will call the C compiler to compile the file {</span><span class="nv">\tt</span><span class="nb"> test.c}.</span>
</div><div id="l2106" class="code_block">
</div><div id="l2107" class="code_block"><span class="nb">    Note that in UNIX systems, since {</span><span class="nv">\tt</span><span class="nb"> system</span><span class="o">()</span><span class="nb">} </span><span class="o">(</span><span class="nb">and {</span><span class="nv">\tt</span>
</div><div id="l2108" class="code_block"><span class="nb">      shell</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span><span class="o">)</span><span class="nb"> executes by forking off a shell process.  Thus it</span>
</div><div id="l2109" class="code_block"><span class="nb">    cannot be used, for example, to change the working directory of</span>
</div><div id="l2110" class="code_block"><span class="nb">    the program.  For that reason the standard predicate {</span><span class="nv">\tt</span><span class="nb"> cd</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span>
</div><div id="l2111" class="code_block"><span class="nb">    described below should be used.</span>
</div><div id="l2112" class="code_block">
</div><div id="l2113" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Error Cases}</span>
</div><div id="l2114" class="code_block"><span class="nv">\bi</span>
</div><div id="l2115" class="code_block"><span class="nv">\item</span><span class="nb">  {</span><span class="nv">\tt</span><span class="nb"> SystemCall} is a variable</span>
</div><div id="l2116" class="code_block"><span class="nv">\bi</span>
</div><div id="l2117" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> instantiation</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l2118" class="code_block"><span class="nv">\ei</span>
</div><div id="l2119" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> SystemCall} is neither an atom nor a list</span>
</div><div id="l2120" class="code_block"><span class="nv">\bi</span>
</div><div id="l2121" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">atom</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">list,SystemCall</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2122" class="code_block"><span class="nv">\ei</span>
</div><div id="l2123" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> SystemCall} is longer than the maximum command length</span>
</div><div id="l2124" class="code_block"><span class="nb">  allowed by {</span><span class="nv">\tt</span><span class="nb"> shell</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span>
</div><div id="l2125" class="code_block"><span class="nv">\bi</span>
</div><div id="l2126" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> resource</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">memory</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2127" class="code_block"><span class="nv">\ei</span>
</div><div id="l2128" class="code_block"><span class="nv">\ei</span>
</div><div id="l2129" class="code_block">
</div><div id="l2130" class="code_block"><span class="nv">\standarditem</span><span class="nb">{shell</span><span class="o">(+</span><span class="nb">SystemCall, </span><span class="o">-</span><span class="nb">Result</span><span class="o">)</span><span class="nb">}{shell</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l2131" class="code_block"><span class="c">%</span>
</div><div id="l2132" class="code_block"><span class="nb">Calls the operating system with the atom {</span><span class="nv">\tt</span><span class="nb"> SystemCall} as argument,</span>
</div><div id="l2133" class="code_block"><span class="nb">using the {</span><span class="nv">\tt</span><span class="nb"> libc} function {</span><span class="nv">\tt</span><span class="nb"> system</span><span class="o">()</span><span class="nb">}.  As a notational</span>
</div><div id="l2134" class="code_block"><span class="nb">convenience, the user can also supply {</span><span class="nv">\tt</span><span class="nb"> SystemCall} as a list.  In</span>
</div><div id="l2135" class="code_block"><span class="nb">in this case, elements of the list will be concatenated together to</span>
</div><div id="l2136" class="code_block"><span class="nb">form the system call.  {</span><span class="nv">\tt</span><span class="nb"> shell</span><span class="o">/</span><span class="m">2</span><span class="nb">} always succeeds instantiating</span>
</div><div id="l2137" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> Result} to the exit code of {</span><span class="nv">\tt</span><span class="nb"> system</span><span class="o">()</span><span class="nb">}.  Thus {</span><span class="nv">\tt</span><span class="nb"> Result}</span>
</div><div id="l2138" class="code_block"><span class="nb">will be </span><span class="m">0</span><span class="nb"> if {</span><span class="nv">\t</span><span class="nb"> SystemCall} executed properly, and non</span><span class="o">-</span><span class="m">0</span><span class="nb"> otherwise:</span>
</div><div id="l2139" class="code_block"><span class="nb">the specific return values of {</span><span class="nv">\tt</span><span class="nb"> system</span><span class="o">()</span><span class="nb">} may be platform</span><span class="o">-</span><span class="nb">dependent.</span>
</div><div id="l2140" class="code_block">
</div><div id="l2141" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Error Cases}</span>
</div><div id="l2142" class="code_block"><span class="nv">\bi</span>
</div><div id="l2143" class="code_block"><span class="nv">\item</span><span class="nb">  {</span><span class="nv">\tt</span><span class="nb"> SystemCall} is a variable</span>
</div><div id="l2144" class="code_block"><span class="nv">\bi</span>
</div><div id="l2145" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> instantiation</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l2146" class="code_block"><span class="nv">\ei</span>
</div><div id="l2147" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> SystemCall} is neither an atom nor a list</span>
</div><div id="l2148" class="code_block"><span class="nv">\bi</span>
</div><div id="l2149" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">atom</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">list,SystemCall</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2150" class="code_block"><span class="nv">\ei</span>
</div><div id="l2151" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Result} is not a variable</span>
</div><div id="l2152" class="code_block"><span class="nv">\bi</span>
</div><div id="l2153" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">variable,Result</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2154" class="code_block"><span class="nv">\ei</span>
</div><div id="l2155" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> SystemCall} is longer than the maximum command length</span>
</div><div id="l2156" class="code_block"><span class="nb">  allowed by {</span><span class="nv">\tt</span><span class="nb"> shell</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l2157" class="code_block"><span class="nv">\bi</span>
</div><div id="l2158" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> resource</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">memory</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2159" class="code_block"><span class="nv">\ei</span>
</div><div id="l2160" class="code_block"><span class="nv">\ei</span>
</div><div id="l2161" class="code_block">
</div><div id="l2162" class="code_block">
</div><div id="l2163" class="code_block"><span class="nv">\repeatstandarditem</span><span class="nb">{shell</span><span class="nv">\_</span><span class="nb">to</span><span class="nv">\_</span><span class="nb">list</span><span class="o">(+</span><span class="nb">SystemCall,</span><span class="o">-</span><span class="nb">StdOut,</span><span class="o">-</span><span class="nb">ErrOut,</span><span class="o">-</span><span class="nb">Result</span><span class="o">)</span><span class="nb">}{shell</span><span class="nv">\_</span><span class="nb">to</span><span class="nv">\_</span><span class="nb">list</span><span class="o">/</span><span class="m">4</span><span class="nb">}</span>
</div><div id="l2164" class="code_block"><span class="nv">\standarditem</span><span class="nb">{shell</span><span class="nv">\_</span><span class="nb">to</span><span class="nv">\_</span><span class="nb">list</span><span class="o">(+</span><span class="nb">SystemCall,</span><span class="o">-</span><span class="nb">StdOut,</span><span class="o">-</span><span class="nb">Result</span><span class="o">)</span><span class="nb">}{shell</span><span class="nv">\_</span><span class="nb">to</span><span class="nv">\_</span><span class="nb">list</span><span class="o">/</span><span class="m">3</span><span class="nb">}</span>
</div><div id="l2165" class="code_block"><span class="c">%</span>
</div><div id="l2166" class="code_block"><span class="nb">Behaves as {</span><span class="nv">\tt</span><span class="nb"> shell</span><span class="o">/</span><span class="m">2</span><span class="nb">} in its </span><span class="m">1</span><span class="nb">st and </span><span class="m">4</span><span class="nb">th arguments, and like {</span><span class="nv">\tt</span>
</div><div id="l2167" class="code_block"><span class="nb">  shell</span><span class="o">/</span><span class="m">2</span><span class="nb">} always succeeds.  Both {</span><span class="nv">\tt</span><span class="nb"> StdOut} and {</span><span class="nv">\tt</span><span class="nb"> ErrOut} are</span>
</div><div id="l2168" class="code_block"><span class="nb">lists of lists: each element of the outer list corresponds to a line</span>
</div><div id="l2169" class="code_block"><span class="nb">of output from {</span><span class="nv">\tt</span><span class="nb"> SystemCall}, while each element of an inner list</span>
</div><div id="l2170" class="code_block"><span class="nb">corresponds to a token in that line.  {</span><span class="nv">\tt</span><span class="nb"> shell</span><span class="nv">\_</span><span class="nb">to</span><span class="nv">\_</span><span class="nb">list</span><span class="o">/</span><span class="m">3</span><span class="nb">} is thus</span>
</div><div id="l2171" class="code_block"><span class="nb">a sort of Prolog analog of the shell command </span><span class="nv">\verb</span><span class="nb">|`SystemCall`|.</span>
</div><div id="l2172" class="code_block">
</div><div id="l2173" class="code_block"><span class="nb">Examples:</span>
</div><div id="l2174" class="code_block"><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l2175" class="code_block"><span class="nb">  ?</span><span class="o">-</span><span class="nb"> shell_to_list</span><span class="o">(</span><span class="nb">sw_vers,Stdout,Ret</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l2176" class="code_block">
</div><div id="l2177" class="code_block"><span class="nb">  Stdout </span><span class="o">=</span><span class="nb"> </span><span class="o">[[</span><span class="nb">ProductName:,Mac,OS,X</span><span class="o">]</span><span class="nb">,</span><span class="o">[</span><span class="nb">ProductVersion:,</span><span class="m">10</span><span class="nb">.</span><span class="m">4</span><span class="nb">.</span><span class="m">9</span><span class="o">]</span><span class="nb">,</span><span class="o">[</span><span class="nb">BuildVersion:,</span><span class="m">8</span><span class="nb">P</span><span class="m">2137</span><span class="o">]]</span>
</div><div id="l2178" class="code_block"><span class="nb">  Ret </span><span class="o">=</span><span class="nb"> </span><span class="m">0</span>
</div><div id="l2179" class="code_block">
</div><div id="l2180" class="code_block"><span class="nb">  ?</span><span class="o">-</span><span class="nb"> shell_to_lists</span><span class="o">(</span><span class="nb">&#39;gcc </span><span class="o">-</span><span class="nb">c nofile.c&#39;,StdOut,StdErr,Ret</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l2181" class="code_block">
</div><div id="l2182" class="code_block"><span class="nb">  Stdout </span><span class="o">=</span><span class="nb"> </span><span class="o">[]</span>
</div><div id="l2183" class="code_block"><span class="nb">  StdErr </span><span class="o">=</span><span class="nb"> </span><span class="o">[[</span><span class="nb">i</span><span class="m">686</span><span class="o">-</span><span class="nb">apple</span><span class="o">-</span><span class="nb">darwin</span><span class="m">8</span><span class="o">-</span><span class="nb">gcc</span><span class="o">-</span><span class="m">4</span><span class="nb">.</span><span class="m">0</span><span class="nb">.</span><span class="m">1</span><span class="nb">:,nofile.c:,No,such,file,or,directory</span><span class="o">]]</span>
</div><div id="l2184" class="code_block"><span class="nb">  Ret </span><span class="o">=</span><span class="nb"> </span><span class="m">256</span>
</div><div id="l2185" class="code_block"><span class="nv">\end</span><span class="nb">{verbatim}</span>
</div><div id="l2186" class="code_block">
</div><div id="l2187" class="code_block"><span class="nb">Error cases are as with {</span><span class="nv">\tt</span><span class="nb"> shell</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l2188" class="code_block">
</div><div id="l2189" class="code_block"><span class="nv">\ourmoditem</span><span class="nb">{datime</span><span class="o">(</span><span class="nb">?Date</span><span class="o">)</span><span class="nb">}{datime</span><span class="o">/</span><span class="m">1</span><span class="nb">}{standard}</span>
</div><div id="l2190" class="code_block"><span class="c">%</span>
</div><div id="l2191" class="code_block"><span class="nb">Unifies {</span><span class="nv">\tt</span><span class="nb"> Date} to the current date, returned as a Prolog term,</span>
</div><div id="l2192" class="code_block"><span class="nb">suitable for term comparison.  Note that {</span><span class="nv">\tt</span><span class="nb"> datime</span><span class="o">/</span><span class="m">1</span><span class="nb">} must be</span>
</div><div id="l2193" class="code_block"><span class="nb">explicitly imported from the module {</span><span class="nv">\tt</span><span class="nb"> standard}.</span>
</div><div id="l2194" class="code_block">
</div><div id="l2195" class="code_block"><span class="nb">Example:</span>
</div><div id="l2196" class="code_block"><span class="nb">{</span><span class="nv">\footnotesize</span>
</div><div id="l2197" class="code_block"><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l2198" class="code_block"><span class="nb">                &gt; date</span>
</div><div id="l2199" class="code_block"><span class="nb">                Mon Aug  </span><span class="m">9</span><span class="nb"> </span><span class="m">16</span><span class="nb">:</span><span class="m">19</span><span class="nb">:</span><span class="m">44</span><span class="nb"> EDT </span><span class="m">2004</span>
</div><div id="l2200" class="code_block"><span class="nb">                &gt; nxsb</span><span class="m">1</span>
</div><div id="l2201" class="code_block"><span class="nb">                XSB Version </span><span class="m">2</span><span class="nb">.</span><span class="m">6</span><span class="nb"> </span><span class="o">(</span><span class="nb">Duff</span><span class="o">)</span><span class="nb"> of June </span><span class="m">24</span><span class="nb">, </span><span class="m">2003</span>
</div><div id="l2202" class="code_block"><span class="nb">                </span><span class="o">[</span><span class="nb">i</span><span class="m">686</span><span class="o">-</span><span class="nb">pc</span><span class="o">-</span><span class="nb">cygwin; mode: optimal; engine: slg</span><span class="o">-</span><span class="nb">wam; gc: indirection; scheduling: local</span><span class="o">]</span>
</div><div id="l2203" class="code_block">
</div><div id="l2204" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> import datime</span><span class="o">/</span><span class="m">1</span><span class="nb"> from standard</span>
</div><div id="l2205" class="code_block">
</div><div id="l2206" class="code_block"><span class="nb">                yes</span>
</div><div id="l2207" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> datime</span><span class="o">(</span><span class="nb">F</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l2208" class="code_block"><span class="nb">                F </span><span class="o">=</span><span class="nb"> datime</span><span class="o">(</span><span class="m">2004</span><span class="nb">,</span><span class="m">8</span><span class="nb">,</span><span class="m">9</span><span class="nb">,</span><span class="m">20</span><span class="nb">,</span><span class="m">20</span><span class="nb">,</span><span class="m">23</span><span class="o">)</span>
</div><div id="l2209" class="code_block">
</div><div id="l2210" class="code_block"><span class="nb">                yes</span>
</div><div id="l2211" class="code_block"><span class="nv">\end</span><span class="nb">{verbatim}}</span>
</div><div id="l2212" class="code_block">
</div><div id="l2213" class="code_block"><span class="nv">\end</span><span class="nb">{description}</span>
</div><div id="l2214" class="code_block">
</div><div id="l2215" class="code_block"><span class="nv">\subsection</span><span class="nb">{The {</span><span class="nv">\tt</span><span class="nb"> path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">/</span><span class="m">2</span><span class="nb">} interface}</span>
</div><div id="l2216" class="code_block"><span class="c">%</span>
</div><div id="l2217" class="code_block"><span class="nb">In addition, XSB provides the following unified interface to the</span>
</div><div id="l2218" class="code_block"><span class="nb">operations on files. All these calls succeed iff the corresponding</span>
</div><div id="l2219" class="code_block"><span class="nb">system call succeeds.  These calls work on both Windows and Unixes</span>
</div><div id="l2220" class="code_block"><span class="nb">unless otherwise noted.</span>
</div><div id="l2221" class="code_block"><span class="c">%%</span>
</div><div id="l2222" class="code_block"><span class="nv">\begin</span><span class="nb">{description}</span>
</div><div id="l2223" class="code_block"><span class="nb">  </span><span class="nv">\standarditem</span><span class="nb">{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">(</span><span class="nb">isplain, </span><span class="o">+</span><span class="nb">Path</span><span class="o">)</span><span class="nb">}{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l2224" class="code_block"><span class="nb">  Succeeds, if {</span><span class="nv">\tt</span><span class="nb"> Path} is a plain file.</span>
</div><div id="l2225" class="code_block"><span class="nb">  </span><span class="nv">\standarditem</span><span class="nb">{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">(</span><span class="nb">isdir, </span><span class="o">+</span><span class="nb">Path</span><span class="o">)</span><span class="nb">}{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l2226" class="code_block"><span class="nb">  Succeeds, if {</span><span class="nv">\tt</span><span class="nb"> Path} is a directory.</span>
</div><div id="l2227" class="code_block"><span class="nb">  </span><span class="nv">\standarditem</span><span class="nb">{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">(</span><span class="nb">rename, </span><span class="o">+</span><span class="nb">OldPath, </span><span class="o">+</span><span class="nb">NewPath</span><span class="o">)</span><span class="nb">}{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">/</span><span class="m">3</span><span class="nb">}</span>
</div><div id="l2228" class="code_block"><span class="nb">  Renames {</span><span class="nv">\tt</span><span class="nb"> OldPath} into {</span><span class="nv">\tt</span><span class="nb"> NewPath}.</span>
</div><div id="l2229" class="code_block"><span class="nb">  </span><span class="nv">\standarditem</span><span class="nb">{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">(</span><span class="nb">copy, </span><span class="o">+</span><span class="nb">FromPath, </span><span class="o">+</span><span class="nb">ToPath</span><span class="o">)</span><span class="nb">}{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">/</span><span class="m">3</span><span class="nb">}</span>
</div><div id="l2230" class="code_block"><span class="nb">  Copies {</span><span class="nv">\tt</span><span class="nb"> FromPath} into {</span><span class="nv">\tt</span><span class="nb"> ToPath}.</span>
</div><div id="l2231" class="code_block"><span class="nb">  </span><span class="nv">\standarditem</span><span class="nb">{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">(</span><span class="nb">rm, </span><span class="o">+</span><span class="nb">Path</span><span class="o">)</span><span class="nb">}{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">/</span><span class="m">2</span><span class="nb">}  Removes the plain file {</span><span class="nv">\tt</span><span class="nb"> Path}.</span>
</div><div id="l2232" class="code_block"><span class="nb">  </span><span class="nv">\standarditem</span><span class="nb">{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">(</span><span class="nb">rmdir, </span><span class="o">+</span><span class="nb">Path</span><span class="o">)</span><span class="nb">}{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">/</span><span class="m">2</span><span class="nb">}  Deletes the directory {</span><span class="nv">\tt</span><span class="nb"> Path}, succeeding only if the directory is empty.</span>
</div><div id="l2233" class="code_block"><span class="nb">  </span><span class="nv">\standarditem</span><span class="nb">{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">(</span><span class="nb">rmdir</span><span class="nv">\_</span><span class="nb">rec, </span><span class="o">+</span><span class="nb">Path</span><span class="o">)</span><span class="nb">}{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">/</span><span class="m">3</span><span class="nb">}</span>
</div><div id="l2234" class="code_block"><span class="nb">  Deletes the directory {</span><span class="nv">\tt</span><span class="nb"> Path} along with any of its contents.</span>
</div><div id="l2235" class="code_block"><span class="c">%  \standarditem{path\_sysop(unlink, +Path)}</span>
</div><div id="l2236" class="code_block"><span class="c">%  Same as {\tt rm}.</span>
</div><div id="l2237" class="code_block"><span class="nb">  </span><span class="nv">\standarditem</span><span class="nb">{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">(</span><span class="nb">link, </span><span class="o">+</span><span class="nb">SrsPath, </span><span class="o">+</span><span class="nb">DestPath</span><span class="o">)</span><span class="nb">}{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">/</span><span class="m">3</span><span class="nb">}</span>
</div><div id="l2238" class="code_block"><span class="nb">  Creates a hard link from {</span><span class="nv">\tt</span><span class="nb"> SrsPath} to {</span><span class="nv">\tt</span><span class="nb"> DestPath}. UNIX only.</span>
</div><div id="l2239" class="code_block"><span class="nb">  </span><span class="nv">\standarditem</span><span class="nb">{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">(</span><span class="nb">cwd, </span><span class="o">-</span><span class="nb">Path</span><span class="o">)</span><span class="nb">}{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l2240" class="code_block"><span class="nb">  Binds {</span><span class="nv">\tt</span><span class="nb"> Path} to the current working directory.</span>
</div><div id="l2241" class="code_block"><span class="nb">  </span><span class="nv">\standarditem</span><span class="nb">{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">(</span><span class="nb">chdir, </span><span class="o">+</span><span class="nb">Path</span><span class="o">)</span><span class="nb">}{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l2242" class="code_block"><span class="nb">  Changes the current working directory to {</span><span class="nv">\tt</span><span class="nb"> Path}.</span>
</div><div id="l2243" class="code_block"><span class="nb">  </span><span class="nv">\standarditem</span><span class="nb">{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">(</span><span class="nb">mkdir, </span><span class="o">+</span><span class="nb">Path</span><span class="o">)</span><span class="nb">}{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l2244" class="code_block"><span class="nb">  Creates a new directory, {</span><span class="nv">\tt</span><span class="nb"> Path}.</span>
</div><div id="l2245" class="code_block"><span class="nb">  </span><span class="nv">\standarditem</span><span class="nb">{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">(</span><span class="nb">exists, </span><span class="o">+</span><span class="nb">Path</span><span class="o">)</span><span class="nb">}{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l2246" class="code_block"><span class="nb">  Succeeds if the file {</span><span class="nv">\tt</span><span class="nb"> Path} exists.</span>
</div><div id="l2247" class="code_block"><span class="nb">  </span><span class="nv">\standarditem</span><span class="nb">{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">(</span><span class="nb">readable, </span><span class="o">+</span><span class="nb">Path</span><span class="o">)</span><span class="nb">}{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l2248" class="code_block"><span class="nb">  Succeeds if {</span><span class="nv">\tt</span><span class="nb"> Path} is a readable file.</span>
</div><div id="l2249" class="code_block"><span class="nb">  </span><span class="nv">\standarditem</span><span class="nb">{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">(</span><span class="nb">writable, </span><span class="o">+</span><span class="nb">Path</span><span class="o">)</span><span class="nb">}{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l2250" class="code_block"><span class="nb">  Succeeds if {</span><span class="nv">\tt</span><span class="nb"> Path} is a writable file.</span>
</div><div id="l2251" class="code_block"><span class="nb">  </span><span class="nv">\standarditem</span><span class="nb">{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">(</span><span class="nb">executable, </span><span class="o">+</span><span class="nb">Path</span><span class="o">)</span><span class="nb">}{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l2252" class="code_block"><span class="nb">  Succeeds if {</span><span class="nv">\tt</span><span class="nb"> Path} is an executable file.</span>
</div><div id="l2253" class="code_block"><span class="nb">  </span><span class="nv">\standarditem</span><span class="nb">{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">(</span><span class="nb">modtime, </span><span class="o">+</span><span class="nb">Path, </span><span class="o">-</span><span class="nb">Time</span><span class="o">)</span><span class="nb">}{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">/</span><span class="m">3</span><span class="nb">}</span>
</div><div id="l2254" class="code_block"><span class="nb">  Returns a list that represents the last modification time of the file.</span>
</div><div id="l2255" class="code_block"><span class="nb">  Succeeds if file exists. In this case, {</span><span class="nv">\tt</span><span class="nb"> Time} is bound to a list</span>
</div><div id="l2256" class="code_block"><span class="nb">  {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">[</span><span class="nb">high,low</span><span class="o">]</span><span class="nb">} where {</span><span class="nv">\tt</span><span class="nb"> low} is the least significant </span><span class="m">24</span><span class="nb"> bits of the</span>
</div><div id="l2257" class="code_block"><span class="nb">  modification time and {</span><span class="nv">\tt</span><span class="nb"> high} is the most significant bits </span><span class="o">(</span><span class="m">25</span><span class="nb">th</span><span class="o">)</span><span class="nb"> and up.</span>
</div><div id="l2258" class="code_block"><span class="nb">  {</span><span class="nv">\tt</span><span class="nb"> Time} represents the last modification time of the file.</span>
</div><div id="l2259" class="code_block"><span class="nb">  The actual value is thus </span><span class="s">$</span><span class="k">\tt</span> high*2<span class="nb">^{</span>24<span class="nb">}</span> + low<span class="s">$</span><span class="nb">, which represents the</span>
</div><div id="l2260" class="code_block"><span class="nb">  number of seconds elapsed since </span><span class="m">00</span><span class="nb">:</span><span class="m">00</span><span class="nb">:</span><span class="m">00</span><span class="nb"> on</span>
</div><div id="l2261" class="code_block"><span class="nb">       January </span><span class="m">1</span><span class="nb">, </span><span class="m">1970</span><span class="nb">, Coordinated Universal Time </span><span class="o">(</span><span class="nb">UTC</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l2262" class="code_block"><span class="nb">  </span><span class="nv">\standarditem</span><span class="nb">{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">(</span><span class="nb">newerthan, </span><span class="o">+</span><span class="nb">Path</span><span class="m">1</span><span class="nb">, </span><span class="o">+</span><span class="nb">Path</span><span class="m">2</span><span class="o">)</span><span class="nb">}{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">/</span><span class="m">3</span><span class="nb">}</span>
</div><div id="l2263" class="code_block"><span class="nb">  Succeeds is the last modification time of {</span><span class="nv">\tt</span><span class="nb"> Path</span><span class="m">1</span><span class="nb">} is higher than that</span>
</div><div id="l2264" class="code_block"><span class="nb">  of {</span><span class="nv">\tt</span><span class="nb"> Path</span><span class="m">2</span><span class="nb">}. Also succeeds if {</span><span class="nv">\tt</span><span class="nb"> Path</span><span class="m">1</span><span class="nb">} exists but {</span><span class="nv">\tt</span><span class="nb"> Path</span><span class="m">2</span><span class="nb">} does</span>
</div><div id="l2265" class="code_block"><span class="nb">  not.</span>
</div><div id="l2266" class="code_block"><span class="nb">  </span><span class="nv">\standarditem</span><span class="nb">{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">(</span><span class="nb">size, </span><span class="o">+</span><span class="nb">Path, </span><span class="o">-</span><span class="nb">Size</span><span class="o">)</span><span class="nb">}{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">/</span><span class="m">3</span><span class="nb">}</span>
</div><div id="l2267" class="code_block"><span class="nb">  Returns a list that represents the byte size of {</span><span class="nv">\tt</span><span class="nb"> Path}.</span>
</div><div id="l2268" class="code_block"><span class="nb">  Succeeds if the file exists. In this case {</span><span class="nv">\tt</span><span class="nb"> Size} is bound to the list</span>
</div><div id="l2269" class="code_block"><span class="nb">  of the form {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">[</span><span class="nb">high,low</span><span class="o">]</span><span class="nb">} where {</span><span class="nv">\tt</span><span class="nb"> low} is the least significant </span><span class="m">24</span>
</div><div id="l2270" class="code_block"><span class="nb">  bits of the byte</span><span class="o">-</span><span class="nb">size and {</span><span class="nv">\tt</span><span class="nb"> high} is the most significant bits </span><span class="o">(</span><span class="m">25</span><span class="nb">th</span><span class="o">)</span>
</div><div id="l2271" class="code_block"><span class="nb">  and up. The actual value is thus </span><span class="s">$</span><span class="k">\tt</span> high*2<span class="nb">^{</span>24<span class="nb">}</span> + low<span class="s">$</span><span class="nb">.</span>
</div><div id="l2272" class="code_block"><span class="nb">  </span><span class="nv">\standarditem</span><span class="nb">{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">(</span><span class="nb">tmpfilename, </span><span class="o">-</span><span class="nb">Name</span><span class="o">)</span><span class="nb">}{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l2273" class="code_block"><span class="nb">  Returns the name of a new temporary file. This is useful when the</span>
</div><div id="l2274" class="code_block"><span class="nb">  application needs to open a completely new temporary file.</span>
</div><div id="l2275" class="code_block"><span class="nb">  </span><span class="nv">\standarditem</span><span class="nb">{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">(</span><span class="nb">extension, </span><span class="o">+</span><span class="nb">Name, </span><span class="o">-</span><span class="nb">Ext</span><span class="o">)</span><span class="nb">}{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">/</span><span class="m">3</span><span class="nb">}</span>
</div><div id="l2276" class="code_block"><span class="nb">  Returns file name extension.</span>
</div><div id="l2277" class="code_block"><span class="nb">  </span><span class="nv">\standarditem</span><span class="nb">{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">(</span><span class="nb">basename, </span><span class="o">+</span><span class="nb">Name, </span><span class="o">-</span><span class="nb">Base</span><span class="o">)</span><span class="nb">}{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">/</span><span class="m">3</span><span class="nb">}</span>
</div><div id="l2278" class="code_block"><span class="nb">  Returns the base name of the file name </span><span class="o">(</span><span class="nb">{</span><span class="nv">\it</span><span class="nb"> i.e.}, the name sans the</span>
</div><div id="l2279" class="code_block"><span class="nb">  directory and the extension</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l2280" class="code_block"><span class="nb">  </span><span class="nv">\standarditem</span><span class="nb">{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">(</span><span class="nb">dirname, </span><span class="o">+</span><span class="nb">Name, </span><span class="o">-</span><span class="nb">Dir</span><span class="o">)</span><span class="nb">}{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">/</span><span class="m">3</span><span class="nb">}</span>
</div><div id="l2281" class="code_block"><span class="nb">  Returns the directory portion of the filename. The directory is slash or</span>
</div><div id="l2282" class="code_block"><span class="nb">  backslash terminated.</span>
</div><div id="l2283" class="code_block"><span class="nb">  </span><span class="nv">\standarditem</span><span class="nb">{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">(</span><span class="nb">isabsolute, </span><span class="o">+</span><span class="nb">Name</span><span class="o">)</span><span class="nb">}{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l2284" class="code_block"><span class="nb">  Succeeds if {</span><span class="nv">\tt</span><span class="nb"> Name} is an absolute path name. File does not need to exist.</span>
</div><div id="l2285" class="code_block"><span class="nb">  </span><span class="nv">\standarditem</span><span class="nb">{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">(</span><span class="nb">expand, </span><span class="o">+</span><span class="nb">Name, </span><span class="o">-</span><span class="nb">ExpandedName</span><span class="o">)</span><span class="nb">}{path</span><span class="nv">\_</span><span class="nb">sysop</span><span class="o">/</span><span class="m">3</span><span class="nb">}</span>
</div><div id="l2286" class="code_block"><span class="nb">  Binds {</span><span class="nv">\tt</span><span class="nb"> ExpandedName} to the expanded absolute path name of {</span><span class="nv">\tt</span><span class="nb"> Name}.</span>
</div><div id="l2287" class="code_block"><span class="nb">  The file does not need to exist. Duplicate slashes, references to the</span>
</div><div id="l2288" class="code_block"><span class="nb">  current and parent directories are factored out.</span>
</div><div id="l2289" class="code_block"><span class="nv">\end</span><span class="nb">{description}</span>
</div><div id="l2290" class="code_block"><span class="c">%%</span>
</div><div id="l2291" class="code_block">
</div><div id="l2292" class="code_block"><span class="c">%-----------------------------------------------------------------</span>
</div><div id="l2293" class="code_block"><span class="nv">\section</span><span class="nb">{Evaluating Arithmetic Expressions through {</span><span class="nv">\tt</span><span class="nb"> is</span><span class="o">/</span><span class="m">2</span><span class="nb">}}</span>
</div><div id="l2294" class="code_block"><span class="nv">\label</span><span class="nb">{Arithmetic} </span>
</div><div id="l2295" class="code_block">
</div><div id="l2296" class="code_block"><span class="nv">\comment</span><span class="nb">{</span>
</div><div id="l2297" class="code_block"><span class="nb">As do most Prologs, XSB supports evaluation of arithmetic expressions</span>
</div><div id="l2298" class="code_block"><span class="nb">in two ways.  First, ground arithmetic expressions can be evaluated</span>
</div><div id="l2299" class="code_block"><span class="nb">through the {</span><span class="nv">\tt</span><span class="nb"> is</span><span class="o">/</span><span class="m">2</span><span class="nb">} operator.  Solving non</span><span class="o">-</span><span class="nb">ground arithmetic</span>
</div><div id="l2300" class="code_block"><span class="nb">expressions is provided through XSB&#39;s port of the CLPQR constraint</span>
</div><div id="l2301" class="code_block"><span class="nb">handling interface.  In this section we describe how arithmetic</span>
</div><div id="l2302" class="code_block"><span class="nb">expressions can be evaluated through {</span><span class="nv">\tt</span><span class="nb"> is</span><span class="o">/</span><span class="m">2</span><span class="nb">}, while the CLPQR</span>
</div><div id="l2303" class="code_block"><span class="nb">interface is described in Volume </span><span class="m">2</span><span class="nb"> of this manual.</span>
</div><div id="l2304" class="code_block"><span class="nb">}</span>
</div><div id="l2305" class="code_block">
</div><div id="l2306" class="code_block"><span class="nb">Before describing {</span><span class="nv">\tt</span><span class="nb"> is</span><span class="o">/</span><span class="m">2</span><span class="nb">} and the expressions that it can evaluate,</span>
</div><div id="l2307" class="code_block"><span class="nb">we note that in </span><span class="nv">\version</span><span class="nb">{} of XSB, integers in XSB are represented</span>
</div><div id="l2308" class="code_block"><span class="nb">using a single word of </span><span class="m">32</span><span class="nb"> or </span><span class="m">64</span><span class="nb"> bits, depending on the machine</span>
</div><div id="l2309" class="code_block"><span class="nb">architecture. Floating point values are, by default, stored as</span>
</div><div id="l2310" class="code_block"><span class="nb">word</span><span class="o">-</span><span class="nb">sized references to double precision values, regardless of the</span>
</div><div id="l2311" class="code_block"><span class="nb">target machine. Direct </span><span class="o">(</span><span class="nb">non</span><span class="o">-</span><span class="nb">referenced, tagged</span><span class="o">)</span><span class="nb"> single precision</span>
</div><div id="l2312" class="code_block"><span class="nb">floats can be activated for speed purposes by passing the option</span>
</div><div id="l2313" class="code_block"><span class="o">--</span><span class="nb">enable</span><span class="o">-</span><span class="nb">fast</span><span class="o">-</span><span class="nb">floats to the configure script at configuration time.</span>
</div><div id="l2314" class="code_block"><span class="nb">This option is not recommended when any sort of precision is desired,</span>
</div><div id="l2315" class="code_block"><span class="nb">as there may be as little as </span><span class="m">28</span><span class="nb"> bits available to represent a given</span>
</div><div id="l2316" class="code_block"><span class="nb">number value under a tagged architecture.  </span>
</div><div id="l2317" class="code_block">
</div><div id="l2318" class="code_block"><span class="nb">All of the evaluable functors described below throw an instantiation</span>
</div><div id="l2319" class="code_block"><span class="nb">error if one of their evaluated inputs is a variable, and an {</span><span class="nv">\tt</span>
</div><div id="l2320" class="code_block"><span class="nb">  evaluation</span><span class="o">(</span><span class="nb">undefined</span><span class="o">)</span><span class="nb">} error if one of their evaluated inputs is</span>
</div><div id="l2321" class="code_block"><span class="nb">instantiated but non</span><span class="o">-</span><span class="nb">numeric.  With this in mind, we describe below</span>
</div><div id="l2322" class="code_block"><span class="nb">only their behavior on correctly typed input.</span>
</div><div id="l2323" class="code_block">
</div><div id="l2324" class="code_block"><span class="nv">\compatability</span>
</div><div id="l2325" class="code_block"><span class="nb">In addition, evaluation of arithmetic expressions through {</span><span class="nv">\tt</span><span class="nb"> is</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l2326" class="code_block"><span class="nb">does not check for overflow or underflow.  As a result, XSB&#39;s floating</span>
</div><div id="l2327" class="code_block"><span class="nb">point operations do not conform to IEEE floating point standards, and</span>
</div><div id="l2328" class="code_block"><span class="nb">deviates in this regard from the ISO Prolog standard </span><span class="o">(</span><span class="nb">see</span>
</div><div id="l2329" class="code_block"><span class="nv">\cite</span><span class="nb">{ISO</span><span class="o">-</span><span class="nb">Prolog} Section </span><span class="m">9</span><span class="o">)</span><span class="nb">~ We hope to fix these problems in a</span>
</div><div id="l2330" class="code_block"><span class="nb">future release </span><span class="nv">\footnote</span><span class="nb">{We also note that the ISO Prolog evaluable</span>
</div><div id="l2331" class="code_block"><span class="nb">  functors{</span><span class="nv">\tt</span><span class="nb"> float</span><span class="nv">\_</span><span class="nb">integer</span><span class="nv">\_</span><span class="nb">part</span><span class="o">/</span><span class="m">1</span><span class="nb">} </span><span class="o">(</span><span class="nb">which can be obtained via {</span><span class="nv">\tt</span>
</div><div id="l2332" class="code_block"><span class="nb">    truncate</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span><span class="o">)</span><span class="nb">, {</span><span class="nv">\tt</span><span class="nb"> float</span><span class="nv">\_</span><span class="nb">fractional</span><span class="nv">\_</span><span class="nb">part</span><span class="o">/</span><span class="m">1</span><span class="nb">} </span><span class="o">(</span><span class="nb">which can be</span>
</div><div id="l2333" class="code_block"><span class="nb">  obtained via {</span><span class="nv">\tt</span><span class="nb"> X </span><span class="o">-</span><span class="nb"> truncate</span><span class="o">(</span><span class="nb">X</span><span class="o">)</span><span class="nb">}</span><span class="o">)</span><span class="nb">, and bitwise complement </span><span class="o">(</span><span class="nb">which</span>
</div><div id="l2334" class="code_block"><span class="nb">  is implementation dependent in the ISO standard</span><span class="o">)</span><span class="nb"> are not implemented</span>
</div><div id="l2335" class="code_block"><span class="nb">  in </span><span class="nv">\version</span><span class="nb"> .}.</span>
</div><div id="l2336" class="code_block">
</div><div id="l2337" class="code_block"><span class="nv">\begin</span><span class="nb">{description}</span>
</div><div id="l2338" class="code_block"><span class="nv">\isoitem</span><span class="nb">{is</span><span class="o">(</span><span class="nb">?Result,</span><span class="o">+</span><span class="nb">Expression</span><span class="o">)</span><span class="nb">}{is</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l2339" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> is</span><span class="o">(</span><span class="nb">Result,Expression</span><span class="o">)</span><span class="nb">} is true iff the result of evaluating {</span><span class="nv">\tt</span>
</div><div id="l2340" class="code_block"><span class="nb">Expression} as a sequence of evaluable functors unifies with {</span><span class="nv">\tt</span>
</div><div id="l2341" class="code_block"><span class="nb">Result}.  As mentioned in Section~</span><span class="nv">\ref</span><span class="nb">{inline_predicates}, {</span><span class="nv">\tt</span><span class="nb"> is</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l2342" class="code_block"><span class="nb">is an inline predicate, so calls to {</span><span class="nv">\tt</span><span class="nb"> is</span><span class="o">/</span><span class="m">2</span><span class="nb">} within compiled code</span>
</div><div id="l2343" class="code_block"><span class="nb">will not be visible during a trace of program execution.</span>
</div><div id="l2344" class="code_block"><span class="nv">\end</span><span class="nb">{description}</span>
</div><div id="l2345" class="code_block">
</div><div id="l2346" class="code_block"><span class="nv">\subsection</span><span class="nb">{Evaluable Functors for Arithmetic Expressions} </span><span class="nv">\label</span><span class="nb">{sec:arith</span><span class="o">-</span><span class="nb">eval}</span>
</div><div id="l2347" class="code_block">
</div><div id="l2348" class="code_block"><span class="nv">\begin</span><span class="nb">{description}</span>
</div><div id="l2349" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{</span><span class="o">+(+</span><span class="nb">Expr</span><span class="m">1</span><span class="nb">,</span><span class="o">+</span><span class="nb">Expr</span><span class="m">2</span><span class="o">)</span><span class="nb">}{</span><span class="o">+/</span><span class="m">2</span><span class="nb">}{Evaluable Functor </span><span class="o">(</span><span class="nb">ISO</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2350" class="code_block"><span class="nb">If {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">+</span><span class="nb">Expr</span><span class="m">1</span><span class="nb">} evaluates to {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">1</span><span class="nb">}, and {</span><span class="nv">\tt</span><span class="nb"> Expr</span><span class="m">2</span><span class="nb">} evaluates</span>
</div><div id="l2351" class="code_block"><span class="nb">to {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">2</span><span class="nb">}, returns {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">1</span><span class="nb"> </span><span class="o">+</span><span class="nb"> Number</span><span class="m">2</span><span class="nb">}, performing any</span>
</div><div id="l2352" class="code_block"><span class="nb">necessary type conversions.</span>
</div><div id="l2353" class="code_block">
</div><div id="l2354" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{</span><span class="o">-(+</span><span class="nb">Expr</span><span class="m">1</span><span class="nb">,</span><span class="o">+</span><span class="nb">Expr</span><span class="m">2</span><span class="o">)</span><span class="nb">}{</span><span class="o">-/</span><span class="m">2</span><span class="nb">}{Evaluable Functor </span><span class="o">(</span><span class="nb">ISO</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2355" class="code_block"><span class="nb">If {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">+</span><span class="nb">Expr</span><span class="m">1</span><span class="nb">} evaluates to {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">1</span><span class="nb">}, and {</span><span class="nv">\tt</span><span class="nb"> Expr</span><span class="m">2</span><span class="nb">} evaluates</span>
</div><div id="l2356" class="code_block"><span class="nb">to {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">2</span><span class="nb">}, returns {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">1</span><span class="nb"> </span><span class="o">-</span><span class="nb"> Number</span><span class="m">2</span><span class="nb">}, performing any</span>
</div><div id="l2357" class="code_block"><span class="nb">necessary type conversions.</span>
</div><div id="l2358" class="code_block">
</div><div id="l2359" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{</span><span class="o">*(+</span><span class="nb">Expr</span><span class="m">1</span><span class="nb">,</span><span class="o">+</span><span class="nb">Expr</span><span class="m">2</span><span class="o">)</span><span class="nb">}{</span><span class="o">*/</span><span class="m">2</span><span class="nb">}{Evaluable Functor </span><span class="o">(</span><span class="nb">ISO</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2360" class="code_block"><span class="nb">If {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">+</span><span class="nb">Expr</span><span class="m">1</span><span class="nb">} evaluates to {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">1</span><span class="nb">}, and {</span><span class="nv">\tt</span><span class="nb"> Expr</span><span class="m">2</span><span class="nb">} evaluates</span>
</div><div id="l2361" class="code_block"><span class="nb">to {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">2</span><span class="nb">}, returns {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">1</span><span class="nb"> </span><span class="o">*</span><span class="nb"> Number</span><span class="m">2</span><span class="nb">} </span><span class="o">(</span><span class="nb">i.e. multiplies</span>
</div><div id="l2362" class="code_block"><span class="nb">them</span><span class="o">)</span><span class="nb">, performing any necessary type conversions.</span>
</div><div id="l2363" class="code_block">
</div><div id="l2364" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{</span><span class="o">/(+</span><span class="nb">Expr</span><span class="m">1</span><span class="nb">,Expr</span><span class="m">2</span><span class="o">)</span><span class="nb">}{&#39;</span><span class="o">/</span><span class="nb">&#39;</span><span class="o">/</span><span class="m">2</span><span class="nb">}{Evaluable Functor </span><span class="o">(</span><span class="nb">ISO</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2365" class="code_block"><span class="nb">If {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">+</span><span class="nb">Expr</span><span class="m">1</span><span class="nb">} evaluates to {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">1</span><span class="nb">}, and {</span><span class="nv">\tt</span><span class="nb"> Expr</span><span class="m">2</span><span class="nb">} evaluates</span>
</div><div id="l2366" class="code_block"><span class="nb">to {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">2</span><span class="nb">}, returns {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">1</span><span class="nb"> </span><span class="o">/</span><span class="nb"> Number</span><span class="m">2</span><span class="nb">} </span><span class="o">(</span><span class="nb">i.e. divides</span>
</div><div id="l2367" class="code_block"><span class="nb">them</span><span class="o">)</span><span class="nb">, performing any necessary type conversions.</span>
</div><div id="l2368" class="code_block">
</div><div id="l2369" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{</span><span class="o">//(+</span><span class="nb">Expr</span><span class="m">1</span><span class="nb">,Expr</span><span class="m">2</span><span class="o">)</span><span class="nb">}{&#39;</span><span class="o">//</span><span class="nb">&#39;</span><span class="o">/</span><span class="m">2</span><span class="nb">}{Evaluable Functor </span><span class="o">(</span><span class="nb">ISO</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2370" class="code_block"><span class="nb">If {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">+</span><span class="nb">Expr</span><span class="m">1</span><span class="nb">} evaluates to {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">1</span><span class="nb">}, and {</span><span class="nv">\tt</span><span class="nb"> Expr</span><span class="m">2</span><span class="nb">} evaluates</span>
</div><div id="l2371" class="code_block"><span class="nb">to {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">2</span><span class="nb">}, returns {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">1</span><span class="nb"> </span><span class="o">//</span><span class="nb"> Number</span><span class="m">2</span><span class="nb">} </span><span class="o">(</span><span class="nb">i.e. integer</span>
</div><div id="l2372" class="code_block"><span class="nb">division</span><span class="o">)</span><span class="nb">, performing any necessary type conversions, and rounding to</span>
</div><div id="l2373" class="code_block"><span class="m">0</span><span class="nb"> if necessary.  </span>
</div><div id="l2374" class="code_block">
</div><div id="l2375" class="code_block"><span class="nb">    Example:</span>
</div><div id="l2376" class="code_block"><span class="nb">    {</span><span class="nv">\footnotesize</span>
</div><div id="l2377" class="code_block"><span class="nb">     </span><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l2378" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> X is </span><span class="m">3</span><span class="o">/</span><span class="m">2</span><span class="nb">.</span>
</div><div id="l2379" class="code_block">
</div><div id="l2380" class="code_block"><span class="nb">                X </span><span class="o">=</span><span class="nb"> </span><span class="m">1</span><span class="nb">.</span><span class="m">5000</span>
</div><div id="l2381" class="code_block">
</div><div id="l2382" class="code_block"><span class="nb">                yes</span>
</div><div id="l2383" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> X is </span><span class="m">3</span><span class="nb"> </span><span class="o">//</span><span class="nb"> </span><span class="m">2</span><span class="nb">.</span>
</div><div id="l2384" class="code_block">
</div><div id="l2385" class="code_block"><span class="nb">                X </span><span class="o">=</span><span class="nb"> </span><span class="m">1</span>
</div><div id="l2386" class="code_block">
</div><div id="l2387" class="code_block"><span class="nb">                yes</span>
</div><div id="l2388" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> X is </span><span class="o">-</span><span class="m">3</span><span class="nb"> </span><span class="o">//</span><span class="nb"> </span><span class="m">2</span><span class="nb">.</span>
</div><div id="l2389" class="code_block">
</div><div id="l2390" class="code_block"><span class="nb">                X </span><span class="o">=</span><span class="nb"> </span><span class="o">-</span><span class="m">1</span>
</div><div id="l2391" class="code_block">
</div><div id="l2392" class="code_block"><span class="nb">                yes</span>
</div><div id="l2393" class="code_block"><span class="nb">  </span><span class="nv">\end</span><span class="nb">{verbatim}}</span>
</div><div id="l2394" class="code_block">
</div><div id="l2395" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{</span><span class="o">-(+</span><span class="nb">Expr</span><span class="m">1</span><span class="o">)</span><span class="nb">}{</span><span class="o">-/</span><span class="m">1</span><span class="nb">}{Evaluable Functor </span><span class="o">(</span><span class="nb">ISO</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2396" class="code_block"><span class="c">%</span>
</div><div id="l2397" class="code_block"><span class="nb"> If {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">+</span><span class="nb">Expr} evaluates to {</span><span class="nv">\tt</span><span class="nb"> Number}, returns {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">-</span><span class="nb">Number</span><span class="m">1</span><span class="nb">},</span>
</div><div id="l2398" class="code_block"><span class="nb"> performing any necessary type conversions.</span>
</div><div id="l2399" class="code_block">
</div><div id="l2400" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{&#39;</span><span class="s">$</span><span class="k">\wedge</span><span class="s">$</span><span class="nb">&#39;</span><span class="o">(+</span><span class="nb">Expr</span><span class="m">1</span><span class="nb">,</span><span class="o">+</span><span class="nb">Expr</span><span class="m">2</span><span class="o">)</span><span class="nb">}{&#39;</span><span class="s">$</span><span class="k">\wedge</span><span class="s">$</span><span class="nb">&#39;</span><span class="o">/</span><span class="m">2</span><span class="nb">}{Evaluable Functor </span><span class="o">(</span><span class="nb">ISO</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2401" class="code_block"><span class="c">%</span>
</div><div id="l2402" class="code_block"><span class="nb"> If {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">+</span><span class="nb">Expr</span><span class="m">1</span><span class="nb">} evaluates to {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">1</span><span class="nb">}, and {</span><span class="nv">\tt</span><span class="nb"> Expr</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l2403" class="code_block"><span class="nb">evaluates to {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">2</span><span class="nb">}, returns the bitwise conjunction of {</span><span class="nv">\tt</span>
</div><div id="l2404" class="code_block"><span class="nb">Number</span><span class="m">1</span><span class="nb">} and {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">2</span><span class="nb">}.</span>
</div><div id="l2405" class="code_block">
</div><div id="l2406" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{&#39;</span><span class="s">$</span><span class="k">\vee</span><span class="s">$</span><span class="nb">&#39;</span><span class="o">(+</span><span class="nb">Expr</span><span class="m">1</span><span class="nb">,</span><span class="o">+</span><span class="nb">Expr</span><span class="m">2</span><span class="o">)</span><span class="nb">}{&#39;</span><span class="s">$</span><span class="k">\vee</span><span class="s">$</span><span class="nb">&#39;</span><span class="o">/</span><span class="m">2</span><span class="nb">}{Evaluable Functor </span><span class="o">(</span><span class="nb">ISO</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2407" class="code_block">
</div><div id="l2408" class="code_block"><span class="c">%</span>
</div><div id="l2409" class="code_block"><span class="nb">If {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">+</span><span class="nb">Expr</span><span class="m">1</span><span class="nb">} evaluates to {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">1</span><span class="nb">}, and {</span><span class="nv">\tt</span><span class="nb"> Expr</span><span class="m">2</span><span class="nb">} evaluates</span>
</div><div id="l2410" class="code_block"><span class="nb">to {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">2</span><span class="nb">}, returns the bitwise disjunction {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">1</span><span class="nb">} and</span>
</div><div id="l2411" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">2</span><span class="nb">}.</span>
</div><div id="l2412" class="code_block">
</div><div id="l2413" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{&#39;&gt;&gt;&#39;</span><span class="o">(+</span><span class="nb">Expr</span><span class="m">1</span><span class="nb">,</span><span class="o">+</span><span class="nb">Expr</span><span class="m">2</span><span class="o">)</span><span class="nb">}{&#39;&gt;&gt;&#39;</span><span class="o">/</span><span class="m">2</span><span class="nb">}{Evaluable Functor </span><span class="o">(</span><span class="nb">ISO</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2414" class="code_block"><span class="c">%</span>
</div><div id="l2415" class="code_block"><span class="nb">If {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">+</span><span class="nb">Expr</span><span class="m">1</span><span class="nb">} evaluates to {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">1</span><span class="nb">}, and {</span><span class="nv">\tt</span><span class="nb"> Expr</span><span class="m">2</span><span class="nb">} evaluates</span>
</div><div id="l2416" class="code_block"><span class="nb">to {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">2</span><span class="nb">}, returns the logical shift right of {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">1</span><span class="nb">},</span>
</div><div id="l2417" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">2</span><span class="nb">} places.</span>
</div><div id="l2418" class="code_block">
</div><div id="l2419" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{&#39;&lt;&lt;&#39;</span><span class="o">(+</span><span class="nb">Expr</span><span class="m">1</span><span class="nb">,</span><span class="o">+</span><span class="nb">Expr</span><span class="m">2</span><span class="o">)</span><span class="nb">}{&#39;&lt;&lt;&#39;</span><span class="o">/</span><span class="m">2</span><span class="nb">}{Evaluable Functor </span><span class="o">(</span><span class="nb">ISO</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2420" class="code_block"><span class="c">%</span>
</div><div id="l2421" class="code_block"><span class="nb">If {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">+</span><span class="nb">Expr</span><span class="m">1</span><span class="nb">} evaluates to {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">1</span><span class="nb">}, and {</span><span class="nv">\tt</span><span class="nb"> Expr</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l2422" class="code_block"><span class="nb">evaluates to {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">2</span><span class="nb">}, returns the logical shift left of </span>
</div><div id="l2423" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">1</span><span class="nb">}, {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">2</span><span class="nb">} places.</span>
</div><div id="l2424" class="code_block">
</div><div id="l2425" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{&#39;&gt;&lt;&#39;</span><span class="o">(+</span><span class="nb">Expr</span><span class="m">1</span><span class="nb">,</span><span class="o">+</span><span class="nb">Expr</span><span class="m">2</span><span class="o">)</span><span class="nb">}{&#39;&gt;&lt;&#39;</span><span class="o">/</span><span class="m">2</span><span class="nb">}{Evaluable Functor </span><span class="o">(</span><span class="nb">ISO</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2426" class="code_block"><span class="c">%</span>
</div><div id="l2427" class="code_block"><span class="nb">If {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">+</span><span class="nb">Expr</span><span class="m">1</span><span class="nb">} evaluates to {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">1</span><span class="nb">}, and {</span><span class="nv">\tt</span><span class="nb"> Expr</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l2428" class="code_block"><span class="nb">evaluates to {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">2</span><span class="nb">}, returns the bitwise exclusive or of </span>
</div><div id="l2429" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">1</span><span class="nb">} and {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">2</span><span class="nb">}.</span>
</div><div id="l2430" class="code_block">
</div><div id="l2431" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{min</span><span class="o">(+</span><span class="nb">Expr</span><span class="m">1</span><span class="nb">,</span><span class="o">+</span><span class="nb">Expr</span><span class="m">2</span><span class="o">)</span><span class="nb">}{min</span><span class="o">/</span><span class="m">2</span><span class="nb">}{Evaluable Functor </span><span class="o">(</span><span class="nb">ISO</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2432" class="code_block"><span class="c">%</span>
</div><div id="l2433" class="code_block"><span class="nb">If {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">+</span><span class="nb">Expr</span><span class="m">1</span><span class="nb">} evaluates to {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">1</span><span class="nb">}, and</span>
</div><div id="l2434" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> Expr</span><span class="m">2</span><span class="nb">} evaluates to {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">2</span><span class="nb">}, returns the minimum of the</span>
</div><div id="l2435" class="code_block"><span class="nb">two.</span>
</div><div id="l2436" class="code_block">
</div><div id="l2437" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{max</span><span class="o">(+</span><span class="nb">Expr</span><span class="m">1</span><span class="nb">,</span><span class="o">+</span><span class="nb">Expr</span><span class="m">2</span><span class="o">)</span><span class="nb">}{max</span><span class="o">/</span><span class="m">2</span><span class="nb">}{Evaluable Functor </span><span class="o">(</span><span class="nb">ISO</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2438" class="code_block"><span class="c">%</span>
</div><div id="l2439" class="code_block"><span class="nb">If {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">+</span><span class="nb">Expr</span><span class="m">1</span><span class="nb">} evaluates to {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">1</span><span class="nb">}, and</span>
</div><div id="l2440" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> Expr</span><span class="m">2</span><span class="nb">} evaluates to {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">2</span><span class="nb">}, returns the maximum of the</span>
</div><div id="l2441" class="code_block"><span class="nb">two.</span>
</div><div id="l2442" class="code_block">
</div><div id="l2443" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{ceiling</span><span class="o">(+</span><span class="nb">Expr</span><span class="o">)</span><span class="nb">}{ceiling</span><span class="o">/</span><span class="m">1</span><span class="nb">}{Evaluable Functor </span><span class="o">(</span><span class="nb">ISO</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2444" class="code_block"><span class="c">%</span>
</div><div id="l2445" class="code_block"><span class="nb">If {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">+</span><span class="nb">Expr} evaluates to {</span><span class="nv">\tt</span><span class="nb"> Number}, {</span><span class="nv">\tt</span><span class="nb"> ceiling</span><span class="o">(</span><span class="nb">Number</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2446" class="code_block"><span class="nb">returns the integer ceiling of {</span><span class="nv">\tt</span><span class="nb"> Number} if {</span><span class="nv">\tt</span><span class="nb"> Number} is a</span>
</div><div id="l2447" class="code_block"><span class="nb">float, and {</span><span class="nv">\tt</span><span class="nb"> Number} itself if {</span><span class="nv">\tt</span><span class="nb"> Number} is an integer.</span>
</div><div id="l2448" class="code_block">
</div><div id="l2449" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{float</span><span class="o">(+</span><span class="nb">Expr</span><span class="o">)</span><span class="nb">}{float</span><span class="o">/</span><span class="m">1</span><span class="nb">}{Evaluable Functor </span><span class="o">(</span><span class="nb">ISO</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2450" class="code_block"><span class="c">%</span>
</div><div id="l2451" class="code_block"><span class="nb">If {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">+</span><span class="nb">Expr} evaluates to {</span><span class="nv">\tt</span><span class="nb"> Number}, {</span><span class="nv">\tt</span><span class="nb"> float</span><span class="o">(</span><span class="nb">Number</span><span class="o">)</span><span class="nb">} converts</span>
</div><div id="l2452" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> Number} to a float if {</span><span class="nv">\tt</span><span class="nb"> Number} is an integer, and returns</span>
</div><div id="l2453" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> Number} itself if {</span><span class="nv">\tt</span><span class="nb"> Number} is a float.</span>
</div><div id="l2454" class="code_block">
</div><div id="l2455" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{floor</span><span class="o">(+</span><span class="nb">Expr</span><span class="o">)</span><span class="nb">}{floor</span><span class="o">/</span><span class="m">1</span><span class="nb">}{Evaluable Functor </span><span class="o">(</span><span class="nb">ISO</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2456" class="code_block"><span class="c">%</span>
</div><div id="l2457" class="code_block"><span class="nb">If {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">+</span><span class="nb">Expr} evaluates to {</span><span class="nv">\tt</span><span class="nb"> Number}, {</span><span class="nv">\tt</span><span class="nb"> floor</span><span class="o">(</span><span class="nb">Number</span><span class="o">)</span><span class="nb">} returns</span>
</div><div id="l2458" class="code_block"><span class="nb">the integer floor of {</span><span class="nv">\tt</span><span class="nb"> Number} if {</span><span class="nv">\tt</span><span class="nb"> Number} is a float, and {</span><span class="nv">\tt</span>
</div><div id="l2459" class="code_block"><span class="nb">  Number} itself if {</span><span class="nv">\tt</span><span class="nb"> Number} is an integer.</span>
</div><div id="l2460" class="code_block">
</div><div id="l2461" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{mod</span><span class="o">(+</span><span class="nb">Expr</span><span class="m">1</span><span class="nb">,</span><span class="o">+</span><span class="nb">Expr</span><span class="m">2</span><span class="o">)</span><span class="nb">}{mod</span><span class="o">/</span><span class="m">2</span><span class="nb">}{Evaluable Functor </span><span class="o">(</span><span class="nb">ISO</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2462" class="code_block"><span class="c">%</span>
</div><div id="l2463" class="code_block"><span class="nb">If {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">+</span><span class="nb">Expr</span><span class="m">1</span><span class="nb">} evaluates to {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">1</span><span class="nb">} and {</span><span class="nv">\tt</span><span class="nb"> Expr</span><span class="m">2</span><span class="nb">} evaluates</span>
</div><div id="l2464" class="code_block"><span class="nb">to {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">2</span><span class="nb">} where {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">2</span><span class="nb">} is not </span><span class="m">0</span><span class="nb">, {</span><span class="nv">\tt</span>
</div><div id="l2465" class="code_block"><span class="nb">mod</span><span class="o">(</span><span class="nb">Number</span><span class="m">1</span><span class="nb">,Number</span><span class="m">2</span><span class="o">)</span><span class="nb">} returns</span>
</div><div id="l2466" class="code_block"><span class="nv">\[</span>
</div><div id="l2467" class="code_block"><span class="nb">	Number</span><span class="m">1</span><span class="nb"> </span><span class="o">-</span><span class="nb"> </span><span class="o">(</span><span class="nv">\lfloor</span><span class="nb"> </span><span class="o">(</span><span class="nb">Number</span><span class="m">1</span><span class="nb"> </span><span class="o">/</span><span class="nb"> Number</span><span class="m">2</span><span class="o">)</span><span class="nb"> </span><span class="nv">\rfloor</span><span class="o">)</span><span class="nb"> </span><span class="nv">\times</span><span class="nb"> Number</span><span class="m">2</span><span class="o">)</span>
</div><div id="l2468" class="code_block"><span class="nv">\]</span>
</div><div id="l2469" class="code_block">
</div><div id="l2470" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{rem</span><span class="o">(+</span><span class="nb">Expr</span><span class="m">1</span><span class="nb">,</span><span class="o">+</span><span class="nb">Expr</span><span class="m">2</span><span class="o">)</span><span class="nb">}{rem</span><span class="o">/</span><span class="m">2</span><span class="nb">}{Evaluable Functor </span><span class="o">(</span><span class="nb">ISO</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2471" class="code_block"><span class="c">%</span>
</div><div id="l2472" class="code_block"><span class="nb">If {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">+</span><span class="nb">Expr</span><span class="m">1</span><span class="nb">} evaluates to {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">1</span><span class="nb">} and {</span><span class="nv">\tt</span><span class="nb"> Expr</span><span class="m">2</span><span class="nb">} evaluates</span>
</div><div id="l2473" class="code_block"><span class="nb">to {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">2</span><span class="nb">} where {</span><span class="nv">\tt</span><span class="nb"> Number</span><span class="m">2</span><span class="nb">} is not </span><span class="m">0</span><span class="nb">, {</span><span class="nv">\tt</span>
</div><div id="l2474" class="code_block"><span class="nb">rem</span><span class="o">(</span><span class="nb">Number</span><span class="m">1</span><span class="nb">,Number</span><span class="m">2</span><span class="o">)</span><span class="nb">} returns</span>
</div><div id="l2475" class="code_block"><span class="nv">\[</span>
</div><div id="l2476" class="code_block"><span class="nb">	Number</span><span class="m">1</span><span class="nb"> </span><span class="o">-</span><span class="nb"> </span><span class="o">(</span><span class="nb">{Number</span><span class="m">1</span><span class="nb">} </span><span class="o">//</span><span class="nb"> {Number</span><span class="m">2</span><span class="nb">}</span><span class="o">)</span><span class="nb"> </span><span class="nv">\times</span><span class="nb"> Number</span><span class="m">2</span><span class="o">)</span>
</div><div id="l2477" class="code_block"><span class="nv">\]</span>
</div><div id="l2478" class="code_block">
</div><div id="l2479" class="code_block"><span class="nb">    Example:</span>
</div><div id="l2480" class="code_block"><span class="nb">    {</span><span class="nv">\footnotesize</span>
</div><div id="l2481" class="code_block"><span class="nb">     </span><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l2482" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> X is </span><span class="m">5</span><span class="nb"> mod </span><span class="m">2</span><span class="nb">.</span>
</div><div id="l2483" class="code_block">
</div><div id="l2484" class="code_block"><span class="nb">                X </span><span class="o">=</span><span class="nb"> </span><span class="m">1</span>
</div><div id="l2485" class="code_block">
</div><div id="l2486" class="code_block"><span class="nb">                yes</span>
</div><div id="l2487" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> X is </span><span class="m">5</span><span class="nb"> rem </span><span class="m">2</span><span class="nb">.</span>
</div><div id="l2488" class="code_block">
</div><div id="l2489" class="code_block"><span class="nb">                X </span><span class="o">=</span><span class="nb"> </span><span class="m">1</span>
</div><div id="l2490" class="code_block">
</div><div id="l2491" class="code_block"><span class="nb">                yes</span>
</div><div id="l2492" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> X is </span><span class="m">5</span><span class="nb"> mod </span><span class="o">-</span><span class="m">2</span><span class="nb">.</span>
</div><div id="l2493" class="code_block">
</div><div id="l2494" class="code_block"><span class="nb">                X </span><span class="o">=</span><span class="nb"> </span><span class="o">-</span><span class="m">1</span>
</div><div id="l2495" class="code_block">
</div><div id="l2496" class="code_block"><span class="nb">                yes</span>
</div><div id="l2497" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> X is </span><span class="m">5</span><span class="nb"> rem </span><span class="o">-</span><span class="m">2</span><span class="nb">.</span>
</div><div id="l2498" class="code_block">
</div><div id="l2499" class="code_block"><span class="nb">                X </span><span class="o">=</span><span class="nb"> </span><span class="m">1</span>
</div><div id="l2500" class="code_block">
</div><div id="l2501" class="code_block"><span class="nb">                yes</span>
</div><div id="l2502" class="code_block"><span class="nb">  </span><span class="nv">\end</span><span class="nb">{verbatim}}</span>
</div><div id="l2503" class="code_block">
</div><div id="l2504" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{round</span><span class="o">(+</span><span class="nb">Expr</span><span class="o">)</span><span class="nb">}{round</span><span class="o">/</span><span class="m">1</span><span class="nb">}{Evaluable Functor </span><span class="o">(</span><span class="nb">ISO</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2505" class="code_block"><span class="c">%</span>
</div><div id="l2506" class="code_block"><span class="nb">If {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">+</span><span class="nb">Expr} evaluates to {</span><span class="nv">\tt</span><span class="nb"> Number}, {</span><span class="nv">\tt</span><span class="nb"> round</span><span class="o">(</span><span class="nb">Number</span><span class="o">)</span><span class="nb">} returns</span>
</div><div id="l2507" class="code_block"><span class="nb">the nearest integer to {</span><span class="nv">\tt</span><span class="nb"> Number} if {</span><span class="nv">\tt</span><span class="nb"> Number} is a float, and</span>
</div><div id="l2508" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> Number} itself if {</span><span class="nv">\tt</span><span class="nb"> Number} is an integer.</span>
</div><div id="l2509" class="code_block">
</div><div id="l2510" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{&#39;</span><span class="o">**</span><span class="nb">&#39;</span><span class="o">(+</span><span class="nb">Expr</span><span class="m">1</span><span class="nb">,</span><span class="o">+</span><span class="nb">Expr</span><span class="m">2</span><span class="o">)</span><span class="nb">}{</span><span class="o">**/</span><span class="m">2</span><span class="nb">}{Evaluable Functor </span><span class="o">(</span><span class="nb">ISO</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2511" class="code_block"><span class="c">%</span>
</div><div id="l2512" class="code_block"><span class="nb">If {</span><span class="nv">\tt</span><span class="nb"> Expr</span><span class="m">1</span><span class="nb">} and {</span><span class="nv">\tt</span><span class="nb"> Expr</span><span class="m">2</span><span class="nb">} both evaluate to numbers, the infix</span>
</div><div id="l2513" class="code_block"><span class="nb">function {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">**/</span><span class="m">2</span><span class="nb">} raises {</span><span class="nv">\tt</span><span class="nb"> Expr</span><span class="m">1</span><span class="nb">} to the {</span><span class="nv">\tt</span><span class="nb"> Expr</span><span class="m">2</span><span class="nb">} power.  If</span>
</div><div id="l2514" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> Expr</span><span class="m">1</span><span class="nb">} and {</span><span class="nv">\tt</span><span class="nb"> Expr</span><span class="m">2</span><span class="nb">} both evaluate to integers, an integer is</span>
</div><div id="l2515" class="code_block"><span class="nb">returned; otherwise a float is returned.</span>
</div><div id="l2516" class="code_block">
</div><div id="l2517" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{sqrt</span><span class="o">(+</span><span class="nb">Expr</span><span class="o">)</span><span class="nb">}{sqrt</span><span class="o">/</span><span class="m">1</span><span class="nb">}{Evaluable Functor </span><span class="o">(</span><span class="nb">ISO</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2518" class="code_block"><span class="c">%</span>
</div><div id="l2519" class="code_block"><span class="nb">If {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">+</span><span class="nb">Expr} evaluates to {</span><span class="nv">\tt</span><span class="nb"> Number}, {</span><span class="nv">\tt</span><span class="nb"> sqrt</span><span class="o">(</span><span class="nb">Number</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2520" class="code_block"><span class="nb">returns the square root of {</span><span class="nv">\tt</span><span class="nb"> Number}.</span>
</div><div id="l2521" class="code_block">
</div><div id="l2522" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{truncate</span><span class="o">(+</span><span class="nb">Expr</span><span class="o">)</span><span class="nb">}{truncate</span><span class="o">/</span><span class="m">1</span><span class="nb">}{Evaluable Functor </span><span class="o">(</span><span class="nb">ISO</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2523" class="code_block"><span class="c">%</span>
</div><div id="l2524" class="code_block"><span class="nb">If {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">+</span><span class="nb">Expr} evaluates to {</span><span class="nv">\tt</span><span class="nb"> Number}, {</span><span class="nv">\tt</span><span class="nb"> truncate</span><span class="o">(</span><span class="nb">Number</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2525" class="code_block"><span class="nb">truncates {</span><span class="nv">\tt</span><span class="nb"> Number} if {</span><span class="nv">\tt</span><span class="nb"> Number} is a float, and returns {</span><span class="nv">\tt</span>
</div><div id="l2526" class="code_block"><span class="nb">  Number} itself if {</span><span class="nv">\tt</span><span class="nb"> Number} is an integer.</span>
</div><div id="l2527" class="code_block">
</div><div id="l2528" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{sign</span><span class="o">(+</span><span class="nb">Expr</span><span class="o">)</span><span class="nb">}{sign</span><span class="o">/</span><span class="m">1</span><span class="nb">}{Evaluable Functor </span><span class="o">(</span><span class="nb">ISO</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2529" class="code_block"><span class="c">%</span>
</div><div id="l2530" class="code_block"><span class="nb">If {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">+</span><span class="nb">Expr} evaluates to {</span><span class="nv">\tt</span><span class="nb"> Number}, {</span><span class="nv">\tt</span><span class="nb"> sign</span><span class="o">(</span><span class="nb">Number</span><span class="o">)</span><span class="nb">} returns</span>
</div><div id="l2531" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> </span><span class="m">1</span><span class="nb">} if {</span><span class="nv">\tt</span><span class="nb"> Number} is greater than </span><span class="m">0</span><span class="nb">, {</span><span class="nv">\tt</span><span class="nb"> </span><span class="m">0</span><span class="nb">} if {</span><span class="nv">\tt</span><span class="nb"> Number} is</span>
</div><div id="l2532" class="code_block"><span class="nb">equal to </span><span class="m">0</span><span class="nb">, and {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">-</span><span class="m">1</span><span class="nb">} if {</span><span class="nv">\tt</span><span class="nb"> Number} is less than </span><span class="m">0</span><span class="nb">.</span>
</div><div id="l2533" class="code_block">
</div><div id="l2534" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{pi}{pi</span><span class="o">/</span><span class="m">0</span><span class="nb">}{Evaluable Functor </span><span class="o">(</span><span class="nb">ISO</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2535" class="code_block"><span class="c">% </span>
</div><div id="l2536" class="code_block"><span class="nb">Evaluates to </span><span class="s">$</span><span class="k">\pi</span><span class="s">$</span><span class="nb"> within an arithmetic expression.</span>
</div><div id="l2537" class="code_block">
</div><div id="l2538" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{e}{e</span><span class="o">/</span><span class="m">0</span><span class="nb">}{Evaluable Functor </span><span class="o">(</span><span class="nb">ISO</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2539" class="code_block"><span class="c">% </span>
</div><div id="l2540" class="code_block"><span class="nb">Evaluates to </span><span class="s">$</span>e<span class="s">$</span><span class="nb">, the base of the natural logarithm, within an</span>
</div><div id="l2541" class="code_block"><span class="nb">arithmetic expression.</span>
</div><div id="l2542" class="code_block">
</div><div id="l2543" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{epsilon}{epsilon</span><span class="o">/</span><span class="m">0</span><span class="nb">}{Evaluable Functor}</span>
</div><div id="l2544" class="code_block"><span class="c">% </span>
</div><div id="l2545" class="code_block"><span class="nb">Evaluates to </span><span class="s">$</span>epsilon<span class="s">$</span><span class="nb">, the difference between the float </span><span class="m">1</span><span class="nb">.</span><span class="m">0</span><span class="nb"> and </span>
</div><div id="l2546" class="code_block"><span class="nb">the first larger floating point number.</span>
</div><div id="l2547" class="code_block">
</div><div id="l2548" class="code_block"><span class="nv">\end</span><span class="nb">{description}</span>
</div><div id="l2549" class="code_block">
</div><div id="l2550" class="code_block"><span class="nv">\subsubsection</span><span class="nb">{Mathematical Functions from {</span><span class="nv">\tt</span><span class="nb"> math.h}}</span>
</div><div id="l2551" class="code_block"><span class="nv">\stdrefindex</span><span class="nb">{cos</span><span class="o">/</span><span class="m">1</span><span class="nb">} </span><span class="nv">\stdrefindex</span><span class="nb">{sin</span><span class="o">/</span><span class="m">1</span><span class="nb">} </span><span class="nv">\stdrefindex</span><span class="nb">{tan</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span>
</div><div id="l2552" class="code_block"><span class="nv">\stdrefindex</span><span class="nb">{acos</span><span class="o">/</span><span class="m">1</span><span class="nb">} </span><span class="nv">\stdrefindex</span><span class="nb">{asin</span><span class="o">/</span><span class="m">1</span><span class="nb">} </span><span class="nv">\stdrefindex</span><span class="nb">{atan</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span>
</div><div id="l2553" class="code_block"><span class="nv">\stdrefindex</span><span class="nb">{log</span><span class="o">/</span><span class="m">1</span><span class="nb">} </span><span class="nv">\stdrefindex</span><span class="nb">{log</span><span class="m">10</span><span class="o">/</span><span class="m">1</span><span class="nb">} </span><span class="nv">\stdrefindex</span><span class="nb">{atan</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l2554" class="code_block"><span class="nb"> </span><span class="nv">\stdrefindex</span><span class="nb">{atan</span><span class="m">2</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l2555" class="code_block">
</div><div id="l2556" class="code_block"><span class="nb">XSB also allows as evaluable functors, many of the functions from the</span>
</div><div id="l2557" class="code_block"><span class="nb">C library {</span><span class="nv">\tt</span><span class="nb"> math.h}.  Functions included in XSB </span><span class="nv">\version</span><span class="nb">{} are {</span><span class="nv">\tt</span>
</div><div id="l2558" class="code_block"><span class="nb">  cos</span><span class="o">/</span><span class="m">1</span><span class="nb">}, {</span><span class="nv">\tt</span><span class="nb"> sin</span><span class="o">/</span><span class="m">1</span><span class="nb">}, {</span><span class="nv">\tt</span><span class="nb"> tan</span><span class="o">/</span><span class="m">1</span><span class="nb">}, {</span><span class="nv">\tt</span><span class="nb"> acos</span><span class="o">/</span><span class="m">1</span><span class="nb">}, {</span><span class="nv">\tt</span><span class="nb"> asin</span><span class="o">/</span><span class="m">1</span><span class="nb">}, {</span><span class="nv">\tt</span>
</div><div id="l2559" class="code_block"><span class="nb">  atan</span><span class="o">/</span><span class="m">1</span><span class="nb">}, {</span><span class="nv">\tt</span><span class="nb"> log</span><span class="o">/</span><span class="m">1</span><span class="nb">} </span><span class="o">(</span><span class="nb">natural logarithm</span><span class="o">)</span><span class="nb">, {</span><span class="nv">\tt</span><span class="nb"> log</span><span class="m">10</span><span class="o">/</span><span class="m">1</span><span class="nb">}, and </span>
</div><div id="l2560" class="code_block"><span class="nb">  {</span><span class="nv">\tt</span><span class="nb"> atan</span><span class="o">/</span><span class="m">2</span><span class="nb">} </span><span class="o">(</span><span class="nb">also available as {</span><span class="nv">\tt</span><span class="nb"> atan</span><span class="m">2</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span><span class="o">)</span><span class="nb">.  For</span>
</div><div id="l2561" class="code_block"><span class="nb">  their semantics, see documentation to {</span><span class="nv">\tt</span><span class="nb"> math.h}.</span>
</div><div id="l2562" class="code_block">
</div><div id="l2563" class="code_block"><span class="nv">\section</span><span class="nb">{Convenience} </span><span class="nv">\label</span><span class="nb">{Convenience}</span>
</div><div id="l2564" class="code_block"><span class="nb">These predicates are standard and often self</span><span class="o">-</span><span class="nb">explanatory, so they are </span>
</div><div id="l2565" class="code_block"><span class="nb">described only briefly.</span>
</div><div id="l2566" class="code_block"><span class="nv">\begin</span><span class="nb">{description}</span>
</div><div id="l2567" class="code_block">
</div><div id="l2568" class="code_block"><span class="nv">\isoitem</span><span class="nb">{true}{true</span><span class="o">/</span><span class="m">0</span><span class="nb">}</span>
</div><div id="l2569" class="code_block"><span class="nb">    Always succeeds.</span>
</div><div id="l2570" class="code_block">
</div><div id="l2571" class="code_block"><span class="nv">\standarditem</span><span class="nb">{otherwise}{otherwise</span><span class="o">/</span><span class="m">0</span><span class="nb">}</span>
</div><div id="l2572" class="code_block"><span class="c">%\predindex{otherwise/0~(B)}</span>
</div><div id="l2573" class="code_block"><span class="nb">    Same as {</span><span class="nv">\tt</span><span class="nb"> true</span><span class="o">/</span><span class="m">0</span><span class="nb">}.</span>
</div><div id="l2574" class="code_block">
</div><div id="l2575" class="code_block"><span class="nv">\isoitem</span><span class="nb">{fail}{fail</span><span class="o">/</span><span class="m">0</span><span class="nb">}</span>
</div><div id="l2576" class="code_block"><span class="c">%\predindex{fail/0~(I)}</span>
</div><div id="l2577" class="code_block"><span class="nb">    Always fails.</span>
</div><div id="l2578" class="code_block">
</div><div id="l2579" class="code_block"><span class="nv">\standarditem</span><span class="nb">{false}{false</span><span class="o">/</span><span class="m">0</span><span class="nb">}</span>
</div><div id="l2580" class="code_block"><span class="c">%\predindex{false/0~(B)}</span>
</div><div id="l2581" class="code_block"><span class="nb">    Same as {</span><span class="nv">\tt</span><span class="nb"> fail</span><span class="o">/</span><span class="m">0</span><span class="nb">}.</span>
</div><div id="l2582" class="code_block">
</div><div id="l2583" class="code_block"><span class="nv">\end</span><span class="nb">{description}</span>
</div><div id="l2584" class="code_block">
</div><div id="l2585" class="code_block"><span class="c">%-----------------------------------------------------------------------------------------</span>
</div><div id="l2586" class="code_block"><span class="nv">\section</span><span class="nb">{Negation and Control}</span><span class="nv">\label</span><span class="nb">{sec:control}</span>
</div><div id="l2587" class="code_block"><span class="nv">\index</span><span class="nb">{control}</span>
</div><div id="l2588" class="code_block">
</div><div id="l2589" class="code_block"><span class="nv">\begin</span><span class="nb">{description}</span>
</div><div id="l2590" class="code_block"><span class="nv">\isoitem</span><span class="nb">{</span><span class="nv">\cut</span><span class="nb">}{&quot;</span><span class="o">!/</span><span class="m">0</span><span class="nb">}  </span><span class="nv">\index</span><span class="nb">{cut} </span>
</div><div id="l2591" class="code_block"><span class="nb">    Cut </span><span class="o">(</span><span class="nb">discard</span><span class="o">)</span><span class="nb"> all choice points made since the parent goal</span>
</div><div id="l2592" class="code_block"><span class="nb">    started execution.</span>
</div><div id="l2593" class="code_block"><span class="nb">    Cuts across tabled predicates are not valid.  The compiler checks for</span>
</div><div id="l2594" class="code_block"><span class="nb">    such cuts, although whether the scope of a cut includes a tabled </span>
</div><div id="l2595" class="code_block"><span class="nb">    predicate is undecidable in the presence of meta</span><span class="o">-</span><span class="nb">predicates like</span>
</div><div id="l2596" class="code_block"><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> call</span><span class="o">/</span><span class="m">1</span><span class="nb">}.</span>
</div><div id="l2597" class="code_block"><span class="nb">    Further discussion of conditions allowing cuts and of their actions </span>
</div><div id="l2598" class="code_block"><span class="nb">    can be found in Section~</span><span class="nv">\ref</span><span class="nb">{tabling_env}.</span>
</div><div id="l2599" class="code_block">
</div><div id="l2600" class="code_block"><span class="c">%\isoitem{$\backslash$+ +P}{\verb|\+/2|}</span>
</div><div id="l2601" class="code_block"><span class="nv">\ournewitem</span><span class="nb">{</span><span class="s">$</span><span class="k">\backslash</span><span class="s">$</span><span class="o">+</span><span class="nb"> </span><span class="o">+</span><span class="nb">P}{ISO}</span><span class="nv">\index</span><span class="nb">{</span><span class="s">$</span><span class="k">\backslash</span><span class="s">$</span><span class="nv">\texttt</span><span class="nb">{</span><span class="o">+/</span><span class="m">1</span><span class="nb">}}</span><span class="nv">\index</span><span class="o">[</span><span class="nb">pred</span><span class="o">]</span><span class="nb">{</span><span class="s">$</span><span class="k">\backslash</span><span class="s">$</span><span class="nv">\texttt</span><span class="nb">{</span><span class="o">+/</span><span class="m">1</span><span class="nb">}} </span>
</div><div id="l2602" class="code_block"><span class="c">%</span>
</div><div id="l2603" class="code_block"><span class="nb">If the goal {</span><span class="nv">\tt</span><span class="nb"> P} has a solution, fails, otherwise it succeeds.</span>
</div><div id="l2604" class="code_block"><span class="nb">Equivalently, it is true iff {</span><span class="nv">\tt</span><span class="nb"> call</span><span class="o">(</span><span class="nb">P</span><span class="o">)</span><span class="nb">} </span><span class="o">(</span><span class="nb">see</span>
</div><div id="l2605" class="code_block"><span class="nb">Section~</span><span class="nv">\ref</span><span class="nb">{meta_predicates}</span><span class="o">)</span><span class="nb"> is false. Argument {</span><span class="nv">\tt</span><span class="nb"> P} must be</span>
</div><div id="l2606" class="code_block"><span class="nb">ground for sound negation as failure, although no runtime checks are</span>
</div><div id="l2607" class="code_block"><span class="nb">made.</span>
</div><div id="l2608" class="code_block">
</div><div id="l2609" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Error Cases}</span>
</div><div id="l2610" class="code_block"><span class="nb">    </span><span class="nv">\begin</span><span class="nb">{description}</span>
</div><div id="l2611" class="code_block"><span class="nb">    </span><span class="nv">\item</span><span class="o">[</span><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> instantiation</span><span class="nv">\_</span><span class="nb">error}</span><span class="o">]</span>
</div><div id="l2612" class="code_block"><span class="nb">	{</span><span class="nv">\tt</span><span class="nb"> P} is not instantiated.</span>
</div><div id="l2613" class="code_block"><span class="nb">    </span><span class="nv">\item</span><span class="o">[</span><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">callable,P</span><span class="o">)</span><span class="nb">}</span><span class="o">]</span>
</div><div id="l2614" class="code_block"><span class="nb">	{</span><span class="nv">\tt</span><span class="nb"> P} is not callable.</span>
</div><div id="l2615" class="code_block"><span class="nb">    </span><span class="nv">\end</span><span class="nb">{description}</span>
</div><div id="l2616" class="code_block">
</div><div id="l2617" class="code_block"><span class="nv">\repeatstandarditem</span><span class="nb">{fail</span><span class="nv">\_</span><span class="nb">if</span><span class="o">(+</span><span class="nb">P</span><span class="o">)</span><span class="nb">}{fail</span><span class="nv">\_</span><span class="nb">if</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span>
</div><div id="l2618" class="code_block"><span class="nv">\standarditem</span><span class="nb">{not </span><span class="o">+</span><span class="nb">P}{not</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span>
</div><div id="l2619" class="code_block"><span class="c">%</span>
</div><div id="l2620" class="code_block"><span class="nb">Like {</span><span class="nv">\tt</span><span class="nb"> </span><span class="s">$</span><span class="k">\backslash</span><span class="s">$</span><span class="o">+/</span><span class="m">1</span><span class="nb">} and provided for compatibility with legacy</span>
</div><div id="l2621" class="code_block"><span class="nb">code.  Compilation of {</span><span class="nv">\tt</span><span class="nb"> </span><span class="s">$</span><span class="k">\backslash</span><span class="s">$</span><span class="o">+/</span><span class="m">1</span><span class="nb">} and {</span><span class="nv">\tt</span><span class="nb"> fail</span><span class="nv">\_</span><span class="nb">if</span><span class="o">/</span><span class="m">1</span><span class="nb">} is</span>
</div><div id="l2622" class="code_block"><span class="nb">optimized by XSB&#39;s compiler, while that of {</span><span class="nv">\tt</span><span class="nb"> not</span><span class="o">/</span><span class="m">1</span><span class="nb">} is not </span><span class="o">--</span>
</div><div id="l2623" class="code_block"><span class="nb">therefore the first two syntactical forms are preferred in terms of</span>
</div><div id="l2624" class="code_block"><span class="nb">efficiency, while {</span><span class="nv">\tt</span><span class="nb"> </span><span class="s">$</span><span class="k">\backslash</span><span class="s">$</span><span class="o">+/</span><span class="m">1</span><span class="nb">} is preferred in terms of</span>
</div><div id="l2625" class="code_block"><span class="nb">portability.</span>
</div><div id="l2626" class="code_block">
</div><div id="l2627" class="code_block"><span class="nb">All error cases are the same as {</span><span class="nv">\tt</span><span class="nb"> call</span><span class="o">/</span><span class="m">1</span><span class="nb">} </span><span class="o">(</span><span class="nb">see</span>
</div><div id="l2628" class="code_block"><span class="nb">Section~</span><span class="nv">\ref</span><span class="nb">{meta_predicates}</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l2629" class="code_block">
</div><div id="l2630" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{tnot</span><span class="o">(+</span><span class="nb">P</span><span class="o">)</span><span class="nb">}{tnot</span><span class="o">/</span><span class="m">1</span><span class="nb">}{Tabling} </span><span class="nv">\label</span><span class="nb">{tnot</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span>
</div><div id="l2631" class="code_block"><span class="nb">    The semantics of {</span><span class="nv">\tt</span><span class="nb"> tnot</span><span class="o">/</span><span class="m">1</span><span class="nb">} allows for correct execution of</span>
</div><div id="l2632" class="code_block"><span class="nb">    programs with according to the well</span><span class="o">-</span><span class="nb">founded semantics.  {</span><span class="nv">\tt</span><span class="nb"> P}</span>
</div><div id="l2633" class="code_block"><span class="nb">    must be a tabled predicate, </span>
</div><div id="l2634" class="code_block"><span class="c">% tls: need to provide an example.</span>
</div><div id="l2635" class="code_block"><span class="c">%and the actions of {\tt tnot/1} are</span>
</div><div id="l2636" class="code_block"><span class="c">%presented in Figure~\ref{fig:tnot}. </span>
</div><div id="l2637" class="code_block"><span class="c">%</span>
</div><div id="l2638" class="code_block"><span class="c">%\input{tnot} </span>
</div><div id="l2639" class="code_block"><span class="c">%</span>
</div><div id="l2640" class="code_block"><span class="nb">    For a detailed description of the actions of tabled negation for</span>
</div><div id="l2641" class="code_block"><span class="nb">    in XSB </span><span class="nv">\version\</span><span class="nb"> see~</span><span class="nv">\cite</span><span class="nb">{SaSw</span><span class="m">98</span><span class="nb">, SaSW</span><span class="m">96</span><span class="nb">}.</span>
</div><div id="l2642" class="code_block"><span class="nb">    Chapter~</span><span class="nv">\ref</span><span class="nb">{chap:TablingOverview} contains further discussion of the</span>
</div><div id="l2643" class="code_block"><span class="nb">    functionality of {</span><span class="nv">\tt</span><span class="nb"> tnot</span><span class="o">/</span><span class="m">1</span><span class="nb">}.</span>
</div><div id="l2644" class="code_block">
</div><div id="l2645" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Error Cases}</span>
</div><div id="l2646" class="code_block"><span class="nv">\begin</span><span class="nb">{itemize}</span>
</div><div id="l2647" class="code_block"><span class="nv">\item</span><span class="nb">	{</span><span class="nv">\tt</span><span class="nb"> P} is not ground </span><span class="o">(</span><span class="nb">floundering occurs</span><span class="o">)</span>
</div><div id="l2648" class="code_block"><span class="nv">\bi</span>
</div><div id="l2649" class="code_block"><span class="nb">    </span><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> instantiation</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l2650" class="code_block"><span class="nv">\ei</span>
</div><div id="l2651" class="code_block"><span class="nv">\item</span><span class="nb">	{</span><span class="nv">\tt</span><span class="nb"> P} is not callable</span>
</div><div id="l2652" class="code_block"><span class="nv">\bi</span>
</div><div id="l2653" class="code_block"><span class="nb">     </span><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">callable,P</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2654" class="code_block"><span class="nv">\ei</span>
</div><div id="l2655" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> P} is not a call to a tabled predicate</span>
</div><div id="l2656" class="code_block"><span class="nv">\bi</span>
</div><div id="l2657" class="code_block"><span class="nb">     </span><span class="nv">\item</span><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> table</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l2658" class="code_block"><span class="nv">\ei</span>
</div><div id="l2659" class="code_block"><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l2660" class="code_block">
</div><div id="l2661" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{sk</span><span class="nv">\_</span><span class="nb">not</span><span class="o">(+</span><span class="nb">P</span><span class="o">)</span><span class="nb">}{sk</span><span class="nv">\_</span><span class="nb">not</span><span class="o">/</span><span class="m">1</span><span class="nb">}{Tabling} </span>
</div><div id="l2662" class="code_block"><span class="c">%% </span>
</div><div id="l2663" class="code_block"><span class="nb">If {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">+</span><span class="nb">P} is a tabled predicate, {</span><span class="nv">\tt</span><span class="nb"> sk</span><span class="nv">\_</span><span class="nb">not</span><span class="o">/</span><span class="m">1</span><span class="nb">} acts as {</span><span class="nv">\tt</span>
</div><div id="l2664" class="code_block"><span class="nb">  tnot</span><span class="o">/</span><span class="m">1</span><span class="nb">} but permits variables in its subgoal argument~</span><span class="nv">\footnote</span><span class="nb">{{</span><span class="nv">\tt</span>
</div><div id="l2665" class="code_block"><span class="nb">    sk</span><span class="nv">\_</span><span class="nb">not</span><span class="o">/</span><span class="m">1</span><span class="nb">} replaces the {</span><span class="nv">\tt</span><span class="nb"> &#39;t not&#39;</span><span class="o">/</span><span class="m">1</span><span class="nb">} predicate of earlier XSB</span>
</div><div id="l2666" class="code_block"><span class="nb">  versions whose implementation and semantics were dubious.}. The</span>
</div><div id="l2667" class="code_block"><span class="nb">semantics in the case of unbound variables is as follows:</span>
</div><div id="l2668" class="code_block"><span class="c">%% </span>
</div><div id="l2669" class="code_block"><span class="nv">\begin</span><span class="nb">{quote} </span>
</div><div id="l2670" class="code_block"><span class="nv">\tt</span><span class="nb"> ... :</span><span class="o">-</span><span class="nb"> ...,~sk</span><span class="nv">\_</span><span class="nb">not</span><span class="o">(</span><span class="nb">p</span><span class="o">(</span><span class="nb">X</span><span class="o">))</span><span class="nb">,~...  </span><span class="nv">\end</span><span class="nb">{quote} </span>
</div><div id="l2671" class="code_block"><span class="c">%% </span>
</div><div id="l2672" class="code_block"><span class="nb">is equivalent to </span>
</div><div id="l2673" class="code_block"><span class="c">%%</span>
</div><div id="l2674" class="code_block"><span class="nv">\begin</span><span class="nb">{quote}</span>
</div><div id="l2675" class="code_block"><span class="nb"> </span><span class="nv">\tt</span><span class="nb"> ... :</span><span class="o">-</span><span class="nb"> ..., tnot</span><span class="o">(</span><span class="nb">pp</span><span class="o">)</span><span class="nb">,~...</span><span class="nv">\\</span><span class="nb"> pp :</span><span class="o">-</span><span class="nb"> p</span><span class="o">(</span><span class="nb">X</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l2676" class="code_block"><span class="nv">\end</span><span class="nb">{quote} </span>
</div><div id="l2677" class="code_block"><span class="c">%% </span>
</div><div id="l2678" class="code_block"><span class="nb">where {</span><span class="nv">\tt</span><span class="nb"> pp} is a new proposition. Thus, the unbound variable </span><span class="s">$</span>X<span class="s">$</span><span class="nb"> is</span>
</div><div id="l2679" class="code_block"><span class="nb">treated as </span><span class="s">$</span><span class="k">\tt</span> tnot(<span class="k">\exists</span> X (p(X)))<span class="s">$</span><span class="nb">.</span>
</div><div id="l2680" class="code_block">
</div><div id="l2681" class="code_block"><span class="nb">If {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">+</span><span class="nb">P} is a non</span><span class="o">-</span><span class="nb">tabled predicate {</span><span class="nv">\tt</span><span class="nb"> sk</span><span class="nv">\_</span><span class="nb">not</span><span class="o">/</span><span class="m">1</span><span class="nb">} ensures that</span>
</div><div id="l2682" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">+</span><span class="nb">P} is ground and called via a tabled predicate so that {</span><span class="nv">\tt</span>
</div><div id="l2683" class="code_block"><span class="nb">  sk</span><span class="nv">\_</span><span class="nb">not</span><span class="o">/</span><span class="m">1</span><span class="nb">} can be used with non</span><span class="o">-</span><span class="nb">tabled predicates as well,</span>
</div><div id="l2684" class="code_block"><span class="nb">regardless of whether {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">+</span><span class="nb">P} is ground or not.</span>
</div><div id="l2685" class="code_block">
</div><div id="l2686" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> sk</span><span class="nv">\_</span><span class="nb">not</span><span class="o">/</span><span class="m">1</span><span class="nb">} uses an auxiliary tabled predicate, {</span><span class="nv">\tt</span><span class="nb"> tunnumcall</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span>
</div><div id="l2687" class="code_block"><span class="nb">in its execution.  Therefore to reclaim space at the predicate or call</span>
</div><div id="l2688" class="code_block"><span class="nb">level </span><span class="o">(</span><span class="nb">e.g. using {</span><span class="nv">\tt</span><span class="nb"> abolish</span><span class="nv">\_</span><span class="nb">table</span><span class="nv">\_</span><span class="nb">pred</span><span class="o">/</span><span class="m">1</span><span class="nb">} or similar predicates</span><span class="o">)</span><span class="nb">,</span>
</div><div id="l2689" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> tunnumcall</span><span class="o">/</span><span class="m">1</span><span class="nb">} must be explicitly abolished.</span>
</div><div id="l2690" class="code_block">
</div><div id="l2691" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Error Cases}</span>
</div><div id="l2692" class="code_block"><span class="nv">\begin</span><span class="nb">{itemize}</span>
</div><div id="l2693" class="code_block"><span class="nv">\item</span><span class="nb">	{</span><span class="nv">\tt</span><span class="nb"> P} is not instantiated</span>
</div><div id="l2694" class="code_block"><span class="nv">\bi</span>
</div><div id="l2695" class="code_block"><span class="nb">    </span><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> instantiation</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l2696" class="code_block"><span class="nv">\ei</span>
</div><div id="l2697" class="code_block"><span class="nv">\item</span><span class="nb">	{</span><span class="nv">\tt</span><span class="nb"> P} is not callable</span>
</div><div id="l2698" class="code_block"><span class="nv">\bi</span>
</div><div id="l2699" class="code_block"><span class="nb">     </span><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">callable,P</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2700" class="code_block"><span class="nv">\ei</span>
</div><div id="l2701" class="code_block"><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l2702" class="code_block">
</div><div id="l2703" class="code_block"><span class="nv">\ournewitem</span><span class="nb">{P </span><span class="o">-</span><span class="nb">&gt; Q ; R}{ISO}</span><span class="nv">\index</span><span class="nb">{</span><span class="nv">\texttt</span><span class="nb">{</span><span class="o">-</span><span class="nb">&gt;</span><span class="o">/</span><span class="m">2</span><span class="nb">}} </span>
</div><div id="l2704" class="code_block"><span class="nb">    Analogous to if {</span><span class="nv">\tt</span><span class="nb"> P} then {</span><span class="nv">\tt</span><span class="nb"> Q} else {</span><span class="nv">\tt</span><span class="nb"> R}, i.e.</span><span class="nv">\</span><span class="nb"> defined as </span>
</div><div id="l2705" class="code_block"><span class="nb">    if by</span>
</div><div id="l2706" class="code_block"><span class="nb">	</span><span class="nv">\begin</span><span class="nb">{center}</span>
</div><div id="l2707" class="code_block"><span class="nb">	</span><span class="nv">\begin</span><span class="nb">{minipage}{</span><span class="m">2</span><span class="nb">.</span><span class="m">10</span><span class="nb">in}</span>
</div><div id="l2708" class="code_block"><span class="nb">	</span><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l2709" class="code_block"><span class="nb">	</span><span class="o">(</span><span class="nb">P </span><span class="o">-</span><span class="nb">&gt; Q ; R</span><span class="o">)</span><span class="nb"> :</span><span class="o">-</span><span class="nb"> P, </span><span class="o">!</span><span class="nb">, Q.</span>
</div><div id="l2710" class="code_block"><span class="nb">	</span><span class="o">(</span><span class="nb">P </span><span class="o">-</span><span class="nb">&gt; Q ; R</span><span class="o">)</span><span class="nb"> :</span><span class="o">-</span><span class="nb"> R.</span>
</div><div id="l2711" class="code_block"><span class="nb">	</span><span class="nv">\end</span><span class="nb">{verbatim}</span>
</div><div id="l2712" class="code_block"><span class="nb">	</span><span class="nv">\end</span><span class="nb">{minipage}</span>
</div><div id="l2713" class="code_block"><span class="nb">	</span><span class="nv">\end</span><span class="nb">{center}</span>
</div><div id="l2714" class="code_block">
</div><div id="l2715" class="code_block"><span class="nv">\ournewitem</span><span class="nb">{P </span><span class="o">-</span><span class="nb">&gt; Q}{ISO} </span><span class="nv">\index</span><span class="nb">{</span><span class="nv">\texttt</span><span class="nb">{</span><span class="o">-</span><span class="nb">&gt;</span><span class="o">/</span><span class="m">2</span><span class="nb">}}</span>
</div><div id="l2716" class="code_block"><span class="nb">    When occurring other than as one of the alternatives of a disjunction,</span>
</div><div id="l2717" class="code_block"><span class="nb">    is equivalent to:</span>
</div><div id="l2718" class="code_block"><span class="nb">	</span><span class="nv">\begin</span><span class="nb">{center}</span>
</div><div id="l2719" class="code_block"><span class="nb">	{</span><span class="nv">\tt</span><span class="nb"> P </span><span class="o">-</span><span class="nb">&gt; Q ; fail.}</span>
</div><div id="l2720" class="code_block"><span class="nb">	</span><span class="nv">\end</span><span class="nb">{center}</span>
</div><div id="l2721" class="code_block">
</div><div id="l2722" class="code_block"><span class="nv">\standarditem</span><span class="nb">{repeat}{repeat</span><span class="o">/</span><span class="m">0</span><span class="nb">}</span>
</div><div id="l2723" class="code_block"><span class="nb">    Generates an infinite sequence of choice points </span><span class="o">(</span><span class="nb">in other words it </span>
</div><div id="l2724" class="code_block"><span class="nb">    provides a very convenient way of executing a loop</span><span class="o">)</span><span class="nb">. It is defined </span>
</div><div id="l2725" class="code_block"><span class="nb">    by the clauses:</span>
</div><div id="l2726" class="code_block"><span class="nb">    </span><span class="nv">\begin</span><span class="nb">{center}</span>
</div><div id="l2727" class="code_block"><span class="nb">    </span><span class="nv">\begin</span><span class="nb">{minipage}{</span><span class="m">1</span><span class="nb">.</span><span class="m">5</span><span class="nb">in}</span>
</div><div id="l2728" class="code_block"><span class="nb">    </span><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l2729" class="code_block"><span class="nb">	repeat.</span>
</div><div id="l2730" class="code_block"><span class="nb">	repeat :</span><span class="o">-</span><span class="nb"> repeat.</span>
</div><div id="l2731" class="code_block"><span class="nb">    </span><span class="nv">\end</span><span class="nb">{verbatim}</span>
</div><div id="l2732" class="code_block"><span class="nb">    </span><span class="nv">\end</span><span class="nb">{minipage}</span>
</div><div id="l2733" class="code_block"><span class="nb">    </span><span class="nv">\end</span><span class="nb">{center}</span>
</div><div id="l2734" class="code_block">
</div><div id="l2735" class="code_block"><span class="nv">\ourmoditem</span><span class="nb">{between</span><span class="o">(+</span><span class="nb">L,</span><span class="o">+</span><span class="nb">U,B</span><span class="o">)</span><span class="nb">}{between</span><span class="o">/</span><span class="m">3</span><span class="nb">}{basics}</span>
</div><div id="l2736" class="code_block"><span class="c">%</span>
</div><div id="l2737" class="code_block"><span class="nb">For {</span><span class="nv">\tt</span><span class="nb"> L} and {</span><span class="nv">\tt</span><span class="nb"> U} integers, with {</span><span class="nv">\tt</span><span class="nb"> L} less than or equal to</span>
</div><div id="l2738" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> U}, successive calls to {</span><span class="nv">\tt</span><span class="nb"> between</span><span class="o">/</span><span class="m">3</span><span class="nb">} unify {</span><span class="nv">\tt</span><span class="nb"> B} with all</span>
</div><div id="l2739" class="code_block"><span class="nb">integers between {</span><span class="nv">\tt</span><span class="nb"> L} and {</span><span class="nv">\tt</span><span class="nb"> U} inclusively.  If {</span><span class="nv">\tt</span><span class="nb"> L} is less</span>
</div><div id="l2740" class="code_block"><span class="nb">than {</span><span class="nv">\tt</span><span class="nb"> U} the predicate fails.</span>
</div><div id="l2741" class="code_block">
</div><div id="l2742" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Error Cases:}</span>
</div><div id="l2743" class="code_block"><span class="nv">\bi</span>
</div><div id="l2744" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> L} </span><span class="o">(</span><span class="nb">or {</span><span class="nv">\tt</span><span class="nb"> U}</span><span class="o">)</span><span class="nb"> is a not a character</span>
</div><div id="l2745" class="code_block"><span class="nv">\bi</span>
</div><div id="l2746" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">integer,L</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l2747" class="code_block"><span class="nv">\ei</span>
</div><div id="l2748" class="code_block"><span class="nv">\ei</span>
</div><div id="l2749" class="code_block"><span class="nv">\end</span><span class="nb">{description}</span>
</div><div id="l2750" class="code_block">
</div><div id="l2751" class="code_block"><span class="c">%-------------------------------------------------------------------------</span>
</div><div id="l2752" class="code_block"><span class="c">% Comparison and unification of terms.</span>
</div><div id="l2753" class="code_block"><span class="nv">\input</span><span class="nb">{comparison}</span>
</div><div id="l2754" class="code_block">
</div><div id="l2755" class="code_block"><span class="c">%------------------------------------------------------------------------------------------------</span>
</div><div id="l2756" class="code_block"><span class="nv">\section</span><span class="nb">{Meta</span><span class="o">-</span><span class="nb">Logical}</span><span class="nv">\label</span><span class="nb">{MetaLogical}</span>
</div><div id="l2757" class="code_block">
</div><div id="l2758" class="code_block"><span class="nb">To facilitate manipulation of terms as objects in themselves,</span>
</div><div id="l2759" class="code_block"><span class="nb">XSB provides a number meta</span><span class="o">-</span><span class="nb">logical predicates.  These</span>
</div><div id="l2760" class="code_block"><span class="nb">predicates include the standard meta</span><span class="o">-</span><span class="nb">logical predicates of Prolog,</span>
</div><div id="l2761" class="code_block"><span class="nb">along with their usual semantics.  In addition are provided predicates</span>
</div><div id="l2762" class="code_block"><span class="nb">which provide special operations on HiLog terms.  For a full</span>
</div><div id="l2763" class="code_block"><span class="nb">discussion of Prolog and HiLog terms see Section~</span><span class="nv">\ref</span><span class="nb">{TermSyntax}.</span>
</div><div id="l2764" class="code_block">
</div><div id="l2765" class="code_block"><span class="nv">\begin</span><span class="nb">{description}</span>
</div><div id="l2766" class="code_block"><span class="nv">\isoitem</span><span class="nb">{var</span><span class="o">(</span><span class="nb">?X</span><span class="o">)</span><span class="nb">}{var</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span>
</div><div id="l2767" class="code_block"><span class="nb">    Succeeds if {</span><span class="nv">\tt</span><span class="nb"> X} is currently uninstantiated </span><span class="o">(</span><span class="nb">i.e.</span><span class="nv">\</span><span class="nb"> is still a </span>
</div><div id="l2768" class="code_block"><span class="nb">    variable</span><span class="o">)</span><span class="nb">; otherwise it fails.  </span>
</div><div id="l2769" class="code_block">
</div><div id="l2770" class="code_block"><span class="nb">    Term {</span><span class="nv">\tt</span><span class="nb"> X} is uninstantiated if it has not been bound to anything, </span>
</div><div id="l2771" class="code_block"><span class="nb">    except possibly another uninstantiated variable. Note in particular,</span>
</div><div id="l2772" class="code_block"><span class="nb">    that the HiLog term X</span><span class="o">(</span><span class="nb">Y,Z</span><span class="o">)</span><span class="nb"> is considered to be instantiated.  There </span>
</div><div id="l2773" class="code_block"><span class="nb">    is no distinction between a Prolog and a HiLog variable.</span>
</div><div id="l2774" class="code_block">
</div><div id="l2775" class="code_block"><span class="nb">    Examples:</span>
</div><div id="l2776" class="code_block"><span class="nb">    {</span><span class="nv">\footnotesize</span>
</div><div id="l2777" class="code_block"><span class="nb">     </span><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l2778" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> var</span><span class="o">(</span><span class="nb">X</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l2779" class="code_block"><span class="nb">                yes</span>
</div><div id="l2780" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> var</span><span class="o">([</span><span class="nb">X</span><span class="o">])</span><span class="nb">.</span>
</div><div id="l2781" class="code_block"><span class="nb">                no</span>
</div><div id="l2782" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> var</span><span class="o">(</span><span class="nb">X</span><span class="o">(</span><span class="nb">Y,Z</span><span class="o">))</span><span class="nb">.</span>
</div><div id="l2783" class="code_block"><span class="nb">                no</span>
</div><div id="l2784" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> var</span><span class="o">((</span><span class="nb">X</span><span class="o">))</span><span class="nb">.</span>
</div><div id="l2785" class="code_block"><span class="nb">                yes</span>
</div><div id="l2786" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> var</span><span class="o">((</span><span class="nb">X</span><span class="o">)(</span><span class="nb">Y</span><span class="o">))</span><span class="nb">.</span>
</div><div id="l2787" class="code_block"><span class="nb">                no</span>
</div><div id="l2788" class="code_block"><span class="nb">     </span><span class="nv">\end</span><span class="nb">{verbatim}}</span>
</div><div id="l2789" class="code_block">
</div><div id="l2790" class="code_block">
</div><div id="l2791" class="code_block"><span class="nv">\isoitem</span><span class="nb">{nonvar</span><span class="o">(</span><span class="nb">?X</span><span class="o">)</span><span class="nb">}{nonvar</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span>
</div><div id="l2792" class="code_block"><span class="nb">    Succeeds if {</span><span class="nv">\tt</span><span class="nb"> X} is currently instantiated to a non</span><span class="o">-</span><span class="nb">variable term;</span>
</div><div id="l2793" class="code_block"><span class="nb">    otherwise it fails. This has exactly the opposite behaviour of </span>
</div><div id="l2794" class="code_block"><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> var</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span><span class="nv">\@</span><span class="nb">.</span>
</div><div id="l2795" class="code_block">
</div><div id="l2796" class="code_block"><span class="nv">\isoitem</span><span class="nb">{atom</span><span class="o">(</span><span class="nb">?X</span><span class="o">)</span><span class="nb">}{atom</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span>
</div><div id="l2797" class="code_block"><span class="nb">    Succeeds only if the {</span><span class="nv">\tt</span><span class="nb"> X} is currently instantiated to an atom, that</span>
</div><div id="l2798" class="code_block"><span class="nb">    is to a Prolog or HiLog non</span><span class="o">-</span><span class="nb">numeric constant.</span>
</div><div id="l2799" class="code_block">
</div><div id="l2800" class="code_block"><span class="nb">    Examples:</span>
</div><div id="l2801" class="code_block"><span class="nb">    {</span><span class="nv">\footnotesize</span>
</div><div id="l2802" class="code_block"><span class="nb">     </span><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l2803" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> atom</span><span class="o">(</span><span class="nb">HiLog</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l2804" class="code_block"><span class="nb">                no</span>
</div><div id="l2805" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> atom</span><span class="o">(</span><span class="m">10</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l2806" class="code_block"><span class="nb">                no</span>
</div><div id="l2807" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> atom</span><span class="o">(</span><span class="nb">&#39;HiLog&#39;</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l2808" class="code_block"><span class="nb">                yes</span>
</div><div id="l2809" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> atom</span><span class="o">(</span><span class="nb">X</span><span class="o">(</span><span class="nb">a,b</span><span class="o">))</span><span class="nb">.</span>
</div><div id="l2810" class="code_block"><span class="nb">                no</span>
</div><div id="l2811" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> atom</span><span class="o">(</span><span class="nb">h</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l2812" class="code_block"><span class="nb">                yes</span>
</div><div id="l2813" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> atom</span><span class="o">(+)</span><span class="nb">.</span>
</div><div id="l2814" class="code_block"><span class="nb">                yes</span>
</div><div id="l2815" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> atom</span><span class="o">([])</span><span class="nb">.</span>
</div><div id="l2816" class="code_block"><span class="nb">                yes</span>
</div><div id="l2817" class="code_block"><span class="nb">     </span><span class="nv">\end</span><span class="nb">{verbatim}}</span>
</div><div id="l2818" class="code_block">
</div><div id="l2819" class="code_block"><span class="nv">\isoitem</span><span class="nb">{integer</span><span class="o">(</span><span class="nb">?X</span><span class="o">)</span><span class="nb">}{integer</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span>
</div><div id="l2820" class="code_block"><span class="nb">    Succeeds if {</span><span class="nv">\tt</span><span class="nb"> X} is currently instantiated to an integer; </span>
</div><div id="l2821" class="code_block"><span class="nb">    otherwise it fails. </span>
</div><div id="l2822" class="code_block">
</div><div id="l2823" class="code_block"><span class="nv">\isoitem</span><span class="nb">{float</span><span class="o">(</span><span class="nb">?X</span><span class="o">)</span><span class="nb">}{ISO}{float</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span>
</div><div id="l2824" class="code_block"><span class="nb">    Same as {</span><span class="nv">\tt</span><span class="nb"> real</span><span class="o">/</span><span class="m">1</span><span class="nb">}. Succeeds if {</span><span class="nv">\tt</span><span class="nb"> X} is currently instantiated </span>
</div><div id="l2825" class="code_block"><span class="nb">    to a floating point number; otherwise it fails.  </span>
</div><div id="l2826" class="code_block"><span class="nb">	</span>
</div><div id="l2827" class="code_block"><span class="nv">\standarditem</span><span class="nb">{real</span><span class="o">(</span><span class="nb">?X</span><span class="o">)</span><span class="nb">}{real</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span>
</div><div id="l2828" class="code_block"><span class="c">%</span>
</div><div id="l2829" class="code_block"><span class="nb">Succeeds if {</span><span class="nv">\tt</span><span class="nb"> X} is currently instantiated to a floating point</span>
</div><div id="l2830" class="code_block"><span class="nb">number; otherwise it fails. This predicate is included for</span>
</div><div id="l2831" class="code_block"><span class="nb">compatibility with earlier versions of XSB.</span>
</div><div id="l2832" class="code_block">
</div><div id="l2833" class="code_block"><span class="nv">\isoitem</span><span class="nb">{number</span><span class="o">(</span><span class="nb">?X</span><span class="o">)</span><span class="nb">}{number</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span>
</div><div id="l2834" class="code_block"><span class="nb">    Succeeds if {</span><span class="nv">\tt</span><span class="nb"> X} is currently instantiated to either an integer or </span>
</div><div id="l2835" class="code_block"><span class="nb">    a floating point number </span><span class="o">(</span><span class="nb">real</span><span class="o">)</span><span class="nb">; otherwise it fails.</span>
</div><div id="l2836" class="code_block">
</div><div id="l2837" class="code_block"><span class="nv">\isoitem</span><span class="nb">{atomic</span><span class="o">(</span><span class="nb">?X</span><span class="o">)</span><span class="nb">}{atomic</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span>
</div><div id="l2838" class="code_block"><span class="nb">    Succeeds if {</span><span class="nv">\tt</span><span class="nb"> X} is currently instantiated to an atom or a number;</span>
</div><div id="l2839" class="code_block"><span class="nb">    otherwise it fails.</span>
</div><div id="l2840" class="code_block">
</div><div id="l2841" class="code_block"><span class="nb">    Examples:</span>
</div><div id="l2842" class="code_block"><span class="nb">    {</span><span class="nv">\footnotesize</span>
</div><div id="l2843" class="code_block"><span class="nb">     </span><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l2844" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> atomic</span><span class="o">(</span><span class="m">10</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l2845" class="code_block"><span class="nb">                yes</span>
</div><div id="l2846" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> atomic</span><span class="o">(</span><span class="nb">p</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l2847" class="code_block"><span class="nb">                yes</span>
</div><div id="l2848" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> atomic</span><span class="o">(</span><span class="nb">h</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l2849" class="code_block"><span class="nb">                yes</span>
</div><div id="l2850" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> atomic</span><span class="o">(</span><span class="nb">h</span><span class="o">(</span><span class="nb">X</span><span class="o">))</span><span class="nb">.</span>
</div><div id="l2851" class="code_block"><span class="nb">                no</span>
</div><div id="l2852" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> atomic</span><span class="o">(</span><span class="nb">&quot;foo&quot;</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l2853" class="code_block"><span class="nb">                no</span>
</div><div id="l2854" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> atomic</span><span class="o">(</span><span class="nb">&#39;foo&#39;</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l2855" class="code_block"><span class="nb">                yes</span>
</div><div id="l2856" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> atomic</span><span class="o">(</span><span class="nb">X</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l2857" class="code_block"><span class="nb">                no</span>
</div><div id="l2858" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> atomic</span><span class="o">(</span><span class="nb">X</span><span class="o">((</span><span class="nb">Y</span><span class="o">)))</span><span class="nb">.</span>
</div><div id="l2859" class="code_block"><span class="nb">                no</span>
</div><div id="l2860" class="code_block"><span class="nb">     </span><span class="nv">\end</span><span class="nb">{verbatim}}</span>
</div><div id="l2861" class="code_block">
</div><div id="l2862" class="code_block"><span class="nv">\isoitem</span><span class="nb">{compound</span><span class="o">(</span><span class="nb">?X</span><span class="o">)</span><span class="nb">}{compound</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span>
</div><div id="l2863" class="code_block"><span class="nb">    Succeeds if {</span><span class="nv">\tt</span><span class="nb"> X} is currently instantiated to a compound term </span><span class="o">(</span><span class="nb">with </span>
</div><div id="l2864" class="code_block"><span class="nb">    arity greater that zero</span><span class="o">)</span><span class="nb">, i.e.</span><span class="nv">\</span><span class="nb"> to a non</span><span class="o">-</span><span class="nb">variable term that is not atomic;</span>
</div><div id="l2865" class="code_block"><span class="nb">    otherwise it fails.</span>
</div><div id="l2866" class="code_block">
</div><div id="l2867" class="code_block"><span class="nb">    Examples:</span>
</div><div id="l2868" class="code_block"><span class="nb">    {</span><span class="nv">\footnotesize</span>
</div><div id="l2869" class="code_block"><span class="nb">     </span><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l2870" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> compound</span><span class="o">(</span><span class="m">1</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l2871" class="code_block"><span class="nb">                no</span>
</div><div id="l2872" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> compound</span><span class="o">(</span><span class="nb">foo</span><span class="o">(</span><span class="m">1</span><span class="nb">,</span><span class="m">2</span><span class="nb">,</span><span class="m">3</span><span class="o">))</span><span class="nb">.</span>
</div><div id="l2873" class="code_block"><span class="nb">                yes</span>
</div><div id="l2874" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> compound</span><span class="o">([</span><span class="nb">foo, bar</span><span class="o">])</span><span class="nb">.</span>
</div><div id="l2875" class="code_block"><span class="nb">                yes</span>
</div><div id="l2876" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> compound</span><span class="o">(</span><span class="nb">&quot;foo&quot;</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l2877" class="code_block"><span class="nb">                yes</span>
</div><div id="l2878" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> compound</span><span class="o">(</span><span class="nb">&#39;foo&#39;</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l2879" class="code_block"><span class="nb">                no</span>
</div><div id="l2880" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> compound</span><span class="o">(</span><span class="nb">X</span><span class="o">(</span><span class="nb">a,b</span><span class="o">))</span><span class="nb">.</span>
</div><div id="l2881" class="code_block"><span class="nb">                yes</span>
</div><div id="l2882" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> compound</span><span class="o">((</span><span class="nb">a,b</span><span class="o">))</span><span class="nb">.</span>
</div><div id="l2883" class="code_block"><span class="nb">                yes	</span>
</div><div id="l2884" class="code_block"><span class="nb">     </span><span class="nv">\end</span><span class="nb">{verbatim}}</span>
</div><div id="l2885" class="code_block">
</div><div id="l2886" class="code_block"><span class="nv">\standarditem</span><span class="nb">{structure</span><span class="o">(</span><span class="nb">?X</span><span class="o">)</span><span class="nb">}{structure</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span>
</div><div id="l2887" class="code_block"><span class="nb">    Same as {</span><span class="nv">\tt</span><span class="nb"> compound</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span><span class="nv">\@</span><span class="nb">. Its existence is only for compatibility </span>
</div><div id="l2888" class="code_block"><span class="nb">    with previous versions.</span>
</div><div id="l2889" class="code_block">
</div><div id="l2890" class="code_block"><span class="nv">\standarditem</span><span class="nb">{is</span><span class="nv">\_</span><span class="nb">list</span><span class="o">(</span><span class="nb">?X</span><span class="o">)</span><span class="nb">}{is</span><span class="nv">\_</span><span class="nb">list</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span>
</div><div id="l2891" class="code_block"><span class="nb">    Succeeds if {</span><span class="nv">\tt</span><span class="nb"> X} is a {</span><span class="nv">\em</span><span class="nb"> proper list}. In other words if it is </span>
</div><div id="l2892" class="code_block"><span class="nb">    either the atom {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">[]</span><span class="nb">} or {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">[</span><span class="nb">H|T</span><span class="o">]</span><span class="nb">} where H is any Prolog or HiLog</span>
</div><div id="l2893" class="code_block"><span class="nb">    term and T is a proper list; otherwise it fails.</span>
</div><div id="l2894" class="code_block">
</div><div id="l2895" class="code_block"><span class="nb">    Examples:</span>
</div><div id="l2896" class="code_block"><span class="nb">    {</span><span class="nv">\footnotesize</span>
</div><div id="l2897" class="code_block"><span class="nb">     </span><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l2898" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> is_list</span><span class="o">([</span><span class="nb">p</span><span class="o">(</span><span class="nb">a,b,c</span><span class="o">)</span><span class="nb">, h</span><span class="o">(</span><span class="nb">a,b</span><span class="o">)])</span><span class="nb">.</span>
</div><div id="l2899" class="code_block"><span class="nb">                yes</span>
</div><div id="l2900" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> is_list</span><span class="o">([</span><span class="nb">_,_</span><span class="o">])</span><span class="nb">.</span>
</div><div id="l2901" class="code_block"><span class="nb">                yes</span>
</div><div id="l2902" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> is_list</span><span class="o">([</span><span class="nb">a,b|X</span><span class="o">])</span><span class="nb">.</span>
</div><div id="l2903" class="code_block"><span class="nb">                no</span>
</div><div id="l2904" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> is_list</span><span class="o">([</span><span class="nb">a|b</span><span class="o">])</span><span class="nb">.</span>
</div><div id="l2905" class="code_block"><span class="nb">                no</span>
</div><div id="l2906" class="code_block"><span class="nb">     </span><span class="nv">\end</span><span class="nb">{verbatim}}</span>
</div><div id="l2907" class="code_block">
</div><div id="l2908" class="code_block"><span class="nv">\standarditem</span><span class="nb">{is</span><span class="nv">\_</span><span class="nb">charlist</span><span class="o">(+</span><span class="nb">X</span><span class="o">)</span><span class="nb">}{is</span><span class="nv">\_</span><span class="nb">charlist</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span>
</div><div id="l2909" class="code_block"><span class="nb">    Succeeds if {</span><span class="nv">\tt</span><span class="nb"> X} is a Prolog string, {</span><span class="nv">\it</span><span class="nb"> i.e.}, a list of</span>
</div><div id="l2910" class="code_block"><span class="nb">    characters.</span>
</div><div id="l2911" class="code_block"><span class="nb">    Examples:</span>
</div><div id="l2912" class="code_block"><span class="nb">    {</span><span class="nv">\footnotesize</span>
</div><div id="l2913" class="code_block"><span class="nb">     </span><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l2914" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> is_charlist</span><span class="o">(</span><span class="nb">&quot;abc&quot;</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l2915" class="code_block"><span class="nb">                yes</span>
</div><div id="l2916" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> is_charlist</span><span class="o">(</span><span class="nb">abc</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l2917" class="code_block"><span class="nb">                no</span>
</div><div id="l2918" class="code_block"><span class="nb">     </span><span class="nv">\end</span><span class="nb">{verbatim}}</span>
</div><div id="l2919" class="code_block">
</div><div id="l2920" class="code_block"><span class="nv">\standarditem</span><span class="nb">{is</span><span class="nv">\_</span><span class="nb">charlist</span><span class="o">(+</span><span class="nb">X,</span><span class="o">-</span><span class="nb">Size</span><span class="o">)</span><span class="nb">}{is</span><span class="nv">\_</span><span class="nb">charlist</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l2921" class="code_block"><span class="nb">    Works as above, but also returns the length of that string in the second</span>
</div><div id="l2922" class="code_block"><span class="nb">    argument, which must be a variable.</span>
</div><div id="l2923" class="code_block">
</div><div id="l2924" class="code_block"><span class="nv">\standarditem</span><span class="nb">{is</span><span class="nv">\_</span><span class="nb">attv</span><span class="o">(+</span><span class="nb">Term</span><span class="o">)</span><span class="nb">}{is</span><span class="nv">\_</span><span class="nb">attv</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span>
</div><div id="l2925" class="code_block"><span class="nb">    Succeeds is {</span><span class="nv">\tt</span><span class="nb"> Term} is an attributed variable, and fails otherwise.</span>
</div><div id="l2926" class="code_block">
</div><div id="l2927" class="code_block"><span class="nv">\standarditem</span><span class="nb">{is</span><span class="nv">\_</span><span class="nb">most</span><span class="nv">\_</span><span class="nb">general</span><span class="nv">\_</span><span class="nb">term</span><span class="o">(</span><span class="nb">?X</span><span class="o">)</span><span class="nb">}{is</span><span class="nv">\_</span><span class="nb">most</span><span class="nv">\_</span><span class="nb">general</span><span class="nv">\_</span><span class="nb">term</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span>
</div><div id="l2928" class="code_block"><span class="nb">    Succeeds if {</span><span class="nv">\tt</span><span class="nb"> X} is compound term with all distinct variables</span>
</div><div id="l2929" class="code_block"><span class="nb">as arguments, or if {</span><span class="nv">\tt</span><span class="nb"> X} is an atom. </span><span class="o">(</span><span class="nb">It fails if X is a cons node.</span><span class="o">)</span>
</div><div id="l2930" class="code_block"><span class="nb">    {</span><span class="nv">\footnotesize</span>
</div><div id="l2931" class="code_block"><span class="nb">     </span><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l2932" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> is_most_general_term</span><span class="o">(</span><span class="nb">f</span><span class="o">(</span><span class="nb">_,_,_,_</span><span class="o">))</span><span class="nb">.</span>
</div><div id="l2933" class="code_block"><span class="nb">                yes</span>
</div><div id="l2934" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> is_most_general_term</span><span class="o">(</span><span class="nb">abc</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l2935" class="code_block"><span class="nb">                yes</span>
</div><div id="l2936" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> is_most_general_term</span><span class="o">(</span><span class="nb">f</span><span class="o">(</span><span class="nb">X,Y,Z,X</span><span class="o">))</span><span class="nb">.</span>
</div><div id="l2937" class="code_block"><span class="nb">                no</span>
</div><div id="l2938" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> is_most_general_term</span><span class="o">(</span><span class="nb">f</span><span class="o">(</span><span class="nb">X,Y,Z,a</span><span class="o">))</span><span class="nb">.</span>
</div><div id="l2939" class="code_block"><span class="nb">                no</span>
</div><div id="l2940" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> is_most_general_term</span><span class="o">([</span><span class="nb">_|_</span><span class="o">])</span><span class="nb">.</span>
</div><div id="l2941" class="code_block"><span class="nb">                no</span>
</div><div id="l2942" class="code_block"><span class="nb">     </span><span class="nv">\end</span><span class="nb">{verbatim}}</span>
</div><div id="l2943" class="code_block">
</div><div id="l2944" class="code_block"><span class="nv">\standarditem</span><span class="nb">{is</span><span class="nv">\_</span><span class="nb">number</span><span class="nv">\_</span><span class="nb">atom</span><span class="o">(</span><span class="nb">?X</span><span class="o">)</span><span class="nb">}{is</span><span class="nv">\_</span><span class="nb">number</span><span class="nv">\_</span><span class="nb">atom</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span>
</div><div id="l2945" class="code_block">
</div><div id="l2946" class="code_block"><span class="nb">    Succeeds if {</span><span class="nv">\tt</span><span class="nb"> X} is an atom </span><span class="o">(</span><span class="nb">e.g. {</span><span class="nv">\tt</span><span class="nb"> &#39;</span><span class="m">123</span><span class="nb">&#39;}</span><span class="o">)</span><span class="nb"> </span><span class="o">(</span><span class="nb">as opposed to a</span>
</div><div id="l2947" class="code_block"><span class="nb">    number {</span><span class="nv">\tt</span><span class="nb"> </span><span class="m">123</span><span class="nb">}</span><span class="o">)</span><span class="nb"> which can be converted to a numeric atom</span>
</div><div id="l2948" class="code_block"><span class="nb">    </span><span class="o">(</span><span class="nb">integer or float</span><span class="o">)</span><span class="nb"> and fails otherwise.  In particular, if {</span><span class="nv">\tt</span>
</div><div id="l2949" class="code_block"><span class="nb">      is</span><span class="nv">\_</span><span class="nb">number</span><span class="nv">\_</span><span class="nb">atom</span><span class="o">(</span><span class="nb">X</span><span class="o">)</span><span class="nb">} succeeds, then {</span><span class="nv">\footnotesize</span>
</div><div id="l2950" class="code_block"><span class="nb">     </span><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l2951" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> atom_codes</span><span class="o">(</span><span class="nb">X,Codes</span><span class="o">)</span><span class="nb">,number_codes</span><span class="o">(</span><span class="nb">N,Codes</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l2952" class="code_block"><span class="nb">     </span><span class="nv">\end</span><span class="nb">{verbatim}}</span>
</div><div id="l2953" class="code_block"><span class="nb">    will succeed.</span>
</div><div id="l2954" class="code_block">
</div><div id="l2955" class="code_block"><span class="nv">\standarditem</span><span class="nb">{callable</span><span class="o">(</span><span class="nb">?X</span><span class="o">)</span><span class="nb">}{callable</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span>
</div><div id="l2956" class="code_block"><span class="nb">    Succeeds if {</span><span class="nv">\tt</span><span class="nb"> X} is currently instantiated to a term that standard</span>
</div><div id="l2957" class="code_block"><span class="nb">    predicate {</span><span class="nv">\tt</span><span class="nb"> call</span><span class="o">/</span><span class="m">1</span><span class="nb">} could take as an argument and not give an </span>
</div><div id="l2958" class="code_block"><span class="nb">    instantiation or type error.  Note that it only checks for errors of</span>
</div><div id="l2959" class="code_block"><span class="nb">    predicate {</span><span class="nv">\tt</span><span class="nb"> call</span><span class="o">/</span><span class="m">1</span><span class="nb">}.  In other words it succeeds if {</span><span class="nv">\tt</span><span class="nb"> X}</span>
</div><div id="l2960" class="code_block"><span class="nb">    is an atom or a compound term; otherwise it fails.  Predicate</span>
</div><div id="l2961" class="code_block"><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> callable</span><span class="o">/</span><span class="m">1</span><span class="nb">} has no associated error conditions.</span>
</div><div id="l2962" class="code_block">
</div><div id="l2963" class="code_block"><span class="nb">    Examples:</span>
</div><div id="l2964" class="code_block"><span class="nb">    {</span><span class="nv">\footnotesize</span>
</div><div id="l2965" class="code_block"><span class="nb">     </span><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l2966" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> callable</span><span class="o">(</span><span class="nb">p</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l2967" class="code_block"><span class="nb">                yes</span>
</div><div id="l2968" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> callable</span><span class="o">(</span><span class="nb">p</span><span class="o">(</span><span class="m">1</span><span class="nb">,</span><span class="m">2</span><span class="nb">,</span><span class="m">3</span><span class="o">))</span><span class="nb">.</span>
</div><div id="l2969" class="code_block"><span class="nb">                yes</span>
</div><div id="l2970" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> callable</span><span class="o">([</span><span class="nb">_,_</span><span class="o">])</span><span class="nb">.</span>
</div><div id="l2971" class="code_block"><span class="nb">                yes</span>
</div><div id="l2972" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> callable</span><span class="o">(</span><span class="nb">_</span><span class="o">(</span><span class="nb">a</span><span class="o">))</span><span class="nb">.</span>
</div><div id="l2973" class="code_block"><span class="nb">                yes</span>
</div><div id="l2974" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> callable</span><span class="o">(</span><span class="m">3</span><span class="nb">.</span><span class="m">14</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l2975" class="code_block"><span class="nb">                no</span>
</div><div id="l2976" class="code_block"><span class="nb">     </span><span class="nv">\end</span><span class="nb">{verbatim}}</span>
</div><div id="l2977" class="code_block">
</div><div id="l2978" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{proper</span><span class="nv">\_</span><span class="nb">hilog</span><span class="o">(</span><span class="nb">?X</span><span class="o">)</span><span class="nb">}{proper</span><span class="nv">\_</span><span class="nb">hilog</span><span class="o">/</span><span class="m">1</span><span class="nb">}{HiLog}</span>
</div><div id="l2979" class="code_block"><span class="c">%</span>
</div><div id="l2980" class="code_block"><span class="nb">   Succeeds if {</span><span class="nv">\tt</span><span class="nb"> X} is a proper HiLog term </span><span class="o">--</span><span class="nb"> i.e. a HiLog term</span>
</div><div id="l2981" class="code_block"><span class="nb">   that is not a Prolog term; otherwise the predicate fails.</span>
</div><div id="l2982" class="code_block">
</div><div id="l2983" class="code_block"><span class="nb">    Examples:</span>
</div><div id="l2984" class="code_block"><span class="nb">    </span><span class="o">(</span><span class="nb">In this example and the rest of the examples of this section we assume</span>
</div><div id="l2985" class="code_block"><span class="nb">     that {</span><span class="nv">\tt</span><span class="nb"> h} is the only parameter symbol that has been declared a HiLog</span>
</div><div id="l2986" class="code_block"><span class="nb">     symbol</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l2987" class="code_block">
</div><div id="l2988" class="code_block"><span class="nb">    {</span><span class="nv">\footnotesize</span>
</div><div id="l2989" class="code_block"><span class="nb">     </span><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l2990" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> proper_hilog</span><span class="o">(</span><span class="nb">X</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l2991" class="code_block"><span class="nb">                no</span>
</div><div id="l2992" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> proper_hilog</span><span class="o">(</span><span class="nb">foo</span><span class="o">(</span><span class="nb">a,f</span><span class="o">(</span><span class="nb">b</span><span class="o">)</span><span class="nb">,</span><span class="o">[</span><span class="nb">A</span><span class="o">]))</span><span class="nb">.</span>
</div><div id="l2993" class="code_block"><span class="nb">                no</span>
</div><div id="l2994" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> proper_hilog</span><span class="o">(</span><span class="nb">X</span><span class="o">(</span><span class="nb">a,b,c</span><span class="o">))</span><span class="nb">.</span>
</div><div id="l2995" class="code_block"><span class="nb">                yes</span>
</div><div id="l2996" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> proper_hilog</span><span class="o">(</span><span class="m">3</span><span class="nb">.</span><span class="m">6</span><span class="o">(</span><span class="m">2</span><span class="nb">,</span><span class="m">4</span><span class="o">))</span><span class="nb">.</span>
</div><div id="l2997" class="code_block"><span class="nb">                yes</span>
</div><div id="l2998" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> proper_hilog</span><span class="o">(</span><span class="nb">h</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l2999" class="code_block"><span class="nb">                no</span>
</div><div id="l3000" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> proper_hilog</span><span class="o">([</span><span class="nb">a, </span><span class="o">[</span><span class="nb">d, e, X</span><span class="o">(</span><span class="nb">a</span><span class="o">)]</span><span class="nb">, c</span><span class="o">])</span><span class="nb">.</span>
</div><div id="l3001" class="code_block"><span class="nb">                yes</span>
</div><div id="l3002" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> proper_hilog</span><span class="o">(</span><span class="nb">a</span><span class="o">(</span><span class="nb">a</span><span class="o">(</span><span class="nb">X</span><span class="o">(</span><span class="nb">a</span><span class="o">))))</span><span class="nb">.</span>
</div><div id="l3003" class="code_block"><span class="nb">                yes</span>
</div><div id="l3004" class="code_block"><span class="nb">     </span><span class="nv">\end</span><span class="nb">{verbatim}}</span>
</div><div id="l3005" class="code_block">
</div><div id="l3006" class="code_block"><span class="nv">\isoitem</span><span class="nb">{functor</span><span class="o">(</span><span class="nb">?Term, ?Functor, ?Arity</span><span class="o">)</span><span class="nb">}{functor</span><span class="o">/</span><span class="m">3</span><span class="nb">}</span>
</div><div id="l3007" class="code_block"><span class="nb">    Succeeds if the {</span><span class="nv">\em</span><span class="nb"> functor} of the Prolog term {</span><span class="nv">\tt</span><span class="nb"> Term} is </span>
</div><div id="l3008" class="code_block"><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> Functor} and the {</span><span class="nv">\em</span><span class="nb"> arity} </span><span class="o">(</span><span class="nb">number of arguments</span><span class="o">)</span><span class="nb"> of {</span><span class="nv">\tt</span><span class="nb"> Term} is</span>
</div><div id="l3009" class="code_block"><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> Arity}</span><span class="nv">\@</span><span class="nb">.  {</span><span class="nv">\tt</span><span class="nb"> Functor} can be used in either the following two </span>
</div><div id="l3010" class="code_block"><span class="nb">    ways:</span>
</div><div id="l3011" class="code_block"><span class="nb">    </span><span class="nv">\begin</span><span class="nb">{enumerate}</span>
</div><div id="l3012" class="code_block"><span class="nb">    </span><span class="nv">\item</span><span class="nb"> If {</span><span class="nv">\tt</span><span class="nb"> Term} is initially instantiated, then</span>
</div><div id="l3013" class="code_block"><span class="nb">          </span><span class="nv">\begin</span><span class="nb">{itemize}</span>
</div><div id="l3014" class="code_block"><span class="nb">          </span><span class="nv">\item</span><span class="nb"> If {</span><span class="nv">\tt</span><span class="nb"> Term} is a compound term, {</span><span class="nv">\tt</span><span class="nb"> Functor} and </span>
</div><div id="l3015" class="code_block"><span class="nb">                {</span><span class="nv">\tt</span><span class="nb"> Arity} are unified with the name and arity of </span>
</div><div id="l3016" class="code_block"><span class="nb">                its principal functor, respectively. </span>
</div><div id="l3017" class="code_block"><span class="nb">          </span><span class="nv">\item</span><span class="nb"> If {</span><span class="nv">\tt</span><span class="nb"> Term} is an atom or a number, {</span><span class="nv">\tt</span><span class="nb"> Functor} is </span>
</div><div id="l3018" class="code_block"><span class="nb">                unified with {</span><span class="nv">\tt</span><span class="nb"> Term}, and {</span><span class="nv">\tt</span><span class="nb"> Arity} is unified with </span><span class="m">0</span><span class="nb">.</span>
</div><div id="l3019" class="code_block"><span class="nb">          </span><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l3020" class="code_block"><span class="nb">    </span><span class="nv">\item</span><span class="nb"> If {</span><span class="nv">\tt</span><span class="nb"> Term} is initially uninstantiated, then either both </span>
</div><div id="l3021" class="code_block"><span class="nb">          {</span><span class="nv">\tt</span><span class="nb"> Functor} and {</span><span class="nv">\tt</span><span class="nb"> Arity} must be instantiated, or {</span><span class="nv">\tt</span><span class="nb"> Functor}</span>
</div><div id="l3022" class="code_block"><span class="nb">          is instantiated to a number, and</span>
</div><div id="l3023" class="code_block"><span class="nb">          </span><span class="nv">\begin</span><span class="nb">{itemize}</span>
</div><div id="l3024" class="code_block"><span class="nb">          </span><span class="nv">\item</span><span class="nb"> If {</span><span class="nv">\tt</span><span class="nb"> Arity} is an integer in the range </span><span class="m">1</span><span class="nb">..</span><span class="m">255</span><span class="nb">, then</span>
</div><div id="l3025" class="code_block"><span class="nb">                {</span><span class="nv">\tt</span><span class="nb"> Term} becomes instantiated to {</span><span class="nv">\em</span><span class="nb"> the most general </span>
</div><div id="l3026" class="code_block"><span class="nb">                Prolog term} having the specified {</span><span class="nv">\tt</span><span class="nb"> Functor} and </span>
</div><div id="l3027" class="code_block"><span class="nb">                {</span><span class="nv">\tt</span><span class="nb"> Arity} as principal functor and number of arguments,</span>
</div><div id="l3028" class="code_block"><span class="nb">                respectively. The variables appearing as arguments of </span>
</div><div id="l3029" class="code_block"><span class="nb">                {</span><span class="nv">\tt</span><span class="nb"> Term} are all distinct.</span>
</div><div id="l3030" class="code_block"><span class="nb">          </span><span class="nv">\item</span><span class="nb"> If {</span><span class="nv">\tt</span><span class="nb"> Arity} is </span><span class="m">0</span><span class="nb">, then {</span><span class="nv">\tt</span><span class="nb"> Functor} must be either an </span>
</div><div id="l3031" class="code_block"><span class="nb">                atom or a number and it is unified with {</span><span class="nv">\tt</span><span class="nb"> Term}. </span>
</div><div id="l3032" class="code_block"><span class="nb">          </span><span class="nv">\item</span><span class="nb"> If {</span><span class="nv">\tt</span><span class="nb"> Arity} is anything else, then {</span><span class="nv">\tt</span><span class="nb"> functor</span><span class="o">/</span><span class="m">3</span><span class="nb">} aborts.</span>
</div><div id="l3033" class="code_block"><span class="nb">          </span><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l3034" class="code_block"><span class="nb">    </span><span class="nv">\end</span><span class="nb">{enumerate}</span>
</div><div id="l3035" class="code_block">
</div><div id="l3036" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Error Cases}</span>
</div><div id="l3037" class="code_block"><span class="nb">    </span><span class="nv">\begin</span><span class="nb">{description}</span>
</div><div id="l3038" class="code_block"><span class="nb">    </span><span class="nv">\item</span><span class="o">[</span><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> atom</span><span class="nv">\_</span><span class="nb">or</span><span class="nv">\_</span><span class="nb">variable}</span><span class="o">]</span>
</div><div id="l3039" class="code_block"><span class="nb">	{</span><span class="nv">\tt</span><span class="nb"> Functor} is not an atom or variable.</span>
</div><div id="l3040" class="code_block"><span class="nb">    </span><span class="nv">\item</span><span class="o">[</span><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> instantiation</span><span class="nv">\_</span><span class="nb">error}</span><span class="o">]</span>
</div><div id="l3041" class="code_block"><span class="nb">	Both {</span><span class="nv">\tt</span><span class="nb"> Term}, and either {</span><span class="nv">\tt</span><span class="nb"> Functor}, or {</span><span class="nv">\tt</span><span class="nb"> Arity} are </span>
</div><div id="l3042" class="code_block"><span class="nb">	uninstantiated.</span>
</div><div id="l3043" class="code_block"><span class="nb">    </span><span class="nv">\end</span><span class="nb">{description}</span>
</div><div id="l3044" class="code_block">
</div><div id="l3045" class="code_block"><span class="nb">    Examples:</span>
</div><div id="l3046" class="code_block"><span class="nb">    {</span><span class="nv">\footnotesize</span>
</div><div id="l3047" class="code_block"><span class="nb">     </span><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l3048" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> functor</span><span class="o">(</span><span class="nb">p</span><span class="o">(</span><span class="nb">f</span><span class="o">(</span><span class="nb">a</span><span class="o">)</span><span class="nb">,b,t</span><span class="o">)</span><span class="nb">, F, A</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3049" class="code_block"><span class="nb">                F </span><span class="o">=</span><span class="nb"> p</span>
</div><div id="l3050" class="code_block"><span class="nb">                A </span><span class="o">=</span><span class="nb"> </span><span class="m">3</span>
</div><div id="l3051" class="code_block">
</div><div id="l3052" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> functor</span><span class="o">(</span><span class="nb">T, foo, </span><span class="m">3</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3053" class="code_block"><span class="nb">                T </span><span class="o">=</span><span class="nb"> foo</span><span class="o">(</span><span class="nb">_</span><span class="m">595708</span><span class="nb">,_</span><span class="m">595712</span><span class="nb">,_</span><span class="m">595716</span><span class="o">)</span>
</div><div id="l3054" class="code_block">
</div><div id="l3055" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> functor</span><span class="o">(</span><span class="nb">T, </span><span class="m">1</span><span class="nb">.</span><span class="m">3</span><span class="nb">, A</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3056" class="code_block"><span class="nb">                T </span><span class="o">=</span><span class="nb"> </span><span class="m">1</span><span class="nb">.</span><span class="m">3</span>
</div><div id="l3057" class="code_block"><span class="nb">                A </span><span class="o">=</span><span class="nb"> </span><span class="m">0</span>
</div><div id="l3058" class="code_block">
</div><div id="l3059" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> functor</span><span class="o">(</span><span class="nb">foo, F, </span><span class="m">0</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3060" class="code_block"><span class="nb">                F </span><span class="o">=</span><span class="nb"> foo</span>
</div><div id="l3061" class="code_block">
</div><div id="l3062" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> functor</span><span class="o">(</span><span class="nb">&quot;foo&quot;, F, A</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3063" class="code_block"><span class="nb">                F </span><span class="o">=</span><span class="nb"> .</span>
</div><div id="l3064" class="code_block"><span class="nb">                A </span><span class="o">=</span><span class="nb"> </span><span class="m">2</span>
</div><div id="l3065" class="code_block">
</div><div id="l3066" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> functor</span><span class="o">([]</span><span class="nb">, </span><span class="o">[]</span><span class="nb">, A</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3067" class="code_block"><span class="nb">                A </span><span class="o">=</span><span class="nb"> </span><span class="m">0</span>
</div><div id="l3068" class="code_block">
</div><div id="l3069" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> functor</span><span class="o">([</span><span class="m">2</span><span class="nb">,</span><span class="m">3</span><span class="nb">,</span><span class="m">4</span><span class="o">]</span><span class="nb">, F, A</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3070" class="code_block"><span class="nb">                F </span><span class="o">=</span><span class="nb"> .</span>
</div><div id="l3071" class="code_block"><span class="nb">                A </span><span class="o">=</span><span class="nb"> </span><span class="m">2</span>
</div><div id="l3072" class="code_block">
</div><div id="l3073" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> functor</span><span class="o">(</span><span class="nb">a</span><span class="o">+</span><span class="nb">b, F, A</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3074" class="code_block"><span class="nb">                F </span><span class="o">=</span><span class="nb"> </span><span class="o">+</span>
</div><div id="l3075" class="code_block"><span class="nb">                A </span><span class="o">=</span><span class="nb"> </span><span class="m">2</span>
</div><div id="l3076" class="code_block">
</div><div id="l3077" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> functor</span><span class="o">(</span><span class="nb">f</span><span class="o">(</span><span class="nb">a,b,c</span><span class="o">)</span><span class="nb">, F, A</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3078" class="code_block"><span class="nb">                F </span><span class="o">=</span><span class="nb"> f</span>
</div><div id="l3079" class="code_block"><span class="nb">                A </span><span class="o">=</span><span class="nb"> </span><span class="m">3</span>
</div><div id="l3080" class="code_block">
</div><div id="l3081" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> functor</span><span class="o">(</span><span class="nb">X</span><span class="o">(</span><span class="nb">a,b,c</span><span class="o">)</span><span class="nb">, F, A</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3082" class="code_block"><span class="nb">                F </span><span class="o">=</span><span class="nb"> apply</span>
</div><div id="l3083" class="code_block"><span class="nb">                A </span><span class="o">=</span><span class="nb"> </span><span class="m">4</span>
</div><div id="l3084" class="code_block">
</div><div id="l3085" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> functor</span><span class="o">(</span><span class="nb">map</span><span class="o">(</span><span class="nb">P</span><span class="o">)(</span><span class="nb">a,b</span><span class="o">)</span><span class="nb">, F, A</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3086" class="code_block"><span class="nb">                F </span><span class="o">=</span><span class="nb"> apply</span>
</div><div id="l3087" class="code_block"><span class="nb">                A </span><span class="o">=</span><span class="nb"> </span><span class="m">3</span>
</div><div id="l3088" class="code_block">
</div><div id="l3089" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> functor</span><span class="o">(</span><span class="nb">T, foo</span><span class="o">(</span><span class="nb">a</span><span class="o">)</span><span class="nb">, </span><span class="m">1</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3090" class="code_block"><span class="nb">                </span><span class="o">++</span><span class="nb">Error: Wrong type in argument </span><span class="m">2</span><span class="nb"> of functor</span><span class="o">/</span><span class="m">3</span>
</div><div id="l3091" class="code_block"><span class="nb">                Aborting...</span>
</div><div id="l3092" class="code_block">
</div><div id="l3093" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> functor</span><span class="o">(</span><span class="nb">T, F, </span><span class="m">3</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3094" class="code_block"><span class="nb">                </span><span class="o">++</span><span class="nb">Error: Uninstantiated argument </span><span class="m">2</span><span class="nb"> of functor</span><span class="o">/</span><span class="m">3</span>
</div><div id="l3095" class="code_block"><span class="nb">                Aborting...</span>
</div><div id="l3096" class="code_block">
</div><div id="l3097" class="code_block"><span class="nb">                | ?</span><span class="o">-</span><span class="nb"> functor</span><span class="o">(</span><span class="nb">T, foo, A</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3098" class="code_block"><span class="nb">                </span><span class="o">++</span><span class="nb">Error: Uninstantiated argument </span><span class="m">3</span><span class="nb"> of functor</span><span class="o">/</span><span class="m">3</span>
</div><div id="l3099" class="code_block"><span class="nb">                Aborting...</span>
</div><div id="l3100" class="code_block"><span class="nb">     </span><span class="nv">\end</span><span class="nb">{verbatim}}</span>
</div><div id="l3101" class="code_block">
</div><div id="l3102" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{hilog</span><span class="nv">\_</span><span class="nb">functor</span><span class="o">(</span><span class="nb">?Term, ?F, ?Arity</span><span class="o">)</span><span class="nb">}{hilog</span><span class="nv">\_</span><span class="nb">functor</span><span class="o">/</span><span class="m">3</span><span class="nb">}{HiLog}</span>
</div><div id="l3103" class="code_block"><span class="c">%</span>
</div><div id="l3104" class="code_block"><span class="nb">    The XSB standard predicate {</span><span class="nv">\tt</span><span class="nb"> hilog</span><span class="nv">\_</span><span class="nb">functor</span><span class="o">/</span><span class="m">3</span><span class="nb">} succeeds </span>
</div><div id="l3105" class="code_block"><span class="nb">    </span><span class="nv">\begin</span><span class="nb">{itemize}</span>
</div><div id="l3106" class="code_block"><span class="nb">    </span><span class="nv">\item</span><span class="nb"> when {</span><span class="nv">\tt</span><span class="nb"> Term} is a Prolog term and the principal function </span>
</div><div id="l3107" class="code_block"><span class="nb">          symbol </span><span class="o">(</span><span class="nb">{</span><span class="nv">\em</span><span class="nb"> functor}</span><span class="o">)</span><span class="nb"> of {</span><span class="nv">\tt</span><span class="nb"> Term} is {</span><span class="nv">\tt</span><span class="nb"> F} and the</span>
</div><div id="l3108" class="code_block"><span class="nb">          {</span><span class="nv">\em</span><span class="nb"> arity} </span><span class="o">(</span><span class="nb">number of arguments</span><span class="o">)</span><span class="nb"> of {</span><span class="nv">\tt</span><span class="nb"> Term} is </span>
</div><div id="l3109" class="code_block"><span class="nb">          {</span><span class="nv">\tt</span><span class="nb"> Arity}, or</span>
</div><div id="l3110" class="code_block"><span class="nb">    </span><span class="nv">\item</span><span class="nb"> when {</span><span class="nv">\tt</span><span class="nb"> Term} is a HiLog term, having {</span><span class="nv">\em</span><span class="nb"> name} {</span><span class="nv">\tt</span><span class="nb"> F} </span>
</div><div id="l3111" class="code_block"><span class="nb">          and the number of arguments {</span><span class="nv">\tt</span><span class="nb"> F} is applied to, in the </span>
</div><div id="l3112" class="code_block"><span class="nb">          HiLog term, is {</span><span class="nv">\tt</span><span class="nb"> Arity}.</span>
</div><div id="l3113" class="code_block"><span class="nb">    </span><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l3114" class="code_block"><span class="nb">    The first of these cases corresponds to the ``usual&#39;&#39; behaviour of</span>
</div><div id="l3115" class="code_block"><span class="nb">    Prolog&#39;s {</span><span class="nv">\tt</span><span class="nb"> functor</span><span class="o">/</span><span class="m">3</span><span class="nb">}, while the second is the extension of</span>
</div><div id="l3116" class="code_block"><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> functor</span><span class="o">/</span><span class="m">3</span><span class="nb">} to handle HiLog terms. Like the Prolog&#39;s {</span><span class="nv">\tt</span>
</div><div id="l3117" class="code_block"><span class="nb">    functor</span><span class="o">/</span><span class="m">3</span><span class="nb">} predicate, {</span><span class="nv">\tt</span><span class="nb"> hilog</span><span class="nv">\_</span><span class="nb">functor</span><span class="o">/</span><span class="m">3</span><span class="nb">} can be used in either</span>
</div><div id="l3118" class="code_block"><span class="nb">    of the following two ways:</span>
</div><div id="l3119" class="code_block"><span class="nb">    </span><span class="nv">\begin</span><span class="nb">{enumerate}</span>
</div><div id="l3120" class="code_block"><span class="nb">    </span><span class="nv">\item</span><span class="nb"> If {</span><span class="nv">\tt</span><span class="nb"> Term} is initially instantiated, then</span>
</div><div id="l3121" class="code_block"><span class="nb">          </span><span class="nv">\begin</span><span class="nb">{itemize}</span>
</div><div id="l3122" class="code_block"><span class="nb">          </span><span class="nv">\item</span><span class="nb"> If {</span><span class="nv">\tt</span><span class="nb"> Term} is a Prolog compound term, {</span><span class="nv">\tt</span><span class="nb"> F} and </span>
</div><div id="l3123" class="code_block"><span class="nb">                {</span><span class="nv">\tt</span><span class="nb"> Arity} are unified with the name and arity of </span>
</div><div id="l3124" class="code_block"><span class="nb">                its principal functor, respectively.</span>
</div><div id="l3125" class="code_block"><span class="nb">          </span><span class="nv">\item</span><span class="nb"> If {</span><span class="nv">\tt</span><span class="nb"> Term} is an atom or a number, {</span><span class="nv">\tt</span><span class="nb"> F} is unified </span>
</div><div id="l3126" class="code_block"><span class="nb">                with {</span><span class="nv">\tt</span><span class="nb"> Term}, and {</span><span class="nv">\tt</span><span class="nb"> Arity} is unified with </span><span class="m">0</span><span class="nb">.</span>
</div><div id="l3127" class="code_block"><span class="nb">          </span><span class="nv">\item</span><span class="nb"> If {</span><span class="nv">\tt</span><span class="nb"> Term} is any other HiLog term, {</span><span class="nv">\tt</span><span class="nb"> F} and {</span><span class="nv">\tt</span><span class="nb"> Arity} </span>
</div><div id="l3128" class="code_block"><span class="nb">                are unified with the name and the number of arguments </span>
</div><div id="l3129" class="code_block"><span class="nb">                that {</span><span class="nv">\tt</span><span class="nb"> F} is applied to. Note that in this case {</span><span class="nv">\tt</span><span class="nb"> F}</span>
</div><div id="l3130" class="code_block"><span class="nb">                may still be uninstantiated.</span>
</div><div id="l3131" class="code_block"><span class="nb">          </span><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l3132" class="code_block"><span class="nb">    </span><span class="nv">\item</span><span class="nb"> If {</span><span class="nv">\tt</span><span class="nb"> Term} is initially uninstantiated, then at least</span>
</div><div id="l3133" class="code_block"><span class="nb">          {</span><span class="nv">\tt</span><span class="nb"> Arity} must be instantiated, and</span>
</div><div id="l3134" class="code_block"><span class="nb">          </span><span class="nv">\begin</span><span class="nb">{itemize}</span>
</div><div id="l3135" class="code_block"><span class="nb">          </span><span class="nv">\item</span><span class="nb"> If {</span><span class="nv">\tt</span><span class="nb"> Arity} is an integer in the range </span><span class="m">1</span><span class="nb">..</span><span class="m">255</span><span class="nb">, then</span>
</div><div id="l3136" class="code_block"><span class="nb">                {</span><span class="nv">\tt</span><span class="nb"> Term} becomes instantiated to {</span><span class="nv">\em</span><span class="nb"> the most general </span>
</div><div id="l3137" class="code_block"><span class="nb">                Prolog or HiLog term} having the specified {</span><span class="nv">\tt</span><span class="nb"> F} and </span>
</div><div id="l3138" class="code_block"><span class="nb">                {</span><span class="nv">\tt</span><span class="nb"> Arity} as name and number of arguments {</span><span class="nv">\tt</span><span class="nb"> F} is </span>
</div><div id="l3139" class="code_block"><span class="nb">                applied to, respectively. The variables appearing as </span>
</div><div id="l3140" class="code_block"><span class="nb">                arguments are all unique.</span>
</div><div id="l3141" class="code_block"><span class="nb">          </span><span class="nv">\item</span><span class="nb"> If {</span><span class="nv">\tt</span><span class="nb"> Arity} is </span><span class="m">0</span><span class="nb">, then {</span><span class="nv">\tt</span><span class="nb"> F} must be a Prolog or</span>
</div><div id="l3142" class="code_block"><span class="nb">                HiLog constant, and it is unified with {</span><span class="nv">\tt</span><span class="nb"> Term}</span><span class="nv">\@</span><span class="nb">. Note</span>
</div><div id="l3143" class="code_block"><span class="nb">                that in this case {</span><span class="nv">\tt</span><span class="nb"> F} cannot be a compound term.</span>
</div><div id="l3144" class="code_block"><span class="nb">          </span><span class="nv">\item</span><span class="nb"> If {</span><span class="nv">\tt</span><span class="nb"> Arity} is anything else, then {</span><span class="nv">\tt</span><span class="nb"> hilog</span><span class="nv">\_</span><span class="nb">functor</span><span class="o">/</span><span class="m">3</span><span class="nb">}</span>
</div><div id="l3145" class="code_block"><span class="nb">                aborts.</span>
</div><div id="l3146" class="code_block"><span class="nb">          </span><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l3147" class="code_block"><span class="nb">    </span><span class="nv">\end</span><span class="nb">{enumerate}</span>
</div><div id="l3148" class="code_block"><span class="nb">    In other words, the standard predicate {</span><span class="nv">\tt</span><span class="nb"> hilog</span><span class="nv">\_</span><span class="nb">functor</span><span class="o">/</span><span class="m">3</span><span class="nb">} either</span>
</div><div id="l3149" class="code_block"><span class="nb">    decomposes a given HiLog term into its {</span><span class="nv">\em</span><span class="nb"> name} and {</span><span class="nv">\em</span><span class="nb"> arity}, or</span>
</div><div id="l3150" class="code_block"><span class="nb">    given an arity </span><span class="o">---</span><span class="nb">and possibly a name</span><span class="o">---</span><span class="nb"> constructs the corresponding </span>
</div><div id="l3151" class="code_block"><span class="nb">    HiLog term creating new uninstantiated variables for its arguments. </span>
</div><div id="l3152" class="code_block"><span class="nb">    As happens with {</span><span class="nv">\tt</span><span class="nb"> functor</span><span class="o">/</span><span class="m">3</span><span class="nb">} all constants can be their own </span>
</div><div id="l3153" class="code_block"><span class="nb">    principal function symbols.</span>
</div><div id="l3154" class="code_block">
</div><div id="l3155" class="code_block"><span class="nb">    Examples:</span>
</div><div id="l3156" class="code_block"><span class="nb">    {</span><span class="nv">\footnotesize</span>
</div><div id="l3157" class="code_block"><span class="nb">     </span><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l3158" class="code_block"><span class="nb">               | ?</span><span class="o">-</span><span class="nb"> hilog_functor</span><span class="o">(</span><span class="nb">f</span><span class="o">(</span><span class="nb">a,b,c</span><span class="o">)</span><span class="nb">, F, A</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3159" class="code_block"><span class="nb">               F </span><span class="o">=</span><span class="nb"> f</span>
</div><div id="l3160" class="code_block"><span class="nb">               A </span><span class="o">=</span><span class="nb"> </span><span class="m">3</span>
</div><div id="l3161" class="code_block">
</div><div id="l3162" class="code_block"><span class="nb">               | ?</span><span class="o">-</span><span class="nb"> hilog_functor</span><span class="o">(</span><span class="nb">X</span><span class="o">(</span><span class="nb">a,b,c</span><span class="o">)</span><span class="nb">, F, A</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3163" class="code_block"><span class="nb">               X </span><span class="o">=</span><span class="nb"> _</span><span class="m">595836</span>
</div><div id="l3164" class="code_block"><span class="nb">               F </span><span class="o">=</span><span class="nb"> _</span><span class="m">595836</span>
</div><div id="l3165" class="code_block"><span class="nb">               A </span><span class="o">=</span><span class="nb"> </span><span class="m">3</span>
</div><div id="l3166" class="code_block">
</div><div id="l3167" class="code_block"><span class="nb">               | ?</span><span class="o">-</span><span class="nb"> hilog_functor</span><span class="o">(</span><span class="nb">map</span><span class="o">(</span><span class="nb">P</span><span class="o">)(</span><span class="nb">a,b</span><span class="o">)</span><span class="nb">, F, A</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3168" class="code_block"><span class="nb">               P </span><span class="o">=</span><span class="nb"> _</span><span class="m">595828</span>
</div><div id="l3169" class="code_block"><span class="nb">               F </span><span class="o">=</span><span class="nb"> map</span><span class="o">(</span><span class="nb">_</span><span class="m">595828</span><span class="o">)</span>
</div><div id="l3170" class="code_block"><span class="nb">               A </span><span class="o">=</span><span class="nb"> </span><span class="m">2</span>
</div><div id="l3171" class="code_block">
</div><div id="l3172" class="code_block"><span class="nb">               | ?</span><span class="o">-</span><span class="nb"> hilog_functor</span><span class="o">(</span><span class="nb">T, p, </span><span class="m">2</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3173" class="code_block"><span class="nb">               T </span><span class="o">=</span><span class="nb"> p</span><span class="o">(</span><span class="nb">_</span><span class="m">595708</span><span class="nb">,_</span><span class="m">595712</span><span class="o">)</span>
</div><div id="l3174" class="code_block">
</div><div id="l3175" class="code_block"><span class="nb">               | ?</span><span class="o">-</span><span class="nb"> hilog_functor</span><span class="o">(</span><span class="nb">T, h, </span><span class="m">2</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3176" class="code_block"><span class="nb">               T </span><span class="o">=</span><span class="nb"> apply</span><span class="o">(</span><span class="nb">h,_</span><span class="m">595712</span><span class="nb">,_</span><span class="m">595716</span><span class="o">)</span>
</div><div id="l3177" class="code_block">
</div><div id="l3178" class="code_block"><span class="nb">               | ?</span><span class="o">-</span><span class="nb"> hilog_functor</span><span class="o">(</span><span class="nb">T, X, </span><span class="m">3</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3179" class="code_block"><span class="nb">               T </span><span class="o">=</span><span class="nb"> apply</span><span class="o">(</span><span class="nb">_</span><span class="m">595592</span><span class="nb">,_</span><span class="m">595736</span><span class="nb">,_</span><span class="m">595740</span><span class="nb">,_</span><span class="m">595744</span><span class="o">)</span>
</div><div id="l3180" class="code_block"><span class="nb">               X </span><span class="o">=</span><span class="nb"> _</span><span class="m">595592</span>
</div><div id="l3181" class="code_block">
</div><div id="l3182" class="code_block"><span class="nb">               | ?</span><span class="o">-</span><span class="nb"> hilog_functor</span><span class="o">(</span><span class="nb">T, p</span><span class="o">(</span><span class="nb">f</span><span class="o">(</span><span class="nb">a</span><span class="o">))</span><span class="nb">, </span><span class="m">2</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3183" class="code_block"><span class="nb">               T </span><span class="o">=</span><span class="nb"> apply</span><span class="o">(</span><span class="nb">p</span><span class="o">(</span><span class="nb">f</span><span class="o">(</span><span class="nb">a</span><span class="o">))</span><span class="nb">,_</span><span class="m">595792</span><span class="nb">,_</span><span class="m">595796</span><span class="o">)</span>
</div><div id="l3184" class="code_block">
</div><div id="l3185" class="code_block"><span class="nb">               | ?</span><span class="o">-</span><span class="nb"> hilog_functor</span><span class="o">(</span><span class="nb">T, h</span><span class="o">(</span><span class="nb">p</span><span class="o">(</span><span class="nb">a</span><span class="o">))(</span><span class="nb">L</span><span class="m">1</span><span class="nb">,L</span><span class="m">2</span><span class="o">)</span><span class="nb">, </span><span class="m">1</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3186" class="code_block"><span class="nb">               T </span><span class="o">=</span><span class="nb"> apply</span><span class="o">(</span><span class="nb">apply</span><span class="o">(</span><span class="nb">apply</span><span class="o">(</span><span class="nb">h,p</span><span class="o">(</span><span class="nb">a</span><span class="o">))</span><span class="nb">,_</span><span class="m">595984</span><span class="nb">,_</span><span class="m">595776</span><span class="o">)</span><span class="nb">,_</span><span class="m">596128</span><span class="o">)</span>
</div><div id="l3187" class="code_block"><span class="nb">               L</span><span class="m">1</span><span class="nb"> </span><span class="o">=</span><span class="nb"> _</span><span class="m">595984</span>
</div><div id="l3188" class="code_block"><span class="nb">               L</span><span class="m">2</span><span class="nb"> </span><span class="o">=</span><span class="nb"> _</span><span class="m">595776</span>
</div><div id="l3189" class="code_block">
</div><div id="l3190" class="code_block"><span class="nb">               | ?</span><span class="o">-</span><span class="nb"> hilog_functor</span><span class="o">(</span><span class="nb">T, a</span><span class="o">+</span><span class="nb">b, </span><span class="m">3</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3191" class="code_block"><span class="nb">               T </span><span class="o">=</span><span class="nb"> apply</span><span class="o">(</span><span class="nb">a</span><span class="o">+</span><span class="nb">b,_</span><span class="m">595820</span><span class="nb">,_</span><span class="m">595824</span><span class="nb">,_</span><span class="m">595828</span><span class="o">)</span>
</div><div id="l3192" class="code_block"><span class="nb">     </span><span class="nv">\end</span><span class="nb">{verbatim}}</span>
</div><div id="l3193" class="code_block">
</div><div id="l3194" class="code_block"><span class="nv">\isoitem</span><span class="nb">{arg</span><span class="o">(+</span><span class="nb">Index, </span><span class="o">+</span><span class="nb">Term, ?Argument</span><span class="o">)</span><span class="nb">}{arg</span><span class="o">/</span><span class="m">3</span><span class="nb">} </span>
</div><div id="l3195" class="code_block"><span class="c">%</span>
</div><div id="l3196" class="code_block"><span class="nb">  Unifies {</span><span class="nv">\tt</span><span class="nb"> Argument} with the </span><span class="s">$</span><span class="nb">{</span><span class="k">\tt</span> Index<span class="nb">}^{</span>th<span class="nb">}</span><span class="s">$</span><span class="nb"> argument of {</span><span class="nv">\tt</span>
</div><div id="l3197" class="code_block"><span class="nb">    Term}</span><span class="nv">\@</span><span class="nb">, where the index is taken to start at </span><span class="s">$</span>1<span class="s">$</span><span class="nb">.  In accordance</span>
</div><div id="l3198" class="code_block"><span class="nb">  with ISO semantics, {</span><span class="nv">\tt</span><span class="nb"> Index} must be instantiated to a</span>
</div><div id="l3199" class="code_block"><span class="nb">  non</span><span class="o">-</span><span class="nb">negative integer, and {</span><span class="nv">\tt</span><span class="nb"> Term} to a compound term, otherwise</span>
</div><div id="l3200" class="code_block"><span class="nb">  an error is thrown as described below.  If {</span><span class="nv">\tt</span><span class="nb"> Index} is {</span><span class="nv">\tt</span><span class="nb"> </span><span class="m">0</span><span class="nb">} or</span>
</div><div id="l3201" class="code_block"><span class="nb">  a number greater than the arity of {</span><span class="nv">\tt</span><span class="nb"> Term}, the predicate quietly</span>
</div><div id="l3202" class="code_block"><span class="nb">  fails.</span>
</div><div id="l3203" class="code_block">
</div><div id="l3204" class="code_block"><span class="nb">    Examples:</span>
</div><div id="l3205" class="code_block"><span class="nb">    {</span><span class="nv">\footnotesize</span>
</div><div id="l3206" class="code_block"><span class="nb">     </span><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l3207" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> arg</span><span class="o">(</span><span class="m">2</span><span class="nb">, p</span><span class="o">(</span><span class="nb">a,b</span><span class="o">)</span><span class="nb">, A</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3208" class="code_block"><span class="nb">                   A </span><span class="o">=</span><span class="nb"> b</span>
</div><div id="l3209" class="code_block">
</div><div id="l3210" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> arg</span><span class="o">(</span><span class="m">2</span><span class="nb">, h</span><span class="o">(</span><span class="nb">a,b</span><span class="o">)</span><span class="nb">, A</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3211" class="code_block"><span class="nb">                   A </span><span class="o">=</span><span class="nb"> a</span>
</div><div id="l3212" class="code_block">
</div><div id="l3213" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> arg</span><span class="o">(</span><span class="m">0</span><span class="nb">, foo, A</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3214" class="code_block"><span class="nb">                   no</span>
</div><div id="l3215" class="code_block">
</div><div id="l3216" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> arg</span><span class="o">(</span><span class="m">2</span><span class="nb">, </span><span class="o">[</span><span class="nb">a,b,c</span><span class="o">]</span><span class="nb">, A</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3217" class="code_block"><span class="nb">                   A </span><span class="o">=</span><span class="nb"> </span><span class="o">[</span><span class="nb">b,c</span><span class="o">]</span>
</div><div id="l3218" class="code_block">
</div><div id="l3219" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> arg</span><span class="o">(</span><span class="m">2</span><span class="nb">, &quot;HiLog&quot;, A</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3220" class="code_block"><span class="nb">                   A </span><span class="o">=</span><span class="nb"> </span><span class="o">[</span><span class="m">105</span><span class="nb">,</span><span class="m">108</span><span class="nb">,</span><span class="m">111</span><span class="nb">,</span><span class="m">103</span><span class="o">]</span>
</div><div id="l3221" class="code_block">
</div><div id="l3222" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> arg</span><span class="o">(</span><span class="m">2</span><span class="nb">, a</span><span class="o">+</span><span class="nb">b</span><span class="o">+</span><span class="nb">c, A</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3223" class="code_block"><span class="nb">                   A </span><span class="o">=</span><span class="nb"> c</span>
</div><div id="l3224" class="code_block">
</div><div id="l3225" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> arg</span><span class="o">(</span><span class="m">3</span><span class="nb">, X</span><span class="o">(</span><span class="nb">a,b,c</span><span class="o">)</span><span class="nb">, A</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3226" class="code_block"><span class="nb">                   X </span><span class="o">=</span><span class="nb"> _</span><span class="m">595820</span><span class="nb"> </span>
</div><div id="l3227" class="code_block"><span class="nb">                   A </span><span class="o">=</span><span class="nb"> b </span>
</div><div id="l3228" class="code_block">
</div><div id="l3229" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> arg</span><span class="o">(</span><span class="m">2</span><span class="nb">, map</span><span class="o">(</span><span class="nb">f</span><span class="o">)(</span><span class="nb">a,b</span><span class="o">)</span><span class="nb">, A</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3230" class="code_block"><span class="nb">                   A </span><span class="o">=</span><span class="nb"> a</span>
</div><div id="l3231" class="code_block">
</div><div id="l3232" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> arg</span><span class="o">(</span><span class="m">1</span><span class="nb">, map</span><span class="o">(</span><span class="nb">f</span><span class="o">)(</span><span class="nb">a,b</span><span class="o">)</span><span class="nb">, A</span><span class="o">)</span><span class="nb">. </span>
</div><div id="l3233" class="code_block"><span class="nb">                   A </span><span class="o">=</span><span class="nb"> map</span><span class="o">(</span><span class="nb">f</span><span class="o">)</span>
</div><div id="l3234" class="code_block">
</div><div id="l3235" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> arg</span><span class="o">(</span><span class="m">1</span><span class="nb">, </span><span class="o">(</span><span class="nb">a</span><span class="o">+</span><span class="nb">b</span><span class="o">)(</span><span class="nb">foo,bar</span><span class="o">)</span><span class="nb">, A</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3236" class="code_block"><span class="nb">                   A </span><span class="o">=</span><span class="nb"> a</span><span class="o">+</span><span class="nb">b</span>
</div><div id="l3237" class="code_block"><span class="nb">     </span><span class="nv">\end</span><span class="nb">{verbatim}}</span>
</div><div id="l3238" class="code_block">
</div><div id="l3239" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Error Cases} </span>
</div><div id="l3240" class="code_block"><span class="nv">\bi</span>
</div><div id="l3241" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Index} is a variable</span>
</div><div id="l3242" class="code_block"><span class="nv">\bi</span>
</div><div id="l3243" class="code_block"><span class="nv">\item</span><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> instantiation</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l3244" class="code_block"><span class="nv">\ei</span>
</div><div id="l3245" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Index} neither a variable nor an integer</span>
</div><div id="l3246" class="code_block"><span class="nv">\bi</span>
</div><div id="l3247" class="code_block"><span class="nv">\item</span><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">integer,Index</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3248" class="code_block"><span class="nv">\ei</span>
</div><div id="l3249" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Index} is less than </span><span class="m">0</span>
</div><div id="l3250" class="code_block"><span class="nv">\bi</span>
</div><div id="l3251" class="code_block"><span class="nv">\item</span><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> domain</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">not</span><span class="nv">\_</span><span class="nb">less</span><span class="nv">\_</span><span class="nb">than</span><span class="nv">\_</span><span class="nb">zero,Index</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3252" class="code_block"><span class="nv">\ei</span>
</div><div id="l3253" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Term} is a variable</span>
</div><div id="l3254" class="code_block"><span class="nv">\bi</span>
</div><div id="l3255" class="code_block"><span class="nv">\item</span><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> instantiation</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l3256" class="code_block"><span class="nv">\ei</span>
</div><div id="l3257" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Term} neither a variable nor a compound term</span>
</div><div id="l3258" class="code_block"><span class="nv">\bi</span>
</div><div id="l3259" class="code_block"><span class="nv">\item</span><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">integer,Index</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3260" class="code_block"><span class="nv">\ei</span>
</div><div id="l3261" class="code_block"><span class="nv">\ei</span>
</div><div id="l3262" class="code_block">
</div><div id="l3263" class="code_block"><span class="nv">\standarditem</span><span class="nb">{arg</span><span class="m">0</span><span class="o">(+</span><span class="nb">Index, </span><span class="o">+</span><span class="nb">Term, ?Argument</span><span class="o">)</span><span class="nb">}{arg</span><span class="m">0</span><span class="o">/</span><span class="m">3</span><span class="nb">}</span>
</div><div id="l3264" class="code_block"><span class="nb">    Unifies {</span><span class="nv">\tt</span><span class="nb"> Argument} with the </span><span class="s">$</span><span class="nb">{</span><span class="k">\tt</span> Index<span class="nb">}^{</span>th<span class="nb">}</span><span class="s">$</span><span class="nb"> argument of {</span><span class="nv">\tt</span><span class="nb"> Term}</span>
</div><div id="l3265" class="code_block"><span class="nb">    if {</span><span class="nv">\tt</span><span class="nb"> Index} </span><span class="s">$</span>&gt;<span class="s">$</span><span class="nb"> </span><span class="m">0</span><span class="nb">, or with the functor of {</span><span class="nv">\tt</span><span class="nb"> Term} if {</span><span class="nv">\tt</span><span class="nb"> Index} </span><span class="o">=</span><span class="nb"> </span><span class="m">0</span><span class="nb">.</span>
</div><div id="l3266" class="code_block">
</div><div id="l3267" class="code_block"><span class="nv">\ourstandarditem</span><span class="nb">{hilog</span><span class="nv">\_</span><span class="nb">arg</span><span class="o">(+</span><span class="nb">Index, </span><span class="o">+</span><span class="nb">Term, ?Argument</span><span class="o">)</span><span class="nb">}{hilog</span><span class="nv">\_</span><span class="nb">arg</span><span class="o">/</span><span class="m">3</span><span class="nb">}{HiLog}</span>
</div><div id="l3268" class="code_block"><span class="nb">    If {</span><span class="nv">\tt</span><span class="nb"> Term} is a Prolog term, it has the same behaviour as {</span><span class="nv">\tt</span><span class="nb"> arg</span><span class="o">/</span><span class="m">3</span><span class="nb">},</span>
</div><div id="l3269" class="code_block"><span class="nb">    but if {</span><span class="nv">\tt</span><span class="nb"> Term} is a proper HiLog term, {</span><span class="nv">\tt</span><span class="nb"> hilog</span><span class="nv">\_</span><span class="nb">arg</span><span class="o">/</span><span class="m">3</span><span class="nb">} unifies </span>
</div><div id="l3270" class="code_block"><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> Argument} with the </span>
</div><div id="l3271" class="code_block"><span class="nb">    </span><span class="s">$</span>(<span class="nb">{</span><span class="k">\tt</span> Index<span class="nb">}</span>+1)<span class="nb">^{</span>th<span class="nb">}</span><span class="s">$</span><span class="nb"> argument of the Prolog representation of </span>
</div><div id="l3272" class="code_block"><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> Term}</span><span class="nv">\@</span><span class="nb">.  Semantically, {</span><span class="nv">\tt</span><span class="nb"> Argument} is the </span><span class="s">$</span><span class="nb">{</span><span class="k">\tt</span> Index<span class="nb">}^{</span>th<span class="nb">}</span><span class="s">$</span><span class="nb"> </span>
</div><div id="l3273" class="code_block"><span class="nb">    argument to which the {</span><span class="nv">\em</span><span class="nb"> HiLog functor} of {</span><span class="nv">\tt</span><span class="nb"> Term} is applied.</span>
</div><div id="l3274" class="code_block"><span class="nb">    The arguments of the {</span><span class="nv">\tt</span><span class="nb"> Term} are numbered from~</span><span class="m">1</span><span class="nb"> upwards. An atomic term </span>
</div><div id="l3275" class="code_block"><span class="nb">    is taken to have </span><span class="s">$</span>0<span class="s">$</span><span class="nb"> arguments.  </span>
</div><div id="l3276" class="code_block"><span class="nb">    </span>
</div><div id="l3277" class="code_block"><span class="nb">    Initially, {</span><span class="nv">\tt</span><span class="nb"> Index} must be instantiated to a positive integer and </span>
</div><div id="l3278" class="code_block"><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> Term} to any non</span><span class="o">-</span><span class="nb">variable Prolog or HiLog term.</span>
</div><div id="l3279" class="code_block"><span class="nb">    If the initial conditions are not satisfied or~</span><span class="s">$</span>I<span class="s">$</span><span class="nb"> is </span>
</div><div id="l3280" class="code_block"><span class="nb">    out of range, the call quietly fails. Note that like {</span><span class="nv">\tt</span><span class="nb"> arg</span><span class="o">/</span><span class="m">3</span><span class="nb">}</span>
</div><div id="l3281" class="code_block"><span class="nb">    this predicate does not succeed for {</span><span class="nv">\tt</span><span class="nb"> Index}</span><span class="o">=</span><span class="m">0</span><span class="nb">.</span>
</div><div id="l3282" class="code_block">
</div><div id="l3283" class="code_block"><span class="nb">    Examples:</span>
</div><div id="l3284" class="code_block"><span class="nb">    {</span><span class="nv">\footnotesize</span>
</div><div id="l3285" class="code_block"><span class="nb">     </span><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l3286" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> hilog_arg</span><span class="o">(</span><span class="m">2</span><span class="nb">, p</span><span class="o">(</span><span class="nb">a,b</span><span class="o">)</span><span class="nb">, A</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3287" class="code_block"><span class="nb">                   A </span><span class="o">=</span><span class="nb"> b</span>
</div><div id="l3288" class="code_block">
</div><div id="l3289" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> hilog_arg</span><span class="o">(</span><span class="m">2</span><span class="nb">, h</span><span class="o">(</span><span class="nb">a,b</span><span class="o">)</span><span class="nb">, A</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3290" class="code_block"><span class="nb">                   A </span><span class="o">=</span><span class="nb"> b</span>
</div><div id="l3291" class="code_block">
</div><div id="l3292" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> hilog_arg</span><span class="o">(</span><span class="m">3</span><span class="nb">, X</span><span class="o">(</span><span class="nb">a,b,c</span><span class="o">)</span><span class="nb">, A</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3293" class="code_block"><span class="nb">                   X </span><span class="o">=</span><span class="nb"> _</span><span class="m">595820</span>
</div><div id="l3294" class="code_block"><span class="nb">                   A </span><span class="o">=</span><span class="nb"> c</span>
</div><div id="l3295" class="code_block">
</div><div id="l3296" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> hilog_arg</span><span class="o">(</span><span class="m">1</span><span class="nb">, map</span><span class="o">(</span><span class="nb">f</span><span class="o">)(</span><span class="nb">a,b</span><span class="o">)</span><span class="nb">, A</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3297" class="code_block"><span class="nb">                   A </span><span class="o">=</span><span class="nb"> a</span>
</div><div id="l3298" class="code_block">
</div><div id="l3299" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> hilog_arg</span><span class="o">(</span><span class="m">2</span><span class="nb">, map</span><span class="o">(</span><span class="nb">f</span><span class="o">)(</span><span class="nb">a,b</span><span class="o">)</span><span class="nb">, A</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3300" class="code_block"><span class="nb">                   A </span><span class="o">=</span><span class="nb"> b</span>
</div><div id="l3301" class="code_block">
</div><div id="l3302" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> hilog_arg</span><span class="o">(</span><span class="m">1</span><span class="nb">, </span><span class="o">(</span><span class="nb">a</span><span class="o">+</span><span class="nb">b</span><span class="o">)(</span><span class="nb">foo,bar</span><span class="o">)</span><span class="nb">, A</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3303" class="code_block"><span class="nb">                   A </span><span class="o">=</span><span class="nb"> foo</span>
</div><div id="l3304" class="code_block">
</div><div id="l3305" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> hilog_arg</span><span class="o">(</span><span class="m">1</span><span class="nb">, apply</span><span class="o">(</span><span class="nb">foo</span><span class="o">)</span><span class="nb">, A</span><span class="o">)</span><span class="nb">. </span>
</div><div id="l3306" class="code_block"><span class="nb">                   A </span><span class="o">=</span><span class="nb"> foo</span>
</div><div id="l3307" class="code_block">
</div><div id="l3308" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> hilog_arg</span><span class="o">(</span><span class="m">1</span><span class="nb">, apply</span><span class="o">(</span><span class="nb">foo,bar</span><span class="o">)</span><span class="nb">, A</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3309" class="code_block"><span class="nb">                   A </span><span class="o">=</span><span class="nb"> bar</span>
</div><div id="l3310" class="code_block"><span class="nb">     </span><span class="nv">\end</span><span class="nb">{verbatim}}</span>
</div><div id="l3311" class="code_block">
</div><div id="l3312" class="code_block"><span class="nb">    Note the difference between the last two examples. The difference is </span>
</div><div id="l3313" class="code_block"><span class="nb">    due to the fact that {</span><span class="nv">\tt</span><span class="nb"> apply</span><span class="o">/</span><span class="m">1</span><span class="nb">} is a Prolog term, while </span>
</div><div id="l3314" class="code_block"><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> apply</span><span class="o">/</span><span class="m">2</span><span class="nb">} is a proper HiLog term.</span>
</div><div id="l3315" class="code_block">
</div><div id="l3316" class="code_block"><span class="nv">\isoitem</span><span class="nb">{?Term </span><span class="o">=</span><span class="nb">.. ?List}{</span><span class="o">=</span><span class="nb">..</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l3317" class="code_block"><span class="c">%</span>
</div><div id="l3318" class="code_block"><span class="nb">Given proper instantiation of the arguments, {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">=</span><span class="nb">..</span><span class="o">/</span><span class="m">2</span><span class="nb">} </span><span class="o">(</span><span class="nb">pronounced</span>
</div><div id="l3319" class="code_block"><span class="nb">{</span><span class="nv">\em</span><span class="nb"> univ}</span><span class="o">)</span><span class="nb"> succeeds when </span><span class="o">(</span><span class="m">1</span><span class="o">)</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Term} unifies with a compound</span>
</div><div id="l3320" class="code_block"><span class="nb">Prolog or HiLog term and {</span><span class="nv">\tt</span><span class="nb"> List} unifies with a list whose head is</span>
</div><div id="l3321" class="code_block"><span class="nb">the functor of {</span><span class="nv">\tt</span><span class="nb"> Term} and whose tail is a list of the arguments of</span>
</div><div id="l3322" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> Term}; or </span><span class="o">(</span><span class="m">2</span><span class="o">)</span><span class="nb"> when {</span><span class="nv">\tt</span><span class="nb"> Term} unifies with an atomic term and</span>
</div><div id="l3323" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> List} unifies with a list whose only element is {</span><span class="nv">\tt</span><span class="nb"> Term}.  More</span>
</div><div id="l3324" class="code_block"><span class="nb">precisely,</span>
</div><div id="l3325" class="code_block"><span class="nb">    </span><span class="nv">\begin</span><span class="nb">{itemize}</span>
</div><div id="l3326" class="code_block"><span class="nb">    </span><span class="nv">\item</span><span class="nb"> If initially {</span><span class="nv">\tt</span><span class="nb"> Term} is uninstantiated, then {</span><span class="nv">\tt</span><span class="nb"> List}</span>
</div><div id="l3327" class="code_block"><span class="nb">      must be instantiated either to a {</span><span class="nv">\em</span><span class="nb"> proper list} </span><span class="o">(</span><span class="nb">list of</span>
</div><div id="l3328" class="code_block"><span class="nb">      determinate length</span><span class="o">)</span><span class="nb"> whose head is an atom, or to a list of</span>
</div><div id="l3329" class="code_block"><span class="nb">      length </span><span class="m">1</span><span class="nb"> whose head is a number.</span>
</div><div id="l3330" class="code_block"><span class="nb">    </span><span class="nv">\item</span><span class="nb"> If the arguments of {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">=</span><span class="nb">..</span><span class="o">/</span><span class="m">2</span><span class="nb">} are both uninstantiated, or</span>
</div><div id="l3331" class="code_block"><span class="nb">      if either of them is not what is expected, {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">=</span><span class="nb">..</span><span class="o">/</span><span class="m">2</span><span class="nb">} throws</span>
</div><div id="l3332" class="code_block"><span class="nb">      the appropriate error message.</span>
</div><div id="l3333" class="code_block"><span class="nb">    </span><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l3334" class="code_block">
</div><div id="l3335" class="code_block"><span class="nb">    Examples:</span>
</div><div id="l3336" class="code_block"><span class="nb">    {</span><span class="nv">\footnotesize</span>
</div><div id="l3337" class="code_block"><span class="nb">     </span><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l3338" class="code_block"><span class="nb">           | ?</span><span class="o">-</span><span class="nb"> X </span><span class="o">-</span><span class="nb"> </span><span class="m">1</span><span class="nb"> </span><span class="o">=</span><span class="nb">.. L.</span>
</div><div id="l3339" class="code_block"><span class="nb">           X </span><span class="o">=</span><span class="nb"> _h</span><span class="m">112</span>
</div><div id="l3340" class="code_block"><span class="nb">           L </span><span class="o">=</span><span class="nb"> </span><span class="o">[-</span><span class="nb">,_h</span><span class="m">112</span><span class="nb">,</span><span class="m">1</span><span class="o">]</span>
</div><div id="l3341" class="code_block">
</div><div id="l3342" class="code_block"><span class="nb">           | ?</span><span class="o">-</span><span class="nb"> p</span><span class="o">(</span><span class="nb">a,b,c</span><span class="o">)</span><span class="nb"> </span><span class="o">=</span><span class="nb">.. L.</span>
</div><div id="l3343" class="code_block"><span class="nb">           L </span><span class="o">=</span><span class="nb"> </span><span class="o">[</span><span class="nb">p,a,b,c</span><span class="o">]</span>
</div><div id="l3344" class="code_block">
</div><div id="l3345" class="code_block"><span class="nb">           | ?</span><span class="o">-</span><span class="nb"> h</span><span class="o">(</span><span class="nb">a,b,c</span><span class="o">)</span><span class="nb"> </span><span class="o">=</span><span class="nb">.. L.</span>
</div><div id="l3346" class="code_block"><span class="nb">           L </span><span class="o">=</span><span class="nb"> </span><span class="o">[</span><span class="nb">apply,h,a,b,c</span><span class="o">]</span>
</div><div id="l3347" class="code_block">
</div><div id="l3348" class="code_block"><span class="nb">           | ?</span><span class="o">-</span><span class="nb"> map</span><span class="o">(</span><span class="nb">p</span><span class="o">)(</span><span class="nb">a,b</span><span class="o">)</span><span class="nb"> </span><span class="o">=</span><span class="nb">.. L.</span>
</div><div id="l3349" class="code_block"><span class="nb">           L </span><span class="o">=</span><span class="nb"> </span><span class="o">[</span><span class="nb">apply,map</span><span class="o">(</span><span class="nb">p</span><span class="o">)</span><span class="nb">,a,b</span><span class="o">]</span>
</div><div id="l3350" class="code_block">
</div><div id="l3351" class="code_block"><span class="nb">           | ?</span><span class="o">-</span><span class="nb"> T </span><span class="o">=</span><span class="nb">.. </span><span class="o">[</span><span class="nb">foo</span><span class="o">]</span><span class="nb">.</span>
</div><div id="l3352" class="code_block"><span class="nb">           T </span><span class="o">=</span><span class="nb"> foo</span>
</div><div id="l3353" class="code_block">
</div><div id="l3354" class="code_block"><span class="nb">           | ?</span><span class="o">-</span><span class="nb"> T </span><span class="o">=</span><span class="nb">.. </span><span class="o">[</span><span class="nb">apply,X,a,b</span><span class="o">]</span><span class="nb">.</span>
</div><div id="l3355" class="code_block"><span class="nb">           T </span><span class="o">=</span><span class="nb"> apply</span><span class="o">(</span><span class="nb">X,a,b</span><span class="o">)</span>
</div><div id="l3356" class="code_block">
</div><div id="l3357" class="code_block"><span class="nb">           | ?</span><span class="o">-</span><span class="nb"> T </span><span class="o">=</span><span class="nb">.. </span><span class="o">[</span><span class="m">1</span><span class="nb">,</span><span class="m">2</span><span class="o">]</span><span class="nb">.</span>
</div><div id="l3358" class="code_block"><span class="nb">           </span><span class="o">++</span><span class="nb">Error</span><span class="o">[</span><span class="nb">XSB</span><span class="o">/</span><span class="nb">Runtime</span><span class="o">/</span><span class="nb">P</span><span class="o">]</span><span class="nb">: </span><span class="o">[</span><span class="nb">Type </span><span class="o">(</span><span class="m">1</span><span class="nb"> in place of atomic</span><span class="o">)]</span><span class="nb"> in arg </span><span class="m">2</span><span class="nb"> of predicate </span><span class="o">=</span><span class="nb">..</span><span class="o">/</span><span class="m">2</span>
</div><div id="l3359" class="code_block">
</div><div id="l3360" class="code_block"><span class="nb">           | ?</span><span class="o">-</span><span class="nb"> T </span><span class="o">=</span><span class="nb">.. </span><span class="o">[</span><span class="nb">a</span><span class="o">+</span><span class="nb">b,</span><span class="m">2</span><span class="o">]</span><span class="nb">.</span>
</div><div id="l3361" class="code_block"><span class="nb">           </span><span class="o">++</span><span class="nb">Error</span><span class="o">[</span><span class="nb">XSB</span><span class="o">/</span><span class="nb">Runtime</span><span class="o">/</span><span class="nb">P</span><span class="o">]</span><span class="nb">: </span><span class="o">[</span><span class="nb">Type </span><span class="o">(</span><span class="nb">a </span><span class="o">+</span><span class="nb"> b in place of atomic</span><span class="o">)]</span><span class="nb"> in arg </span><span class="m">2</span><span class="nb"> of predicate </span><span class="o">=</span><span class="nb">..</span><span class="o">/</span><span class="m">2</span>
</div><div id="l3362" class="code_block">
</div><div id="l3363" class="code_block"><span class="nb">           | ?</span><span class="o">-</span><span class="nb"> X </span><span class="o">=</span><span class="nb">.. </span><span class="o">[</span><span class="nb">foo|Y</span><span class="o">]</span><span class="nb">.</span>
</div><div id="l3364" class="code_block"><span class="nb">           </span><span class="o">++</span><span class="nb">Error</span><span class="o">[</span><span class="nb">XSB</span><span class="o">/</span><span class="nb">Runtime</span><span class="o">/</span><span class="nb">P</span><span class="o">]</span><span class="nb">: </span><span class="o">[</span><span class="nb">Instantiation</span><span class="o">]</span><span class="nb">  in arg </span><span class="m">2</span><span class="nb"> of predicate </span><span class="o">=</span><span class="nb">..</span><span class="o">/</span><span class="m">2</span>
</div><div id="l3365" class="code_block"><span class="nb">     </span><span class="nv">\end</span><span class="nb">{verbatim}}</span>
</div><div id="l3366" class="code_block">
</div><div id="l3367" class="code_block"><span class="c">% Not ISO compliant in that X =.. [] should give domain error -- not</span>
</div><div id="l3368" class="code_block"><span class="c">% a big deal </span>
</div><div id="l3369" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Error Cases}</span>
</div><div id="l3370" class="code_block"><span class="nv">\begin</span><span class="nb">{itemize}</span>
</div><div id="l3371" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Term} is a variable and {</span><span class="nv">\tt</span><span class="nb"> List} is a variable, a partial list,</span>
</div><div id="l3372" class="code_block"><span class="nb">  or a list whose head is a variable</span>
</div><div id="l3373" class="code_block"><span class="nv">\bi</span>
</div><div id="l3374" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> instantiation</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l3375" class="code_block"><span class="nv">\ei</span>
</div><div id="l3376" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> List} is neither a variable nor a non</span><span class="o">-</span><span class="nb">empty list</span>
</div><div id="l3377" class="code_block"><span class="nv">\bi</span>
</div><div id="l3378" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">list, H</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3379" class="code_block"><span class="nv">\ei</span>
</div><div id="l3380" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> List} is a list whose head {</span><span class="nv">\tt</span><span class="nb"> H} is neither an atom nor a</span>
</div><div id="l3381" class="code_block"><span class="nb">  variable, and whose tail is not the empty list </span>
</div><div id="l3382" class="code_block"><span class="nv">\bi</span>
</div><div id="l3383" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">atomic, H</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3384" class="code_block"><span class="nv">\ei</span>
</div><div id="l3385" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Term} is a variable and the tail of {</span><span class="nv">\tt</span><span class="nb"> List} has a length</span>
</div><div id="l3386" class="code_block"><span class="nb">  greater than XSB&#39;s maximum arity for terms </span><span class="o">(</span><span class="m">256</span><span class="o">)</span><span class="nb"> </span>
</div><div id="l3387" class="code_block"><span class="nv">\bi</span>
</div><div id="l3388" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> representation</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">max</span><span class="nv">\_</span><span class="nb">arity</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3389" class="code_block"><span class="nv">\ei</span>
</div><div id="l3390" class="code_block"><span class="nv">\ei</span>
</div><div id="l3391" class="code_block">
</div><div id="l3392" class="code_block"><span class="c">%in the following line I used a very ``dirty&#39;&#39; LaTeX hack! -- Kostis.</span>
</div><div id="l3393" class="code_block">
</div><div id="l3394" class="code_block"><span class="nv">\standarditem</span><span class="nb">{?Term </span><span class="nv">\^</span><span class="nb">{ }</span><span class="o">=</span><span class="nb">.. </span><span class="o">[</span><span class="nb">?F |?ArgList</span><span class="o">]</span><span class="nb">}{</span><span class="nv">\^</span><span class="nb">{ }</span><span class="o">=</span><span class="nb">..</span><span class="o">/</span><span class="m">2</span><span class="nb">}{HiLog}</span>
</div><div id="l3395" class="code_block"><span class="nb">    When {</span><span class="nv">\tt</span><span class="nb"> Term} is a Prolog term, this predicate behaves exactly like</span>
</div><div id="l3396" class="code_block"><span class="nb">    the Prolog {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">=</span><span class="nb">..</span><span class="o">/</span><span class="m">2</span><span class="nb">}. However when {</span><span class="nv">\tt</span><span class="nb"> Term} is a proper HiLog term, </span>
</div><div id="l3397" class="code_block"><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> </span><span class="nv">\verb</span><span class="nb">|^|</span><span class="o">=</span><span class="nb">..</span><span class="o">/</span><span class="m">2</span><span class="nb">} </span>
</div><div id="l3398" class="code_block"><span class="nb">    succeeds unifying {</span><span class="nv">\tt</span><span class="nb"> F} to its HiLog functor and {</span><span class="nv">\tt</span><span class="nb"> ArgList} to the </span>
</div><div id="l3399" class="code_block"><span class="nb">    list of the arguments to which this HiLog functor is applied. Like </span>
</div><div id="l3400" class="code_block"><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">=</span><span class="nb">..</span><span class="o">/</span><span class="m">2</span><span class="nb">}, the use of {</span><span class="nv">\tt</span><span class="nb"> </span><span class="nv">\verb</span><span class="nb">|^|</span><span class="o">=</span><span class="nb">..</span><span class="o">/</span><span class="m">2</span><span class="nb">} can nearly always be avoided</span>
</div><div id="l3401" class="code_block"><span class="nb">    by using the more efficient predicates {</span><span class="nv">\tt</span><span class="nb"> hilog</span><span class="nv">\_</span><span class="nb">functor</span><span class="o">/</span><span class="m">3</span><span class="nb">} and </span>
</div><div id="l3402" class="code_block"><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> hilog</span><span class="nv">\_</span><span class="nb">arg</span><span class="o">/</span><span class="m">3</span><span class="nb">}. The behaviour of {</span><span class="nv">\tt</span><span class="nb"> </span><span class="nv">\verb</span><span class="nb">|^|</span><span class="o">=</span><span class="nb">..</span><span class="o">/</span><span class="m">2</span><span class="nb">}, on HiLog terms </span>
</div><div id="l3403" class="code_block"><span class="nb">    is as follows:</span>
</div><div id="l3404" class="code_block"><span class="nb">    </span><span class="nv">\begin</span><span class="nb">{itemize}</span>
</div><div id="l3405" class="code_block"><span class="nb">    </span><span class="nv">\item</span><span class="nb"> If initially {</span><span class="nv">\tt</span><span class="nb"> Term} is uninstantiated, then the list in the </span>
</div><div id="l3406" class="code_block"><span class="nb">          second argument of {</span><span class="nv">\tt</span><span class="nb"> </span><span class="nv">\verb</span><span class="nb">|^|</span><span class="o">=</span><span class="nb">..</span><span class="o">/</span><span class="m">2</span><span class="nb">} must be instantiated to </span>
</div><div id="l3407" class="code_block"><span class="nb">          a {</span><span class="nv">\em</span><span class="nb"> proper list} </span><span class="o">(</span><span class="nb">list of determinate length</span><span class="o">)</span><span class="nb"> whose head can </span>
</div><div id="l3408" class="code_block"><span class="nb">          be any Prolog or HiLog term.</span>
</div><div id="l3409" class="code_block"><span class="nb">    </span><span class="nv">\item</span><span class="nb"> If the arguments of {</span><span class="nv">\tt</span><span class="nb"> </span><span class="nv">\verb</span><span class="nb">|^|</span><span class="o">=</span><span class="nb">..</span><span class="o">/</span><span class="m">2</span><span class="nb">} are both uninstantiated, </span>
</div><div id="l3410" class="code_block"><span class="nb">          or if the second of them is not what is expected, </span>
</div><div id="l3411" class="code_block"><span class="nb">          {</span><span class="nv">\tt</span><span class="nb"> </span><span class="nv">\verb</span><span class="nb">|^|</span><span class="o">=</span><span class="nb">..</span><span class="o">/</span><span class="m">2</span><span class="nb">} aborts, producing an appropriate error message.</span>
</div><div id="l3412" class="code_block"><span class="nb">    </span><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l3413" class="code_block"><span class="nb">    Examples:</span>
</div><div id="l3414" class="code_block"><span class="nb">    {</span><span class="nv">\footnotesize</span>
</div><div id="l3415" class="code_block"><span class="nb">     </span><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l3416" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> p</span><span class="o">(</span><span class="nb">a,b,c</span><span class="o">)</span><span class="nb"> ^</span><span class="o">=</span><span class="nb">.. L.</span>
</div><div id="l3417" class="code_block"><span class="nb">                   L </span><span class="o">=</span><span class="nb"> </span><span class="o">[</span><span class="nb">p,a,b,c</span><span class="o">]</span>
</div><div id="l3418" class="code_block">
</div><div id="l3419" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> h</span><span class="o">(</span><span class="nb">a,b,c</span><span class="o">)</span><span class="nb"> ^</span><span class="o">=</span><span class="nb">.. L.</span>
</div><div id="l3420" class="code_block"><span class="nb">                   L </span><span class="o">=</span><span class="nb"> </span><span class="o">[</span><span class="nb">h,a,b,c</span><span class="o">]</span>
</div><div id="l3421" class="code_block">
</div><div id="l3422" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> map</span><span class="o">(</span><span class="nb">p</span><span class="o">)(</span><span class="nb">a,b</span><span class="o">)</span><span class="nb"> ^</span><span class="o">=</span><span class="nb">.. L.</span>
</div><div id="l3423" class="code_block"><span class="nb">                   L </span><span class="o">=</span><span class="nb"> </span><span class="o">[</span><span class="nb">map</span><span class="o">(</span><span class="nb">p</span><span class="o">)</span><span class="nb">,a,b</span><span class="o">]</span>
</div><div id="l3424" class="code_block">
</div><div id="l3425" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> T ^</span><span class="o">=</span><span class="nb">.. </span><span class="o">[</span><span class="nb">X,a,b</span><span class="o">]</span><span class="nb">.</span>
</div><div id="l3426" class="code_block"><span class="nb">                   T </span><span class="o">=</span><span class="nb"> apply</span><span class="o">(</span><span class="nb">X,a,b</span><span class="o">)</span>
</div><div id="l3427" class="code_block">
</div><div id="l3428" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> T ^</span><span class="o">=</span><span class="nb">.. </span><span class="o">[</span><span class="m">2</span><span class="nb">,</span><span class="m">2</span><span class="o">]</span><span class="nb">.</span>
</div><div id="l3429" class="code_block"><span class="nb">                   T </span><span class="o">=</span><span class="nb"> apply</span><span class="o">(</span><span class="m">2</span><span class="nb">,</span><span class="m">2</span><span class="o">)</span>
</div><div id="l3430" class="code_block">
</div><div id="l3431" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> T ^</span><span class="o">=</span><span class="nb">.. </span><span class="o">[</span><span class="nb">a</span><span class="o">+</span><span class="nb">b,</span><span class="m">2</span><span class="o">]</span><span class="nb">.</span>
</div><div id="l3432" class="code_block"><span class="nb">                   T </span><span class="o">=</span><span class="nb"> apply</span><span class="o">(</span><span class="nb">a</span><span class="o">+</span><span class="nb">b,</span><span class="m">2</span><span class="o">)</span>
</div><div id="l3433" class="code_block">
</div><div id="l3434" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> T ^</span><span class="o">=</span><span class="nb">.. </span><span class="o">[</span><span class="m">3</span><span class="nb">|X</span><span class="o">]</span><span class="nb">.</span>
</div><div id="l3435" class="code_block"><span class="nb">                   </span><span class="o">++</span><span class="nb">Error: Argument </span><span class="m">2</span><span class="nb"> of ^</span><span class="o">=</span><span class="nb">..</span><span class="o">/</span><span class="m">2</span><span class="nb"> is not a proper list</span>
</div><div id="l3436" class="code_block"><span class="nb">                   Aborting...</span>
</div><div id="l3437" class="code_block"><span class="nb">     </span><span class="nv">\end</span><span class="nb">{verbatim}}</span>
</div><div id="l3438" class="code_block">
</div><div id="l3439" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Error Cases}</span>
</div><div id="l3440" class="code_block"><span class="nb">     </span><span class="nv">\begin</span><span class="nb">{description}</span>
</div><div id="l3441" class="code_block"><span class="nb">     </span><span class="nv">\item</span><span class="o">[</span><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> instantiation</span><span class="nv">\_</span><span class="nb">error}</span><span class="o">]</span>
</div><div id="l3442" class="code_block"><span class="nb">	Argument </span><span class="m">2</span><span class="nb"> of {</span><span class="nv">\tt</span><span class="nb"> </span><span class="nv">\verb</span><span class="nb">|^|</span><span class="o">=</span><span class="nb">..</span><span class="o">/</span><span class="m">2</span><span class="nb">} is not a proper list.</span>
</div><div id="l3443" class="code_block"><span class="nb">     </span><span class="nv">\end</span><span class="nb">{description}</span>
</div><div id="l3444" class="code_block">
</div><div id="l3445" class="code_block"><span class="nv">\isoitem</span><span class="nb">{copy</span><span class="nv">\_</span><span class="nb">term</span><span class="o">(+</span><span class="nb">Term, </span><span class="o">-</span><span class="nb">Copy</span><span class="o">)</span><span class="nb">}{copy</span><span class="nv">\_</span><span class="nb">term</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l3446" class="code_block"><span class="nb">    Makes a {</span><span class="nv">\tt</span><span class="nb"> Copy} of {</span><span class="nv">\tt</span><span class="nb"> Term} in which all variables have been</span>
</div><div id="l3447" class="code_block"><span class="nb">    replaced by brand new variables which occur nowhere else. It can</span>
</div><div id="l3448" class="code_block"><span class="nb">    be very handy when writing </span><span class="o">(</span><span class="nb">meta</span><span class="o">-)</span><span class="nb">interpreters for logic</span><span class="o">-</span><span class="nb">based</span>
</div><div id="l3449" class="code_block"><span class="nb">    languages.  The version of {</span><span class="nv">\tt</span><span class="nb"> copy</span><span class="nv">\_</span><span class="nb">term</span><span class="o">/</span><span class="m">2</span><span class="nb">} provided is {</span><span class="nv">\em</span><span class="nb"> space</span>
</div><div id="l3450" class="code_block"><span class="nb">    efficient} in the sense that it never copies ground terms. </span>
</div><div id="l3451" class="code_block"><span class="nb">    Predicate {</span><span class="nv">\tt</span><span class="nb"> copy</span><span class="nv">\_</span><span class="nb">term</span><span class="o">/</span><span class="m">2</span><span class="nb">} has no associated errors or exceptions.</span>
</div><div id="l3452" class="code_block">
</div><div id="l3453" class="code_block"><span class="nb">    Examples:</span>
</div><div id="l3454" class="code_block"><span class="nb">    {</span><span class="nv">\footnotesize</span>
</div><div id="l3455" class="code_block"><span class="nb">     </span><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l3456" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> copy_term</span><span class="o">(</span><span class="nb">X, Y</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3457" class="code_block">
</div><div id="l3458" class="code_block"><span class="nb">                   X </span><span class="o">=</span><span class="nb"> _</span><span class="m">598948</span>
</div><div id="l3459" class="code_block"><span class="nb">                   Y </span><span class="o">=</span><span class="nb"> _</span><span class="m">598904</span>
</div><div id="l3460" class="code_block">
</div><div id="l3461" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> copy_term</span><span class="o">(</span><span class="nb">f</span><span class="o">(</span><span class="nb">a,X</span><span class="o">)</span><span class="nb">, Y</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3462" class="code_block">
</div><div id="l3463" class="code_block"><span class="nb">                   X </span><span class="o">=</span><span class="nb"> _</span><span class="m">598892</span>
</div><div id="l3464" class="code_block"><span class="nb">                   Y </span><span class="o">=</span><span class="nb"> f</span><span class="o">(</span><span class="nb">a,_</span><span class="m">599112</span><span class="o">)</span>
</div><div id="l3465" class="code_block"><span class="nb">     </span><span class="nv">\end</span><span class="nb">{verbatim}}</span>
</div><div id="l3466" class="code_block">
</div><div id="l3467" class="code_block"><span class="nv">\end</span><span class="nb">{description}</span>
</div><div id="l3468" class="code_block">
</div><div id="l3469" class="code_block"><span class="c">%-----------------------------------------------------------------------------------------------</span>
</div><div id="l3470" class="code_block"><span class="nv">\section</span><span class="nb">{Manipulation of Atomic Terms}</span>
</div><div id="l3471" class="code_block">
</div><div id="l3472" class="code_block"><span class="nv">\begin</span><span class="nb">{description}</span>
</div><div id="l3473" class="code_block">
</div><div id="l3474" class="code_block"><span class="nv">\isoitem</span><span class="nb">{atom</span><span class="nv">\_</span><span class="nb">codes</span><span class="o">(</span><span class="nb">?Atom, ?CharCodeList</span><span class="o">)</span><span class="nb">}{atom</span><span class="nv">\_</span><span class="nb">codes</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l3475" class="code_block"><span class="nb">    The standard predicate {</span><span class="nv">\tt</span><span class="nb"> atom</span><span class="nv">\_</span><span class="nb">codes</span><span class="o">/</span><span class="m">2</span><span class="nb">} performs the conversion </span>
</div><div id="l3476" class="code_block"><span class="nb">    between an atom and its character list representation. </span>
</div><div id="l3477" class="code_block"><span class="nb">    If {</span><span class="nv">\tt</span><span class="nb"> Atom} is supplied </span><span class="o">(</span><span class="nb">and is an atom</span><span class="o">)</span><span class="nb">, {</span><span class="nv">\tt</span><span class="nb"> CharList} </span>
</div><div id="l3478" class="code_block"><span class="nb">    is unified with a list of ASCII codes representing the {</span><span class="nv">\em</span><span class="nb"> ``name&#39;&#39;} </span>
</div><div id="l3479" class="code_block"><span class="nb">    of that atom.  In that case, {</span><span class="nv">\tt</span><span class="nb"> CharList} is exactly the list of </span>
</div><div id="l3480" class="code_block"><span class="nb">    ASCII character codes that appear in the printed representation of </span>
</div><div id="l3481" class="code_block"><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> Atom}.  If on the other hand {</span><span class="nv">\tt</span><span class="nb"> Atom} is a variable, </span>
</div><div id="l3482" class="code_block"><span class="nb">    then {</span><span class="nv">\tt</span><span class="nb"> CharList} must be a proper list of ASCII character codes. </span>
</div><div id="l3483" class="code_block"><span class="nb">    In that case, {</span><span class="nv">\tt</span><span class="nb"> Atom} is instantiated to an atom containing</span>
</div><div id="l3484" class="code_block"><span class="nb">    exactly those characters, even if the characters look like the</span>
</div><div id="l3485" class="code_block"><span class="nb">    printed representation of a number.</span>
</div><div id="l3486" class="code_block">
</div><div id="l3487" class="code_block"><span class="nb">    Examples:</span>
</div><div id="l3488" class="code_block"><span class="nb">    {</span><span class="nv">\footnotesize</span>
</div><div id="l3489" class="code_block"><span class="nb">     </span><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l3490" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> atom_codes</span><span class="o">(</span><span class="nb">&#39;Foo&#39;, L</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3491" class="code_block"><span class="nb">                   L </span><span class="o">=</span><span class="nb"> </span><span class="o">[</span><span class="m">70</span><span class="nb">,</span><span class="m">111</span><span class="nb">,</span><span class="m">111</span><span class="o">]</span>
</div><div id="l3492" class="code_block">
</div><div id="l3493" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> atom_codes</span><span class="o">([]</span><span class="nb">, L</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3494" class="code_block"><span class="nb">                   L </span><span class="o">=</span><span class="nb"> </span><span class="o">[</span><span class="m">91</span><span class="nb">,</span><span class="m">93</span><span class="o">]</span>
</div><div id="l3495" class="code_block">
</div><div id="l3496" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> atom_codes</span><span class="o">(</span><span class="nb">X, </span><span class="o">[</span><span class="m">102</span><span class="nb">,</span><span class="m">111</span><span class="nb">,</span><span class="m">111</span><span class="o">])</span><span class="nb">.</span>
</div><div id="l3497" class="code_block"><span class="nb">                   X </span><span class="o">=</span><span class="nb"> foo</span>
</div><div id="l3498" class="code_block"><span class="nb"> </span>
</div><div id="l3499" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> atom_codes</span><span class="o">(</span><span class="nb">X, </span><span class="o">[])</span><span class="nb">.</span>
</div><div id="l3500" class="code_block"><span class="nb">                   X </span><span class="o">=</span><span class="nb"> &#39;&#39;</span>
</div><div id="l3501" class="code_block">
</div><div id="l3502" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> atom_codes</span><span class="o">(</span><span class="nb">X, &quot;Foo&quot;</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3503" class="code_block"><span class="nb">                   X </span><span class="o">=</span><span class="nb"> &#39;Foo&#39;</span>
</div><div id="l3504" class="code_block">
</div><div id="l3505" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> atom_codes</span><span class="o">(</span><span class="nb">X, </span><span class="o">[</span><span class="m">52</span><span class="nb">,</span><span class="m">51</span><span class="nb">,</span><span class="m">49</span><span class="o">])</span><span class="nb">.</span>
</div><div id="l3506" class="code_block"><span class="nb">                   X </span><span class="o">=</span><span class="nb"> &#39;</span><span class="m">431</span><span class="nb">&#39;</span>
</div><div id="l3507" class="code_block">
</div><div id="l3508" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> atom_codes</span><span class="o">(</span><span class="nb">X, </span><span class="o">[</span><span class="m">52</span><span class="nb">,</span><span class="m">51</span><span class="nb">,</span><span class="m">49</span><span class="o">])</span><span class="nb">, integer</span><span class="o">(</span><span class="nb">X</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3509" class="code_block"><span class="nb">                   no</span>
</div><div id="l3510" class="code_block">
</div><div id="l3511" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> atom_codes</span><span class="o">(</span><span class="nb">X, </span><span class="o">[</span><span class="m">52</span><span class="nb">,Y,</span><span class="m">49</span><span class="o">])</span><span class="nb">.</span>
</div><div id="l3512" class="code_block"><span class="nb">                   </span><span class="o">++</span><span class="nb">Error</span><span class="o">[</span><span class="nb">XSB</span><span class="o">/</span><span class="nb">Runtime</span><span class="o">/</span><span class="nb">P</span><span class="o">]</span><span class="nb">: </span><span class="o">[</span><span class="nb">Instantiation</span><span class="o">]</span><span class="nb">  in arg </span><span class="m">2</span><span class="nb"> of predicate atom_codes</span><span class="o">/</span><span class="m">2</span>
</div><div id="l3513" class="code_block"><span class="nb">                   Forward Continuation...</span>
</div><div id="l3514" class="code_block">
</div><div id="l3515" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> atom_codes</span><span class="o">(</span><span class="m">431</span><span class="nb">, L</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3516" class="code_block"><span class="nb">                   </span><span class="o">++</span><span class="nb">Error</span><span class="o">[</span><span class="nb">XSB</span><span class="o">/</span><span class="nb">Runtime</span><span class="o">/</span><span class="nb">P</span><span class="o">]</span><span class="nb">: </span><span class="o">[</span><span class="nb">Type </span><span class="o">(</span><span class="m">431</span><span class="nb"> in place of atom</span><span class="o">)]</span><span class="nb"> in arg </span><span class="m">1</span><span class="nb"> of predicate </span>
</div><div id="l3517" class="code_block"><span class="nb">                   atom_codes</span><span class="o">/</span><span class="m">2</span>
</div><div id="l3518" class="code_block"><span class="nb">                   Forward Continuation...</span>
</div><div id="l3519" class="code_block">
</div><div id="l3520" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> atom_codes</span><span class="o">(</span><span class="nb">X, </span><span class="o">[</span><span class="m">52</span><span class="nb">,</span><span class="m">300</span><span class="nb">,</span><span class="m">49</span><span class="o">])</span><span class="nb">.</span>
</div><div id="l3521" class="code_block"><span class="nb">                   </span><span class="o">[</span><span class="nb">Representation </span><span class="o">(</span><span class="m">300</span><span class="nb"> is not character code</span><span class="o">)]</span><span class="nb"> in arg </span><span class="m">2</span><span class="nb"> of predicate </span>
</div><div id="l3522" class="code_block"><span class="nb">                   atom_codes</span><span class="o">/</span><span class="m">2</span>
</div><div id="l3523" class="code_block"><span class="nb">                   Forward Continuation...</span>
</div><div id="l3524" class="code_block"><span class="nb">     </span><span class="nv">\end</span><span class="nb">{verbatim}}</span>
</div><div id="l3525" class="code_block">
</div><div id="l3526" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Error Cases}</span>
</div><div id="l3527" class="code_block"><span class="nv">\begin</span><span class="nb">{itemize}</span>
</div><div id="l3528" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Atom} is a variable and {</span><span class="nv">\tt</span><span class="nb"> CharCodeList} is a partial</span>
</div><div id="l3529" class="code_block"><span class="nb">  list or a list with an element which is a variable</span>
</div><div id="l3530" class="code_block"><span class="nv">\begin</span><span class="nb">{itemize}</span>
</div><div id="l3531" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> instantiation</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l3532" class="code_block"><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l3533" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Atom} is neither a variable nor an atom </span>
</div><div id="l3534" class="code_block"><span class="nv">\bi</span>
</div><div id="l3535" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">atom, Atom</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3536" class="code_block"><span class="nv">\ei</span>
</div><div id="l3537" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Atom} is a variable and {</span><span class="nv">\tt</span><span class="nb"> CharCodeList} is neither a</span>
</div><div id="l3538" class="code_block"><span class="nb">  list nor a partial list </span>
</div><div id="l3539" class="code_block"><span class="nv">\bi</span>
</div><div id="l3540" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">list, CharCodeList</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3541" class="code_block"><span class="nv">\ei</span>
</div><div id="l3542" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Atom} is a variable and an element {</span><span class="nv">\tt</span><span class="nb"> E} of {</span><span class="nv">\tt</span><span class="nb"> CharCodeList} is neither a</span>
</div><div id="l3543" class="code_block"><span class="nb">variable nor a character code</span>
</div><div id="l3544" class="code_block"><span class="nv">\bi</span>
</div><div id="l3545" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> representation</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">character</span><span class="nv">\_</span><span class="nb">code, E</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3546" class="code_block"><span class="nv">\ei</span>
</div><div id="l3547" class="code_block"><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l3548" class="code_block">
</div><div id="l3549" class="code_block"><span class="nv">\isoitem</span><span class="nb">{number</span><span class="nv">\_</span><span class="nb">codes</span><span class="o">(</span><span class="nb">?Number, ?CharCodeList</span><span class="o">)</span><span class="nb">}{number</span><span class="nv">\_</span><span class="nb">codes</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l3550" class="code_block"><span class="c">%</span>
</div><div id="l3551" class="code_block"><span class="nb">    The standard predicate {</span><span class="nv">\tt</span><span class="nb"> number</span><span class="nv">\_</span><span class="nb">codes</span><span class="o">/</span><span class="m">2</span><span class="nb">} performs the conversion </span>
</div><div id="l3552" class="code_block"><span class="nb">    between a number and its character list representation. </span>
</div><div id="l3553" class="code_block"><span class="nb">    If {</span><span class="nv">\tt</span><span class="nb"> Number} is supplied </span><span class="o">(</span><span class="nb">and is a number</span><span class="o">)</span><span class="nb">, {</span><span class="nv">\tt</span><span class="nb"> CharList} is</span>
</div><div id="l3554" class="code_block"><span class="nb">    unified with a list of ASCII codes comprising the printed representation</span>
</div><div id="l3555" class="code_block"><span class="nb">    of that {</span><span class="nv">\tt</span><span class="nb"> Number}.  If on the other hand {</span><span class="nv">\tt</span><span class="nb"> Number} is a variable, </span>
</div><div id="l3556" class="code_block"><span class="nb">    then {</span><span class="nv">\tt</span><span class="nb"> CharList} must be a proper list of ASCII character codes that</span>
</div><div id="l3557" class="code_block"><span class="nb">    corresponds to the correct syntax of a number </span><span class="o">(</span><span class="nb">either integer or float</span><span class="o">)</span>
</div><div id="l3558" class="code_block"><span class="nb">    In that case, {</span><span class="nv">\tt</span><span class="nb"> Number} is instantiated to that number, otherwise</span>
</div><div id="l3559" class="code_block"><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> number</span><span class="nv">\_</span><span class="nb">codes</span><span class="o">/</span><span class="m">2</span><span class="nb">} will simply fail.</span>
</div><div id="l3560" class="code_block">
</div><div id="l3561" class="code_block"><span class="nb">    Examples:</span>
</div><div id="l3562" class="code_block"><span class="nb">    {</span><span class="nv">\footnotesize</span>
</div><div id="l3563" class="code_block"><span class="nb">     </span><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l3564" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> number_codes</span><span class="o">(</span><span class="m">123</span><span class="nb">, L</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3565" class="code_block"><span class="nb">                   L </span><span class="o">=</span><span class="nb"> </span><span class="o">[</span><span class="m">49</span><span class="nb">,</span><span class="m">50</span><span class="nb">,</span><span class="m">51</span><span class="o">]</span><span class="nb">;</span>
</div><div id="l3566" class="code_block">
</div><div id="l3567" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> number_codes</span><span class="o">(</span><span class="nb">N, </span><span class="o">[</span><span class="m">49</span><span class="nb">,</span><span class="m">50</span><span class="nb">,</span><span class="m">51</span><span class="o">])</span><span class="nb">, integer</span><span class="o">(</span><span class="nb">N</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3568" class="code_block"><span class="nb">                   N </span><span class="o">=</span><span class="nb"> </span><span class="m">123</span>
</div><div id="l3569" class="code_block">
</div><div id="l3570" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> number_codes</span><span class="o">(</span><span class="m">31</span><span class="nb">.</span><span class="m">4</span><span class="nb">e</span><span class="o">+</span><span class="m">10</span><span class="nb">, L</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3571" class="code_block"><span class="nb">                   L </span><span class="o">=</span><span class="nb"> </span><span class="o">[</span><span class="m">51</span><span class="nb">,</span><span class="m">46</span><span class="nb">,</span><span class="m">49</span><span class="nb">,</span><span class="m">51</span><span class="nb">,</span><span class="m">57</span><span class="nb">,</span><span class="m">57</span><span class="nb">,</span><span class="m">57</span><span class="nb">,</span><span class="m">55</span><span class="nb">,</span><span class="m">69</span><span class="nb">,</span><span class="m">43</span><span class="nb">,</span><span class="m">49</span><span class="nb">,</span><span class="m">48</span><span class="o">]</span>
</div><div id="l3572" class="code_block">
</div><div id="l3573" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> number_codes</span><span class="o">(</span><span class="nb">N, &quot;</span><span class="m">314</span><span class="nb">e</span><span class="o">+</span><span class="m">8</span><span class="nb">&quot;</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3574" class="code_block"><span class="nb">                   N </span><span class="o">=</span><span class="nb"> </span><span class="m">3</span><span class="nb">.</span><span class="m">14</span><span class="nb">e</span><span class="o">+</span><span class="m">10</span>
</div><div id="l3575" class="code_block">
</div><div id="l3576" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> number_codes</span><span class="o">(</span><span class="nb">foo, L</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3577" class="code_block"><span class="nb">                   </span><span class="o">++</span><span class="nb">Error</span><span class="o">[</span><span class="nb">XSB</span><span class="o">/</span><span class="nb">Runtime</span><span class="o">/</span><span class="nb">P</span><span class="o">]</span><span class="nb">: </span><span class="o">[</span><span class="nb">Type </span><span class="o">(</span><span class="nb">foo in place of</span>
</div><div id="l3578" class="code_block"><span class="nb">                     number</span><span class="o">)]</span><span class="nb"> in arg </span><span class="m">1</span><span class="nb"> of predicate </span>
</div><div id="l3579" class="code_block"><span class="nb">                   number_codes</span>
</div><div id="l3580" class="code_block"><span class="nb">                   Forward Continuation...</span>
</div><div id="l3581" class="code_block"><span class="nb">     </span><span class="nv">\end</span><span class="nb">{verbatim}}</span>
</div><div id="l3582" class="code_block">
</div><div id="l3583" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Error Cases}</span>
</div><div id="l3584" class="code_block"><span class="nv">\begin</span><span class="nb">{itemize}</span>
</div><div id="l3585" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Number} is a variable and {</span><span class="nv">\tt</span><span class="nb"> CharCodeList} is a partial</span>
</div><div id="l3586" class="code_block"><span class="nb">  list or a list with an element which is a variable</span>
</div><div id="l3587" class="code_block"><span class="nv">\begin</span><span class="nb">{itemize}</span>
</div><div id="l3588" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> instantiation</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l3589" class="code_block"><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l3590" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Number} is neither a variable nor a number</span>
</div><div id="l3591" class="code_block"><span class="nv">\bi</span>
</div><div id="l3592" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">number, Number</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3593" class="code_block"><span class="nv">\ei</span>
</div><div id="l3594" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Number} is a variable and {</span><span class="nv">\tt</span><span class="nb"> CharCodeList} is neither a</span>
</div><div id="l3595" class="code_block"><span class="nb">  list nor a partial list </span>
</div><div id="l3596" class="code_block"><span class="nv">\bi</span>
</div><div id="l3597" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">list, CharCodeList</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3598" class="code_block"><span class="nv">\ei</span>
</div><div id="l3599" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Number} is a variable and an element {</span><span class="nv">\tt</span><span class="nb"> E} of {</span><span class="nv">\tt</span><span class="nb"> CharCodeList} is neither a</span>
</div><div id="l3600" class="code_block"><span class="nb">variable nor a character code</span>
</div><div id="l3601" class="code_block"><span class="nv">\bi</span>
</div><div id="l3602" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> representation</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">character</span><span class="nv">\_</span><span class="nb">code, E</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3603" class="code_block"><span class="nv">\ei</span>
</div><div id="l3604" class="code_block"><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l3605" class="code_block">
</div><div id="l3606" class="code_block"><span class="nv">\standarditem</span><span class="nb">{name</span><span class="o">(</span><span class="nb">?Constant, ?CharList</span><span class="o">)</span><span class="nb">}{name</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l3607" class="code_block"><span class="c">%</span>
</div><div id="l3608" class="code_block"><span class="nb">The standard predicate {</span><span class="nv">\tt</span><span class="nb"> name</span><span class="o">/</span><span class="m">2</span><span class="nb">} performs the conversion between a</span>
</div><div id="l3609" class="code_block"><span class="nb">constant and its character list representation.  If {</span><span class="nv">\tt</span><span class="nb"> Constant} is</span>
</div><div id="l3610" class="code_block"><span class="nb">supplied </span><span class="o">(</span><span class="nb">and is any atom or number</span><span class="o">)</span><span class="nb">, {</span><span class="nv">\tt</span><span class="nb"> CharList} is unified with a</span>
</div><div id="l3611" class="code_block"><span class="nb">list of ASCII codes representing the {</span><span class="nv">\em</span><span class="nb"> ``name&#39;&#39;} of the constant.</span>
</div><div id="l3612" class="code_block"><span class="nb">In that case, {</span><span class="nv">\tt</span><span class="nb"> CharList} is exactly the list of ASCII character</span>
</div><div id="l3613" class="code_block"><span class="nb">codes that appear in the printed representation of {</span><span class="nv">\tt</span><span class="nb"> Constant}</span><span class="nv">\@</span><span class="nb">.</span>
</div><div id="l3614" class="code_block"><span class="nb">If on the other hand {</span><span class="nv">\tt</span><span class="nb"> Constant} is a variable, then {</span><span class="nv">\tt</span><span class="nb"> CharList}</span>
</div><div id="l3615" class="code_block"><span class="nb">must be a proper list of ASCII character codes.  In that case, {</span><span class="nv">\tt</span>
</div><div id="l3616" class="code_block"><span class="nb">  name</span><span class="o">/</span><span class="m">2</span><span class="nb">} will convert a list of ASCII characters that can represent a</span>
</div><div id="l3617" class="code_block"><span class="nb">number to a number rather than to a character string.  As a</span>
</div><div id="l3618" class="code_block"><span class="nb">consequence of this, there are some atoms </span><span class="o">(</span><span class="nb">for example </span><span class="nv">\verb</span><span class="nb">|&#39;</span><span class="m">18</span><span class="nb">&#39;|</span><span class="o">)</span>
</div><div id="l3619" class="code_block"><span class="nb">which cannot be constructed by using {</span><span class="nv">\tt</span><span class="nb"> name</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span><span class="nv">\@</span><span class="nb">.  If conversion to</span>
</div><div id="l3620" class="code_block"><span class="nb">an atom is preferred in these cases, the standard predicate {</span><span class="nv">\tt</span>
</div><div id="l3621" class="code_block"><span class="nb">  atom</span><span class="nv">\_</span><span class="nb">codes</span><span class="o">/</span><span class="m">2</span><span class="nb">} should be used instead. The syntax for numbers that</span>
</div><div id="l3622" class="code_block"><span class="nb">is accepted by {</span><span class="nv">\tt</span><span class="nb"> name</span><span class="o">/</span><span class="m">2</span><span class="nb">} is exactly the one which {</span><span class="nv">\tt</span><span class="nb"> read</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span>
</div><div id="l3623" class="code_block"><span class="nb">accepts.  </span>
</div><div id="l3624" class="code_block">
</div><div id="l3625" class="code_block"><span class="c">%Predicate {\tt name/2} is provided for backwards</span>
</div><div id="l3626" class="code_block"><span class="c">%compatibility.  It is advisable that new programs use the predicates</span>
</div><div id="l3627" class="code_block"><span class="c">%{\tt atom\_codes/2} and {\tt number\_codes/2} described below.</span>
</div><div id="l3628" class="code_block"><span class="c">%In \version\ predicate {\tt name/2} is not yet implemented for</span>
</div><div id="l3629" class="code_block"><span class="c">%converting from a real number to its character list representation,</span>
</div><div id="l3630" class="code_block"><span class="c">%%and if the representation of a real is provided as {\tt CharList}, it</span>
</div><div id="l3631" class="code_block"><span class="c">%will be converted to an atom.  If both of the arguments of {\tt</span>
</div><div id="l3632" class="code_block"><span class="c">%  name/2} are uninstantiated or {\tt CharList} is not a proper list of</span>
</div><div id="l3633" class="code_block"><span class="c">%ASCII characters, {\tt name/2} will abort and an error message will be</span>
</div><div id="l3634" class="code_block"><span class="c">%sent to the standard error stream.</span>
</div><div id="l3635" class="code_block">
</div><div id="l3636" class="code_block"><span class="nb">    Examples:</span>
</div><div id="l3637" class="code_block"><span class="nb">    {</span><span class="nv">\footnotesize</span>
</div><div id="l3638" class="code_block"><span class="nb">     </span><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l3639" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> name</span><span class="o">(</span><span class="nb">&#39;Foo&#39;, L</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3640" class="code_block"><span class="nb">                   L </span><span class="o">=</span><span class="nb"> </span><span class="o">[</span><span class="m">70</span><span class="nb">,</span><span class="m">111</span><span class="nb">,</span><span class="m">111</span><span class="o">]</span>
</div><div id="l3641" class="code_block">
</div><div id="l3642" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> name</span><span class="o">([]</span><span class="nb">, L</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3643" class="code_block"><span class="nb">                   L </span><span class="o">=</span><span class="nb"> </span><span class="o">[</span><span class="m">91</span><span class="nb">,</span><span class="m">93</span><span class="o">]</span>
</div><div id="l3644" class="code_block">
</div><div id="l3645" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> name</span><span class="o">(</span><span class="m">431</span><span class="nb">, L</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3646" class="code_block"><span class="nb">                   L </span><span class="o">=</span><span class="nb"> </span><span class="o">[</span><span class="m">52</span><span class="nb">,</span><span class="m">51</span><span class="nb">,</span><span class="m">49</span><span class="o">]</span>
</div><div id="l3647" class="code_block">
</div><div id="l3648" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> name</span><span class="o">(</span><span class="nb">X, </span><span class="o">[</span><span class="m">102</span><span class="nb">,</span><span class="m">111</span><span class="nb">,</span><span class="m">111</span><span class="o">])</span><span class="nb">.</span>
</div><div id="l3649" class="code_block"><span class="nb">                   X </span><span class="o">=</span><span class="nb"> foo</span>
</div><div id="l3650" class="code_block"><span class="nb"> </span>
</div><div id="l3651" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> name</span><span class="o">(</span><span class="nb">X, </span><span class="o">[])</span><span class="nb">.</span>
</div><div id="l3652" class="code_block"><span class="nb">                   X </span><span class="o">=</span><span class="nb"> &#39;&#39;</span>
</div><div id="l3653" class="code_block">
</div><div id="l3654" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> name</span><span class="o">(</span><span class="nb">X, &quot;Foo&quot;</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3655" class="code_block"><span class="nb">                   X </span><span class="o">=</span><span class="nb"> &#39;Foo&#39;</span>
</div><div id="l3656" class="code_block">
</div><div id="l3657" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> name</span><span class="o">(</span><span class="nb">X, </span><span class="o">[</span><span class="m">52</span><span class="nb">,</span><span class="m">51</span><span class="nb">,</span><span class="m">49</span><span class="o">])</span><span class="nb">.</span>
</div><div id="l3658" class="code_block"><span class="nb">                   X </span><span class="o">=</span><span class="nb"> </span><span class="m">431</span>
</div><div id="l3659" class="code_block">
</div><div id="l3660" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> name</span><span class="o">(</span><span class="nb">X, </span><span class="o">[</span><span class="m">45</span><span class="nb">,</span><span class="m">48</span><span class="nb">,</span><span class="m">50</span><span class="nb">,</span><span class="m">49</span><span class="nb">,</span><span class="m">51</span><span class="o">])</span><span class="nb">, integer</span><span class="o">(</span><span class="nb">X</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3661" class="code_block"><span class="nb">                   X </span><span class="o">=</span><span class="nb"> </span><span class="o">-</span><span class="m">213</span>
</div><div id="l3662" class="code_block">
</div><div id="l3663" class="code_block"><span class="nb">                   | ?</span><span class="o">-</span><span class="nb"> name</span><span class="o">(</span><span class="m">3</span><span class="nb">.</span><span class="m">14</span><span class="nb">, L</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3664" class="code_block"><span class="nb">                   </span><span class="o">++</span><span class="nb">Error</span><span class="o">[</span><span class="nb">XSB</span><span class="o">/</span><span class="nb">Runtime</span><span class="o">/</span><span class="nb">P</span><span class="o">]</span><span class="nb">: </span><span class="o">[</span><span class="nb">Miscellaneous</span><span class="o">]</span><span class="nb"> Predicate name</span><span class="o">/</span><span class="m">2</span><span class="nb"> for reals is not implemented yet</span>
</div><div id="l3665" class="code_block"><span class="nb">                   Aborting...</span>
</div><div id="l3666" class="code_block"><span class="nb">     </span><span class="nv">\end</span><span class="nb">{verbatim}}</span>
</div><div id="l3667" class="code_block">
</div><div id="l3668" class="code_block"><span class="nv">\begin</span><span class="nb">{itemize}</span>
</div><div id="l3669" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Constant} is a variable and {</span><span class="nv">\tt</span><span class="nb"> CharCodeList} is a partial</span>
</div><div id="l3670" class="code_block"><span class="nb">  list or a list with an element which is a variable</span>
</div><div id="l3671" class="code_block"><span class="nv">\begin</span><span class="nb">{itemize}</span>
</div><div id="l3672" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> instantiation</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l3673" class="code_block"><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l3674" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Constant} is neither a variable nor atomic</span>
</div><div id="l3675" class="code_block"><span class="nv">\bi</span>
</div><div id="l3676" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">atomic, Constant</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3677" class="code_block"><span class="nv">\ei</span>
</div><div id="l3678" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Constant} is a variable and {</span><span class="nv">\tt</span><span class="nb"> CharCodeList} is neither a</span>
</div><div id="l3679" class="code_block"><span class="nb">  list nor a partial list </span>
</div><div id="l3680" class="code_block"><span class="nv">\bi</span>
</div><div id="l3681" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">list, CharCodeList</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3682" class="code_block"><span class="nv">\ei</span>
</div><div id="l3683" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Constant} is a variable and an element {</span><span class="nv">\tt</span><span class="nb"> E} of {</span><span class="nv">\tt</span>
</div><div id="l3684" class="code_block"><span class="nb">  CharCodeList} is neither a variable nor a character code </span>
</div><div id="l3685" class="code_block"><span class="nv">\bi</span>
</div><div id="l3686" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> representation</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">character</span><span class="nv">\_</span><span class="nb">code, E</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3687" class="code_block"><span class="nv">\ei</span>
</div><div id="l3688" class="code_block"><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l3689" class="code_block">
</div><div id="l3690" class="code_block"><span class="nv">\isoitem</span><span class="nb">{atom</span><span class="nv">\_</span><span class="nb">chars</span><span class="o">(</span><span class="nb">?Number, ?CharList</span><span class="o">)</span><span class="nb">}{atom</span><span class="nv">\_</span><span class="nb">chars</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l3691" class="code_block"><span class="nb">    Like </span><span class="nv">\verb</span><span class="nb">|atom_codes</span><span class="o">/</span><span class="m">2</span><span class="nb">|, but the list returned </span><span class="o">(</span><span class="nb">or input</span><span class="o">)</span><span class="nb"> is a list of</span>
</div><div id="l3692" class="code_block"><span class="nb">    characters </span><span class="nv">\emph</span><span class="nb">{as atoms} rather than ASCII codes. For instance, </span>
</div><div id="l3693" class="code_block"><span class="nb">    </span><span class="nv">\verb</span><span class="nb">|atom_chars</span><span class="o">(</span><span class="nb">abc,X</span><span class="o">)</span><span class="nb">| binds {</span><span class="nv">\tt</span><span class="nb"> X} to the list {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">[</span><span class="nb">a,b,c</span><span class="o">]</span><span class="nb">}</span>
</div><div id="l3694" class="code_block"><span class="nb">    Instead of {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">[</span><span class="m">97</span><span class="nb">,</span><span class="m">98</span><span class="nb">,</span><span class="m">99</span><span class="o">]</span><span class="nb">}.</span>
</div><div id="l3695" class="code_block">
</div><div id="l3696" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Error Cases}</span>
</div><div id="l3697" class="code_block"><span class="nv">\begin</span><span class="nb">{itemize}</span>
</div><div id="l3698" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Atom} is a variable and {</span><span class="nv">\tt</span><span class="nb"> CharList} is a partial</span>
</div><div id="l3699" class="code_block"><span class="nb">  list or a list with an element which is a variable</span>
</div><div id="l3700" class="code_block"><span class="nv">\begin</span><span class="nb">{itemize}</span>
</div><div id="l3701" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> instantiation</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l3702" class="code_block"><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l3703" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Atom} is neither a variable nor an atom </span>
</div><div id="l3704" class="code_block"><span class="nv">\bi</span>
</div><div id="l3705" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">atom, Atom</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3706" class="code_block"><span class="nv">\ei</span>
</div><div id="l3707" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Atom} is a variable and {</span><span class="nv">\tt</span><span class="nb"> CharList} is neither a</span>
</div><div id="l3708" class="code_block"><span class="nb">  list nor a partial list </span>
</div><div id="l3709" class="code_block"><span class="nv">\bi</span>
</div><div id="l3710" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">list, CharList</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3711" class="code_block"><span class="nv">\ei</span>
</div><div id="l3712" class="code_block"><span class="nv">\item</span><span class="nb"> An element {</span><span class="nv">\tt</span><span class="nb"> E} of {</span><span class="nv">\tt</span><span class="nb"> CharList} is not a single</span><span class="o">-</span><span class="nb">character</span>
</div><div id="l3713" class="code_block"><span class="nb">atom</span>
</div><div id="l3714" class="code_block"><span class="nv">\bi</span>
</div><div id="l3715" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">character, E</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3716" class="code_block"><span class="nv">\ei</span>
</div><div id="l3717" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Atom} is a variable and an element {</span><span class="nv">\tt</span><span class="nb"> E} of {</span><span class="nv">\tt</span>
</div><div id="l3718" class="code_block"><span class="nb">  CharCodeList} is not a single</span><span class="o">-</span><span class="nb">character atom</span>
</div><div id="l3719" class="code_block"><span class="nv">\bi</span>
</div><div id="l3720" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> representation</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">character, E</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3721" class="code_block"><span class="nv">\ei</span>
</div><div id="l3722" class="code_block"><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l3723" class="code_block">
</div><div id="l3724" class="code_block"><span class="nv">\isoitem</span><span class="nb">{number</span><span class="nv">\_</span><span class="nb">chars</span><span class="o">(</span><span class="nb">?Number, ?CharList</span><span class="o">)</span><span class="nb">}{number</span><span class="nv">\_</span><span class="nb">chars</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l3725" class="code_block"><span class="c">%</span>
</div><div id="l3726" class="code_block"><span class="nb">    Like </span><span class="nv">\verb</span><span class="nb">|number_codes</span><span class="o">/</span><span class="m">2</span><span class="nb">|, but the list returned </span><span class="o">(</span><span class="nb">or input</span><span class="o">)</span><span class="nb"> is a list of</span>
</div><div id="l3727" class="code_block"><span class="nb">    characters </span><span class="nv">\emph</span><span class="nb">{as atoms} rather than ASCII codes. For instance, </span>
</div><div id="l3728" class="code_block"><span class="nb">    </span><span class="nv">\verb</span><span class="nb">|number_chars</span><span class="o">(</span><span class="m">123</span><span class="nb">,X</span><span class="o">)</span><span class="nb">| binds {</span><span class="nv">\tt</span><span class="nb"> X} to the list {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">[</span><span class="nb">&#39;</span><span class="m">1</span><span class="nb">&#39;,&#39;</span><span class="m">2</span><span class="nb">&#39;,&#39;</span><span class="m">3</span><span class="nb">&#39;</span><span class="o">]</span><span class="nb">}</span>
</div><div id="l3729" class="code_block"><span class="nb">    instead of {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">[</span><span class="m">49</span><span class="nb">,</span><span class="m">50</span><span class="nb">,</span><span class="m">51</span><span class="o">]</span><span class="nb">}.</span>
</div><div id="l3730" class="code_block">
</div><div id="l3731" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Error Cases}</span>
</div><div id="l3732" class="code_block"><span class="nv">\begin</span><span class="nb">{itemize}</span>
</div><div id="l3733" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Number} is a variable and {</span><span class="nv">\tt</span><span class="nb"> CharList} is a partial</span>
</div><div id="l3734" class="code_block"><span class="nb">  list or a list with an element which is a variable</span>
</div><div id="l3735" class="code_block"><span class="nv">\begin</span><span class="nb">{itemize}</span>
</div><div id="l3736" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> instantiation</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l3737" class="code_block"><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l3738" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Number} is neither a variable nor a number</span>
</div><div id="l3739" class="code_block"><span class="nv">\bi</span>
</div><div id="l3740" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">number, Number</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3741" class="code_block"><span class="nv">\ei</span>
</div><div id="l3742" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Number} is a variable and {</span><span class="nv">\tt</span><span class="nb"> CharList} is neither a</span>
</div><div id="l3743" class="code_block"><span class="nb">  list nor a partial list </span>
</div><div id="l3744" class="code_block"><span class="nv">\bi</span>
</div><div id="l3745" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">list, CharList</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3746" class="code_block"><span class="nv">\ei</span>
</div><div id="l3747" class="code_block"><span class="nv">\item</span><span class="nb"> An element {</span><span class="nv">\tt</span><span class="nb"> E} of {</span><span class="nv">\tt</span><span class="nb"> CharList} is not a single</span><span class="o">-</span><span class="nb">character</span>
</div><div id="l3748" class="code_block"><span class="nb">atom</span>
</div><div id="l3749" class="code_block"><span class="nv">\bi</span>
</div><div id="l3750" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">character, E</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3751" class="code_block"><span class="nv">\ei</span>
</div><div id="l3752" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> CharList} is a list of single</span><span class="o">-</span><span class="nb">character atoms but is not</span>
</div><div id="l3753" class="code_block"><span class="nb">  parsable as a number </span><span class="o">(</span><span class="nb">by XSB</span><span class="o">)</span>
</div><div id="l3754" class="code_block"><span class="nv">\bi</span>
</div><div id="l3755" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> syntax</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">CharList</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3756" class="code_block"><span class="nv">\ei</span>
</div><div id="l3757" class="code_block"><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l3758" class="code_block">
</div><div id="l3759" class="code_block"><span class="nv">\standarditem</span><span class="nb">{number</span><span class="nv">\_</span><span class="nb">digits</span><span class="o">(</span><span class="nb">?Number, ?DigitList</span><span class="o">)</span><span class="nb">}{number</span><span class="nv">\_</span><span class="nb">digits</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l3760" class="code_block"><span class="nb">    Like </span><span class="nv">\verb</span><span class="nb">|number_codes</span><span class="o">/</span><span class="m">2</span><span class="nb">|, but the list returned </span><span class="o">(</span><span class="nb">or input</span><span class="o">)</span><span class="nb"> is a list of</span>
</div><div id="l3761" class="code_block"><span class="nb">    digits </span><span class="nv">\emph</span><span class="nb">{as numbers} rather than ASCII codes </span><span class="o">(</span><span class="nb">for floats, the atom</span>
</div><div id="l3762" class="code_block"><span class="nb">    &#39;.&#39;, &#39;</span><span class="o">+</span><span class="nb">&#39; or &#39;</span><span class="o">-</span><span class="nb">&#39;, and &#39;e&#39; will also be present in the list</span><span class="o">)</span><span class="nb">. For instance, </span>
</div><div id="l3763" class="code_block"><span class="nb">    </span><span class="nv">\verb</span><span class="nb">|number_digits</span><span class="o">(</span><span class="m">123</span><span class="nb">,X</span><span class="o">)</span><span class="nb">| binds {</span><span class="nv">\tt</span><span class="nb"> X} to the list {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">[</span><span class="m">1</span><span class="nb">,</span><span class="m">2</span><span class="nb">,</span><span class="m">3</span><span class="o">]</span><span class="nb">}</span>
</div><div id="l3764" class="code_block"><span class="nb">    instead of {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">[</span><span class="nb">&#39;</span><span class="m">1</span><span class="nb">&#39;,&#39;</span><span class="m">2</span><span class="nb">&#39;,&#39;</span><span class="m">3</span><span class="nb">&#39;</span><span class="o">]</span><span class="nb">}, and </span><span class="nv">\verb</span><span class="nb">|number_digits</span><span class="o">(</span><span class="m">123</span><span class="nb">.</span><span class="m">45</span><span class="nb">,X</span><span class="o">)</span><span class="nb">|</span>
</div><div id="l3765" class="code_block"><span class="nb">    binds {</span><span class="nv">\tt</span><span class="nb"> X} to {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">[</span><span class="m">1</span><span class="nb">,.,</span><span class="m">2</span><span class="nb">,</span><span class="m">3</span><span class="nb">,</span><span class="m">4</span><span class="nb">,</span><span class="m">5</span><span class="nb">,</span><span class="m">0</span><span class="nb">,</span><span class="m">0</span><span class="nb">,e,</span><span class="o">+</span><span class="nb">,</span><span class="m">0</span><span class="nb">,</span><span class="m">2</span><span class="o">]</span><span class="nb">}.</span>
</div><div id="l3766" class="code_block">
</div><div id="l3767" class="code_block"><span class="nb">Error cases are the same as {</span><span class="nv">\tt</span><span class="nb"> number</span><span class="nv">\_</span><span class="nb">chars</span><span class="o">/</span><span class="m">2</span><span class="nb">}.</span>
</div><div id="l3768" class="code_block">
</div><div id="l3769" class="code_block"><span class="nv">\isoitem</span><span class="nb">{char</span><span class="nv">\_</span><span class="nb">code</span><span class="o">(</span><span class="nb">?Character, ?Code</span><span class="o">)</span><span class="nb">}{char</span><span class="nv">\_</span><span class="nb">code</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l3770" class="code_block"><span class="c">%</span>
</div><div id="l3771" class="code_block"><span class="nb">The standard predicate {</span><span class="nv">\tt</span><span class="nb"> char</span><span class="nv">\_</span><span class="nb">code</span><span class="o">/</span><span class="m">2</span><span class="nb">} is true if {</span><span class="nv">\tt</span><span class="nb"> Code} is the</span>
</div><div id="l3772" class="code_block"><span class="nb">current code for {</span><span class="nv">\tt</span><span class="nb"> Character}.  In XSB it is defined as {</span><span class="nv">\tt</span>
</div><div id="l3773" class="code_block"><span class="nb">  atom</span><span class="nv">\_</span><span class="nb">codes</span><span class="o">(</span><span class="nb">Character,</span><span class="o">[</span><span class="nb">Code</span><span class="o">])</span><span class="nb">}.</span>
</div><div id="l3774" class="code_block">
</div><div id="l3775" class="code_block"><span class="nv">\isoitem</span><span class="nb">{atom</span><span class="nv">\_</span><span class="nb">length</span><span class="o">(+</span><span class="nb">Atom</span><span class="m">1</span><span class="nb">,?Length</span><span class="o">)</span><span class="nb">}{atom</span><span class="nv">\_</span><span class="nb">length</span><span class="o">/</span><span class="m">2</span><span class="nb">}</span>
</div><div id="l3776" class="code_block"><span class="c">%</span>
</div><div id="l3777" class="code_block"><span class="nb">This standard predicate succeeds if {</span><span class="nv">\tt</span><span class="nb"> Length} unifies with the</span>
</div><div id="l3778" class="code_block"><span class="nb">length of </span><span class="o">(</span><span class="nb">the name of</span><span class="o">)</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Atom}.</span>
</div><div id="l3779" class="code_block">
</div><div id="l3780" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Example}</span>
</div><div id="l3781" class="code_block"><span class="nb">{</span><span class="nv">\small</span>
</div><div id="l3782" class="code_block"><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l3783" class="code_block"><span class="nb">|?</span><span class="o">-</span><span class="nb"> atom_length</span><span class="o">(</span><span class="nb">trilobyte,L</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3784" class="code_block">
</div><div id="l3785" class="code_block"><span class="nb">L </span><span class="o">=</span><span class="nb"> </span><span class="m">9</span>
</div><div id="l3786" class="code_block"><span class="nv">\end</span><span class="nb">{verbatim}</span>
</div><div id="l3787" class="code_block"><span class="nb">}</span>
</div><div id="l3788" class="code_block">
</div><div id="l3789" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Error Cases}</span>
</div><div id="l3790" class="code_block"><span class="nv">\begin</span><span class="nb">{itemize}</span>
</div><div id="l3791" class="code_block"><span class="nb">  </span><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Atom} is a variable</span>
</div><div id="l3792" class="code_block"><span class="nv">\begin</span><span class="nb">{itemize}</span>
</div><div id="l3793" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> instantiation</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l3794" class="code_block"><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l3795" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Atom} is neither a variable nor an atom</span>
</div><div id="l3796" class="code_block"><span class="nv">\begin</span><span class="nb">{itemize}      </span>
</div><div id="l3797" class="code_block"><span class="nv">\item</span><span class="nb">   {</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">atom,Atom</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3798" class="code_block"><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l3799" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Length} is neither a variable nor an integer</span>
</div><div id="l3800" class="code_block"><span class="nv">\begin</span><span class="nb">{itemize}      </span>
</div><div id="l3801" class="code_block"><span class="nv">\item</span><span class="nb">   {</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">integer,Length</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3802" class="code_block"><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l3803" class="code_block"><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l3804" class="code_block">
</div><div id="l3805" class="code_block"><span class="nv">\ourisousageitem</span><span class="nb">{atom</span><span class="nv">\_</span><span class="nb">concat</span><span class="o">(</span><span class="nb">Atom</span><span class="m">1</span><span class="nb">,Atom</span><span class="m">2</span><span class="nb">,Atom</span><span class="m">3</span><span class="o">)</span><span class="nb">}{atom</span><span class="nv">\_</span><span class="nb">concat</span><span class="o">/</span><span class="m">3</span><span class="nb">}</span>
</div><div id="l3806" class="code_block"><span class="nv">\ourusage</span><span class="nb">{atom</span><span class="nv">\_</span><span class="nb">concat</span><span class="o">(</span><span class="nb">?Atom,?Atom,</span><span class="o">+</span><span class="nb">Atom</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3807" class="code_block"><span class="nv">\ourusage</span><span class="nb">{atom</span><span class="nv">\_</span><span class="nb">concat</span><span class="o">(+</span><span class="nb">Atom,</span><span class="o">+</span><span class="nb">Atom,</span><span class="o">-</span><span class="nb">Atom</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3808" class="code_block"><span class="c">%</span>
</div><div id="l3809" class="code_block"><span class="nb">Succeeds if {</span><span class="nv">\tt</span><span class="nb"> Atom</span><span class="m">12</span><span class="nb">} is the concatenation of {</span><span class="nv">\tt</span><span class="nb"> Atom</span><span class="m">1</span><span class="nb">} and {</span><span class="nv">\tt</span><span class="nb"> Atom</span><span class="m">2</span><span class="nb">}.</span>
</div><div id="l3810" class="code_block">
</div><div id="l3811" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Examples}</span>
</div><div id="l3812" class="code_block"><span class="nb">{</span><span class="nv">\small</span>
</div><div id="l3813" class="code_block"><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l3814" class="code_block"><span class="nb">| ?</span><span class="o">-</span><span class="nb"> atom_concat</span><span class="o">(</span><span class="nb">hello,world,F</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3815" class="code_block">
</div><div id="l3816" class="code_block"><span class="nb">F </span><span class="o">=</span><span class="nb"> hello world</span>
</div><div id="l3817" class="code_block">
</div><div id="l3818" class="code_block"><span class="nb">| ?</span><span class="o">-</span><span class="nb"> atom_concat</span><span class="o">(</span><span class="nb">X,Y,&#39;hello world&#39;</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3819" class="code_block">
</div><div id="l3820" class="code_block"><span class="nb">X </span><span class="o">=</span>
</div><div id="l3821" class="code_block"><span class="nb">Y </span><span class="o">=</span><span class="nb"> hello world;</span>
</div><div id="l3822" class="code_block">
</div><div id="l3823" class="code_block"><span class="nb">X </span><span class="o">=</span><span class="nb"> h</span>
</div><div id="l3824" class="code_block"><span class="nb">Y </span><span class="o">=</span><span class="nb"> ello world </span>
</div><div id="l3825" class="code_block"><span class="nv">\end</span><span class="nb">{verbatim}</span>
</div><div id="l3826" class="code_block"><span class="nb">}</span>
</div><div id="l3827" class="code_block"><span class="nb">The last query will re</span><span class="o">-</span><span class="nb">succeed for all combinations of atoms that</span>
</div><div id="l3828" class="code_block"><span class="nb">produce {</span><span class="nv">\tt</span><span class="nb"> hello world}.</span>
</div><div id="l3829" class="code_block">
</div><div id="l3830" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Error Cases}</span>
</div><div id="l3831" class="code_block"><span class="nv">\begin</span><span class="nb">{itemize}</span>
</div><div id="l3832" class="code_block"><span class="nb">  </span><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Atom</span><span class="m">1</span><span class="nb">} and {</span><span class="nv">\tt</span><span class="nb"> Atom</span><span class="m">3</span><span class="nb">} are both variables</span>
</div><div id="l3833" class="code_block"><span class="nv">\begin</span><span class="nb">{itemize}</span>
</div><div id="l3834" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> instantiation</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l3835" class="code_block"><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l3836" class="code_block"><span class="nb">  </span><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Atom</span><span class="m">2</span><span class="nb">} and {</span><span class="nv">\tt</span><span class="nb"> Atom</span><span class="m">3</span><span class="nb">} are both variables</span>
</div><div id="l3837" class="code_block"><span class="nv">\begin</span><span class="nb">{itemize}</span>
</div><div id="l3838" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> instantiation</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l3839" class="code_block"><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l3840" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Atom</span><span class="m">1</span><span class="nb">} is neither a variable nor an atom</span>
</div><div id="l3841" class="code_block"><span class="nv">\begin</span><span class="nb">{itemize}      </span>
</div><div id="l3842" class="code_block"><span class="nv">\item</span><span class="nb">   {</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">atom,Atom</span><span class="m">1</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3843" class="code_block"><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l3844" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Atom</span><span class="m">2</span><span class="nb">} is neither a variable nor an atom</span>
</div><div id="l3845" class="code_block"><span class="nv">\begin</span><span class="nb">{itemize}      </span>
</div><div id="l3846" class="code_block"><span class="nv">\item</span><span class="nb">   {</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">atom,Atom</span><span class="m">2</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3847" class="code_block"><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l3848" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> Atom</span><span class="m">3</span><span class="nb">} is neither a variable nor an atom</span>
</div><div id="l3849" class="code_block"><span class="nv">\begin</span><span class="nb">{itemize}      </span>
</div><div id="l3850" class="code_block"><span class="nv">\item</span><span class="nb">   {</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">atom,Atom</span><span class="m">3</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3851" class="code_block"><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l3852" class="code_block"><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l3853" class="code_block">
</div><div id="l3854" class="code_block"><span class="nv">\isoitem</span><span class="nb">{sub</span><span class="nv">\_</span><span class="nb">atom</span><span class="o">(+</span><span class="nb">Atom,?LeftLength,?CenterLength,?RightLength,?CenterAtom}{sub</span><span class="nv">\_</span><span class="nb">atom</span><span class="o">/</span><span class="m">5</span><span class="nb"> }</span>
</div><div id="l3855" class="code_block"><span class="c">%</span>
</div><div id="l3856" class="code_block"><span class="nb">Succeeds if {</span><span class="nv">\tt</span><span class="nb"> Atom} can be broken into three pieces: A left atom of</span>
</div><div id="l3857" class="code_block"><span class="nb">length {</span><span class="nv">\tt</span><span class="nb"> LeftLength}, a center atom {</span><span class="nv">\tt</span><span class="nb"> CenterAtom} of length {</span><span class="nv">\tt</span>
</div><div id="l3858" class="code_block"><span class="nb">  CenterLength} and a right atom of length {</span><span class="nv">\tt</span><span class="nb"> RightLength}.  If</span>
</div><div id="l3859" class="code_block"><span class="nb">sufficient arguments are uninstantiated to produce {</span><span class="nv">\tt</span><span class="nb"> CenterAtom} in</span>
</div><div id="l3860" class="code_block"><span class="nb">non</span><span class="o">-</span><span class="nb">deterministic starting positions, the predicate will backtrack</span>
</div><div id="l3861" class="code_block"><span class="nb">through all center atoms for which the left atom length is the</span>
</div><div id="l3862" class="code_block"><span class="nb">smallest , up to those whose left atom length is greatest </span><span class="o">(</span><span class="nb">see</span>
</div><div id="l3863" class="code_block"><span class="nb">examples below</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3864" class="code_block">
</div><div id="l3865" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Examples}</span>
</div><div id="l3866" class="code_block"><span class="nb">{</span><span class="nv">\small</span>
</div><div id="l3867" class="code_block"><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l3868" class="code_block"><span class="nb">| ?</span><span class="o">-</span><span class="nb"> sub_atom</span><span class="o">(</span><span class="nb">trilobyte,</span><span class="m">5</span><span class="nb">,</span><span class="m">4</span><span class="nb">,RL,CA</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3869" class="code_block">
</div><div id="l3870" class="code_block"><span class="nb">RL </span><span class="o">=</span><span class="nb"> </span><span class="m">0</span>
</div><div id="l3871" class="code_block"><span class="nb">CA </span><span class="o">=</span><span class="nb"> byte</span>
</div><div id="l3872" class="code_block"><span class="nb">| ?</span><span class="o">-</span><span class="nb"> sub_atom</span><span class="o">(</span><span class="nb">trilobyte,</span><span class="m">1</span><span class="nb">,CL,</span><span class="m">2</span><span class="nb">,CA</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3873" class="code_block">
</div><div id="l3874" class="code_block"><span class="nb">CL </span><span class="o">=</span><span class="nb"> </span><span class="m">6</span>
</div><div id="l3875" class="code_block"><span class="nb">CA </span><span class="o">=</span><span class="nb"> riloby</span>
</div><div id="l3876" class="code_block"><span class="nb">| ?</span><span class="o">-</span><span class="nb"> sub_atom</span><span class="o">(</span><span class="nb">trilobyte,LL,</span><span class="m">6</span><span class="nb">,RL,riloby</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3877" class="code_block">
</div><div id="l3878" class="code_block"><span class="nb">LL </span><span class="o">=</span><span class="nb"> </span><span class="m">1</span>
</div><div id="l3879" class="code_block"><span class="nb">RL </span><span class="o">=</span><span class="nb"> </span><span class="m">2</span>
</div><div id="l3880" class="code_block"><span class="nb">| ?</span><span class="o">-</span><span class="nb"> sub_atom</span><span class="o">(</span><span class="nb">trilobyte,RL,</span><span class="m">4</span><span class="nb">,LL,CA</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3881" class="code_block">
</div><div id="l3882" class="code_block"><span class="nb">RL </span><span class="o">=</span><span class="nb"> </span><span class="m">0</span>
</div><div id="l3883" class="code_block"><span class="nb">LL </span><span class="o">=</span><span class="nb"> </span><span class="m">5</span>
</div><div id="l3884" class="code_block"><span class="nb">CA </span><span class="o">=</span><span class="nb"> tril;</span>
</div><div id="l3885" class="code_block">
</div><div id="l3886" class="code_block"><span class="nb">RL </span><span class="o">=</span><span class="nb"> </span><span class="m">1</span>
</div><div id="l3887" class="code_block"><span class="nb">LL </span><span class="o">=</span><span class="nb"> </span><span class="m">4</span>
</div><div id="l3888" class="code_block"><span class="nb">CA </span><span class="o">=</span><span class="nb"> rilo;</span>
</div><div id="l3889" class="code_block">
</div><div id="l3890" class="code_block"><span class="nb">RL </span><span class="o">=</span><span class="nb"> </span><span class="m">2</span>
</div><div id="l3891" class="code_block"><span class="nb">CL </span><span class="o">=</span><span class="nb"> </span><span class="m">3</span>
</div><div id="l3892" class="code_block"><span class="nb">CA </span><span class="o">=</span><span class="nb"> ilob</span>
</div><div id="l3893" class="code_block"><span class="nb">| ?</span><span class="o">-</span><span class="nb"> sub_atom</span><span class="o">(</span><span class="nb">trilobyte,LL,CL,RL,CA</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3894" class="code_block">
</div><div id="l3895" class="code_block"><span class="nb">LL </span><span class="o">=</span><span class="nb"> </span><span class="m">0</span>
</div><div id="l3896" class="code_block"><span class="nb">CL </span><span class="o">=</span><span class="nb"> </span><span class="m">0</span>
</div><div id="l3897" class="code_block"><span class="nb">RL </span><span class="o">=</span><span class="nb"> </span><span class="m">9</span>
</div><div id="l3898" class="code_block"><span class="nb">CA </span><span class="o">=</span><span class="nb"> ;</span>
</div><div id="l3899" class="code_block">
</div><div id="l3900" class="code_block"><span class="nb">LL </span><span class="o">=</span><span class="nb"> </span><span class="m">0</span>
</div><div id="l3901" class="code_block"><span class="nb">CL </span><span class="o">=</span><span class="nb"> </span><span class="m">1</span>
</div><div id="l3902" class="code_block"><span class="nb">RL </span><span class="o">=</span><span class="nb"> </span><span class="m">8</span>
</div><div id="l3903" class="code_block"><span class="nb">CA </span><span class="o">=</span><span class="nb"> t;</span>
</div><div id="l3904" class="code_block">
</div><div id="l3905" class="code_block"><span class="nb">LL </span><span class="o">=</span><span class="nb"> </span><span class="m">0</span>
</div><div id="l3906" class="code_block"><span class="nb">CL </span><span class="o">=</span><span class="nb"> </span><span class="m">2</span>
</div><div id="l3907" class="code_block"><span class="nb">RL </span><span class="o">=</span><span class="nb"> </span><span class="m">7</span>
</div><div id="l3908" class="code_block"><span class="nb">CA </span><span class="o">=</span><span class="nb"> tr;</span>
</div><div id="l3909" class="code_block">
</div><div id="l3910" class="code_block"><span class="nb">: </span><span class="o">/*</span><span class="nb"> after more backtracking </span><span class="o">*/</span>
</div><div id="l3911" class="code_block">
</div><div id="l3912" class="code_block"><span class="nb">LL </span><span class="o">=</span><span class="nb"> </span><span class="m">0</span>
</div><div id="l3913" class="code_block"><span class="nb">CL </span><span class="o">=</span><span class="nb"> </span><span class="m">9</span>
</div><div id="l3914" class="code_block"><span class="nb">RL </span><span class="o">=</span><span class="nb"> </span><span class="m">0</span>
</div><div id="l3915" class="code_block"><span class="nb">CA </span><span class="o">=</span><span class="nb"> trilobyte;</span>
</div><div id="l3916" class="code_block">
</div><div id="l3917" class="code_block"><span class="nb">LL </span><span class="o">=</span><span class="nb"> </span><span class="m">1</span>
</div><div id="l3918" class="code_block"><span class="nb">CL </span><span class="o">=</span><span class="nb"> </span><span class="m">0</span>
</div><div id="l3919" class="code_block"><span class="nb">RL </span><span class="o">=</span><span class="nb"> </span><span class="m">8</span>
</div><div id="l3920" class="code_block"><span class="nb">CA </span><span class="o">=</span><span class="nb"> ;</span>
</div><div id="l3921" class="code_block">
</div><div id="l3922" class="code_block"><span class="nb">Ll </span><span class="o">=</span><span class="nb"> </span><span class="m">1</span>
</div><div id="l3923" class="code_block"><span class="nb">CL </span><span class="o">=</span><span class="nb"> </span><span class="m">1</span>
</div><div id="l3924" class="code_block"><span class="nb">RL </span><span class="o">=</span><span class="nb"> </span><span class="m">7</span>
</div><div id="l3925" class="code_block"><span class="nb">CA </span><span class="o">=</span><span class="nb"> r;</span>
</div><div id="l3926" class="code_block"><span class="nv">\end</span><span class="nb">{verbatim}</span>
</div><div id="l3927" class="code_block"><span class="nb">}</span>
</div><div id="l3928" class="code_block">
</div><div id="l3929" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Error Cases}</span>
</div><div id="l3930" class="code_block"><span class="nv">\bi</span>
</div><div id="l3931" class="code_block"><span class="nv">\item</span><span class="nb">  {</span><span class="nv">\tt</span><span class="nb"> Atom} is a variable</span>
</div><div id="l3932" class="code_block"><span class="nv">\bi</span>
</div><div id="l3933" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> instantiation</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l3934" class="code_block"><span class="nv">\ei</span>
</div><div id="l3935" class="code_block"><span class="nv">\item</span><span class="nb">  {</span><span class="nv">\tt</span><span class="nb"> Atom} is neither a variable nor an atom</span>
</div><div id="l3936" class="code_block"><span class="nv">\bi</span>
</div><div id="l3937" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">atom, Atom</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3938" class="code_block"><span class="nv">\ei</span>
</div><div id="l3939" class="code_block"><span class="nv">\item</span><span class="nb">  {</span><span class="nv">\tt</span><span class="nb"> CenterAtom} is neither a variable nor an atom</span>
</div><div id="l3940" class="code_block"><span class="nv">\bi</span>
</div><div id="l3941" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">atom, CenterAtom</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3942" class="code_block"><span class="nv">\ei</span>
</div><div id="l3943" class="code_block"><span class="nv">\item</span><span class="nb">  {</span><span class="nv">\tt</span><span class="nb"> LeftLength} is neither a variable nor an integer</span>
</div><div id="l3944" class="code_block"><span class="nv">\bi</span>
</div><div id="l3945" class="code_block"><span class="nv">\item</span><span class="nb">  {</span><span class="nv">\tt</span><span class="nb">  type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">integer, LeftLength</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3946" class="code_block"><span class="nv">\ei</span>
</div><div id="l3947" class="code_block"><span class="nv">\item</span><span class="nb">  {</span><span class="nv">\tt</span><span class="nb"> CenterLength} is neither a variable nor an integer</span>
</div><div id="l3948" class="code_block"><span class="nv">\bi</span>
</div><div id="l3949" class="code_block"><span class="nv">\item</span><span class="nb">  {</span><span class="nv">\tt</span><span class="nb">  type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">integer, CenterLength</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3950" class="code_block"><span class="nv">\ei</span>
</div><div id="l3951" class="code_block"><span class="nv">\item</span><span class="nb">  {</span><span class="nv">\tt</span><span class="nb"> RightLength} is neither a variable nor an integer</span>
</div><div id="l3952" class="code_block"><span class="nv">\bi</span>
</div><div id="l3953" class="code_block"><span class="nv">\item</span><span class="nb">  {</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">integer, RightLength</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3954" class="code_block"><span class="nv">\ei</span>
</div><div id="l3955" class="code_block"><span class="nv">\item</span><span class="nb">  {</span><span class="nv">\tt</span><span class="nb"> LeftLength} is an integer that is less than zero</span>
</div><div id="l3956" class="code_block"><span class="nv">\bi</span>
</div><div id="l3957" class="code_block"><span class="nv">\item</span><span class="nb">  {</span><span class="nv">\tt</span><span class="nb">  domain</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">not</span><span class="nv">\_</span><span class="nb">less</span><span class="nv">\_</span><span class="nb">than</span><span class="nv">\_</span><span class="nb">zero, LeftLength</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3958" class="code_block"><span class="nv">\ei</span>
</div><div id="l3959" class="code_block"><span class="nv">\item</span><span class="nb">  {</span><span class="nv">\tt</span><span class="nb"> CenterLength} is an integer that is less than zero</span>
</div><div id="l3960" class="code_block"><span class="nv">\bi</span>
</div><div id="l3961" class="code_block"><span class="nv">\item</span><span class="nb">  {</span><span class="nv">\tt</span><span class="nb">  domain</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">not</span><span class="nv">\_</span><span class="nb">less</span><span class="nv">\_</span><span class="nb">than</span><span class="nv">\_</span><span class="nb">zero, CenterLength</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3962" class="code_block"><span class="nv">\ei</span>
</div><div id="l3963" class="code_block"><span class="nv">\item</span><span class="nb">  {</span><span class="nv">\tt</span><span class="nb"> RightLength} is an integer that is less than zero</span>
</div><div id="l3964" class="code_block"><span class="nv">\bi</span>
</div><div id="l3965" class="code_block"><span class="nv">\item</span><span class="nb">  {</span><span class="nv">\tt</span><span class="nb">  domain</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">not</span><span class="nv">\_</span><span class="nb">less</span><span class="nv">\_</span><span class="nb">than</span><span class="nv">\_</span><span class="nb">zero, RightLength</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l3966" class="code_block"><span class="nv">\ei</span>
</div><div id="l3967" class="code_block"><span class="nv">\ei</span>
</div><div id="l3968" class="code_block">
</div><div id="l3969" class="code_block"><span class="nv">\ourmoditem</span><span class="nb">{term</span><span class="nv">\_</span><span class="nb">to</span><span class="nv">\_</span><span class="nb">atom</span><span class="o">(+</span><span class="nb">Term,</span><span class="o">-</span><span class="nb">Atom,</span><span class="o">+</span><span class="nb">Options</span><span class="o">)</span><span class="nb">}{term</span><span class="nv">\_</span><span class="nb">to</span><span class="nv">\_</span><span class="nb">atom</span><span class="o">/</span><span class="m">3</span><span class="nb">}{string}</span>
</div><div id="l3970" class="code_block"><span class="c">%</span>
</div><div id="l3971" class="code_block"><span class="nb">Converts {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">+</span><span class="nb">Term} to an atomic form according to a list of write</span>
</div><div id="l3972" class="code_block"><span class="nb">options, {</span><span class="nv">\tt</span><span class="nb"> Options}, that are similar to those used by {</span><span class="nv">\tt</span>
</div><div id="l3973" class="code_block"><span class="nb">write</span><span class="nv">\_</span><span class="nb">term</span><span class="o">/[</span><span class="m">2</span><span class="nb">,</span><span class="m">3</span><span class="o">]</span><span class="nb">}.  The various options of {</span><span class="nv">\tt</span>
</div><div id="l3974" class="code_block"><span class="nb">term</span><span class="nv">\_</span><span class="nb">to</span><span class="nv">\_</span><span class="nb">atom</span><span class="o">/[</span><span class="m">2</span><span class="nb">,</span><span class="m">3</span><span class="o">]</span><span class="nb">} are especially useful for the interface from C</span>
</div><div id="l3975" class="code_block"><span class="nb">to XSB </span><span class="o">(</span><span class="nb">see {</span><span class="nv">\em</span><span class="nb"> Calling XSB from C} in Volume </span><span class="m">2</span><span class="nb"> of this manual</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l3976" class="code_block"><span class="c">%</span>
</div><div id="l3977" class="code_block"><span class="nv">\begin</span><span class="nb">{itemize}</span>
</div><div id="l3978" class="code_block"><span class="c">%</span>
</div><div id="l3979" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> quoted</span><span class="o">(+</span><span class="nb">Bool</span><span class="o">)</span><span class="nb">}.  If {</span><span class="nv">\tt</span><span class="nb"> Bool </span><span class="o">=</span><span class="nb"> true}, then atoms and</span>
</div><div id="l3980" class="code_block"><span class="nb">    functors that can&#39;t be read back by {</span><span class="nv">\tt</span><span class="nb"> read</span><span class="o">/</span><span class="m">1</span><span class="nb">} are quoted, if</span>
</div><div id="l3981" class="code_block"><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> Bool </span><span class="o">=</span><span class="nb"> false}, each atom and functor is written as its</span>
</div><div id="l3982" class="code_block"><span class="nb">    unquoted name. Default value is {</span><span class="nv">\tt</span><span class="nb"> false}.</span>
</div><div id="l3983" class="code_block"><span class="c">%</span>
</div><div id="l3984" class="code_block"><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> ignore</span><span class="nv">\_</span><span class="nb">ops</span><span class="o">(+</span><span class="nb">Bool</span><span class="o">)</span><span class="nb">}. If {</span><span class="nv">\tt</span><span class="nb"> Bool </span><span class="o">=</span><span class="nb"> true} each compound term</span>
</div><div id="l3985" class="code_block"><span class="nb">is output in functional notation; list braces are ignored, as are all</span>
</div><div id="l3986" class="code_block"><span class="nb">explicitly defined operators.  If {</span><span class="nv">\tt</span><span class="nb"> Bool </span><span class="o">=</span><span class="nb"> canonical}, bracketed list</span>
</div><div id="l3987" class="code_block"><span class="nb">notation is used.  Default value is {</span><span class="nv">\tt</span><span class="nb"> canonical}.  The</span>
</div><div id="l3988" class="code_block"><span class="nb">corresponding value of {</span><span class="nv">\tt</span><span class="nb"> false}, that would enable operator</span>
</div><div id="l3989" class="code_block"><span class="nb">precedence, is not yet implemented.</span>
</div><div id="l3990" class="code_block"><span class="c">%</span>
</div><div id="l3991" class="code_block"><span class="nb"> </span><span class="nv">\item</span><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> numbervars</span><span class="o">(+</span><span class="nb">Bool</span><span class="o">)</span><span class="nb">}.  If {</span><span class="nv">\tt</span><span class="nb"> Bool </span><span class="o">=</span><span class="nb"> true}, a term of the</span>
</div><div id="l3992" class="code_block"><span class="nb">form {</span><span class="nv">\tt</span><span class="nb"> &#39;</span><span class="nv">\$</span><span class="nb">VAR&#39;</span><span class="o">(</span><span class="nb">N</span><span class="o">)</span><span class="nb">} where {</span><span class="nv">\tt</span><span class="nb"> N} is an integer, is output as a</span>
</div><div id="l3993" class="code_block"><span class="nb">variable name consisting of a capital letter possibly followed by an</span>
</div><div id="l3994" class="code_block"><span class="nb">integer.  A term of the form {</span><span class="nv">\tt</span><span class="nb"> &#39;</span><span class="nv">\$</span><span class="nb">VAR&#39;</span><span class="o">(</span><span class="nb">Atom</span><span class="o">)</span><span class="nb">} where {</span><span class="nv">\tt</span><span class="nb"> Atom} is an</span>
</div><div id="l3995" class="code_block"><span class="nb">atom, is output as itself </span><span class="o">(</span><span class="nb">without quotes</span><span class="o">)</span><span class="nb">.  Finally, a term of the</span>
</div><div id="l3996" class="code_block"><span class="nb">form {</span><span class="nv">\tt</span><span class="nb"> &#39;</span><span class="nv">\$</span><span class="nb">VAR&#39;</span><span class="o">(</span><span class="nb">String</span><span class="o">)</span><span class="nb">} where {</span><span class="nv">\tt</span><span class="nb"> String} is a character string, is</span>
</div><div id="l3997" class="code_block"><span class="nb">output as the atom corresponding to this character string.  If</span>
</div><div id="l3998" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> bool} is {</span><span class="nv">\tt</span><span class="nb"> false} this cases are not treated in any special</span>
</div><div id="l3999" class="code_block"><span class="nb">way.  Default value is {</span><span class="nv">\tt</span><span class="nb"> false}.</span>
</div><div id="l4000" class="code_block"><span class="c">%</span>
</div><div id="l4001" class="code_block"><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l4002" class="code_block">
</div><div id="l4003" class="code_block"><span class="nb">{</span><span class="nv">\bf</span><span class="nb"> Error Cases} </span>
</div><div id="l4004" class="code_block"><span class="nv">\bi</span>
</div><div id="l4005" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Options} is a variable</span>
</div><div id="l4006" class="code_block"><span class="nv">\bi</span>
</div><div id="l4007" class="code_block"><span class="nv">\item</span><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> instantiation</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l4008" class="code_block"><span class="nv">\ei</span>
</div><div id="l4009" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Options} neither a variable nor a list</span>
</div><div id="l4010" class="code_block"><span class="nv">\bi</span>
</div><div id="l4011" class="code_block"><span class="nv">\item</span><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> type</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">list,Options</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l4012" class="code_block"><span class="nv">\ei</span>
</div><div id="l4013" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Options} contains a variable element, {</span><span class="nv">\tt</span><span class="nb"> O}</span>
</div><div id="l4014" class="code_block"><span class="nv">\bi</span>
</div><div id="l4015" class="code_block"><span class="nv">\item</span><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> instantiation</span><span class="nv">\_</span><span class="nb">error}</span>
</div><div id="l4016" class="code_block"><span class="nv">\ei</span>
</div><div id="l4017" class="code_block"><span class="nv">\item</span><span class="nb"> 	{</span><span class="nv">\tt</span><span class="nb"> Options} contains an element {</span><span class="nv">\tt</span><span class="nb"> O} that is neither a variable</span>
</div><div id="l4018" class="code_block"><span class="nb">nor a write option.</span>
</div><div id="l4019" class="code_block"><span class="nv">\bi</span>
</div><div id="l4020" class="code_block"><span class="nv">\item</span><span class="nb">    {</span><span class="nv">\tt</span><span class="nb"> domain</span><span class="nv">\_</span><span class="nb">error</span><span class="o">(</span><span class="nb">write</span><span class="nv">\_</span><span class="nb">option,O</span><span class="o">)</span><span class="nb">}</span>
</div><div id="l4021" class="code_block"><span class="nv">\ei</span>
</div><div id="l4022" class="code_block"><span class="nv">\ei</span>
</div><div id="l4023" class="code_block">
</div><div id="l4024" class="code_block"><span class="nb">Examples:</span>
</div><div id="l4025" class="code_block"><span class="nb">{</span><span class="nv">\footnotesize</span>
</div><div id="l4026" class="code_block"><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l4027" class="code_block"><span class="nb">| ?</span><span class="o">-</span><span class="nb"> term_to_atom</span><span class="o">(</span><span class="nb">f</span><span class="o">(</span><span class="nb">a,</span><span class="m">1</span><span class="nb">,X,</span><span class="o">[</span><span class="nb">&#39;</span><span class="m">3</span><span class="nb">cpio&#39;,d</span><span class="o">(</span><span class="m">3</span><span class="o">)</span><span class="nb">,&#39;</span><span class="s">$</span>VAR&#39;(&quot;Foo&quot;)]),F,[]).
</div><div id="l4028" class="code_block">
</div><div id="l4029" class="code_block">X = <span class="nb">_</span>h131
</div><div id="l4030" class="code_block">F = f(a,1,<span class="nb">_</span>h0,[3cpio,d(3),<span class="s">$</span><span class="nb">VAR</span><span class="o">([</span><span class="m">70</span><span class="nb">,</span><span class="m">111</span><span class="nb">,</span><span class="m">111</span><span class="o">])])</span>
</div><div id="l4031" class="code_block">
</div><div id="l4032" class="code_block"><span class="nb">yes</span>
</div><div id="l4033" class="code_block"><span class="nb">| ?</span><span class="o">-</span><span class="nb"> term_to_atom</span><span class="o">(</span><span class="nb">f</span><span class="o">(</span><span class="nb">a,</span><span class="m">1</span><span class="nb">,X,</span><span class="o">[</span><span class="nb">&#39;</span><span class="m">3</span><span class="nb">cpio&#39;,d</span><span class="o">(</span><span class="m">3</span><span class="o">)</span><span class="nb">,&#39;</span><span class="s">$</span>VAR&#39;(&quot;Foo&quot;)]),F,[numbervars(true)]).
</div><div id="l4034" class="code_block">
</div><div id="l4035" class="code_block">X = <span class="nb">_</span>h131
</div><div id="l4036" class="code_block">F = f(a,1,<span class="nb">_</span>h0,[3cpio,d(3),Foo])
</div><div id="l4037" class="code_block">
</div><div id="l4038" class="code_block">yes
</div><div id="l4039" class="code_block">| ?- term<span class="nb">_</span>to<span class="nb">_</span>atom(f(a,1,X,[&#39;3cpio&#39;,d(3),&#39;<span class="s">$</span><span class="nb">VAR&#39;</span><span class="o">(</span><span class="nb">&quot;Foo&quot;</span><span class="o">)])</span><span class="nb">,F,</span><span class="o">[</span><span class="nb">numbervars</span><span class="o">(</span><span class="nb">true</span><span class="o">)</span><span class="nb">,quoted</span><span class="o">(</span><span class="nb">true</span><span class="o">)])</span><span class="nb">.</span>
</div><div id="l4040" class="code_block">
</div><div id="l4041" class="code_block"><span class="nb">X </span><span class="o">=</span><span class="nb"> _h</span><span class="m">131</span>
</div><div id="l4042" class="code_block"><span class="nb">F </span><span class="o">=</span><span class="nb"> f</span><span class="o">(</span><span class="nb">a,</span><span class="m">1</span><span class="nb">,_h</span><span class="m">0</span><span class="nb">,</span><span class="o">[</span><span class="nb">&#39;</span><span class="m">3</span><span class="nb">cpio&#39;,d</span><span class="o">(</span><span class="m">3</span><span class="o">)</span><span class="nb">,Foo</span><span class="o">])</span>
</div><div id="l4043" class="code_block">
</div><div id="l4044" class="code_block"><span class="nb">yes</span>
</div><div id="l4045" class="code_block"><span class="nb">| ?</span><span class="o">-</span><span class="nb"> term_to_atom</span><span class="o">(</span><span class="nb">f</span><span class="o">(</span><span class="nb">a,</span><span class="m">1</span><span class="nb">,X,</span><span class="o">[</span><span class="nb">&#39;</span><span class="m">3</span><span class="nb">cpio&#39;,d</span><span class="o">(</span><span class="m">3</span><span class="o">)</span><span class="nb">,&#39;</span><span class="s">$</span>VAR&#39;(&quot;Foo&quot;)]),F,[numbervars(true),quoted(true),ignore<span class="nb">_</span>ops(true)]).
</div><div id="l4046" class="code_block">
</div><div id="l4047" class="code_block">X = <span class="nb">_</span>h131
</div><div id="l4048" class="code_block">F = f(a,1,<span class="nb">_</span>h0,&#39;.&#39;(&#39;3cpio&#39;,&#39;.&#39;(d(3),&#39;.&#39;(Foo,[]))))
</div><div id="l4049" class="code_block">
</div><div id="l4050" class="code_block">yes
</div><div id="l4051" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}}</span>
</div><div id="l4052" class="code_block">
</div><div id="l4053" class="code_block"><span class="k">\ourmoditem</span><span class="nb">{</span>term<span class="k">\_to\_atom</span>(+Term,-Atom)<span class="nb">}{</span>term<span class="k">\_to\_atom</span>/2<span class="nb">}{</span>string<span class="nb">}</span>
</div><div id="l4054" class="code_block"><span class="c">%</span>
</div><div id="l4055" class="code_block">This predicate converts an arbitrary Prolog term <span class="nb">{</span><span class="k">\tt</span> Term<span class="nb">}</span> into an
</div><div id="l4056" class="code_block">atom, putting the result in <span class="nb">{</span><span class="k">\tt</span> Atom<span class="nb">}</span>.  It is defined using the
</div><div id="l4057" class="code_block">default options for <span class="nb">{</span><span class="k">\tt</span> term<span class="k">\_to\_atom</span>/3<span class="nb">}</span>, e.g. <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l4058" class="code_block">ignore<span class="k">\_ops</span>(canonical)<span class="nb">}</span>, <span class="nb">{</span><span class="k">\tt</span> quoted(false)<span class="nb">}</span>, and <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l4059" class="code_block">numbervars(false)<span class="nb">}</span>.
</div><div id="l4060" class="code_block">
</div><div id="l4061" class="code_block"><span class="k">\ourmoditem</span><span class="nb">{</span>term<span class="k">\_to\_codes</span>(+Term,-CodeList,+OptionList)<span class="nb">}{</span>term<span class="k">\_to\_codes</span>/3 <span class="nb">}{</span>string<span class="nb">}</span>
</div><div id="l4062" class="code_block"><span class="c">%</span>
</div><div id="l4063" class="code_block">This predicate is used in the definition of <span class="nb">{</span><span class="k">\tt</span> term<span class="k">\_to\_atom</span>/3<span class="nb">}</span> but
</div><div id="l4064" class="code_block">only converts a term into a list of ASCII codes, and does not intern
</div><div id="l4065" class="code_block">the list as an atom.  Allowed values for <span class="nb">{</span><span class="k">\tt</span> OptionList<span class="nb">}</span> and error
</div><div id="l4066" class="code_block">cases are the same as in <span class="nb">{</span><span class="k">\tt</span> term<span class="k">\_to\_atm</span>/3<span class="nb">}</span>.
</div><div id="l4067" class="code_block">
</div><div id="l4068" class="code_block"><span class="k">\ourmoditem</span><span class="nb">{</span>term<span class="k">\_to\_codes</span>(+Term,-CodeList)<span class="nb">}{</span>term<span class="k">\_to\_codes</span>/2<span class="nb">}{</span>string<span class="nb">}</span>
</div><div id="l4069" class="code_block"><span class="c">%</span>
</div><div id="l4070" class="code_block">This predicate converts a term to a list of ASCII codes.  It is
</div><div id="l4071" class="code_block">defined using the default options for <span class="nb">{</span><span class="k">\tt</span> term<span class="k">\_to\_atom</span>/3<span class="nb">}</span>,
</div><div id="l4072" class="code_block">e.g. <span class="nb">{</span><span class="k">\tt</span> ignore<span class="k">\_ops</span>(canonical)<span class="nb">}</span>, <span class="nb">{</span><span class="k">\tt</span> quoted(false)<span class="nb">}</span>, and <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l4073" class="code_block">numbervars(false)<span class="nb">}</span>.
</div><div id="l4074" class="code_block">
</div><div id="l4075" class="code_block"><span class="k">\standarditem</span><span class="nb">{</span>gc<span class="k">\_atoms</span><span class="nb">}{</span>gc<span class="k">\_atoms</span>/0<span class="nb">}</span>
</div><div id="l4076" class="code_block"><span class="k">\index</span><span class="nb">{</span>garbage collection!atoms<span class="nb">}</span>
</div><div id="l4077" class="code_block"><span class="c">%</span>
</div><div id="l4078" class="code_block">Explicitly invokes the garbage collector for atoms that are created,
</div><div id="l4079" class="code_block">but no longer needed.  By default, <span class="nb">{</span><span class="k">\tt</span> gc<span class="k">\_atoms</span>/1<span class="nb">}</span> is called
</div><div id="l4080" class="code_block">automatically, unless the <span class="nb">{</span><span class="k">\tt</span> xsb<span class="k">\_flag</span><span class="nb">}</span> <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l4081" class="code_block">  atom<span class="k">\_garbage\_collection</span><span class="nb">}</span> is set to <span class="nb">{</span><span class="k">\tt</span> false<span class="nb">}</span>, or if more than
</div><div id="l4082" class="code_block">one thread is active.  However there are reasons why a user may need
</div><div id="l4083" class="code_block">to invoke atom table garbage collection.  First, in <span class="k">\version</span><span class="nb">{}</span>, if
</div><div id="l4084" class="code_block">atom table garbage collection is invoked automatically, it occurs
</div><div id="l4085" class="code_block">periodically on heap garbage collection, or if numerous asserts and
</div><div id="l4086" class="code_block">retracts have taken place.  These heuristics overlook certain cases
</div><div id="l4087" class="code_block">where numerous atoms may be created without invoking the garbage
</div><div id="l4088" class="code_block">collector -- e.g. through repeated uses of <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l4089" class="code_block">  format<span class="k">\_write\_string</span>/3<span class="nb">}</span>.  In addition if user-defined C code
</div><div id="l4090" class="code_block">contains pointers to XSB&#39;s atom table, atom table garbage collection
</div><div id="l4091" class="code_block">will be unsafe, as <span class="k">\version</span><span class="nb">{}</span> of XSB does not detect such pointers in
</div><div id="l4092" class="code_block">external code.  In such cases, atom table garbage collection should be
</div><div id="l4093" class="code_block">turned off via the <span class="nb">{</span><span class="k">\tt</span> xsb<span class="k">\_flag</span><span class="nb">}</span> <span class="nb">{</span><span class="k">\tt</span> atom<span class="k">\_garbage\_collection</span><span class="nb">}</span>,
</div><div id="l4094" class="code_block">and reinvoked at a point where the external pointers are no longer
</div><div id="l4095" class="code_block">used.
</div><div id="l4096" class="code_block">
</div><div id="l4097" class="code_block"><span class="k">\end</span><span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l4098" class="code_block">
</div><div id="l4099" class="code_block">
</div><div id="l4100" class="code_block"><span class="k">\section</span><span class="nb">{</span>All Solutions and Aggregate Predicates<span class="nb">}</span>
</div><div id="l4101" class="code_block"><span class="k">\index</span><span class="nb">{</span>sets, bags<span class="nb">}</span> <span class="k">\index</span><span class="nb">{</span>aggregate predicates!prolog<span class="nb">}</span>
</div><div id="l4102" class="code_block"><span class="c">%-----------------------------------------------------</span>
</div><div id="l4103" class="code_block">Often there are many solutions to a problem and it is necessary
</div><div id="l4104" class="code_block">somehow to compare these solutions with one another.  The most general
</div><div id="l4105" class="code_block">way of doing this is to collect all the solutions into a list, which
</div><div id="l4106" class="code_block">may then be processed in any way desired.  So XSB provides
</div><div id="l4107" class="code_block">ISO-standard predicates such as <span class="nb">{</span><span class="k">\tt</span> setof/3<span class="nb">}</span>, <span class="nb">{</span><span class="k">\tt</span> bagof/3<span class="nb">}</span>, and <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l4108" class="code_block">findall/3<span class="nb">}</span> to collect solutions into lists.  Sometimes however, one
</div><div id="l4109" class="code_block">wants simply to perform some aggregate operation over the set of
</div><div id="l4110" class="code_block">solutions, for example to find the maximum or minimum of the set of
</div><div id="l4111" class="code_block">solutions.  XSB uses answer subsumption to produce a 
</div><div id="l4112" class="code_block">powerful aggregation facility as discussed in Section
</div><div id="l4113" class="code_block"><span class="k">\ref</span><span class="nb">{</span>sec:table-aggregation<span class="nb">}</span>
</div><div id="l4114" class="code_block">
</div><div id="l4115" class="code_block"><span class="k">\begin</span><span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l4116" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>setof(?Template, +Goal, ?Set)<span class="nb">}{</span>setof/3<span class="nb">}</span>
</div><div id="l4117" class="code_block">    This predicate may be read as ``<span class="nb">{</span><span class="k">\tt</span> Set<span class="nb">}</span> is the set of all instances 
</div><div id="l4118" class="code_block">    of <span class="nb">{</span><span class="k">\tt</span> Template<span class="nb">}</span> such that <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> is provable&#39;&#39;.
</div><div id="l4119" class="code_block">    If~<span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> is not provable, <span class="nb">{</span><span class="k">\tt</span> setof/3<span class="nb">}</span> fails.
</div><div id="l4120" class="code_block">    The term <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> specifies a goal or goals as in <span class="nb">{</span><span class="k">\tt</span> call(Goal)<span class="nb">}</span>.
</div><div id="l4121" class="code_block">    <span class="nb">{</span><span class="k">\tt</span> Set<span class="nb">}</span> is a set of terms represented as a list of those terms,
</div><div id="l4122" class="code_block">    without duplicates, in the standard order for terms 
</div><div id="l4123" class="code_block">    (see Section~<span class="k">\ref</span><span class="nb">{</span>Comparison<span class="nb">}</span>).
</div><div id="l4124" class="code_block">    If there are uninstantiated variables in <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> which do not also 
</div><div id="l4125" class="code_block">    appear in <span class="nb">{</span><span class="k">\tt</span> Template<span class="nb">}</span>, then a call to this evaluable predicate may backtrack,
</div><div id="l4126" class="code_block">    generating alternative values for~<span class="nb">{</span><span class="k">\tt</span> Set<span class="nb">}</span> corresponding to different
</div><div id="l4127" class="code_block">    instantiations of the free variables of~<span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span>.
</div><div id="l4128" class="code_block">    Variables occurring in <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> will not be treated as free if they 
</div><div id="l4129" class="code_block">    are explicitly bound within~<span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> by an existential quantifier.
</div><div id="l4130" class="code_block">    An existential quantification can be specified as:
</div><div id="l4131" class="code_block">    <span class="k">\begin</span><span class="nb">{</span>center<span class="nb">}</span>
</div><div id="l4132" class="code_block">    <span class="nb">{</span><span class="k">\tt</span> Y <span class="k">\^\</span> G<span class="nb">}</span><span class="k">\index</span><span class="nb">{</span><span class="k">\^</span><span class="nb">}</span>
</div><div id="l4133" class="code_block">    <span class="k">\end</span><span class="nb">{</span>center<span class="nb">}</span>
</div><div id="l4134" class="code_block">    meaning there exists a <span class="nb">{</span><span class="k">\tt</span> Y<span class="nb">}</span> such that <span class="nb">{</span><span class="k">\tt</span> G<span class="nb">}</span> is true,
</div><div id="l4135" class="code_block">    where <span class="nb">{</span><span class="k">\tt</span> Y<span class="nb">}</span> is some Prolog term (usually, a variable).
</div><div id="l4136" class="code_block">  
</div><div id="l4137" class="code_block">    Error cases are the same as predicate <span class="nb">{</span><span class="k">\tt</span> call/1<span class="nb">}</span> (see
</div><div id="l4138" class="code_block">    Section~<span class="k">\ref</span><span class="nb">{</span>meta<span class="nb">_</span>predicates<span class="nb">}</span>).
</div><div id="l4139" class="code_block">
</div><div id="l4140" class="code_block">Example: Consider the following predicate: 
</div><div id="l4141" class="code_block"><span class="c">%</span>
</div><div id="l4142" class="code_block"><span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4143" class="code_block">    p(red,high,1).
</div><div id="l4144" class="code_block">    p(green,low,2).
</div><div id="l4145" class="code_block">    p(blue,high,3).
</div><div id="l4146" class="code_block">    p(black,low,4).
</div><div id="l4147" class="code_block">    p(black,high,5).
</div><div id="l4148" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4149" class="code_block"><span class="c">%</span>
</div><div id="l4150" class="code_block">The goal <span class="k">\verb</span>|?- setof(Color,Height<span class="nb">^</span>Val<span class="nb">^</span>p(Color,Height,Val),List)|
</div><div id="l4151" class="code_block">returns a single solution:
</div><div id="l4152" class="code_block"><span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4153" class="code_block">    Color = <span class="nb">_</span>h73
</div><div id="l4154" class="code_block">    Height = <span class="nb">_</span>h87
</div><div id="l4155" class="code_block">    Val = <span class="nb">_</span>h101
</div><div id="l4156" class="code_block">    L = [black,blue,green,red]
</div><div id="l4157" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4158" class="code_block">
</div><div id="l4159" class="code_block">If <span class="nb">{</span><span class="k">\tt</span> Height<span class="nb">}</span> is removed from the sequence of existential variables, so
</div><div id="l4160" class="code_block">that the goal becomes:<span class="k">\\</span>
</div><div id="l4161" class="code_block"><span class="k">\verb</span>|?- setof(Color,Val<span class="nb">^</span>p(Color,Height,Val),List)<span class="nb">}</span>|, the first solution is:
</div><div id="l4162" class="code_block"><span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4163" class="code_block">    Color = <span class="nb">_</span>h73
</div><div id="l4164" class="code_block">    Val = <span class="nb">_</span>h87
</div><div id="l4165" class="code_block">    Height = high
</div><div id="l4166" class="code_block">    L = [black,blue,red];
</div><div id="l4167" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4168" class="code_block"><span class="c">%</span>
</div><div id="l4169" class="code_block">upon backtracking, a second solution is produced: 
</div><div id="l4170" class="code_block"><span class="c">%</span>
</div><div id="l4171" class="code_block"><span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4172" class="code_block">    Color = <span class="nb">_</span>h73
</div><div id="l4173" class="code_block">    Val = <span class="nb">_</span>h87
</div><div id="l4174" class="code_block">    Height = low
</div><div id="l4175" class="code_block">    L = [black,green]
</div><div id="l4176" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4177" class="code_block">
</div><div id="l4178" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>bagof(?Template, +Goal, ?Bag)<span class="nb">}{</span>bagof/3<span class="nb">}</span>
</div><div id="l4179" class="code_block"><span class="c">%</span>
</div><div id="l4180" class="code_block">This predicate has the same semantics as <span class="nb">{</span><span class="k">\tt</span> setof/3<span class="nb">}</span> except that the
</div><div id="l4181" class="code_block">third argument returns an unsorted list that may contain duplicates.
</div><div id="l4182" class="code_block">
</div><div id="l4183" class="code_block">Error Cases are the same as predicate <span class="nb">{</span><span class="k">\tt</span> call/1<span class="nb">}</span> (see
</div><div id="l4184" class="code_block">Section~<span class="k">\ref</span><span class="nb">{</span>meta<span class="nb">_</span>predicates<span class="nb">}</span>).
</div><div id="l4185" class="code_block">
</div><div id="l4186" class="code_block">Example: 
</div><div id="l4187" class="code_block"><span class="c">%</span>
</div><div id="l4188" class="code_block">For the predicate <span class="nb">{</span><span class="k">\tt</span> p/3<span class="nb">}</span> in the example for <span class="nb">{</span><span class="k">\tt</span> setof/3<span class="nb">}</span>, the
</div><div id="l4189" class="code_block">goal<span class="k">\\</span> 
</div><div id="l4190" class="code_block"><span class="k">\verb</span>|?- bagof(Color,Height<span class="nb">^</span>Val<span class="nb">^</span>p(Color,Height,Val),L)| returns
</div><div id="l4191" class="code_block">the single solution:
</div><div id="l4192" class="code_block"><span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4193" class="code_block">    Color = <span class="nb">_</span>h73
</div><div id="l4194" class="code_block">    Height = <span class="nb">_</span>h87
</div><div id="l4195" class="code_block">    Val = <span class="nb">_</span>h101
</div><div id="l4196" class="code_block">    L = [red,green,blue,black,black];
</div><div id="l4197" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4198" class="code_block">If <span class="nb">{</span><span class="k">\tt</span> Height<span class="nb">}</span> is removed from the sequence of existential variables, so
</div><div id="l4199" class="code_block">that the goal becomes: 
</div><div id="l4200" class="code_block"><span class="k">\verb</span>|?- bagof(Color,Val<span class="nb">^</span>p(Color,Height,Val),List)|, the first solution is:
</div><div id="l4201" class="code_block"><span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4202" class="code_block">    Color = <span class="nb">_</span>h73
</div><div id="l4203" class="code_block">    Val = <span class="nb">_</span>h87
</div><div id="l4204" class="code_block">    Height = high
</div><div id="l4205" class="code_block">    L = [red,blue,black];
</div><div id="l4206" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4207" class="code_block"><span class="c">%</span>
</div><div id="l4208" class="code_block">upon backtracking, a second solution is produced: 
</div><div id="l4209" class="code_block"><span class="c">%</span>
</div><div id="l4210" class="code_block"><span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4211" class="code_block">    Color = <span class="nb">_</span>h73
</div><div id="l4212" class="code_block">    Val = <span class="nb">_</span>h87
</div><div id="l4213" class="code_block">    Height = low
</div><div id="l4214" class="code_block">    L = [green,black];
</div><div id="l4215" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4216" class="code_block">
</div><div id="l4217" class="code_block"><span class="c">%----------</span>
</div><div id="l4218" class="code_block">
</div><div id="l4219" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>findall(?Template, +Goal, ?List)<span class="nb">}{</span>findall/3<span class="nb">}</span>
</div><div id="l4220" class="code_block">Similar to predicate <span class="nb">{</span><span class="k">\tt</span> bagof/3<span class="nb">}</span>, except that variables in <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l4221" class="code_block">  Goal<span class="nb">}</span> that do not occur in <span class="nb">{</span><span class="k">\tt</span> Template<span class="nb">}</span> are treated as
</div><div id="l4222" class="code_block">existential, and alternative lists are not returned for different
</div><div id="l4223" class="code_block">bindings of such variables.  Note that this means that <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span>
</div><div id="l4224" class="code_block">should not contain existential variables.  This makes <span class="nb">{</span><span class="k">\tt</span> findall/3<span class="nb">}</span>
</div><div id="l4225" class="code_block">deterministic (non-backtrackable).  Unlike <span class="nb">{</span><span class="k">\tt</span> setof/3<span class="nb">}</span> and <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l4226" class="code_block">  bagof/3<span class="nb">}</span>, if <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> is unsatisfiable, <span class="nb">{</span><span class="k">\tt</span> findall/3<span class="nb">}</span> succeeds
</div><div id="l4227" class="code_block">binding <span class="nb">{</span><span class="k">\tt</span> List<span class="nb">}</span> to the empty list.
</div><div id="l4228" class="code_block">
</div><div id="l4229" class="code_block">Error cases are the same as <span class="nb">{</span><span class="k">\tt</span> call/1<span class="nb">}</span> (see
</div><div id="l4230" class="code_block">Section~<span class="k">\ref</span><span class="nb">{</span>meta<span class="nb">_</span>predicates<span class="nb">}</span>).
</div><div id="l4231" class="code_block">
</div><div id="l4232" class="code_block">Example: 
</div><div id="l4233" class="code_block"><span class="c">%</span>
</div><div id="l4234" class="code_block">For the predicate <span class="nb">{</span><span class="k">\tt</span> p/3<span class="nb">}</span> in the example for <span class="nb">{</span><span class="k">\tt</span> setof/3<span class="nb">}</span>, the goal <span class="k">\\</span>
</div><div id="l4235" class="code_block"><span class="nb">{</span><span class="k">\tt</span> findall(Color,p(Color,Height,Val),L)<span class="nb">}</span> returns a single solution: 
</div><div id="l4236" class="code_block"><span class="c">%</span>
</div><div id="l4237" class="code_block"><span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4238" class="code_block">    Color = <span class="nb">_</span>h73
</div><div id="l4239" class="code_block">    Height = <span class="nb">_</span>h107
</div><div id="l4240" class="code_block">    Val = <span class="nb">_</span>h121
</div><div id="l4241" class="code_block">    F = [red,green,blue,black,black]
</div><div id="l4242" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4243" class="code_block">
</div><div id="l4244" class="code_block"><span class="c">%----------</span>
</div><div id="l4245" class="code_block"><span class="k">\standarditem</span><span class="nb">{</span>findall(?Template, +Goal, ?List,?Tail)<span class="nb">}{</span>findall/4<span class="nb">}</span>
</div><div id="l4246" class="code_block"><span class="c">%</span>
</div><div id="l4247" class="code_block">Acts as <span class="nb">{</span><span class="k">\tt</span> findall/3<span class="nb">}</span>, but returns the result as the difference-list
</div><div id="l4248" class="code_block"><span class="nb">{</span><span class="k">\tt</span> Bag-Tail<span class="nb">}</span>. In fact, the 3-argument version is defined in terms of
</div><div id="l4249" class="code_block">the 4-argument version:
</div><div id="l4250" class="code_block"><span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4251" class="code_block">findall(Templ, Goal, Bag) :- findall(Templ, Goal, Bag, [])
</div><div id="l4252" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4253" class="code_block">
</div><div id="l4254" class="code_block">Error cases are the same as <span class="nb">{</span><span class="k">\tt</span> findall/3<span class="nb">}</span> (or <span class="nb">{</span><span class="k">\tt</span> call/1<span class="nb">}</span>).
</div><div id="l4255" class="code_block">
</div><div id="l4256" class="code_block"><span class="k">\ourstandarditem</span><span class="nb">{</span>tfindall(?Template, +Goal, ?List)<span class="nb">}{</span>tfindall/3<span class="nb">}{</span>Tabling<span class="nb">}</span>
</div><div id="l4257" class="code_block"><span class="c">%</span>
</div><div id="l4258" class="code_block"><span class="k">\label</span><span class="nb">{</span>tfindall/3<span class="nb">}</span>
</div><div id="l4259" class="code_block">
</div><div id="l4260" class="code_block">    Like <span class="nb">{</span><span class="k">\tt</span> findall/3<span class="nb">}</span>, <span class="nb">{</span><span class="k">\tt</span> tfindall/3<span class="nb">}</span> treats all variables in
</div><div id="l4261" class="code_block">    <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> that do not occur in <span class="nb">{</span><span class="k">\tt</span> Template<span class="nb">}</span> as existential.  However,
</div><div id="l4262" class="code_block">    in <span class="nb">{</span><span class="k">\tt</span> tfindall/3<span class="nb">}</span>, the <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> must be a call to a single
</div><div id="l4263" class="code_block">    tabled predicate.
</div><div id="l4264" class="code_block">	
</div><div id="l4265" class="code_block">    <span class="nb">{</span><span class="k">\tt</span> tfindall/3<span class="nb">}</span> allows <span class="nb">{</span><span class="k">\tt</span> findall<span class="nb">}</span> functionality to be used
</div><div id="l4266" class="code_block">    safely with tabling by throwing an error if it is called
</div><div id="l4267" class="code_block">    recursively.  Its use can be seen by considering the following
</div><div id="l4268" class="code_block">    series of programs.
</div><div id="l4269" class="code_block">
</div><div id="l4270" class="code_block">    <span class="nb">{</span><span class="k">\footnotesize</span>
</div><div id="l4271" class="code_block">    <span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4272" class="code_block">            p1(X):- findall(Y,p1(Y),X).
</div><div id="l4273" class="code_block">    <span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4274" class="code_block"><span class="nb">}</span> 
</div><div id="l4275" class="code_block"><span class="c">%</span>
</div><div id="l4276" class="code_block">When executing the goal <span class="nb">{</span><span class="k">\tt</span> p(X)<span class="nb">}</span>, XSB will throw an error when it
</div><div id="l4277" class="code_block">reaches the maximum number of recursive invocations of findall.
</div><div id="l4278" class="code_block">
</div><div id="l4279" class="code_block">Next, consider the program
</div><div id="l4280" class="code_block">    <span class="nb">{</span><span class="k">\footnotesize</span>
</div><div id="l4281" class="code_block">    <span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4282" class="code_block">            :- table t/1.
</div><div id="l4283" class="code_block">            t(X):- findall(Y,t(Y),X).
</div><div id="l4284" class="code_block">            t(a).
</div><div id="l4285" class="code_block">    <span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4286" class="code_block"><span class="nb">}</span> 
</div><div id="l4287" class="code_block"><span class="c">%</span>
</div><div id="l4288" class="code_block">The query <span class="nb">{</span><span class="k">\tt</span> t(X)<span class="nb">}</span> will terminate without error, but will return two
</div><div id="l4289" class="code_block">answers: <span class="nb">{</span><span class="k">\tt</span> X = []<span class="nb">}</span> and <span class="nb">{</span><span class="k">\tt</span> X = a<span class="nb">}</span>.  These answers are hard to
</div><div id="l4290" class="code_block">defend semantically, since there is an implicit domain closure axiom
</div><div id="l4291" class="code_block">in findall-like predicates.  On the other hand, for the program
</div><div id="l4292" class="code_block"><span class="c">%</span>
</div><div id="l4293" class="code_block"><span class="nb">{</span><span class="k">\footnotesize</span>
</div><div id="l4294" class="code_block">    <span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4295" class="code_block">            :- table t2/1.
</div><div id="l4296" class="code_block">            t2(X):- tfindall(Y,t2(Y),X).
</div><div id="l4297" class="code_block">            t2(a).
</div><div id="l4298" class="code_block">    <span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4299" class="code_block"><span class="nb">}</span>
</div><div id="l4300" class="code_block"><span class="c">%</span>
</div><div id="l4301" class="code_block">the query <span class="nb">{</span><span class="k">\tt</span> t2(X)<span class="nb">}</span> will throw a table error, indicating that a call
</div><div id="l4302" class="code_block">to <span class="nb">{</span><span class="k">\tt</span> tfindall/3<span class="nb">}</span> is apparently non-stratified~footnote<span class="nb">{</span>Detection of
</div><div id="l4303" class="code_block">  non-stratification is based on the approximate detection of
</div><div id="l4304" class="code_block">  dependencies among subgoals maintained by XSB.  This approximation
</div><div id="l4305" class="code_block">  is quite close for local evaluation, but is less close for batched
</div><div id="l4306" class="code_block">  evaluation.<span class="nb">}</span>.  Other behavior for tabled aggregation is provided by
</div><div id="l4307" class="code_block">answer subsumption as discussed in Section~<span class="k">\ref</span><span class="nb">{</span>sec:table-aggregation<span class="nb">}</span>
</div><div id="l4308" class="code_block">
</div><div id="l4309" class="code_block">Other differences between predicates <span class="nb">{</span><span class="k">\tt</span> findall/3<span class="nb">}</span> and <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l4310" class="code_block">  tfindall/3<span class="nb">}</span> can be seen from the following example:
</div><div id="l4311" class="code_block">
</div><div id="l4312" class="code_block">    <span class="nb">{</span><span class="k">\footnotesize</span>
</div><div id="l4313" class="code_block">    <span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4314" class="code_block">            | ?- [user].
</div><div id="l4315" class="code_block">            [Compiling user]
</div><div id="l4316" class="code_block">            :- table p/1.
</div><div id="l4317" class="code_block">            p(a).
</div><div id="l4318" class="code_block">            p(b).
</div><div id="l4319" class="code_block">            [user compiled, cpu time used: 0.639 seconds]
</div><div id="l4320" class="code_block">            [user loaded]
</div><div id="l4321" class="code_block">
</div><div id="l4322" class="code_block">            yes
</div><div id="l4323" class="code_block">            | ?- p(X), findall(Y, p(Y), L).
</div><div id="l4324" class="code_block">
</div><div id="l4325" class="code_block">            X = a
</div><div id="l4326" class="code_block">            Y = <span class="nb">_</span>922928
</div><div id="l4327" class="code_block">            L = [a];
</div><div id="l4328" class="code_block">
</div><div id="l4329" class="code_block">            X = b
</div><div id="l4330" class="code_block">            Y = <span class="nb">_</span>922820
</div><div id="l4331" class="code_block">            L = [a,b];
</div><div id="l4332" class="code_block">
</div><div id="l4333" class="code_block">            no
</div><div id="l4334" class="code_block">            | ?- abolish<span class="nb">_</span>all<span class="nb">_</span>tables.
</div><div id="l4335" class="code_block">
</div><div id="l4336" class="code_block">            yes
</div><div id="l4337" class="code_block">            | ?- p(X), tfindall(Y, p(Y), L).
</div><div id="l4338" class="code_block">
</div><div id="l4339" class="code_block">            X = b
</div><div id="l4340" class="code_block">            Y = <span class="nb">_</span>922820
</div><div id="l4341" class="code_block">            L = [b,a];
</div><div id="l4342" class="code_block">
</div><div id="l4343" class="code_block">            X = a
</div><div id="l4344" class="code_block">            Y = <span class="nb">_</span>922820
</div><div id="l4345" class="code_block">            L = [b,a];
</div><div id="l4346" class="code_block">
</div><div id="l4347" class="code_block">            no
</div><div id="l4348" class="code_block">    <span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4349" class="code_block">    <span class="nb">}</span>
</div><div id="l4350" class="code_block">
</div><div id="l4351" class="code_block">Error cases include those of <span class="nb">{</span><span class="k">\tt</span> findall/3<span class="nb">}</span> (see above), along with 
</div><div id="l4352" class="code_block">    <span class="k">\begin</span><span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l4353" class="code_block">    <span class="k">\item</span><span class="na">[{\tt table\_error}]</span>
</div><div id="l4354" class="code_block">	Upon execution <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> is not a subgoal of a tabled predicate.
</div><div id="l4355" class="code_block">    <span class="k">\item</span><span class="na">[{\tt table\_error}]</span>
</div><div id="l4356" class="code_block">	A call to <span class="nb">{</span><span class="k">\tt</span> tfindall/3<span class="nb">}</span> is apparently non-stratified
</div><div id="l4357" class="code_block">    <span class="k">\end</span><span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l4358" class="code_block">
</div><div id="l4359" class="code_block"><span class="c">%\ourrepeatstandarditem{tsetof(?X, +Goal, ?List)}{tsetof/3}{Tabling}</span>
</div><div id="l4360" class="code_block"><span class="c">%\ourstandarditem{tbagof(?X, +Goal, ?List)}{tbagof/3}{Tabling}</span>
</div><div id="l4361" class="code_block">
</div><div id="l4362" class="code_block"><span class="c">%    {\em Note: {\tt tbagof/3} and {\tt tsetof/3} may be deprecated in</span>
</div><div id="l4363" class="code_block"><span class="c">%    current versions.  Please use the predicates described in</span>
</div><div id="l4364" class="code_block"><span class="c">%    Section~\ref{tabling_aggregate_predicates} if possible.}</span>
</div><div id="l4365" class="code_block">
</div><div id="l4366" class="code_block"><span class="c">%The standard predicates {\tt tbagof/3} and {\tt tsetof/3} provide</span>
</div><div id="l4367" class="code_block"><span class="c">%tabled versions of {\tt bagof/3} and {\tt setof/3} in a similar manner</span>
</div><div id="l4368" class="code_block"><span class="c">%to the way in which {\tt tfindall/3} provides a tabled version of {\tt</span>
</div><div id="l4369" class="code_block"><span class="c">%findall/3}.</span>
</div><div id="l4370" class="code_block">
</div><div id="l4371" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>X <span class="k">\^\</span> Goal<span class="nb">}{</span><span class="k">\^\</span> /2<span class="nb">}</span>
</div><div id="l4372" class="code_block"><span class="c">%</span>
</div><div id="l4373" class="code_block">Within <span class="nb">{</span><span class="k">\tt</span> setof/3<span class="nb">}</span>, <span class="nb">{</span><span class="k">\tt</span> bagof/3<span class="nb">}</span> and the like, the <span class="nb">{</span><span class="k">\tt</span> <span class="k">\^\</span> /2<span class="nb">}</span>
</div><div id="l4374" class="code_block">operator means there exists an <span class="nb">{</span><span class="k">\tt</span> X<span class="nb">}</span> such that <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> is true.
</div><div id="l4375" class="code_block">
</div><div id="l4376" class="code_block"><span class="k">\end</span><span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l4377" class="code_block">
</div><div id="l4378" class="code_block"><span class="c">%\input{aggreates}</span>
</div><div id="l4379" class="code_block"><span class="c">% TLS: took out old bagPO, etc.</span>
</div><div id="l4380" class="code_block">
</div><div id="l4381" class="code_block"><span class="c">%-------------------------------------------------------------------------</span>
</div><div id="l4382" class="code_block">
</div><div id="l4383" class="code_block"><span class="k">\section</span><span class="nb">{</span>Meta-Predicates<span class="nb">}</span> <span class="k">\label</span><span class="nb">{</span>meta<span class="nb">_</span>predicates<span class="nb">}</span>
</div><div id="l4384" class="code_block"><span class="k">\begin</span><span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l4385" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>call(<span class="k">\#</span>X)<span class="nb">}{</span>call/1<span class="nb">}</span>
</div><div id="l4386" class="code_block"><span class="c">%</span>
</div><div id="l4387" class="code_block">    If <span class="nb">{</span><span class="k">\tt</span> X<span class="nb">}</span> is a non-variable term in the program text, then it is 
</div><div id="l4388" class="code_block">    executed exactly as if <span class="nb">{</span><span class="k">\tt</span> X<span class="nb">}</span> appeared in the program text instead 
</div><div id="l4389" class="code_block">    of <span class="nb">{</span><span class="k">\tt</span> call(X)<span class="nb">}</span>,
</div><div id="l4390" class="code_block">    e.g.
</div><div id="l4391" class="code_block">    <span class="k">\begin</span><span class="nb">{</span>center<span class="nb">}</span>
</div><div id="l4392" class="code_block">        <span class="nb">{</span><span class="k">\tt</span> <span class="s">$</span><span class="nv">\ldots</span><span class="s">$</span>, p(a), call( (q(X), r(Y)) ), s(X), <span class="s">$</span><span class="nv">\ldots</span><span class="s">$</span><span class="nb">}</span>
</div><div id="l4393" class="code_block">    <span class="k">\end</span><span class="nb">{</span>center<span class="nb">}</span>
</div><div id="l4394" class="code_block">    is equivalent to
</div><div id="l4395" class="code_block">    <span class="k">\begin</span><span class="nb">{</span>center<span class="nb">}</span>
</div><div id="l4396" class="code_block">        <span class="nb">{</span><span class="k">\tt</span> <span class="s">$</span><span class="nv">\ldots</span><span class="s">$</span>, p(a), q(X), r(Y), s(X), <span class="s">$</span><span class="nv">\ldots</span><span class="s">$</span><span class="nb">}</span>
</div><div id="l4397" class="code_block">    <span class="k">\end</span><span class="nb">{</span>center<span class="nb">}</span>
</div><div id="l4398" class="code_block">    However, if <span class="nb">{</span><span class="k">\tt</span> X<span class="nb">}</span> is a variable in the program text,
</div><div id="l4399" class="code_block">    then if at runtime <span class="nb">{</span><span class="k">\tt</span> X<span class="nb">}</span> is instantiated to a term which 
</div><div id="l4400" class="code_block">    would be acceptable as the body of a clause, the goal 
</div><div id="l4401" class="code_block">    <span class="nb">{</span><span class="k">\tt</span> call(X)<span class="nb">}</span> is executed as if that
</div><div id="l4402" class="code_block">    term appeared textually in place of the <span class="nb">{</span><span class="k">\tt</span> call(X)<span class="nb">}</span>,
</div><div id="l4403" class="code_block">    <span class="nb">{</span><span class="k">\em</span> except that<span class="nb">}</span> any cut (`!&#39;)<span class="k">\index</span><span class="nb">{</span><span class="k">\texttt</span><span class="nb">{</span>&quot;!/0<span class="nb">}}</span><span class="k">\index</span><span class="nb">{</span>cut<span class="nb">}</span>
</div><div id="l4404" class="code_block">    occurring in <span class="nb">{</span><span class="k">\tt</span> X<span class="nb">}</span> will remove only those choice points in~<span class="nb">{</span><span class="k">\tt</span> X<span class="nb">}</span>.
</div><div id="l4405" class="code_block">    If~<span class="nb">{</span><span class="k">\tt</span> X<span class="nb">}</span> is not instantiated as described above,
</div><div id="l4406" class="code_block">    an error message is printed and <span class="nb">{</span><span class="k">\tt</span> call/1<span class="nb">}</span> fails.
</div><div id="l4407" class="code_block">
</div><div id="l4408" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>
</div><div id="l4409" class="code_block">    <span class="k">\begin</span><span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l4410" class="code_block">    <span class="k">\item</span><span class="na">[{\tt instantiation\_error}]</span>
</div><div id="l4411" class="code_block">	<span class="nb">{</span><span class="k">\tt</span> X<span class="nb">}</span> is a variable
</div><div id="l4412" class="code_block">     <span class="k">\item</span><span class="na">[{\tt type\_error(callable,X)}]</span>
</div><div id="l4413" class="code_block">	<span class="nb">{</span><span class="k">\tt</span> X<span class="nb">}</span> is not callable.
</div><div id="l4414" class="code_block">    <span class="k">\end</span><span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l4415" class="code_block">
</div><div id="l4416" class="code_block"><span class="k">\ouritem</span><span class="nb">{</span><span class="k">\#</span>X<span class="nb">}</span>					      
</div><div id="l4417" class="code_block">    (where <span class="nb">{</span><span class="k">\tt</span> X<span class="nb">}</span> is a variable) executes exactly the same as 
</div><div id="l4418" class="code_block">    <span class="nb">{</span><span class="k">\tt</span> call(X)<span class="nb">}</span>.
</div><div id="l4419" class="code_block">    However, the explicit use of <span class="nb">{</span><span class="k">\tt</span> call/1<span class="nb">}</span> is considered better
</div><div id="l4420" class="code_block">    programming practice.  The use of a top level variable subgoal
</div><div id="l4421" class="code_block">    elicits a warning from the compiler.
</div><div id="l4422" class="code_block">
</div><div id="l4423" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>call(Goal,Arg,...)<span class="nb">}{</span>call/[2,10]<span class="nb">}</span>
</div><div id="l4424" class="code_block"><span class="c">%</span>
</div><div id="l4425" class="code_block"><span class="nb">{</span><span class="k">\tt</span> call(Goal,Arg)<span class="nb">}</span> where <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> is an N-ary callable term first
</div><div id="l4426" class="code_block">constructs a new N+1-ary term <span class="nb">{</span><span class="k">\tt</span> NewGoal<span class="nb">}</span> with the same functor and
</div><div id="l4427" class="code_block">first N arguments as <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> and with <span class="nb">{</span><span class="k">\tt</span> Arg<span class="nb">}</span> as its N+1th
</div><div id="l4428" class="code_block">argument, and then calls <span class="nb">{</span><span class="k">\tt</span> NewGoal<span class="nb">}</span>.  As an example,
</div><div id="l4429" class="code_block">
</div><div id="l4430" class="code_block"><span class="nb">{</span><span class="k">\tt</span> call(member(X),[a,b,c])<span class="nb">}</span>
</div><div id="l4431" class="code_block">
</div><div id="l4432" class="code_block">is equivalent to <span class="nb">{</span><span class="k">\tt</span> call(member(X,[a,b,c])<span class="nb">}</span>.  <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> must be a
</div><div id="l4433" class="code_block">callable term, but can be prepended by a module name using the <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l4434" class="code_block">  :/2<span class="nb">}</span> symbol.  <span class="nb">{</span><span class="k">\tt</span> call(Goal,Arg1,Arg2,...)<span class="nb">}</span> will act similarly. 
</div><div id="l4435" class="code_block">Note that <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> should usually be atomic -- if the outer functor 
</div><div id="l4436" class="code_block">of <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> is, say, <span class="nb">{</span><span class="k">\tt</span> ,/2<span class="nb">}</span>, <span class="nb">{</span><span class="k">\tt</span> call/[2-10]<span class="nb">}</span> will try to add 
</div><div id="l4437" class="code_block">the extra argument(s) to the comma functor, which is generally not 
</div><div id="l4438" class="code_block">the intended behavior.
</div><div id="l4439" class="code_block">
</div><div id="l4440" class="code_block">While meta calls are generally fast in XSB, the extra term
</div><div id="l4441" class="code_block">manipulation of <span class="nb">{</span><span class="k">\tt</span> call/[2-10]<span class="nb">}</span> makes it somewhat slower than <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l4442" class="code_block">  call/1<span class="nb">}</span>.
</div><div id="l4443" class="code_block">
</div><div id="l4444" class="code_block"><span class="k">\ourstandarditem</span><span class="nb">{</span>call<span class="k">\_tv</span>(<span class="k">\#</span>Goal,-TV)<span class="nb">}{</span>call<span class="k">\_tv</span>/2<span class="nb">}{</span>Tabling<span class="nb">}</span>
</div><div id="l4445" class="code_block"><span class="c">%</span>
</div><div id="l4446" class="code_block">Calls <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> just as with <span class="nb">{</span><span class="k">\tt</span> call/1<span class="nb">}</span>, and if <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> does not
</div><div id="l4447" class="code_block">fail, instantiates <span class="nb">{</span><span class="k">\tt</span> TV<span class="nb">}</span> with either <span class="nb">{</span><span class="k">\tt</span> true<span class="nb">}</span> or <span class="nb">{</span><span class="k">\tt</span> undefined<span class="nb">}</span>,
</div><div id="l4448" class="code_block">depending on the value of <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> in the well-founded semantics.
</div><div id="l4449" class="code_block"><span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> need not be tabled itself.
</div><div id="l4450" class="code_block">
</div><div id="l4451" class="code_block">    Error cases are the same as <span class="nb">{</span><span class="k">\tt</span> call/1<span class="nb">}</span>.
</div><div id="l4452" class="code_block">
</div><div id="l4453" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>once(<span class="k">\#</span>X)<span class="nb">}{</span>once/1<span class="nb">}</span>
</div><div id="l4454" class="code_block"><span class="c">%</span>
</div><div id="l4455" class="code_block">    <span class="nb">{</span><span class="k">\tt</span> once/1<span class="nb">}</span> is defined as <span class="nb">{</span><span class="k">\tt</span> once(X):- call(X),!.<span class="nb">}</span>  <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l4456" class="code_block">    once/1<span class="nb">}</span> should be used with care in tabled programs.  The compiler
</div><div id="l4457" class="code_block">    can not determine whether a tabled predicate is called in the
</div><div id="l4458" class="code_block">    scope of <span class="nb">{</span><span class="k">\tt</span> once/1<span class="nb">}</span>, and such a call may lead to runtime errors.
</div><div id="l4459" class="code_block">    If a tabled predicate may occur in the scope of <span class="nb">{</span><span class="k">\tt</span> once/1<span class="nb">}</span>, use
</div><div id="l4460" class="code_block">    <span class="nb">{</span><span class="k">\tt</span> table<span class="k">\_once</span>/1<span class="nb">}</span> instead.
</div><div id="l4461" class="code_block">
</div><div id="l4462" class="code_block">    Error cases are the same as <span class="nb">{</span><span class="k">\tt</span> call/1<span class="nb">}</span>.
</div><div id="l4463" class="code_block">
</div><div id="l4464" class="code_block"><span class="k">\standarditem</span><span class="nb">{</span>forall(Generate,Test)<span class="nb">}{</span>forall/2<span class="nb">}</span>
</div><div id="l4465" class="code_block"><span class="c">%</span>
</div><div id="l4466" class="code_block"><span class="nb">{</span><span class="k">\tt</span> forall(Generate, Test)<span class="nb">}</span> is true iff for all possible bindings of
</div><div id="l4467" class="code_block"><span class="nb">{</span><span class="k">\tt</span> Generate<span class="nb">}</span>, the goal <span class="nb">{</span><span class="k">\tt</span> Test<span class="nb">}</span> is true. Procedurally, abstracting
</div><div id="l4468" class="code_block">error checking, the predicate shall behave as being defined by 
</div><div id="l4469" class="code_block"><span class="k">\verb</span>|<span class="k">\+</span> (call(Generator), <span class="k">\+</span> call(Test))|.
</div><div id="l4470" class="code_block">
</div><div id="l4471" class="code_block">    Error cases are the same as <span class="nb">{</span><span class="k">\tt</span> call/1<span class="nb">}</span>.
</div><div id="l4472" class="code_block">
</div><div id="l4473" class="code_block"><span class="k">\ourstandarditem</span><span class="nb">{</span>table<span class="k">\_once</span>(<span class="k">\#</span>X)<span class="nb">}{</span>table<span class="k">\_once</span>/1<span class="nb">}{</span>Tabling<span class="nb">}</span>
</div><div id="l4474" class="code_block">    <span class="nb">{</span><span class="k">\tt</span> table<span class="k">\_once</span>/1<span class="nb">}</span> is a weaker form of <span class="nb">{</span><span class="k">\tt</span> once/1<span class="nb">}</span>, suitable for
</div><div id="l4475" class="code_block">    situations in which a single solution is desired for a
</div><div id="l4476" class="code_block">    subcomputation that may involve a call to a tabled predicate.  <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l4477" class="code_block">    table<span class="k">\_once</span>(?Pred)<span class="nb">}</span> succeeds only once even if there are many
</div><div id="l4478" class="code_block">    solutions to the subgoal <span class="nb">{</span><span class="k">\tt</span> Pred<span class="nb">}</span>.  However, it does not ``cut
</div><div id="l4479" class="code_block">    over&#39;&#39; the subcomputation started by the subgoal <span class="nb">{</span><span class="k">\tt</span> Pred<span class="nb">}</span>,
</div><div id="l4480" class="code_block">    thereby ensuring the correct evaluation of tabled subgoals.
</div><div id="l4481" class="code_block">
</div><div id="l4482" class="code_block"><span class="k">\isoitem</span><span class="nb">{</span>call<span class="k">\_cleanup</span>(<span class="k">\#</span>Goal,<span class="k">\#</span>Handler)<span class="nb">}{</span>call<span class="k">\_cleanup</span>/2<span class="nb">}</span>
</div><div id="l4483" class="code_block"><span class="c">%</span>
</div><div id="l4484" class="code_block"><span class="nb">{</span><span class="k">\tt</span> call<span class="k">\_cleanup</span>(Goal, Cleanup)<span class="nb">}</span> calls <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> just as if it were
</div><div id="l4485" class="code_block">called via <span class="nb">{</span><span class="k">\tt</span> call/1<span class="nb">}</span>, but it is ensures that <span class="nb">{</span><span class="k">\tt</span> Handler<span class="nb">}</span> will be
</div><div id="l4486" class="code_block">called after <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> finishes execution.  <span class="nb">{</span><span class="k">\tt</span> call<span class="k">\_cleanup</span>/2<span class="nb">}</span> is
</div><div id="l4487" class="code_block">thus useful when <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> uses a resource, (such as a stream, mutex,
</div><div id="l4488" class="code_block">database cursor, etc.) that should be released when <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span>
</div><div id="l4489" class="code_block">finishes execution.
</div><div id="l4490" class="code_block">
</div><div id="l4491" class="code_block">More precisely, <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> finishes execution either 1) by failure, 2)
</div><div id="l4492" class="code_block">by determining that the success of <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> is deterministic, 3)
</div><div id="l4493" class="code_block">when an error is thrown and not handled by <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> or one of its
</div><div id="l4494" class="code_block">subgoals; or 4) when <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> is cut over.  In all of these cases,
</div><div id="l4495" class="code_block"><span class="nb">{</span><span class="k">\tt</span> Handler<span class="nb">}</span> will be called and will succeed non-deterministically.
</div><div id="l4496" class="code_block">We illustrate these cases through examples.
</div><div id="l4497" class="code_block"><span class="k">\begin</span><span class="nb">{</span>itemize<span class="nb">}</span>
</div><div id="l4498" class="code_block"><span class="k">\item</span> Failure of <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span>:
</div><div id="l4499" class="code_block"><span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4500" class="code_block">   ?- call<span class="nb">_</span>cleanup(fail,writeln(failed(Goal))).
</div><div id="l4501" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4502" class="code_block">In this case, <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> has no solutions, and the handler is invoked
</div><div id="l4503" class="code_block">when the engine backtracks out of <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span>.
</div><div id="l4504" class="code_block"><span class="c">%</span>
</div><div id="l4505" class="code_block"><span class="k">\item</span> Deterministic success of <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span>.  Assume that <span class="nb">{</span><span class="k">\tt</span> p(1)<span class="nb">}</span> and
</div><div id="l4506" class="code_block">  <span class="nb">{</span><span class="k">\tt</span> p(2)<span class="nb">}</span> have been asserted.  Then
</div><div id="l4507" class="code_block"><span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4508" class="code_block">   ?- call<span class="nb">_</span>cleanup((p(X),writeln(got(p(X)))),writeln(handled(p(X)))).
</div><div id="l4509" class="code_block">   got(p(1))
</div><div id="l4510" class="code_block">
</div><div id="l4511" class="code_block">   X = 1;
</div><div id="l4512" class="code_block">   got(p(2))
</div><div id="l4513" class="code_block">   handled(p(2))
</div><div id="l4514" class="code_block">
</div><div id="l4515" class="code_block">   X = 2;
</div><div id="l4516" class="code_block">
</div><div id="l4517" class="code_block">  no
</div><div id="l4518" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4519" class="code_block">Note that <span class="nb">{</span><span class="k">\tt</span> Handler<span class="nb">}</span> is called only after the last solution of the
</div><div id="l4520" class="code_block">goal <span class="nb">{</span><span class="k">\tt</span> p(X)<span class="nb">}</span> has been obtained.  XSB decides to call <span class="nb">{</span><span class="k">\tt</span> Handler<span class="nb">}</span>
</div><div id="l4521" class="code_block">only when it can be determined that the success of <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> has left
</div><div id="l4522" class="code_block">no choice points.  In such a case, the final solution has been
</div><div id="l4523" class="code_block">obtained for <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span>.  Of course, it may be that a solution <span class="s">$</span><span class="nb">S</span><span class="s">$</span> to
</div><div id="l4524" class="code_block"><span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> leaves a choice point but the choice point will produce no
</div><div id="l4525" class="code_block">further solutions for <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span>.  XSB will not call <span class="nb">{</span><span class="k">\tt</span> Handler<span class="nb">}</span> in
</div><div id="l4526" class="code_block">this case, rather it will wait until there are no choice points left
</div><div id="l4527" class="code_block">for <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span>.
</div><div id="l4528" class="code_block">
</div><div id="l4529" class="code_block"><span class="k">\item</span> An uncaught error <span class="s">$</span><span class="nb">E</span><span class="s">$</span> is thrown out of <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span>.  In this
</div><div id="l4530" class="code_block">  case, <span class="nb">{</span><span class="k">\tt</span> Handler<span class="nb">}</span> will be called, and then, if <span class="s">$</span><span class="nb">E</span><span class="s">$</span> is uncaught,
</div><div id="l4531" class="code_block">  <span class="s">$</span><span class="nb">E</span><span class="s">$</span> will be rethrown.  This is illustrated in the following example
</div><div id="l4532" class="code_block">  (Error handling is discussed further in Section~<span class="k">\ref</span><span class="nb">{</span>sec:catch<span class="nb">}</span>):
</div><div id="l4533" class="code_block"><span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4534" class="code_block">   ?- catch(call<span class="nb">_</span>cleanup(throw(my<span class="nb">_</span>error),writeln(invoking<span class="nb">_</span>handler)),Ball,write(Ball)).
</div><div id="l4535" class="code_block">   invoking<span class="nb">_</span>handler
</div><div id="l4536" class="code_block">   my<span class="nb">_</span>error
</div><div id="l4537" class="code_block">   yes
</div><div id="l4538" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4539" class="code_block">Of course, <span class="nb">{</span><span class="k">\tt</span> Handler<span class="nb">}</span> itself can be wrapped in a <span class="nb">{</span><span class="k">\tt</span> catch/3<span class="nb">}</span> so
</div><div id="l4540" class="code_block">that any errors will be caught by <span class="nb">{</span><span class="k">\tt</span> call<span class="k">\_cleanup</span>/2<span class="nb">}</span>.
</div><div id="l4541" class="code_block">
</div><div id="l4542" class="code_block"><span class="k">\item</span> Choice points for <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> are removed via a cut.  Consider an
</div><div id="l4543" class="code_block">  example in which <span class="nb">{</span><span class="k">\tt</span> p/1<span class="nb">}</span> has the same extension as above (<span class="nb">{</span><span class="k">\tt</span> p(1),p(2)<span class="nb">}</span>:
</div><div id="l4544" class="code_block"><span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4545" class="code_block">   call<span class="nb">_</span>cleanup(p(X),writeln(handled<span class="nb">_</span>1)),!.
</div><div id="l4546" class="code_block">   handled<span class="nb">_</span>1
</div><div id="l4547" class="code_block">
</div><div id="l4548" class="code_block">X = 1
</div><div id="l4549" class="code_block">
</div><div id="l4550" class="code_block">yes	
</div><div id="l4551" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4552" class="code_block">The handler is invoked immediately when the choice point laid down by
</div><div id="l4553" class="code_block"><span class="nb">{</span><span class="k">\tt</span> p(X)<span class="nb">}</span> is cut over -- before returning to the command line.  If a
</div><div id="l4554" class="code_block">cut cuts over more than goal to be cleaned, more than one handler will be executed:
</div><div id="l4555" class="code_block"><span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4556" class="code_block">   ?-call<span class="nb">_</span>cleanup(p(X),writeln(handled<span class="nb">_</span>4<span class="nb">_</span>1)),
</div><div id="l4557" class="code_block">       call<span class="nb">_</span>cleanup(p(Y),writeln(handled<span class="nb">_</span>4<span class="nb">_</span>2)),
</div><div id="l4558" class="code_block">       call<span class="nb">_</span>cleanup(p(Z),writeln(handled<span class="nb">_</span>4<span class="nb">_</span>3)),
</div><div id="l4559" class="code_block">       !.
</div><div id="l4560" class="code_block">   handled<span class="nb">_</span>4<span class="nb">_</span>3
</div><div id="l4561" class="code_block">   handled<span class="nb">_</span>4<span class="nb">_</span>2
</div><div id="l4562" class="code_block">   handled<span class="nb">_</span>4<span class="nb">_</span>1
</div><div id="l4563" class="code_block"> 
</div><div id="l4564" class="code_block">   X = 1
</div><div id="l4565" class="code_block">   Y = 1
</div><div id="l4566" class="code_block">   Z = 1
</div><div id="l4567" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l4568" class="code_block"><span class="k">\end</span><span class="nb">{</span>itemize<span class="nb">}</span>
</div><div id="l4569" class="code_block">
</div><div id="l4570" class="code_block"><span class="nb">{</span><span class="k">\tt</span> call<span class="k">\_cleanup</span>/2<span class="nb">}</span> is thus an extremely powerful and flexible
</div><div id="l4571" class="code_block">mechanism when used in a simple manner.  While <span class="nb">{</span><span class="k">\tt</span> Handler<span class="nb">}</span> is
</div><div id="l4572" class="code_block">``guaranteed&#39;&#39; to be invoked whenever <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> finishes
</div><div id="l4573" class="code_block">execution~<span class="k">\footnote</span><span class="nb">{</span>In fact we don&#39;t guarantee anything, see XSB&#39;s
</div><div id="l4574" class="code_block">  license.<span class="nb">}</span>, it may be difficult to predict when <span class="nb">{</span><span class="k">\tt</span> Handler<span class="nb">}</span> will be
</div><div id="l4575" class="code_block">invoked, as <span class="nb">{</span><span class="k">\tt</span> Handler<span class="nb">}</span> may be invoked because of deeply non-local
</div><div id="l4576" class="code_block">cuts over <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span>, and even when such cuts are not present, the
</div><div id="l4577" class="code_block">invocation depends on XSB determining when the last solution for <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l4578" class="code_block">  Goal<span class="nb">}</span> has been obtained.  Baroque usages, such as invoking <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l4579" class="code_block">  call<span class="k">\_cleanup</span>/2<span class="nb">}</span> and cuts in the handler are supported, but may lead
</div><div id="l4580" class="code_block">to code that is difficult to debug, since handlers may be invoked
</div><div id="l4581" class="code_block">based on the state of XSB&#39;s choice point stack.  
</div><div id="l4582" class="code_block">
</div><div id="l4583" class="code_block"><span class="nb">{</span><span class="k">\bf</span> Error Cases<span class="nb">}</span>
</div><div id="l4584" class="code_block"><span class="k">\begin</span><span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l4585" class="code_block"><span class="k">\item</span>  <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> is a variable
</div><div id="l4586" class="code_block"><span class="k">\bi</span>
</div><div id="l4587" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> instantiation error<span class="nb">}</span>
</div><div id="l4588" class="code_block"><span class="k">\ei</span>
</div><div id="l4589" class="code_block"><span class="k">\item</span>  <span class="nb">{</span><span class="k">\tt</span> Goal<span class="nb">}</span> is neither a variable nor a callable term
</div><div id="l4590" class="code_block"><span class="k">\bi</span>
</div><div id="l4591" class="code_block"><span class="k">\item</span>  <span class="nb">{</span><span class="k">\tt</span> type error(callable, Goal)<span class="nb">}</span>
</div><div id="l4592" class="code_block"><span class="k">\ei</span>
</div><div id="l4593" class="code_block"><span class="k">\item</span>  <span class="nb">{</span><span class="k">\tt</span> Handler<span class="nb">}</span> is a variable
</div><div id="l4594" class="code_block"><span class="k">\bi</span>
</div><div id="l4595" class="code_block"><span class="k">\item</span>  <span class="nb">{</span><span class="k">\tt</span> instantiation error<span class="nb">}</span>
</div><div id="l4596" class="code_block"><span class="k">\ei</span>
</div><div id="l4597" class="code_block"><span class="k">\item</span>  <span class="nb">{</span><span class="k">\tt</span> Handler<span class="nb">}</span> is neither a variable nor a callable term
</div><div id="l4598" class="code_block"><span class="k">\bi</span>
</div><div id="l4599" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> type error(callable, Handler)<span class="nb">}</span>
</div><div id="l4600" class="code_block"><span class="k">\ei</span>
</div><div id="l4601" class="code_block"><span class="k">\end</span><span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l4602" class="code_block">
</div><div id="l4603" class="code_block"><span class="k">\end</span><span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l4604" class="code_block">
</div><div id="l4605" class="code_block">
</div><div id="l4606" class="code_block"><span class="c">%%% Local Variables: </span>
</div><div id="l4607" class="code_block"><span class="c">%%% mode: latex</span>
</div><div id="l4608" class="code_block"><span class="c">%%% TeX-master: &quot;manual1&quot;</span>
</div><div id="l4609" class="code_block"><span class="c">%%% End: </span>
</div></pre></div></td></tr></table></div>

      
    </div>
  

                    </div>
                    
                    
                </div>
            



        </div>
    </section>
      

    <footer class="sandiego">
    <div class="as-row">
        <div class="footer-wrapper">
            <nav aria-label="Site Links" role="navigation">
                <section>
                    <div class="as-h2">SourceForge</div>
                    <ul>
                    
                        <li><a href="/create/" title="Create a Project">Create a Project</a></li>
                    
                        <li><a href="/directory/" title="Open Source Software Directory">Open Source Software</a></li>
                        <li><a href="/software/" title="Business Software Directory">Business Software</a></li>
                        
                            
                            <li><a href="/top" title="Top Open Source Projects">Top Downloaded Projects</a></li>
                        

                    </ul>
                </section>
            </nav>
            <nav aria-label="Company Links" role="navigation">
                <section>
                    <div class="as-h2">Company</div>
                    <ul>
                        <li><a href="/about">About</a></li>
                        <li><a href="/about/leadership" title="Open Source Software Directory">Team</a></li>
                        <li class="h-card">
                            <address>
                                <span class="p-name p-org">SourceForge Headquarters</span><br>
                                <span class="p-street-address">225 Broadway Suite 1600</span><br>
                                <span class="p-locality">San Diego, CA <span class="p-postal-code">92101</span></span><br>
                                <span class="p-tel">+1 (858) 422-6466</span><br>
                            </address>
                        </li>
                        <li id="social">
                            
<span></span>
<a href="https://twitter.com/sourceforge" class="twitter" rel="nofollow" target="_blank" title="SourceForge on X">


<svg  class="vertical-icon-fix" data-name="twitter" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1684 408q-67 98-162 167 1 14 1 42 0 130-38 259.5t-115.5 248.5-184.5 210.5-258 146-323 54.5q-271 0-496-145 35 4 78 4 225 0 401-138-105-2-188-64.5t-114-159.5q33 5 61 5 43 0 85-11-112-23-185.5-111.5t-73.5-205.5v-4q68 38 146 41-66-44-105-115t-39-154q0-88 44-163 121 149 294.5 238.5t371.5 99.5q-8-38-8-74 0-134 94.5-228.5t228.5-94.5q140 0 236 102 109-21 205-78-37 115-142 178 93-10 186-50z"/></svg></a>
<a href="https://fosstodon.org/@sourceforge" rel="me nofollow" target="_blank" title="SourceForge on Mastodon">


<svg  class="vertical-icon-fix" data-name="mastodon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M433 179.11c0-97.2-63.71-125.7-63.71-125.7-62.52-28.7-228.56-28.4-290.48 0 0 0-63.72 28.5-63.72 125.7 0 115.7-6.6 259.4 105.63 289.1 40.51 10.7 75.32 13 103.33 11.4 50.81-2.8 79.32-18.1 79.32-18.1l-1.7-36.9s-36.31 11.4-77.12 10.1c-40.41-1.4-83-4.4-89.63-54a102.54 102.54 0 0 1-.9-13.9c85.63 20.9 158.65 9.1 178.75 6.7 56.12-6.7 105-41.3 111.23-72.9 9.8-49.8 9-121.5 9-121.5zm-75.12 125.2h-46.63v-114.2c0-49.7-64-51.6-64 6.9v62.5h-46.33V197c0-58.5-64-56.6-64-6.9v114.2H90.19c0-122.1-5.2-147.9 18.41-175 25.9-28.9 79.82-30.8 103.83 6.1l11.6 19.5 11.6-19.5c24.11-37.1 78.12-34.8 103.83-6.1 23.71 27.3 18.4 53 18.4 175z"/></svg></a>
<a href="https://www.facebook.com/sourceforgenet/" class="facebook" rel="nofollow" target="_blank" title="SourceForge on Facebook">


<svg  data-name="facebook" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1343 12v264h-157q-86 0-116 36t-30 108v189h293l-39 296h-254v759h-306v-759h-255v-296h255v-218q0-186 104-288.5t277-102.5q147 0 228 12z"/></svg></a>
<a href="https://www.linkedin.com/company/sourceforge.net" class="linkedin" rel="nofollow" target="_blank" title="SourceForge on LinkedIn">


<svg  data-name="linkedin" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M477 625v991h-330v-991h330zm21-306q1 73-50.5 122t-135.5 49h-2q-82 0-132-49t-50-122q0-74 51.5-122.5t134.5-48.5 133 48.5 51 122.5zm1166 729v568h-329v-530q0-105-40.5-164.5t-126.5-59.5q-63 0-105.5 34.5t-63.5 85.5q-11 30-11 81v553h-329q2-399 2-647t-1-296l-1-48h329v144h-2q20-32 41-56t56.5-52 87-43.5 114.5-15.5q171 0 275 113.5t104 332.5z"/></svg></a>

<a href="/user/newsletters" rel=nofollow class="newsletter" title="Subscribe to our newsletter">


<svg  class="vertical-icon-fix" data-name="mmSF_11mail" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 42 42" enable-background="new 0 0 42 42" xml:space="preserve"><path fill="#FFFFFF" d="M0,6v30h42V6H0z M24.2,21.2c-0.8,0.8-2.3,2-3.2,2c-0.9,0-2.4-1.2-3.2-2L5.8,9.7h30.3L24.2,21.2z M13.7,21l-9.9,9.4V11.6L13.7,21z M15.7,23L15.7,23c0.5,0.5,2.9,2.9,5.3,2.9c2.4,0,4.8-2.4,5.2-2.8l0.1-0.1l9.8,9.4H5.8L15.7,23z M28.3,21l9.9-9.5v18.9L28.3,21z"/></svg></a>

<span></span>
                        </li>
                    </ul>
                </section>
            </nav>
             <nav aria-label="Resources Links" role="navigation">
                <section>
                    <div class="as-h2">Resources</div>
                    <ul>
                        
                            <li><a href="/support" title="Support Section">Support</a></li>
                            <li><a href="/p/forge/documentation/Docs%20Home/" title="Site Documentation">Site Documentation</a></li>
                        
                        <li><a href="https://fosstodon.org/@sourceforgestatus" title="Site Status" rel="me nofollow">Site Status</a></li>
                        <li><a href="/reviews" title="Reviews" rel="me nofollow">SourceForge Reviews</a></li>

                    </ul>
                </section>
            </nav>
            <section class="footer-logo">
                <a href="/" title="Home" class="sf-logo">
                    
    
    <img src="https://a.fsdn.com/con/images/sandiego/sf-logo-full.svg"  alt="SourceForge logo" class="sf-logo-full"/>
                </a>
            </section>
        </div>
    </div>
    <section class="l-nav-bottom">
        <nav class="row">
            
                
            
        
    <div class="columns small-12 large-6 copyright-notice">
        &copy; 2025 Slashdot Media. All Rights Reserved.
    </div>
    <div class="columns large-6 links links-right">
        

    
    

    <a href="https://slashdotmedia.com/terms-of-use" target="_blank" title="Terms" rel="nofollow">Terms</a>
    <a href="https://slashdotmedia.com/privacy-statement/" target="_blank" title="Privacy" rel="nofollow">Privacy</a>

    
    
    

    
        <a href="https://slashdotmedia.com/opt-out-choices/" target="_blank" title="Opt Out" rel="nofollow">Opt Out</a>
    

    
        <a href="https://slashdotmedia.com/contact/" target="_blank" title="Advertise" rel="nofollow">Advertise</a>
    
    </div>
        </nav>
    </section>

    </footer>
    





    
    
    <div id="newsletter-floating" class="sandiego newsletter-floating-new">
        <a class="close-button btn-closer" data-close aria-label="Close modal">
            <span aria-hidden="true">&times;</span>
        </a>
        <div class="as-h2">Want the latest updates on software, tech news, and AI?</div>
        <div class="row">
            <div class="column small-2 medium-2 large-2" style="padding-left: 0px; padding-right: 0px;"><img src="/images/sandiego/sf_email_icon.svg"  alt="" /></div>
            <div class="as-h3 column small-10 medium-10 large-10">Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.</div>
        </div>
        <form action="/user/newsletters/" method="post">
            <div class="row">
              <input class="newsletter-input" type="email" placeholder="Enter your email address" autocomplete="off" name="newsletter_email"
                     value="">
              <input type="hidden" name="source" value="floating">
              <button type="submit" class="button blue newsletter-button">Submit</button>
            </div>
        </form>
    </div>
    






</div>


<div id="messages">
    
</div>


    <!-- ew:body_js -->


    <script type="text/javascript" src="https://a.fsdn.com/allura/nf/1753456284/_ew_/_slim/js?href=allura%2Fjs%2Fjquery.notify.js%3Ballura%2Fjs%2Fjquery.tooltipster.js%3Ballura%2Fjs%2Fallura-base.js%3Ballura%2Fjs%2Fchecklist.js%3Ballura%2Fjs%2Fadmin_modal.js%3Bjs%2Fjquery.lightbox_me.js%3Ballura%2Fjs%2Fmemorable.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fshared.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fsticky.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fsandiego%2Fchrome.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fsandiego%2Futilities.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fvendor%2Ffoundation6%2Fplugins%2Ffoundation.core.min.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fvendor%2Ffoundation6%2Fplugins%2Ffoundation.util.mediaQuery.min.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fvendor%2Ffoundation6%2Fplugins%2Ffoundation.util.keyboard.min.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fvendor%2Ffoundation6%2Fplugins%2Ffoundation.util.box.min.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fvendor%2Ffoundation6%2Fplugins%2Ffoundation.util.nest.min.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fvendor%2Ffoundation6%2Fplugins%2Ffoundation.dropdownMenu.min.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fvendor%2Ffoundation6%2Fplugins%2Ffoundation.offcanvas.min.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fvendor%2Ffoundation6%2Fplugins%2Ffoundation.toggler.min.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fsandiego%2Fproject.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fvendor%2Fjquery.typeahead.min.js%3Ballura%2Fjs%2Fmaximize-content.js"></script>

    
<!-- /ew:body_js -->



    <!-- ew:body_js_tail -->


    <script type="text/javascript" src="https://a.fsdn.com/allura/nf/1753456284/_ew_/_slim/js?href=theme%2Fsftheme%2Fjs%2Fsftheme%2Fvendor%2Ffoundation6%2Fplugins%2Ffoundation.util.triggers.min.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fvendor%2Ffoundation6%2Fplugins%2Ffoundation.reveal.min.js"></script>

    
<!-- /ew:body_js_tail -->




<script type="text/javascript">(function() {
  $('#access_urls .btn').click(function(evt){
    evt.preventDefault();
    var parent = $(this).parents('.btn-bar');
    var checkout_cmd = $(this).attr('data-url');
    $(parent).find('input').val(checkout_cmd);
    $(parent).find('span').text($(this).attr('title')+' access');
    $(this).parent().children('.btn').removeClass('active');
    $(this).addClass('active');
    if (checkout_cmd.indexOf(' http://') !== -1 || checkout_cmd.indexOf(' https://') !== -1 ) {
      $('#http-2fa-msg').show();
    } else {
      $('#http-2fa-msg').hide();
    }
  });
  $('#access_urls .btn').first().click();

  
  var repo_status = document.getElementById('repo_status');
  // The repo_status div will only be present if repo.status != 'ready'
  if (repo_status) {
    $('.spinner').show()
    var delay = 500;
    function check_status() {
        $.get('/p/xsb/src/status', function(data) {
            if (data.status === 'ready') {
                $('.spinner').hide()
                $('#repo_status h2').html('Repo status: ready. <a href="." rel="nofollow">Click here to refresh this page.</a>');
            }
            else {
                $('#repo_status h2 span').html(data.status);
                if (delay < 60000){
                    delay = delay * 2;
                }
                window.setTimeout(check_status, delay);
            }
        });
    }
    var status_checker = window.setTimeout(check_status, delay);
    
  }
}());
</script>

<script type="text/javascript">(function() {
  $(window).on('hashchange', function(e) {
    var hash = window.location.hash.substring(1);
    if ('originalEvent' in e && 'oldURL' in e.originalEvent) {
      $('#' + e.originalEvent.oldURL.split('#')[1]).css('background-color', 'transparent');
    }
    if (hash !== '' && hash.substring(0, 1) === 'l' && !isNaN(hash.substring(1))) {
      $('#' + hash).css('background-color', '#ffff99');
    }
  }).trigger('hashchange');

  var clicks = 0;
  $('.code_block').each(function(index, element) {
    $(element).on('click', function() {
      // Trick to ignore double and triple clicks
      clicks++;
      if (clicks === 1) {
        setTimeout(function() {
          if (clicks === 1) {
            var hash = window.location.hash.substring(1);
            if (hash !== '' && hash.substring(0, 1) === 'l' && !isNaN(hash.substring(1))) {
              $('#' + hash).css('background-color', 'transparent');
            }
            $(element).css('background-color', '#ffff99');
            window.history.pushState({}, document.title, window.location.pathname + window.location.search + '#' + $(element).attr('id'));
          }
          clicks = 0;
        }, 500);
      }
    });
  });
}());
</script>


    


    
    
    <noscript><p><img src="https://analytics.slashdotmedia.com/index.php?idsite=39" style="border:0;position:absolute;top:0;" alt="" /></p></noscript>
    
    <script>
        $(document).foundation();
    </script>
    








    

<script>
    (function () {
        function load_bombora() {
            /*global _ml:true, window */
            _ml = window._ml || {};
            
            _ml.eid = '771';
            _ml.fp = 'e7ad0448-32d5-49fb-8f11-fd2e5104e1d5';  
            var s = document.getElementsByTagName('script')[0], cd = new Date(), mltag = document.createElement('script');
            mltag.type = 'text/javascript';
            mltag.async = true;
            mltag.defer = true;
            mltag.src = '//ml314.com/tag.aspx?' + cd.getDate() + cd.getMonth() + cd.getFullYear();
            s.parentNode.insertBefore(mltag, s);
        }
        bizx.cmp.ifConsent({ purposes: 'all', vendors: 'bombora'}, load_bombora);
    })();
</script>




<script>
    $(document).ready(function () {
        $(".tooltip, .m-tooltip").each(function(){
            let $el = $(this);
            $el.tooltipster({
                animation: 'fade',
                delay: 200,
                theme: 'tooltipster-light',
                trigger: 'hover',
                position: $el.data('position') || 'right',
                iconCloning: false,
                maxWidth: 300,
                contentAsHTML: true,
                interactive: true
            }).focus(function () {
                $(this).tooltipster('show');
            }).blur(function () {
                $(this).tooltipster('hide');
            });
        });
    });
</script>

    



<script type="text/javascript">
    bizx.cmp.ifConsent({ purposes: ['storage', 'measurement'], vendors: 'google-analytics'}, function () {
        /* jshint ignore:start */
        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
                (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
            m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
        /* jshint ignore:end */

        window.dataLayer = window.dataLayer || [];
        function gtag(){ window.dataLayer.push(arguments); }
        window.gtag = window.gtag || gtag;
        bizx.cmp.embedScript("https://www.googletagmanager.com/gtag/js");
        gtag('js', new Date());
        gtag('set', {
            'page_location': 'https://sourceforge.net/p/xsb/src/6903/tree/trunk/XSB/docs/userman/builtin.tex',
        });
    });
</script>










<script>
        function gam(id){
            bizx.cmp.ifConsent({ purposes: 'all' }, function () {
                bizx.cmp.embedScript(`https://pagead2.googlesyndication.com/pagead/js/pcd.js?${id}`,
                    true,  // async
                    'head', // location
                    null, // callback
                    false, // defer
                    {id: `google-pcd-tag-${id}`, 'data-audience-pixel': 'dc_iu=/41014381/DFPAudiencePixel;dc_seg=' + id});
            });
        }

        
            gam("8901705213");gam("8901712041");</script>

<script type="text/javascript">
    /*global ga, gtag */

    
        
        bizx.cmp.ifConsent({ purposes: ['storage', 'measurement'], vendors: 'google-analytics'}, function () {
            gtag('config', 'G-1H226E4E4L', {
                
                send_page_view: false,
                'SF_Page_Type': '', 
                user_properties: {
                    'SF_Logged_in': 'Logged Out', 
                },
                'devicePixelRatio': SF.devicePixelRatio, 
            });
            gtag('event', 'page_view', { send_to: 'G-1H226E4E4L' });
        });
    
    
    
        
</script>

</body>
</html>