<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 term manipulation</TITLE> </HEAD> <BODY> Go to the <A HREF="ciao_1.html">first</A>, <A HREF="ciao_19.html">previous</A>, <A HREF="ciao_21.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="SEC141" HREF="ciao_toc.html#TOC141">Basic term manipulation</A></H1> <P> <A NAME="IDX1436"></A> <P> <STRONG>Author(s):</STRONG> Daniel Cabeza, Manuel Hermenegildo. <P> <STRONG>Version:</STRONG> 1.10#7 (2006/4/26, 19:22:13 CEST) <P> <STRONG>Version of last change:</STRONG> 1.9#191 (2003/12/19, 16:47:39 CET) <P> This module provides basic term manipulation. <UL> <LI><A HREF="ciao_20.html#SEC142">Usage and interface (term_basic)</A> <LI><A HREF="ciao_20.html#SEC143">Documentation on exports (term_basic)</A> </UL> <H2><A NAME="SEC142" HREF="ciao_toc.html#TOC142">Usage and interface (<CODE>term_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="IDX1437"></A> <CODE>arg/3</CODE>, <A NAME="IDX1438"></A> <CODE>functor/3</CODE>, <A NAME="IDX1439"></A> <CODE>=../2</CODE>, <A NAME="IDX1440"></A> <CODE>copy_term/2</CODE>, <A NAME="IDX1441"></A> <CODE>C/3</CODE>. <LI><EM>Properties:</EM> <A NAME="IDX1442"></A> <CODE>=/2</CODE>. </UL> </UL> </div class="cartouche"> <H2><A NAME="SEC143" HREF="ciao_toc.html#TOC143">Documentation on exports (<CODE>term_basic</CODE>)</A></H2> <P> <A NAME="IDX1443"></A> <A NAME="IDX1444"></A> <DL> <DT><span class="define">PROPERTY:</span> <B>=/2:</B> <DD><A NAME="IDX1445"></A> <P> <STRONG>Usage:</STRONG> <CODE>X = Y</CODE> <KBD> * ISO * </KBD> <UL> <LI><EM>Description:</EM> <CODE>X</CODE> and <CODE>Y</CODE> unify. <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="IDX1446"></A> <A NAME="IDX1447"></A> <DL> <DT><span class="define">PREDICATE:</span> <B>arg/3:</B> <DD><A NAME="IDX1448"></A> <P> <STRONG>Usage:</STRONG> <CODE>arg(+ArgNo, +Term, ?Arg)</CODE> <KBD> * ISO * </KBD> <UL> <LI><EM>Description:</EM> Argument <CODE>ArgNo</CODE> of the term <CODE>Term</CODE> is <CODE>Arg</CODE>. <LI><EM>The following properties should hold at call time:</EM> <CODE>ArgNo</CODE> is an integer. (<CODE>basic_props:int/1</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="IDX1449"></A> <A NAME="IDX1450"></A> <DL> <DT><span class="define">PREDICATE:</span> <B>functor/3:</B> <DD><A NAME="IDX1451"></A> <P> <STRONG>Usage:</STRONG> <CODE>functor(?Term, ?Name, ?Arity)</CODE> <KBD> * ISO * </KBD> <UL> <LI><EM>Description:</EM> The principal functor of the term <CODE>Term</CODE> has name <CODE>Name</CODE> and arity <CODE>Arity</CODE>. <LI><EM>The following properties hold upon exit:</EM> <CODE>Name</CODE> is an atom. (<CODE>basic_props:atm/1</CODE>) <CODE>Arity</CODE> is a number. (<CODE>basic_props:num/1</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="IDX1452"></A> <A NAME="IDX1453"></A> <DL> <DT><span class="define">PREDICATE:</span> <B>=../2:</B> <DD><A NAME="IDX1454"></A> <P> <STRONG>Usage:</STRONG> <CODE>?Term =.. ?List</CODE> <KBD> * ISO * </KBD> <UL> <LI><EM>Description:</EM> The functor and arguments of the term <CODE>Term</CODE> comprise the list <CODE>List</CODE>. <LI><EM>The following properties hold upon exit:</EM> <CODE>List</CODE> is a list. (<CODE>basic_props:list/1</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="IDX1455"></A> <A NAME="IDX1456"></A> <DL> <DT><span class="define">PREDICATE:</span> <B>copy_term/2:</B> <DD><A NAME="IDX1457"></A> <P> <STRONG>Usage:</STRONG> <CODE>copy_term(Term, Copy)</CODE> <KBD> * ISO * </KBD> <UL> <LI><EM>Description:</EM> <CODE>Copy</CODE> is a renaming of <CODE>Term</CODE>, such that brand new variables have been substituted for all variables in <CODE>Term</CODE>. If any of the variables of <CODE>Term</CODE> have <A NAME="IDX1458"></A> attributes, the copied variables will have copies of the attributes as well. It behaves as if defined by: <PRE> :- data 'copy of'/1. copy_term(X, Y) :- asserta_fact('copy of'(X)), retract_fact('copy of'(Y)). </PRE> <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="IDX1459"></A> <A NAME="IDX1460"></A> <DL> <DT><span class="define">PREDICATE:</span> <B>C/3:</B> <DD><A NAME="IDX1461"></A> <P> <STRONG>Usage:</STRONG> <CODE>C(?S1, ?Terminal, ?S2)</CODE> <UL> <LI><EM>Description:</EM> <CODE>S1</CODE> is connected by the terminal <CODE>Terminal</CODE> to <CODE>S2</CODE>. Internally used in <EM>DCG grammar rules</EM>. Defined as if by the single clause: <CODE>'C'([X|S], X, S).</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><HR><P> Go to the <A HREF="ciao_1.html">first</A>, <A HREF="ciao_19.html">previous</A>, <A HREF="ciao_21.html">next</A>, <A HREF="ciao_241.html">last</A> section, <A HREF="ciao_toc.html">table of contents</A>. </BODY> </HTML>