aboutsummaryrefslogtreecommitdiff
path: root/src/hyper/pages/LIB.ht
diff options
context:
space:
mode:
Diffstat (limited to 'src/hyper/pages/LIB.ht')
-rw-r--r--src/hyper/pages/LIB.ht67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/hyper/pages/LIB.ht b/src/hyper/pages/LIB.ht
new file mode 100644
index 00000000..e14b397c
--- /dev/null
+++ b/src/hyper/pages/LIB.ht
@@ -0,0 +1,67 @@
+% Copyright The Numerical Algorithms Group Limited 1992-94. All rights reserved.
+% !! DO NOT MODIFY THIS FILE BY HAND !! Created by ht.awk.
+\newcommand{\LibraryXmpTitle}{Library}
+\newcommand{\LibraryXmpNumber}{9.41}
+%
+% =====================================================================
+\begin{page}{LibraryXmpPage}{9.41 Library}
+% =====================================================================
+\beginscroll
+
+The \spadtype{Library} domain provides a simple way to store \Language{}
+values in a file.
+This domain is similar to \spadtype{KeyedAccessFile} but fewer declarations
+are needed and items of different types can be saved together in the same
+file.
+
+\xtc{
+To create a library, you supply a file name.
+}{
+\spadpaste{stuff := library "/tmp/Neat.stuff" \bound{stuff}}
+}
+\xtc{
+Now values can be saved by key in the file.
+The keys should be mnemonic, just as the field names are for records.
+They can be given either as strings or symbols.
+}{
+\spadpaste{stuff.int := 32**2 \free{stuff}\bound{stuffa}}
+}
+\xtc{
+}{
+\spadpaste{stuff."poly" := x**2 + 1 \free{stuffa}\bound{stuffb}}
+}
+\xtc{
+}{
+\spadpaste{stuff.str := "Hello" \free{stuffb}\bound{stuffc}}
+}
+\xtc{
+You obtain
+the set of available keys using the \spadfunFrom{keys}{Library} operation.
+}{
+\spadpaste{keys stuff \free{stuffa,stuffb,stuffc}\bound{stuffabc}}
+}
+\xtc{
+You extract values by giving the desired key in this way.
+}{
+\spadpaste{stuff.poly \free{stuffb}}
+}
+\xtc{
+}{
+\spadpaste{stuff("poly") \free{stuffb}}
+}
+\noOutputXtc{
+When the file is no longer needed, you should remove it from the
+file system.
+}{
+\spadpaste{)system rm -rf /tmp/Neat.stuff \free{stuff}\bound{rmstuff}}
+}
+
+For more information on related topics, see
+\downlink{`File'}{FileXmpPage}\ignore{File},
+\downlink{`TextFile'}{TextFileXmpPage}\ignore{TextFile}, and
+\downlink{`KeyedAccessFile'}{KeyedAccessFileXmpPage}\ignore{KeyedAccessFile}.
+\showBlurb{Library}
+\endscroll
+\autobuttons
+\end{page}
+%