# SegmentCategory SΒΆ

seg.spad line 1 [edit on github]

S: Type

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

- ~=: (%, %) -> 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.

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

- convert: % -> InputForm if S has ConvertibleTo InputForm
from ConvertibleTo InputForm

- convert: S -> %
`convert(i)`

creates the segment`i..i`

.

- 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`

.

- SEGMENT: (S, S) -> %
`l..h`

creates a segment with`l`

and`h`

as the endpoints.

BasicType if S has SetCategory

CoercibleTo OutputForm if S has SetCategory

ConvertibleTo InputForm if S has ConvertibleTo InputForm

SetCategory if S has SetCategory