% Copyright The Numerical Algorithms Group Limited 1992-94. All rights reserved.
% !! DO NOT MODIFY THIS FILE BY HAND !! Created by ht.awk.
\newcommand{\EqTableXmpTitle}{EqTable}
\newcommand{\EqTableXmpNumber}{9.18}
%
% =====================================================================
\begin{page}{EqTableXmpPage}{9.18 EqTable}
% =====================================================================
\beginscroll
%

The \spadtype{EqTable} domain provides tables where the keys are compared
%-% \HDindex{table}{EqTableXmpPage}{9.18}{EqTable}
using \spadfunFrom{eq?}{EqTable}.
Keys are considered equal only if they are the same instance of a
structure.
This is useful if the keys are themselves updatable structures.
Otherwise, all operations are the same as for type \spadtype{Table}.
See \downlink{`Table'}{TableXmpPage}\ignore{Table} for general information about tables.
\showBlurb{EqTable}

\xtc{
The operation \spadfunFrom{table}{EqTable} is here used to create a table
where the keys are lists of integers.
}{
\spadpaste{e: EqTable(List Integer, Integer) := table() \bound{e}}
}
\xtc{
These two lists are equal according to \spadopFrom{=}{List},
but not according to \spadfunFrom{eq?}{List}.
}{
\spadpaste{l1 := [1,2,3] \bound{l1}}
}
\xtc{
}{
\spadpaste{l2 := [1,2,3] \bound{l2}}
}
\xtc{
Because the two lists are not \spadfunFrom{eq?}{List}, separate values
can be stored under each.
}{
\spadpaste{e.l1 := 111   \free{e l1} \bound{e1}}
}
\xtc{
}{
\spadpaste{e.l2 := 222   \free{e1 l2} \bound{e2}}
}
\xtc{
}{
\spadpaste{e.l1          \free{e2 l1}}
}
\endscroll
\autobuttons
\end{page}
%