<!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> Type testing </TITLE> </HEAD> <BODY TEXT=black BGCOLOR=white> <A HREF="manual023.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A> <A HREF="manual025.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="htoc66">7.1</A></B></FONT></TD> <TD WIDTH="100%" ALIGN=center><FONT SIZE=4><B>Type testing</B></FONT></TD> </TR></TABLE></DIV></TD> </TR></TABLE><UL> <LI><A HREF="manual024.html#toc44"> <TT>var/1</TT>, <TT>nonvar/1</TT>, <TT>atom/1</TT>, <TT>integer/1</TT>, <TT>float/1</TT>, <TT>number/1</TT>, <TT>atomic/1</TT>,<BR> <TT>compound/1</TT>, <TT>callable/1</TT>, <TT>list/1</TT>, <TT>partial_list/1</TT>, <TT>list_or_partial_list/1</TT></A> </UL> <BR> <A NAME="toc44"></A><TABLE CELLPADDING=0 CELLSPACING=0 WIDTH="100%"> <TR><TD BGCOLOR="#98e7ff"><DIV ALIGN=center><TABLE> <TR><TD><B><A NAME="htoc67">7.1.1</A></B></TD> <TD WIDTH="100%" ALIGN=center><B><TT>var/1</TT>, <TT>nonvar/1</TT>, <TT>atom/1</TT>, <TT>integer/1</TT>, <TT>float/1</TT>, <TT>number/1</TT>, <TT>atomic/1</TT>,<BR> <TT>compound/1</TT>, <TT>callable/1</TT>, <TT>list/1</TT>, <TT>partial_list/1</TT>, <TT>list_or_partial_list/1</TT></B></TD> </TR></TABLE></DIV></TD> </TR></TABLE> <A NAME="var/1"></A> <BR> <B>Templates</B> <DL COMPACT=compact><DT><DD><TT> var(?term)<BR> nonvar(?term)<BR> atom(?term)<BR> integer(?term)<BR> float(?term)<BR> number(?term)<BR> atomic(?term)<BR> compound(?term)<BR> callable(?term)<BR> list(?term)<BR> partial_list(?term)<BR> list_or_partial_list(?term)</TT></DL> <B>Description</B><BR> <BR> <TT>var(Term)</TT> succeeds if <TT>Term</TT> is currently uninstantiated (which therefore has not been bound to anything, except possibly another uninstantiated variable).<BR> <BR> <TT>nonvar(Term)</TT> succeeds if <TT>Term</TT> is currently instantiated (opposite of <TT>var/1</TT>).<BR> <BR> <TT>atom(Term)</TT> succeeds if <TT>Term</TT> is currently instantiated to an atom.<BR> <BR> <TT>integer(Term)</TT> succeeds if <TT>Term</TT> is currently instantiated to an integer.<BR> <BR> <TT>float(Term)</TT> succeeds if <TT>Term</TT> is currently instantiated to a floating point number.<BR> <BR> <TT>number(Term)</TT> succeeds if <TT>Term</TT> is currently instantiated to an integer or a floating point number.<BR> <BR> <TT>atomic(Term)</TT> succeeds if <TT>Term</TT> is currently instantiated to an atom, an integer or a floating point number.<BR> <BR> <TT>compound(Term)</TT> succeeds if <TT>Term</TT> is currently instantiated to a compound term, i.e. a term of arity > 0 (a list or a structure).<BR> <BR> <TT>callable(Term)</TT> succeeds if <TT>Term</TT> is currently instantiated to a callable term, i.e. an atom or a compound term.<BR> <BR> <TT>list(Term)</TT> succeeds if <TT>Term</TT> is currently instantiated to a list, i.e. the atom <TT>[]</TT> (empty list) or a term with principal functor <TT>'.'/2</TT> and with second argument (the tail) a list.<BR> <BR> <TT>partial_list(Term)</TT> succeeds if <TT>Term</TT> is currently instantiated to a partial list, i.e. a variable or a term whose the main functor is <TT>'.'/2</TT> and the second argument (the tail) is a partial list.<BR> <BR> <TT>list_or_partial_list(Term)</TT> succeeds if <TT>Term</TT> is currently instantiated to a list or a partial list.<BR> <BR> <B>Errors</B><BR> <BR> None.<BR> <BR> <B>Portability</B><BR> <BR> <TT>var/1</TT>, <TT>nonvar/1</TT>, <TT>atom/1</TT>, <TT>integer/1</TT>, <TT>float/1</TT>, <TT>number/1</TT>, <TT>atomic/1</TT>, <TT>compound/1</TT> and <TT>callable/1</TT> are ISO predicates.<BR> <BR> <TT>list/1</TT>, <TT>partial_list/1</TT> and <TT>list_or_partial_list/1</TT> are GNU Prolog predicates.<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="manual023.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A> <A HREF="manual025.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> </BODY> </HTML>