# `Feel.Builtin.Range`
[🔗](https://github.com/FeeJai/BDM/blob/feel-v0.1.0/apps/feel/lib/feel/builtin/range.ex#L1)

The range functions of FEEL (DMN 1.6, section 10.3.4.7, Table 79): `before`, `after`, `meets`, `met by`,
`overlaps`, `overlaps before`, `overlaps after`, `finishes`, `finished by`, `includes`, `during`, `starts`,
`started by` and `coincides`.

They are the relations of Allen's interval algebra, as the HL7 CQL has them, between points and ranges, and
they give `true` or `false`. A *point* is a value that has an order (Table 55): a number, a string, a date, a
time, a date and time, or a duration. A signature takes a point or a range in each place, and which one it is
is told by the kind of the argument, so `before(1, [5..10])` and `before([1..10], 15)` are two signatures of
one function; the parameters of each have the names of the specification (`point`, `range`, `point1`,
`range2`...), which a call by name tells apart.

## What is written (D-79)

All fourteen, each signature by the formula of the table as it is printed. Not one is turned into another
through a conversion of a point to a range: the point and the range forms of a function agree on every range
that holds something, and they differ on an empty one, `[p..p)` (notes, 3.7). `starts(1, [1..1))` is what the
formula says.

## Range-domain choices (D-79)

The table has no column for the domain, and the notes read (A1, A5, A6) as follows.

  * **An endpoint that is not there** (`< 10` has no start, `>= 5` has no end, and `[1..null]` has none) is
    minus infinity as a start and plus infinity as an end, its side never included. Two starts that are not
    there are equal, so are two ends. `before(5, < 3)` is `false`, `after(5, < 3)` is `true` and
    `includes(< 3, 2)` is `true`; `during(< 3, < 4)` is `true`.
  * **A `null`, or an argument that is neither a point nor a range** (a boolean, a list, a context, a
    function) is out of the domain: the call is `null` with an `:argument_out_of_domain` error. `before(date, null)`
    is `null` in FEEL; it is `false` in B-FEEL (section 11.2), and the dialects of this library are FEEL.
  * **Endpoints that cannot be compared with one another** (a number and a string, a date and a date and time)
    are out of the domain as well. It is checked on all that are given, so a call is either `null` for that
    or has every comparison of its formula defined.
  * **A combination that is not a signature** (`meets(1, 2)`, `finishes([1..2], 3)`) is out of the domain.
  * **A range that holds nothing** (`(1..1)`, `[5..1]`) is a range as any other: the formulas are
    applied to its properties, which can give odd answers (both `before` and `after` can be true of one
    pair). Only a range value has the properties; `(!= 10)` has 10 on both sides, left out, and is read so.

A list of one point is that point (section 10.3.2.9.4).

# `functions`

```elixir
@spec functions() :: [Feel.Builtin.Function.t()]
```

The functions of this module that are written, as `Feel.Builtin.Function`s: all fourteen.

    iex> length(Feel.Builtin.Range.functions())
    14

# `names`

```elixir
@spec names() :: [Feel.Name.t()]
```

Returns the canonical names of the functions of this module, sorted.

    iex> "overlaps before" in Feel.Builtin.Range.names()
    true

---

*Consult [api-reference.md](api-reference.md) for complete listing*
