Feel.Builtin.List (feel v0.1.0)

Copy Markdown View Source

The list functions of FEEL (DMN 1.6, section 10.3.4.4, Table 76), and sort (section 10.3.4.9).

What is written (D-79, D-87)

All of them. Feel.Builtin.List.Aggregate has the functions that make one value of a list (count, sum, mean, median, mode, stddev, product, min, max, all, any), and Feel.Builtin.List.Sequence the others (append, concatenate, distinct values, flatten, index of, insert before, list contains, list replace, remove, reverse, sort, sublist, union). Each says what it does with an argument that is not a list, a position that is out of range, the empty list, and an item of the wrong kind.

What they share:

  • A list is wanted, a value that is not one is the list of it (section 10.3.2.9.4): count(1) is count([1]). null is no list, and the call is null with an :argument_out_of_domain error. The TCK flags every null argument as an error (0059, 1155), with one exception, null among the items of a list of booleans.
  • The aggregates have two forms, sum(list) and sum(n1, ..., nN), which is what a variadic parameter (Feel.Builtin.Function.parameter/3) is for. append, concatenate and union take any number of arguments after the first, and none.
  • Equality is that of = (Feel.Runtime.Compare), and what cannot be compared is not equal.
  • A position is a whole number, a fraction being cut off (section 10.3.2.9.4), that counts from the end when it is negative.

The functions that call a function

list replace (with a match) and sort take a function value. A built-in can call one (Feel.Runtime.Invoke.call/4, D-82) and its outcome carries the environment (Feel.Runtime.Env.outcome/0), so what the function reports is reported. sort is a stable merge sort that threads the environment through its comparisons (D-87).

Summary

Functions

The functions of this module that are written, as Feel.Builtin.Functions: all 24.

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

Functions

functions()

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

The functions of this module that are written, as Feel.Builtin.Functions: all 24.

iex> length(Feel.Builtin.List.functions())
24

names()

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

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

iex> "sort" in Feel.Builtin.List.names()
true