Sophie

Sophie

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

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               - Basic predicates handling names of constants</TITLE>
</HEAD>
<BODY> 
Go to the <A HREF="ciao_1.html">first</A>, <A HREF="ciao_21.html">previous</A>, <A HREF="ciao_23.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="SEC147" HREF="ciao_toc.html#TOC147">Basic predicates handling names of constants</A></H1>
<P>
<A NAME="IDX1493"></A>


<P>
<STRONG>Author(s):</STRONG> The CLIP Group.


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


<P>
<STRONG>Version of last change:</STRONG> 1.9#334 (2004/4/13, 13:28:2 CEST)


<P>
The Ciao system provides builtin predicates which allow dealing with names of constants (atoms or numbers). Note that sometimes strings (character code lists) are more suitable to handle sequences of characters.



<UL>
<LI><A HREF="ciao_22.html#SEC148">Usage and interface (atomic_basic)</A>
<LI><A HREF="ciao_22.html#SEC149">Documentation on exports (atomic_basic)</A>
</UL>



<H2><A NAME="SEC148" HREF="ciao_toc.html#TOC148">Usage and interface (<CODE>atomic_basic</CODE>)</A></H2>

<div class="cartouche">

<UL>

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

These predicates are builtin in Ciao, so nothing special has to be done to use them.

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


<UL>

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

<A NAME="IDX1494"></A>
<CODE>name/2</CODE>, 
<A NAME="IDX1495"></A>
<CODE>atom_codes/2</CODE>, 
<A NAME="IDX1496"></A>
<CODE>number_codes/2</CODE>, 
<A NAME="IDX1497"></A>
<CODE>number_codes/3</CODE>, 
<A NAME="IDX1498"></A>
<CODE>atom_number/2</CODE>, 
<A NAME="IDX1499"></A>
<CODE>atom_length/2</CODE>, 
<A NAME="IDX1500"></A>
<CODE>atom_concat/3</CODE>, 
<A NAME="IDX1501"></A>
<CODE>sub_atom/4</CODE>.

</UL>

</UL>

</div class="cartouche">



<H2><A NAME="SEC149" HREF="ciao_toc.html#TOC149">Documentation on exports (<CODE>atomic_basic</CODE>)</A></H2>
<P>
<A NAME="IDX1502"></A>
<A NAME="IDX1503"></A>
<DL>
<DT><span class="define">PREDICATE:</span> <B>name/2:</B>
<DD><A NAME="IDX1504"></A>


<P>
<CODE>name(Const, String)</CODE>


<P>
<CODE>String</CODE> is the list of the ASCII codes of the characters comprising the name of <CODE>Const</CODE>. Note that if <CODE>Const</CODE> is an atom whose name can be interpreted as a number (e.g. '96'), the predicate is not reversible, as that atom will not be constructed when <CODE>Const</CODE> is uninstantiated. Thus it is recommended that new programs use the ISO-compliant predicates 
<A NAME="IDX1505"></A>
<CODE>atom_codes/2</CODE> or 
<A NAME="IDX1506"></A>
<CODE>number_codes/2</CODE>, as these predicates do not have this inconsistency.


<P>
<STRONG>Usage 1:</STRONG> <CODE>name(+constant, ?string)</CODE>

<UL>
<LI><EM>The following properties hold globally:</EM>

This predicate is understood natively by CiaoPP.
 (<CODE>basic_props:native/1</CODE>)
</UL>

<P>
<STRONG>Usage 2:</STRONG> <CODE>name(-constant, +string)</CODE>

<UL>
<LI><EM>Description:</EM> If <CODE>String</CODE> can be interpreted as a number, <CODE>Const</CODE> is unified with that number, otherwise with the atom whose name is <CODE>String</CODE>.

<LI><EM>The following properties hold globally:</EM>

This predicate is understood natively by CiaoPP.
 (<CODE>basic_props:native/1</CODE>)
</UL>

</DL>

<P>
<A NAME="IDX1507"></A>
<A NAME="IDX1508"></A>
<DL>
<DT><span class="define">PREDICATE:</span> <B>atom_codes/2:</B>
<DD><A NAME="IDX1509"></A>


<P>
<CODE>atom_codes(Atom, String)</CODE>


<P>
<CODE>String</CODE> is the list of the ASCII codes of the characters comprising the name of <CODE>Atom</CODE>.


<P>
<STRONG>Usage 1:</STRONG> <CODE>atom_codes(+atm, ?string)</CODE>
<KBD> * ISO * </KBD>

<UL>
<LI><EM>The following properties hold globally:</EM>

This predicate is understood natively by CiaoPP.
 (<CODE>basic_props:native/1</CODE>)
</UL>

<P>
<STRONG>Usage 2:</STRONG> <CODE>atom_codes(-atm, +string)</CODE>
<KBD> * ISO * </KBD>

<UL>
<LI><EM>The following properties hold globally:</EM>

This predicate is understood natively by CiaoPP.
 (<CODE>basic_props:native/1</CODE>)
</UL>

</DL>

<P>
<A NAME="IDX1510"></A>
<A NAME="IDX1511"></A>
<DL>
<DT><span class="define">PREDICATE:</span> <B>number_codes/2:</B>
<DD><A NAME="IDX1512"></A>


<P>
<CODE>number_codes(Number, String)</CODE>


<P>
<CODE>String</CODE> is the list of the ASCII codes of the characters comprising a representation of <CODE>Number</CODE>.


<P>
<STRONG>Usage 1:</STRONG> <CODE>number_codes(+num, ?string)</CODE>
<KBD> * ISO * </KBD>

<UL>
<LI><EM>The following properties hold globally:</EM>

This predicate is understood natively by CiaoPP.
 (<CODE>basic_props:native/1</CODE>)
</UL>

<P>
<STRONG>Usage 2:</STRONG> <CODE>number_codes(-num, +string)</CODE>
<KBD> * ISO * </KBD>

<UL>
<LI><EM>The following properties hold globally:</EM>

This predicate is understood natively by CiaoPP.
 (<CODE>basic_props:native/1</CODE>)
</UL>

</DL>

<P>
<A NAME="IDX1513"></A>
<A NAME="IDX1514"></A>
<DL>
<DT><span class="define">PREDICATE:</span> <B>number_codes/3:</B>
<DD><A NAME="IDX1515"></A>


<P>
<CODE>number_codes(Number, Base, String)</CODE>


<P>
<CODE>String</CODE> is the list of the ASCII codes of the characters comprising a representation of <CODE>Number</CODE> in base <CODE>Base</CODE>.


<P>
<STRONG>Usage 1:</STRONG> <CODE>number_codes(+num, +int, ?string)</CODE>

<UL>
<LI><EM>The following properties hold globally:</EM>

This predicate is understood natively by CiaoPP.
 (<CODE>basic_props:native/1</CODE>)
</UL>

<P>
<STRONG>Usage 2:</STRONG> <CODE>number_codes(-num, +int, +string)</CODE>

<UL>
<LI><EM>The following properties hold globally:</EM>

This predicate is understood natively by CiaoPP.
 (<CODE>basic_props:native/1</CODE>)
</UL>

</DL>

<P>
<A NAME="IDX1516"></A>
<A NAME="IDX1517"></A>
<DL>
<DT><span class="define">PREDICATE:</span> <B>atom_number/2:</B>
<DD><A NAME="IDX1518"></A>


<P>
<CODE>atom_number(Atom, Number)</CODE>


<P>
<CODE>Atom</CODE> can be read as a representation of <CODE>Number</CODE>.


<P>
<STRONG>Usage 1:</STRONG> <CODE>atom_number(+atm, ?num)</CODE>

<UL>
<LI><EM>The following properties hold globally:</EM>

This predicate is understood natively by CiaoPP.
 (<CODE>basic_props:native/1</CODE>)
</UL>

<P>
<STRONG>Usage 2:</STRONG> <CODE>atom_number(-atm, +num)</CODE>

<UL>
<LI><EM>The following properties hold globally:</EM>

This predicate is understood natively by CiaoPP.
 (<CODE>basic_props:native/1</CODE>)
</UL>

</DL>

<P>
<A NAME="IDX1519"></A>
<A NAME="IDX1520"></A>
<DL>
<DT><span class="define">PREDICATE:</span> <B>atom_length/2:</B>
<DD><A NAME="IDX1521"></A>


<P>
<CODE>atom_length(Atom, Length)</CODE>


<P>
<CODE>Length</CODE> is the number of characters forming the name of <CODE>Atom</CODE>.


<P>
<STRONG>Usage:</STRONG> <CODE>atom_length(+atm, ?int)</CODE>
<KBD> * ISO * </KBD>

<UL>
<LI><EM>The following properties hold globally:</EM>

This predicate is understood natively by CiaoPP.
 (<CODE>basic_props:native/1</CODE>)
</UL>

</DL>

<P>
<A NAME="IDX1522"></A>
<A NAME="IDX1523"></A>
<DL>
<DT><span class="define">PREDICATE:</span> <B>atom_concat/3:</B>
<DD><A NAME="IDX1524"></A>


<P>
<CODE>atom_concat(Atom_1, Atom_2, Atom_12)</CODE>


<P>
<CODE>Atom_12</CODE> is the result of concatenating <CODE>Atom_1</CODE> followed by <CODE>Atom_2</CODE>.


<P>
<STRONG>Usage 1:</STRONG> <CODE>atom_concat(+atom, +atom, ?atom)</CODE>
<KBD> * ISO * </KBD>

<UL>
<LI><EM>Description:</EM> Concatenate two atoms.

<LI><EM>The following properties hold globally:</EM>

This predicate is understood natively by CiaoPP.
 (<CODE>basic_props:native/1</CODE>)
</UL>

<P>
<STRONG>Usage 2:</STRONG> <CODE>atom_concat(-atom, -atom, +atom)</CODE>
<KBD> * ISO * </KBD>

<UL>
<LI><EM>Description:</EM> Non-deterministically split an atom.

<LI><EM>The following properties hold globally:</EM>

This predicate is understood natively by CiaoPP.
 (<CODE>basic_props:native/1</CODE>)
</UL>

<P>
<STRONG>Usage 3:</STRONG> <CODE>atom_concat(-atom, +atom, +atom)</CODE>
<KBD> * ISO * </KBD>

<UL>
<LI><EM>Description:</EM> Take out of an atom a certain suffix (or fail if it cannot be done).

<LI><EM>The following properties hold globally:</EM>

This predicate is understood natively by CiaoPP.
 (<CODE>basic_props:native/1</CODE>)
</UL>

<P>
<STRONG>Usage 4:</STRONG> <CODE>atom_concat(+atom, -atom, +atom)</CODE>
<KBD> * ISO * </KBD>

<UL>
<LI><EM>Description:</EM> Take out of an atom a certain prefix (or fail if it cannot be done).

<LI><EM>The following properties hold globally:</EM>

This predicate is understood natively by CiaoPP.
 (<CODE>basic_props:native/1</CODE>)
</UL>

</DL>

<P>
<A NAME="IDX1525"></A>
<A NAME="IDX1526"></A>
<DL>
<DT><span class="define">PREDICATE:</span> <B>sub_atom/4:</B>
<DD><A NAME="IDX1527"></A>


<P>
<CODE>sub_atom(Atom, Before, Length, Sub_atom)</CODE>


<P>
<CODE>Sub_atom</CODE> is formed with <CODE>Length</CODE> consecutive characters of <CODE>Atom</CODE> after the <CODE>Before</CODE> character. For example, the goal <CODE>sub_atom(summer,1,4,umme)</CODE> succeeds.


<P>
<STRONG>Usage:</STRONG> <CODE>sub_atom(+atm, +int, +int, ?atm)</CODE>

<UL>
<LI><EM>The following properties hold globally:</EM>

This predicate is understood natively by CiaoPP.
 (<CODE>basic_props:native/1</CODE>)
</UL>

</DL>

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