<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <HTML> <HEAD> <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <META name="GENERATOR" content="hevea 1.06-7 of 2001-11-14"> <TITLE> Predicate information </TITLE> </HEAD> <BODY TEXT=black BGCOLOR=white> <A HREF="manual030.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> <A HREF="manual023.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A> <A HREF="manual032.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> <HR> <TABLE CELLPADDING=0 CELLSPACING=0 WIDTH="100%"> <TR><TD BGCOLOR="#66dbff"><DIV ALIGN=center><TABLE> <TR><TD><FONT SIZE=4><B><A NAME="htoc98">7.8</A></B></FONT></TD> <TD WIDTH="100%" ALIGN=center><FONT SIZE=4><B>Predicate information</B></FONT></TD> </TR></TABLE></DIV></TD> </TR></TABLE><UL> <LI><A HREF="manual031.html#toc69"> <TT>current_predicate/1</TT></A> <LI><A HREF="manual031.html#toc70"> <TT>predicate_property/2</TT></A> </UL> <BR> <A NAME="toc69"></A><TABLE CELLPADDING=0 CELLSPACING=0 WIDTH="100%"> <TR><TD BGCOLOR="#98e7ff"><DIV ALIGN=center><TABLE> <TR><TD><B><A NAME="htoc99">7.8.1</A></B></TD> <TD WIDTH="100%" ALIGN=center><TT><B>current_predicate/1</B></TT></TD> </TR></TABLE></DIV></TD> </TR></TABLE> <A NAME="current-predicate/1"></A> <BR> <B>Templates</B> <DL COMPACT=compact><DT><DD><TT> current_predicate(?predicate_indicator)</TT></DL> <B>Description</B><BR> <BR> <TT>current_predicate(Pred)</TT> succeeds if there exists a predicate indicator of a defined procedure that unifies with <TT>Pred</TT>. All user defined procedures are found, whether static or dynamic. Internal system procedures whose name begins with <TT>'$'</TT> are not found. A user-defined procedure is found even when it has no clauses. A user-defined procedure is not found if it has been abolished. To conform to the ISO reference, built-in predicates are not found except if the <TT>strict_iso</TT> Prolog flag is switched off (section <A HREF="manual045.html#set-prolog-flag/2">7.22.1</A>). This predicate is re-executable on backtracking.<BR> <BR> <B>Errors</B><BR> <TABLE CELLSPACING=2 CELLPADDING=0> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR> <TR><TD VALIGN=top ALIGN=left><TT>Pred</TT> is neither a variable nor a predicate indicator</TD> <TD VALIGN=top ALIGN=center NOWRAP> </TD> <TD VALIGN=top ALIGN=left><TT>type_error(predicate_indicator, Pred)</TT></TD> </TR> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR> <TR><TD VALIGN=top ALIGN=left><TT>Pred</TT> is a term <TT>Name/Arity</TT> and <TT>Arity</TT> is neither a variable nor an integer</TD> <TD VALIGN=top ALIGN=center NOWRAP> </TD> <TD VALIGN=top ALIGN=left><TT>type_error(integer, Arity)</TT></TD> </TR> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR> <TR><TD VALIGN=top ALIGN=left><TT>Pred</TT> is a term <TT>Name/Arity</TT> and <TT>Name</TT> is neither a variable nor an atom</TD> <TD VALIGN=top ALIGN=center NOWRAP> </TD> <TD VALIGN=top ALIGN=left><TT>type_error(atom, Name)</TT></TD> </TR> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR> <TR><TD VALIGN=top ALIGN=left><TT>Pred</TT> is a term <TT>Name/Arity</TT> and <TT>Arity</TT> is an integer < 0</TD> <TD VALIGN=top ALIGN=center NOWRAP> </TD> <TD VALIGN=top ALIGN=left><TT>domain_error(not_less_than_zero, Arity)</TT></TD> </TR> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR> <TR><TD VALIGN=top ALIGN=left><TT>Pred</TT> is a term <TT>Name/Arity</TT> and <TT>Arity</TT> is an integer > <TT>max_arity</TT> flag (section <A HREF="manual045.html#set-prolog-flag/2">7.22.1</A>)</TD> <TD VALIGN=top ALIGN=center NOWRAP> </TD> <TD VALIGN=top ALIGN=left><TT>representation_error(max_arity)</TT></TD> </TR> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR></TABLE><BR> <B>Portability</B><BR> <BR> ISO predicate.<BR> <BR> <A NAME="toc70"></A><TABLE CELLPADDING=0 CELLSPACING=0 WIDTH="100%"> <TR><TD BGCOLOR="#98e7ff"><DIV ALIGN=center><TABLE> <TR><TD><B><A NAME="htoc100">7.8.2</A></B></TD> <TD WIDTH="100%" ALIGN=center><TT><B>predicate_property/2</B></TT></TD> </TR></TABLE></DIV></TD> </TR></TABLE> <A NAME="predicate-property/2"></A> <BR> <B>Templates</B> <DL COMPACT=compact><DT><DD><TT> predicate_property(?predicate_indicator, ?predicate_property)</TT></DL> <B>Description</B><BR> <BR> <TT>predicate_property(Pred, Property)</TT> succeeds if there exists a predicate indicator of a defined procedure that unifies with <TT>Pred</TT> and if <TT>Property</TT> unifies with one of the properties of the procedure. All user defined procedures and built-in predicates are found. Internal system procedures whose name begins with <TT>'$'</TT> are not found. This predicate is re-executable on backtracking.<BR> <BR> <B>Predicate properties</B>: <UL><LI><TT>static</TT>: if the procedure is static.<BR> <BR> <LI><TT>dynamic</TT>: if the procedure is dynamic.<BR> <BR> <LI><TT>private</TT>: if the procedure is private.<BR> <BR> <LI><TT>public</TT>: if the procedure is public.<BR> <BR> <LI><TT>user</TT>: if the procedure is a user-defined procedure.<BR> <BR> <LI><TT>built_in</TT>: if the procedure is a Prolog built-in predicate.<BR> <BR> <LI><TT>built_in_fd</TT>: if the procedure is an FD built-in predicate.<BR> <BR> <LI><TT>native_code</TT>: if the procedure is compiled in native code.<BR> <BR> <LI><TT>prolog_file(File)</TT>: source file from which the predicate has been read.<BR> <BR> <LI><TT>prolog_line(Line)</TT>: line number of the source file.</UL> <B>Errors</B><BR> <TABLE CELLSPACING=2 CELLPADDING=0> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR> <TR><TD VALIGN=top ALIGN=left><TT>Pred</TT> is neither a variable nor a predicate indicator</TD> <TD VALIGN=top ALIGN=center NOWRAP> </TD> <TD VALIGN=top ALIGN=left><TT>type_error(predicate_indicator, Pred)</TT></TD> </TR> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR> <TR><TD VALIGN=top ALIGN=left><TT>Pred</TT> is a term <TT>Name/Arity</TT> and <TT>Arity</TT> is neither a variable nor an integer</TD> <TD VALIGN=top ALIGN=center NOWRAP> </TD> <TD VALIGN=top ALIGN=left><TT>type_error(integer, Arity)</TT></TD> </TR> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR> <TR><TD VALIGN=top ALIGN=left><TT>Pred</TT> is a term <TT>Name/Arity</TT> and <TT>Name</TT> is neither a variable nor an atom</TD> <TD VALIGN=top ALIGN=center NOWRAP> </TD> <TD VALIGN=top ALIGN=left><TT>type_error(atom, Name)</TT></TD> </TR> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR> <TR><TD VALIGN=top ALIGN=left><TT>Pred</TT> is a term <TT>Name/Arity</TT> and <TT>Arity</TT> is an integer < 0</TD> <TD VALIGN=top ALIGN=center NOWRAP> </TD> <TD VALIGN=top ALIGN=left><TT>domain_error(not_less_than_zero, Arity)</TT></TD> </TR> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR> <TR><TD VALIGN=top ALIGN=left><TT>Pred</TT> is a term <TT>Name/Arity</TT> and <TT>Arity</TT> is an integer > <TT>max_arity</TT> flag (section <A HREF="manual045.html#set-prolog-flag/2">7.22.1</A>)</TD> <TD VALIGN=top ALIGN=center NOWRAP> </TD> <TD VALIGN=top ALIGN=left><TT>representation_error(max_arity)</TT></TD> </TR> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR> <TR><TD VALIGN=top ALIGN=left><TT>Property</TT> is neither a variable nor a predicate property term</TD> <TD VALIGN=top ALIGN=center NOWRAP> </TD> <TD VALIGN=top ALIGN=left><TT>domain_error(predicate_property, Property)</TT></TD> </TR> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR> <TR><TD VALIGN=top ALIGN=left><TT>Property</TT> = <TT>prolog_file(File)</TT> and <TT>File</TT> is neither a variable nor an atom</TD> <TD VALIGN=top ALIGN=center NOWRAP> </TD> <TD VALIGN=top ALIGN=left><TT>type_error(atom, File)</TT></TD> </TR> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR> <TR><TD VALIGN=top ALIGN=left><TT>Property</TT> = <TT>prolog_line(Line)</TT> and <TT>Line</TT> is neither a variable nor an integer</TD> <TD VALIGN=top ALIGN=center NOWRAP> </TD> <TD VALIGN=top ALIGN=left><TT>type_error(integer, Line)</TT></TD> </TR> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR></TABLE><BR> <B>Portability</B><BR> <BR> GNU Prolog predicate.<BR> <BR> <HR SIZE=2> Copyright (C) 1999-2002 Daniel Diaz <BR> <BR> Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. <BR> <BR> <A HREF="index.html#copyright">More about the copyright</A> <HR> <A HREF="manual030.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> <A HREF="manual023.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A> <A HREF="manual032.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> </BODY> </HTML>