aboutsummaryrefslogtreecommitdiff
path: root/src/hyper/pages/EQTBL.ht
blob: 2e5680b9a56e1e6f331263598beb471b8211c5cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
% 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}
%