SegmentCategory(S)

seg.spad line 1 [edit on github]

This category provides operations on ranges, or segments as they are called.

+ : (%, S) -> % if S has AbelianSemiGroup

(l..h)+i returns segment l+i .. h+i.

+ : (S, %) -> % if S has AbelianSemiGroup

i+(l..h) returns segment i+l .. i+h.

- : (%, S) -> % if S has AbelianGroup

(l..h)-i returns segment l-i .. h-i.

= : (%, %) -> Boolean if S has SetCategory
from BasicType
BY : (%, Integer) -> %

s by n creates a new segment in which only every n-th element is used.

SEGMENT : (S, S) -> %

l..h creates a segment with l and h as the endpoints.

coerce : % -> OutputForm if S has SetCategory
from CoercibleTo(OutputForm)
convert : S -> %

convert(i) creates the segment i..i.

convert : % -> InputForm if S has ConvertibleTo(InputForm)
from ConvertibleTo(InputForm)
high : % -> S

high(s) returns the second endpoint of s. Note: high(l..h) = h.

incr : % -> Integer

incr(s) returns n, where s is a segment in which every n-th element is used. Note: incr(l..h by n) = n.

latex : % -> String if S has SetCategory
from SetCategory
low : % -> S

low(s) returns the first endpoint of s. Note: low(l..h) = l.

reverse : % -> % if S has OrderedRing

reverse(s) returns segment s in reverse order.

segment : (S, S) -> %

segment(i, j) is an alternate way to create the segment i..j.

~= : (%, %) -> Boolean if S has SetCategory
from BasicType

BasicType

CoercibleTo(OutputForm)

SetCategory

ConvertibleTo(InputForm)