Sequences

A range of adjacent `Enumerable` values. Two values of an enumerable type are considered adjacent if their offset is of unit or zero magnitude. Thus, a `Range` is a list of values where for every integer `index` where both `index` and `index+1` fall within the indices of the range:

    range[index+1].offset(range[index]).magnitude <= 1

A range is always nonempty, containing at least one value. Thus, it is a `Sequence`.

A sequence of adjacent values may be represented very efficiently in memory, either:

- via its endpoints, `first..last`, or
- via an endpoint and length, `first:size`.

Furthermore, certain operations are much more efficient than for other lists, assuming that the enumerable type has efficient neighbour and offset functions.

The functions `makeSpan()` and `makeMeasure()`, and corresponding operators `..` and `:` are used to create new instances of `Range`.

See also `makeSpan()`, `makeMeasure()`

- `Anything`
  - `Object`
    - `Range` ...and other supertypes

- `Range`
  - `Object`
    - `Anything`
  - `Sequence`
    - `Iterable`
      - `Category`
    - `Sequential`
      - `List`
        - `Collection`
          - `Iterable`
            - `Category`
        - `Correspondence`
        - `Ranged`
          - `Iterable`
            - `Category`
      - `Ranged`
        - `Iterable`
          - `Category`

no subtypes hierarchy

Initializer
`Range()`

Attributes
`coalesced` | Source Code `shared actual Range<Element> coalesced` Returns the range itself, since a range cannot contain null elements. Refines `Iterable.coalesced`
`decreasing` | Source Code `shared formal Boolean decreasing` Determines if the range is decreasing, that is, if predecessors occur after successors.
`distinct` | Source Code `shared actual Range<Element> distinct` Returns the range itself, since a range cannot contain duplicate elements. Refines `Iterable.distinct`
`increasing` | Source Code `shared formal Boolean increasing` Determines if the range is increasing, that is, if successors occur after predecessors. Since 1.1.0

Inherited Attributes
Attributes inherited from: `Object` `hash`, `string`
Attributes inherited from: `Collection<Element>` `empty`, `permutations`, `string`
Attributes inherited from: `Correspondence<Key,Item>` `keys`
Attributes inherited from: `Iterable<Element,Absent>` `coalesced`, `cycled`, `distinct`, `empty`, `exceptLast`, `first`, `indexed`, `last`, `paired`, `rest`, `size`, `string`
Attributes inherited from: `List<Element>` `first`, `hash`, `keys`, `last`, `lastIndex`, `rest`, `reversed`, `size`
Attributes inherited from: `[Element+]` `empty`, `first`, `keys`, `last`, `lastIndex`, `rest`, `reversed`, `size`, `string`
Attributes inherited from: `Element[]` `keys`, `rest`, `reversed`, `size`, `string`

Methods
`contains` | Source Code `shared actual Boolean contains(Object element)` Returns `true` if the given value belongs to this `Category`, that is, if it is an element of this `Category`, or `false` otherwise. For any instance `c` of `Category`, `c.contains(element)` may be written using the `in` operator:
    element in c
For most `Category`s, the following relationship is satisfied by every pair of elements `x` and `y`: if `x==y`, then `x in category == y in category` However, it is possible to form a useful `Category` consistent with some other equivalence relation, for example `===`. Therefore implementations of `contains()` which do not satisfy this relationship are tolerated. Refines `Sequence.contains` ultimately refines `Category.contains`
`containsElement` | Source Code `shared formal Boolean containsElement(Element element)` Determines if this range includes the given value.
`includesRange` | Source Code `shared formal Boolean includesRange(Range<Element> range)` Determines if this range includes the given range.
`shifted` | Source Code `shared formal Range<Element> shifted(Integer shift)` Returns a range of the same length and type as this range, with its endpoints shifted by the given number of elements, where: a negative `shift` measures decrements, and a positive `shift` measures increments. Since 1.1.0

Inherited Methods
Methods inherited from: `Object` `equals()`
Methods inherited from: `Category<Element>` `contains()`, `containsAny()`, `containsEvery()`
Methods inherited from: `Collection<Element>` `clone()`, `combinations()`, `contains()`
Methods inherited from: `Correspondence<Key,Item>` `defines()`, `definesAny()`, `definesEvery()`, `get()`, `getAll()`
Methods inherited from: `Iterable<Element,Absent>` `any()`, `by()`, `chain()`, `collect()`, `contains()`, `count()`, `defaultNullElements()`, `each()`, `every()`, `filter()`, `find()`, `findLast()`, `flatMap()`, `fold()`, `follow()`, `frequencies()`, `getFromFirst()`, `group()`, `indexes()`, `interpose()`, `iterator()`, `locate()`, `locateLast()`, `locations()`, `longerThan()`, `map()`, `max()`, `narrow()`, `partition()`, `product()`, `reduce()`, `repeat()`, `scan()`, `select()`, `sequence()`, `shorterThan()`, `skip()`, `skipWhile()`, `sort()`, `spread()`, `summarize()`, `tabulate()`, `take()`, `takeWhile()`
Methods inherited from: `List<Element>` `clone()`, `collect()`, `contains()`, `defines()`, `endsWith()`, `equals()`, `find()`, `findLast()`, `firstIndexWhere()`, `get()`, `getFromFirst()`, `getFromLast()`, `indexesWhere()`, `initial()`, `iterator()`, `lastIndexWhere()`, `longerThan()`, `mapElements()`, `measure()`, `patch()`, `repeat()`, `shorterThan()`, `slice()`, `span()`, `spanFrom()`, `spanTo()`, `startsWith()`, `sublist()`, `sublistFrom()`, `sublistTo()`, `terminal()`, `trim()`, `trimLeading()`, `trimTrailing()`
Methods inherited from: `Ranged<Index,Element,Subrange>` `measure()`, `span()`, `spanFrom()`, `spanTo()`
Methods inherited from: `[Element+]` `append()`, `clone()`, `collect()`, `contains()`, `find()`, `findLast()`, `indexes()`, `longerThan()`, `measure()`, `prepend()`, `repeat()`, `sequence()`, `shorterThan()`, `slice()`, `sort()`, `span()`, `spanFrom()`, `spanTo()`, `withLeading()`, `withTrailing()`
Methods inherited from: `Element[]` `append()`, `clone()`, `initial()`, `prepend()`, `repeat()`, `sequence()`, `slice()`, `terminal()`, `trim()`, `trimLeading()`, `trimTrailing()`, `withLeading()`, `withTrailing()`