aboutsummaryrefslogtreecommitdiff
path: root/src/hyper/pages/SEG.ht
diff options
context:
space:
mode:
Diffstat (limited to 'src/hyper/pages/SEG.ht')
-rw-r--r--src/hyper/pages/SEG.ht89
1 files changed, 89 insertions, 0 deletions
diff --git a/src/hyper/pages/SEG.ht b/src/hyper/pages/SEG.ht
new file mode 100644
index 00000000..03b5cbf7
--- /dev/null
+++ b/src/hyper/pages/SEG.ht
@@ -0,0 +1,89 @@
+% Copyright The Numerical Algorithms Group Limited 1992-94. All rights reserved.
+% !! DO NOT MODIFY THIS FILE BY HAND !! Created by ht.awk.
+\newcommand{\SegmentXmpTitle}{Segment}
+\newcommand{\SegmentXmpNumber}{9.69}
+%
+% =====================================================================
+\begin{page}{SegmentXmpPage}{9.69 Segment}
+% =====================================================================
+\beginscroll
+
+The \spadtype{Segment} domain provides a generalized interval type.
+
+\labelSpace{2pc}
+\xtc{
+Segments are created using the \spadSyntax{..} construct
+by indicating the (included) end points.
+}{
+\spadpaste{s := 3..10 \bound{s}}
+}
+\xtc{
+The first end point is called the \spadfunFrom{lo}{Segment}
+and the second is called \spadfunFrom{hi}{Segment}.
+}{
+\spadpaste{lo s \free{s}}
+}
+\xtc{
+These names are used even though the end points might belong to an
+unordered set.
+}{
+\spadpaste{hi s \free{s}}
+}
+
+\xtc{
+In addition to the end points, each segment has an integer ``increment.''
+An increment can be specified using the ``\spad{by}'' construct.
+\spadkey{by}
+}{
+\spadpaste{t := 10..3 by -2 \bound{t}}
+}
+\xtc{
+This part can be obtained using the \spadfunFrom{incr}{Segment} function.
+}{
+\spadpaste{incr s \free{s}}
+}
+\xtc{
+Unless otherwise specified, the increment is \spad{1}.
+}{
+\spadpaste{incr t \free{t}}
+}
+
+\xtc{
+A single value can be converted to a segment with equal end points.
+This happens if segments and single values are mixed in a list.
+}{
+\spadpaste{l := [1..3, 5, 9, 15..11 by -1] \bound{l}}
+}
+
+\xtc{
+If the underlying type is an ordered ring, it is possible to perform
+additional operations.
+The \spadfunFrom{expand}{Segment} operation creates a list of
+points in a segment.
+}{
+\spadpaste{expand s \free{s}}
+}
+\xtc{
+If \spad{k > 0}, then \spad{expand(l..h by k)} creates the list
+\spad{[l, l+k, ..., lN]} where \spad{lN <= h < lN+k}.
+If \spad{k < 0}, then \spad{lN >= h > lN+k}.
+}{
+\spadpaste{expand t \free{t}}
+}
+
+\xtc{
+It is also possible to expand a list of segments. This is equivalent
+to appending lists obtained by expanding each segment individually.
+}{
+\spadpaste{expand l \free{l}}
+}
+
+For more information on related topics, see
+\downlink{`SegmentBinding'}{SegmentBindingXmpPage}\ignore{SegmentBinding} and
+\downlink{`UniversalSegment'}{UniversalSegmentXmpPage}\ignore{UniversalSegment}.
+%
+\showBlurb{Segment}
+\endscroll
+\autobuttons
+\end{page}
+%