% Copyright The Numerical Algorithms Group Limited 1992-94. All rights reserved.
% !! DO NOT MODIFY THIS FILE BY HAND !! Created by ht.awk.
\newcommand{\UniversalSegmentXmpTitle}{UniversalSegment}
\newcommand{\UniversalSegmentXmpNumber}{9.84}
%
% =====================================================================
\begin{page}{UniversalSegmentXmpPage}{9.84 UniversalSegment}
% =====================================================================
\beginscroll

The \spadtype{UniversalSegment} domain generalizes \spadtype{Segment}
by allowing segments without a ``hi'' end point.
\xtc{
}{
\spadpaste{pints  := 1..         \bound{pints}}
}
\xtc{
}{
\spadpaste{nevens := (0..) by -2 \bound{nevens}}
}
\xtc{
Values of type \spadtype{Segment} are automatically converted to
type \spadtype{UniversalSegment} when appropriate.
%-% \HDexptypeindex{Segment}{UniversalSegmentXmpPage}{9.84}{UniversalSegment}
}{
\spadpaste{useg: UniversalSegment(Integer) := 3..10 \bound{useg}}
}
\xtc{
The operation \spadfunFrom{hasHi}{UniversalSegment} is used to test
whether a segment has a \spad{hi} end point.
}{
\spadpaste{hasHi pints  \free{pints}}
}
\xtc{
}{
\spadpaste{hasHi nevens \free{nevens}}
}
\xtc{
}{
\spadpaste{hasHi useg   \free{useg}}
}
\xtc{
All operations available on type \spadtype{Segment} apply to
\spadtype{UniversalSegment}, with the proviso that expansions produce
streams rather than lists.
This is to accommodate infinite expansions.
}{
\spadpaste{expand pints \free{pints}}
}
\xtc{
}{
\spadpaste{expand nevens \free{nevens}}
}
\xtc{
}{
\spadpaste{expand [1, 3, 10..15, 100..]}
}

For more information on related topics,  see
\downlink{`Segment'}{SegmentXmpPage}\ignore{Segment},
\downlink{`SegmentBinding'}{SegmentBindingXmpPage}\ignore{SegmentBinding},
\downlink{`List'}{ListXmpPage}\ignore{List}, and
\downlink{`Stream'}{StreamXmpPage}\ignore{Stream}.
\showBlurb{UniversalSegment}
\endscroll
\autobuttons
\end{page}
%