Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > by-pkgid > 2fc07611b08d4a735fd34d5eb60d8e16 > files > 2279

ciao-1.10p8-3mdv2010.0.i586.rpm

<HTML>
<HEAD>
<!-- Created by texi2html 1.56k + clip patches and <A href="http://www.clip.dia.fi.upm.es/Software">lpdoc</A> from ciao.texi on 28 January 2007 -->

<LINK rel="stylesheet" href="ciao.css" type="text/css">
<TITLE>The Ciao Prolog System               - Higher-order predicates</TITLE>
</HEAD>
<BODY> 
Go to the <A HREF="ciao_1.html">first</A>, <A HREF="ciao_97.html">previous</A>, <A HREF="ciao_99.html">next</A>, <A HREF="ciao_241.html">last</A> section, <A HREF="ciao_toc.html">table of contents</A>.
<P><HR><P>


<H1><A NAME="SEC405" HREF="ciao_toc.html#TOC405">Higher-order predicates</A></H1>
<P>
<A NAME="IDX5280"></A>


<P>
<STRONG>Author(s):</STRONG> Daniel Cabeza, Manuel Carro.


<P>
<STRONG>Version:</STRONG> 1.10#7 (2006/4/26, 19:22:13 CEST)


<P>
<STRONG>Version of last change:</STRONG> 1.7#208 (2002/4/23, 19:9:14 CEST)


<P>
This library implements a few basic higher-order predicates. These add functionality to the basic higher-order functionality of Ciao. Examples of the latter are: 
 
Using pred(1): 



<PRE>
  list(L, functor(_,2))
  list(L, &#62;(0))
</PRE>

<P>
Using pred(2): 



<UL>
<LI><A HREF="ciao_98.html#SEC406">Usage and interface (hiordlib)</A>
<LI><A HREF="ciao_98.html#SEC407">Documentation on exports (hiordlib)</A>
</UL>



<H2><A NAME="SEC406" HREF="ciao_toc.html#TOC406">Usage and interface (<CODE>hiordlib</CODE>)</A></H2>

<div class="cartouche">

<UL>

<LI><STRONG>Library usage:</STRONG>

<CODE>:- use_module(library(hiordlib)).</CODE>

<LI><STRONG>Exports:</STRONG>


<UL>

<LI><EM>Predicates:</EM>

<A NAME="IDX5281"></A>
<CODE>map/3</CODE>, 
<A NAME="IDX5282"></A>
<CODE>foldl/4</CODE>, 
<A NAME="IDX5283"></A>
<CODE>minimum/3</CODE>.

</UL>

</UL>

</div class="cartouche">



<H2><A NAME="SEC407" HREF="ciao_toc.html#TOC407">Documentation on exports (<CODE>hiordlib</CODE>)</A></H2>
<P>
<A NAME="IDX5284"></A>
<A NAME="IDX5285"></A>
<DL>
<DT><span class="define">PREDICATE:</span> <B>map/3:</B>
<DD><A NAME="IDX5286"></A>


<P>
<EM>Meta-predicate</EM> with arguments: <CODE>map(?,pred(2),?)</CODE>.


<P>
<STRONG>Usage:</STRONG> <CODE>map(LList, Op, RList)</CODE>

<UL>
<LI><EM>Description:</EM> Examples of use:


<PRE>
  map([1,3,2], arg(f(a,b,c,d)), [a,c,b]) or
  map([1,3,2], nth([a,b,c,d]), [a,c,b])
  map(["D","C"], append("."), ["D.","C."])
</PRE>

 
</UL>

</DL>

<P>
<A NAME="IDX5287"></A>
<A NAME="IDX5288"></A>
<DL>
<DT><span class="define">PREDICATE:</span> <B>foldl/4:</B>
<DD><A NAME="IDX5289"></A>


<P>
<EM>Meta-predicate</EM> with arguments: <CODE>foldl(?,?,pred(3),?)</CODE>.


<P>
<STRONG>Usage:</STRONG> <CODE>foldl(List, Seed, Op, Result)</CODE>

<UL>
<LI><EM>Description:</EM> Example of use:


<PRE>
?- foldl(["daniel","cabeza","gras"], "", 
         (''(X,Y,Z) :- append(X, " "||Y, Z)), R).

R = "daniel cabeza gras " ? 
</PRE>

 
</UL>

</DL>

<P>
<A NAME="IDX5290"></A>
<A NAME="IDX5291"></A>
<DL>
<DT><span class="define">PREDICATE:</span> <B>minimum/3:</B>
<DD><A NAME="IDX5292"></A>


<P>
<EM>Meta-predicate</EM> with arguments: <CODE>minimum(?,pred(2),?)</CODE>.


<P>
<STRONG>Usage:</STRONG> <CODE>minimum(?List, +SmallerThan, ?Minimum)</CODE>

<UL>
<LI><EM>Description:</EM> <CODE>Minimum</CODE> is the smaller in the nonempty list <CODE>List</CODE> according to the relation <CODE>SmallerThan</CODE>:

<A NAME="IDX5293"></A>
<CODE>SmallerThan(X, Y)</CODE> succeeds iff X is smaller than Y. 
<LI><EM>The following properties should hold at call time:</EM>

<CODE>?List</CODE> is a list.
 (<CODE>basic_props:list/1</CODE>)

<CODE>+SmallerThan</CODE> is a term which represents a goal, i.e., an atom or a structure.
 (<CODE>basic_props:callable/1</CODE>)

<CODE>?Minimum</CODE> is any term.
 (<CODE>basic_props:term/1</CODE>)
</UL>

</DL>

<P><HR><P>
Go to the <A HREF="ciao_1.html">first</A>, <A HREF="ciao_97.html">previous</A>, <A HREF="ciao_99.html">next</A>, <A HREF="ciao_241.html">last</A> section, <A HREF="ciao_toc.html">table of contents</A>.
</BODY>
</HTML>