# `Feel.Extension.Camunda.Functions`
[🔗](https://github.com/FeeJai/BDM/blob/feel-v0.1.0/apps/feel/lib/feel/extension/camunda/functions.ex#L1)

The functions that Camunda has and DMN 1.6 does not (D-81).

| Function | Camunda |
| -------- | ------- |
| `is defined(value)` | `false` if the value is `null`, else `true` |
| `get or else(value, default)` | the value, or the default if it is `null` |
| `assert(value, condition)`, `assert(value, condition, cause)` | the value if the condition is `true`; else the evaluation fails, with the cause |
| `is empty(list)`, `is blank(string)` | whether the list has no item, or the string no character but white space |
| `trim(string)` | the string without the white space at its ends |
| `partition(list, size)` | the consecutive sublists of that size, the last one the rest; a size below 1 is an error |
| `duplicate values(list)` | the values that occur more than once, each once, in the order they first occur; two values are the same as `=` says (`1` and `1.0` are), and one that cannot be compared is not (`Feel.Runtime.EqualItems`) |
| `last day of month(date)` | the last day of the month of a date, or of a date and time, as a date |
| `to base64(value)`, `from base64(value)` | the Base64 of a string, and the string of a Base64 text |
| `to json(value)`, `from json(value)` | the value as JSON text and back, see `Feel.Extension.Camunda.Json` |
| `extract(string, pattern)` | the text of every match of the pattern (the regular expressions of XPath, D-80) |
| `uuid()`, `random number()` | a version 4 UUID, and a number from 0 to under 1; both from the `:entropy` of the run |

A `null` or an argument of another kind than the function takes is `null` with an `:argument_out_of_domain` error, as
for the functions of DMN 1.6 (D-79), where the documentation says nothing else. Four things that are decisions:

**`is defined` reads its argument without reporting** (D-100). `is defined(x)` for a name that is not bound, and
`is defined(x.y)` for a path through an entry that is not there, are `false`, as the documentation says, and nothing
is reported: no warning for the unknown name when the expression is prepared, no `:invalid_property` error when it is
run, so a `mode: :strict` run goes on. The parameter is `quiet: true` (`Feel.Builtin.Function.parameter/3`). An
error that is not a report still ends the run (a limit, `Feel.Runtime.Env.abort/3`), and so does an error of the
analysis, as an unknown name does with the option `unknown_names: :error`. `get or else` reads its argument as any
function does: the documentation of Camunda says it handles a `null`, not a missing entry.

**`assert` fails by the error.** Its failure is `null` with an `:assertion_failed` error, which ends a strict run, where
Camunda ends the evaluation. The message is the cause, if there is one.

**`partition(list, 0)` is an error,** as in the documentation's example, though its text says "less than 0".

**`random number()` is a number of 53 random bits over 2 to the 53rd,** so it is exact as a number of FEEL and
never 1. Neither it nor `uuid()` is pure, and neither is folded (`Feel.Builtin.Function`).

It is `:camunda_functions`, and part of `:camunda`.

---

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