%% $Date: 2003/09/22 18:05:12 $ $Author: nthiery $ $Revision: 1.1.1.2 $

\begin{Mhelppage}{TableOf}{N. Thiéry}%[DocState=beta]

\begin{MInfo}
  \eng{a type representing tables}
  \de {Typ zum Testen von Tabellen}
\end{MInfo} % end of MInfo

\begin{MIntro}
  \eng{\Mthis\ represents tables; the types of the \emph{indices} and
    of the \emph{entries} can be specified.}
  \de {}
\end{MIntro} % end of MIntro

\begin{MCalls}
  \call[testtype]{obj, \Margs{\Mopt{indices\_type \Mopt{, entries\_type}}}}
  \eng{}

\end{MCalls} % end of MCalls

\begin{MParameters}
  \param{obj}
    \eng{any \mupad\ object}
    \de {ein beliebiges \mupad-Objekt}
  \param{indices\_type}
  \eng{the type of the indices. It can be an object of the library
    \Mup{Type} or one of the possible return values of \Mup{domtype}
    and \Mup{type}} \de {Typ der Indizes}

  \param{entries\_type}
    \eng{the type of the entries.}
    \de {}
\end{MParameters} % end of MParameters

\begin{MReturnValue}
  \eng{see \Mup{testtype}}
  \de {siehe \Mup{testtype}}
\end{MReturnValue} % end of MReturnValue

\MRelatedFunctions{testtype,table,Type::TableOfIndex, Type::TableOfEntry}

\MKeywords{Type,table,index,entry}

\begin{MDetails}
  \eng{The call \Mupc{testtype}{obj, \Margs{indices\_type},
      \Margs{entries\_type}} checks, whether \Mpar{obj} is a
    \Mhref[DOM_TABLE]{table} with indices of type \Mpar{indices\_type}
    and entries of type \Mpar{entries\_type}.}
    
  \eng{The \emph{indices} (resp. the \emph{entries}) of a
    \Mhref[DOM_TABLE]{table} are the left (resp. right) hand sides of
    the operands of a table.}
  
  \eng{\Mpar{indices\_type} and \Mpar{entries\_type} default to
    \Mup{Type::AnyType}}

  \eng{This type does not represent a \Mhref[property,]{property}.}
%%
  \de {}
\end{MDetails} % end of MDetails

\begin{MExample}{ex1}
  \eng{We test if the following objects are tables:}
  \begin{Mexin}
testtype(x, Type::TableOf());
testtype(table(), Type::TableOf())
  \end{Mexin}
  \begin{Mexout}
                             FALSE

                             TRUE
  \end{Mexout}

  \eng{We test if the following objects are tables with integer indexes:}
  \begin{Mexin}
testtype(table(a = 1), Type::TableOf(Type::Integer));
testtype(table(1 = 2), Type::TableOf(Type::Integer))
  \end{Mexin}
  \begin{Mexout}
                             FALSE

                             TRUE
  \end{Mexout}

  \eng{We test if the following objects are tables with integer entries:}
  \begin{Mexin}
testtype(table(a = a), Type::TableOf(Type::AnyType, Type::Integer));
testtype(table(a = 2), Type::TableOf(Type::AnyType, Type::Integer))
  \end{Mexin}
  \begin{Mexout}
                             FALSE

                             TRUE
  \end{Mexout}

  \eng{We test if the following objects are tables with integer
    indexes and entries:}
  \begin{Mexin}
testtype(table(a = a), Type::TableOf(Type::Integer, Type::Integer));
testtype(table(1 = 2), Type::TableOf(Type::Integer, Type::Integer))
  \end{Mexin}
  \begin{Mexout}
                             FALSE

                             TRUE
  \end{Mexout}

\end{MExample} % end of MExample

\begin{MExample}{ex1}
\eng{Test if the following table uses identifiers as indexes:}
\de {Test, ob die gegebene Tabelle eine Tabelle mit Indizes vom Typ \Mup{DOM_IDENT} ist.}
\begin{Mexin}
T := table(a = 1, b = 2, c = 3, d = 4):
testtype(T, Type::TableOf(DOM_IDENT))
\end{Mexin}
\begin{Mexout}
                             TRUE
\end{Mexout}
\eng{Test if the following table uses integers as indexes:}
\de {Test, ob die gegebene Tabelle eine Tabelle mit Indizes vom Typ \Mup{DOM_INT} ist.}
\begin{Mexin}
T := table(a = 1, b = 2, c = 3, d = 4):
testtype(T, Type::TableOf(DOM_INT))
\end{Mexin}
\begin{Mexout}
                             FALSE
\end{Mexout}
\begin{Mexin}
delete T:
\end{Mexin}
\end{MExample} % end of MExample


\begin{MExample}{type}
\eng{The following table uses identifiers as keys and integers as entries:}
\de {Test, ob die gegebene Tabelle eine Tabelle mit Indizes vom Typ \Mup{DOM_INT} ist.}
\begin{Mexin}
T := table(a = 1, b = 2, c = 3, d = 4):
testtype(T, Type::TableOf(Type::AnyType, DOM_INT))
\end{Mexin}
\begin{Mexout}
                             TRUE
\end{Mexout}
\eng{\Mthis\ only checks the type of the entries, not the keys:}
\de {Test, ob die gegebene Tabelle eine Tabelle mit Indizes vom Typ \Mup{DOM_IDENT} ist.}
\begin{Mexin}
T := table(a = 1, b = 2, c = 3, d = 4):
testtype(T, Type::TableOf(Type::AnyType, DOM_IDENT))
\end{Mexin}
\begin{Mexout}
                             FALSE
\end{Mexout}
\begin{Mexin}
delete T:
\end{Mexin}
\end{MExample} % end of MExample

\begin{MChanges}
  \version{3.0}
  \new
  \eng{Deprecates Type::TableOfEntry and Type::TableOfIndices}
\end{MChanges}

\end{Mhelppage}
%% end of helppage 'Predicate'
