# `Expression.Callbacks.Standard`

The function callbacks for the standard function set available
in FLOIP expressions.

This should be relatively swappable with another implementation.
The only requirement is the `handle/3` function.

FLOIP functions are case insensitive. All functions in this callback
module are implemented as lowercase names.

Some functions accept a variable amount of arguments. Elixir doesn't
support variable arguments in functions.

If a function accepts a variable number of arguments the convention
is to call the `<function_name>_vargs/2` callback where the context
is given as the first argument and the argument list as a second
argument.

Reserved names such as `and`, `if`, and `or` are suffixed with an
underscore.

# `abs`

Returns the absolute value of a number

## Example 1:

When used in the following Stack expression it returns a  value of type **Integer**: `1`.

```
> abs(-1)
1
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @abs(-1) ..."
"1"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "abs(-1)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 1 = result
    1
    iex> Expression.evaluate_as_string!(
    ...>   "@abs(-1)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "1"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Float**: `0.5`.

```
> abs(-0.5)
0.5
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @abs(-0.5) ..."
"0.5"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "abs(-0.5)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 0.5 = result
    0.5
    iex> Expression.evaluate_as_string!(
    ...>   "@abs(-0.5)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "0.5"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **Float**: `0.5` when used with the following context:

```elixir
%{"number" => %{"__value__" => -0.5, "display" => "value for display key", "value" => "value for value key"}}
```

```
> abs(number)
0.5
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @abs(number) ..."
"0.5"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "abs(number)",
    ...>   %{"number" => %{"__value__" => -0.5, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 0.5 = result
    0.5
    iex> Expression.evaluate_as_string!(
    ...>   "@abs(number)",
    ...>   %{"number" => %{"__value__" => -0.5, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "0.5"

---

# `and_vargs`

Returns `true` if and only if all its arguments evaluate to `true`

## Example 1:

When used in the following Stack expression it returns a  value of type **Boolean**: `true` when used with the following context:

```elixir
%{"contact" => %{"age" => 32, "gender" => "F"}}
```

```
> contact.gender = "F" and contact.age >= 18
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @and(contact.gender = "F", contact.age >= 18) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "and(contact.gender = \"F\", contact.age >= 18)",
    ...>   %{"contact" => %{"age" => 32, "gender" => "F"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@and(contact.gender = \"F\", contact.age >= 18)",
    ...>   %{"contact" => %{"age" => 32, "gender" => "F"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Boolean**: `false` when used with the following context:

```elixir
%{"contact" => %{"age" => 32, "gender" => "?"}}
```

```
> contact.gender = "F" and contact.age >= 18
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @and(contact.gender = "F", contact.age >= 18) ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "and(contact.gender = \"F\", contact.age >= 18)",
    ...>   %{"contact" => %{"age" => 32, "gender" => "?"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@and(contact.gender = \"F\", contact.age >= 18)",
    ...>   %{"contact" => %{"age" => 32, "gender" => "?"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 3:

> Return true if value in __value__ key if complex values are provided evaluates to true.

When used in the following Stack expression it returns a  value of type **Boolean**: `true` when used with the following context:

```elixir
%{"age" => %{"__value__" => 18, "display" => "value for display key", "value" => "value for value key"}, "gender" => %{"__value__" => "F", "display" => "value for display key", "value" => "value for value key"}}
```

```
> gender = "F" and age >= 18
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @and(gender = "F", age >= 18) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "and(gender = \"F\", age >= 18)",
    ...>   %{"age" => %{"__value__" => 18, "display" => "value for display key", "value" => "value for value key"}, "gender" => %{"__value__" => "F", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@and(gender = \"F\", age >= 18)",
    ...>   %{"age" => %{"__value__" => 18, "display" => "value for display key", "value" => "value for value key"}, "gender" => %{"__value__" => "F", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `append`

Appends an item or a list of items to a given list.

## Example 1:

When used in the following Stack expression it returns a  value of type **List with values String, String, String**: 

```
[
  "A",
  "B",
  "C"
]
```

.

```
> append(["A", "B"], "C")
["A", "B", "C"]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @append(["A", "B"], "C") ..."
"ABC"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "append([\"A\", \"B\"], \"C\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ["A", "B", "C"] = result
    ["A", "B", "C"]
    iex> Expression.evaluate_as_string!(
    ...>   "@append([\"A\", \"B\"], \"C\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "ABC"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **List with values String, String, String, String**: 

```
[
  "A",
  "B",
  "C",
  "B"
]
```

.

```
> append(["A", "B"], ["C", "B"])
["A", "B", "C", "B"]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @append(["A", "B"], ["C", "B"]) ..."
"ABCB"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "append([\"A\", \"B\"], [\"C\", \"B\"])",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ["A", "B", "C", "B"] = result
    ["A", "B", "C", "B"]
    iex> Expression.evaluate_as_string!(
    ...>   "@append([\"A\", \"B\"], [\"C\", \"B\"])",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "ABCB"

---

## Example 3:

> Appends an item or a list of items to a given list from __value__ keys if complex values are provided.

When used in the following Stack expression it returns a  value of type **List with values String, String, String**: 

```
[
  "A",
  "B",
  "C"
]
```

 when used with the following context:

```elixir
%{"list" => %{"__value__" => ["A", "B"], "display" => "value for display key", "value" => "value for value key"}, "payload" => %{"__value__" => "C", "display" => "value for display key", "value" => "value for value key"}}
```

```
> append(list, payload)
["A", "B", "C"]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @append(list, payload) ..."
"ABC"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "append(list, payload)",
    ...>   %{"list" => %{"__value__" => ["A", "B"], "display" => "value for display key", "value" => "value for value key"}, "payload" => %{"__value__" => "C", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ["A", "B", "C"] = result
    ["A", "B", "C"]
    iex> Expression.evaluate_as_string!(
    ...>   "@append(list, payload)",
    ...>   %{"list" => %{"__value__" => ["A", "B"], "display" => "value for display key", "value" => "value for value key"}, "payload" => %{"__value__" => "C", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "ABC"

---

# `base64_decode`

Base64 decode an expression

## Example 1:

When used in the following Stack expression it returns a  value of type **String**: `"hello world"`.

```
> base64_decode("aGVsbG8gd29ybGQ=")
"hello world"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @base64_decode("aGVsbG8gd29ybGQ=") ..."
"hello world"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "base64_decode(\"aGVsbG8gd29ybGQ=\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "hello world" = result
    "hello world"
    iex> Expression.evaluate_as_string!(
    ...>   "@base64_decode(\"aGVsbG8gd29ybGQ=\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "hello world"

---

## Example 2:

> Return Base64 decoded string from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **String**: `"hello world"` when used with the following context:

```elixir
%{"text" => %{"__value__" => "aGVsbG8gd29ybGQ=", "display" => "value for display key", "value" => "value for value key"}}
```

```
> base64_decode(text)
"hello world"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @base64_decode(text) ..."
"hello world"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "base64_decode(text)",
    ...>   %{"text" => %{"__value__" => "aGVsbG8gd29ybGQ=", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "hello world" = result
    "hello world"
    iex> Expression.evaluate_as_string!(
    ...>   "@base64_decode(text)",
    ...>   %{"text" => %{"__value__" => "aGVsbG8gd29ybGQ=", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "hello world"

---

# `base64_encode`

Base64 encode an expression

## Example 1:

When used in the following Stack expression it returns a  value of type **String**: `"aGVsbG8gd29ybGQ="`.

```
> base64_encode("hello world")
"aGVsbG8gd29ybGQ="
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @base64_encode("hello world") ..."
"aGVsbG8gd29ybGQ="
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "base64_encode(\"hello world\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "aGVsbG8gd29ybGQ=" = result
    "aGVsbG8gd29ybGQ="
    iex> Expression.evaluate_as_string!(
    ...>   "@base64_encode(\"hello world\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "aGVsbG8gd29ybGQ="

---

## Example 2:

> Return Base64 encoded string from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **String**: `"aGVsbG8gd29ybGQ="` when used with the following context:

```elixir
%{"text" => %{"__value__" => "hello world", "display" => "value for display key", "value" => "value for value key"}}
```

```
> base64_encode(text)
"aGVsbG8gd29ybGQ="
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @base64_encode(text) ..."
"aGVsbG8gd29ybGQ="
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "base64_encode(text)",
    ...>   %{"text" => %{"__value__" => "hello world", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "aGVsbG8gd29ybGQ=" = result
    "aGVsbG8gd29ybGQ="
    iex> Expression.evaluate_as_string!(
    ...>   "@base64_encode(text)",
    ...>   %{"text" => %{"__value__" => "hello world", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "aGVsbG8gd29ybGQ="

---

# `char`

Returns the character specified by a number

```
> "As easy as @char(65), @char(66), @char(67)"
"As easy as A, B, C"
```

## Example 1:

When used in the following Stack expression it returns a  value of type **String**: `"A"`.

```
> char(65)
"A"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @char(65) ..."
"A"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "char(65)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "A" = result
    "A"
    iex> Expression.evaluate_as_string!(
    ...>   "@char(65)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "A"

---

## Example 2:

> Return character from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **String**: `"A"` when used with the following context:

```elixir
%{"code" => %{"__value__" => 65, "display" => "value for display key", "value" => "value for value key"}}
```

```
> char(code)
"A"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @char(code) ..."
"A"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "char(code)",
    ...>   %{"code" => %{"__value__" => 65, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "A" = result
    "A"
    iex> Expression.evaluate_as_string!(
    ...>   "@char(code)",
    ...>   %{"code" => %{"__value__" => 65, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "A"

---

# `chunk_every`

Chunk a list into a list of smaller lists.

This is useful in cases where one has a large list but want
to process them in smaller chunks.

## Example 1:

> Split a large set of sentences into a smaller set of sentences.

When used in the following Stack expression it returns a  value of type **List with values List with values String, String, List with values String, String, List with values String**: 

```
[
  [
    "the first sentence",
    "the second sentence"
  ],
  [
    "the third sentence",
    "the fourth sentence"
  ],
  [
    "the fifth sentence"
  ]
]
```

 when used with the following context:

```elixir
%{"sentences" => ["the first sentence", "the second sentence", "the third sentence", "the fourth sentence", "the fifth sentence"]}
```

```
> chunk_every(sentences, 2)
[["the first sentence", "the second sentence"], ["the third sentence", "the fourth sentence"], ["the fifth sentence"]]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @chunk_every(sentences, 2) ..."
"the first sentencethe second sentencethe third sentencethe fourth sentencethe fifth sentence"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "chunk_every(sentences, 2)",
    ...>   %{"sentences" => ["the first sentence", "the second sentence", "the third sentence", "the fourth sentence", "the fifth sentence"]},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert [["the first sentence", "the second sentence"], ["the third sentence", "the fourth sentence"], ["the fifth sentence"]] = result
    [["the first sentence", "the second sentence"], ["the third sentence", "the fourth sentence"], ["the fifth sentence"]]
    iex> Expression.evaluate_as_string!(
    ...>   "@chunk_every(sentences, 2)",
    ...>   %{"sentences" => ["the first sentence", "the second sentence", "the third sentence", "the fourth sentence", "the fifth sentence"]},
    ...>   Expression.Callbacks.Standard
    ...> )
    "the first sentencethe second sentencethe third sentencethe fourth sentencethe fifth sentence"

---

## Example 2:

> If an invalid, non-enumerable value is passed, return an error

When used in the following Stack expression it returns a complex **Null** type of default value:
```
null
```
with the following fields:

* *__type__* of type **String**
* *error* of type **Boolean**
* *message* of type **String**
.

```
> chunk_every(nil, 2)
%{"__type__" => "expression/v1error", "__value__" => nil, "error" => true, "message" => "Invalid enumerable"}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @chunk_every(nil, 2) ..."
""
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "chunk_every(nil, 2)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__type__" => "expression/v1error", "__value__" => nil, "error" => true, "message" => "Invalid enumerable"} = result
    %{"__type__" => "expression/v1error", "__value__" => nil, "error" => true, "message" => "Invalid enumerable"}
    iex> Expression.evaluate_as_string!(
    ...>   "@chunk_every(nil, 2)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ""

---

## Example 3:

> Split enum in __value__ key if complex value is provided.

When used in the following Stack expression it returns a  value of type **List with values List with values String, String, String, List with values String, String**: 

```
[
  [
    "the first sentence",
    "the second sentence",
    "the third sentence"
  ],
  [
    "the fourth sentence",
    "the fifth sentence"
  ]
]
```

 when used with the following context:

```elixir
%{"complex" => %{"__value__" => ["the first sentence", "the second sentence", "the third sentence", "the fourth sentence", "the fifth sentence"], "display" => "value for display key", "value" => "value for value key"}}
```

```
> chunk_every(complex, 3)
[["the first sentence", "the second sentence", "the third sentence"], ["the fourth sentence", "the fifth sentence"]]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @chunk_every(complex, 3) ..."
"the first sentencethe second sentencethe third sentencethe fourth sentencethe fifth sentence"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "chunk_every(complex, 3)",
    ...>   %{"complex" => %{"__value__" => ["the first sentence", "the second sentence", "the third sentence", "the fourth sentence", "the fifth sentence"], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert [["the first sentence", "the second sentence", "the third sentence"], ["the fourth sentence", "the fifth sentence"]] = result
    [["the first sentence", "the second sentence", "the third sentence"], ["the fourth sentence", "the fifth sentence"]]
    iex> Expression.evaluate_as_string!(
    ...>   "@chunk_every(complex, 3)",
    ...>   %{"complex" => %{"__value__" => ["the first sentence", "the second sentence", "the third sentence", "the fourth sentence", "the fifth sentence"], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "the first sentencethe second sentencethe third sentencethe fourth sentencethe fifth sentence"

---

# `clean`

Removes all non-printable characters from a text string

## Example 1:

When used in the following Stack expression it returns a  value of type **String**: `"ABC"` when used with the following context:

```elixir
%{"value" => <<65, 0, 66, 0, 67>>}
```

```
> clean(value)
"ABC"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @clean(value) ..."
"ABC"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "clean(value)",
    ...>   %{"value" => <<65, 0, 66, 0, 67>>},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "ABC" = result
    "ABC"
    iex> Expression.evaluate_as_string!(
    ...>   "@clean(value)",
    ...>   %{"value" => <<65, 0, 66, 0, 67>>},
    ...>   Expression.Callbacks.Standard
    ...> )
    "ABC"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **String**: `""`.

```
> clean(nil)
""
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @clean(nil) ..."
""
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "clean(nil)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "" = result
    ""
    iex> Expression.evaluate_as_string!(
    ...>   "@clean(nil)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ""

---

## Example 3:

> Return cleaned string from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **String**: `"ABC"` when used with the following context:

```elixir
%{"value" => %{"__value__" => <<65, 0, 66, 0, 67>>, "display" => "value for display key", "value" => "value for value key"}}
```

```
> clean(value)
"ABC"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @clean(value) ..."
"ABC"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "clean(value)",
    ...>   %{"value" => %{"__value__" => <<65, 0, 66, 0, 67>>, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "ABC" = result
    "ABC"
    iex> Expression.evaluate_as_string!(
    ...>   "@clean(value)",
    ...>   %{"value" => %{"__value__" => <<65, 0, 66, 0, 67>>, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "ABC"

---

# `code`

Returns a numeric code for the first character in a text string

```
> "The numeric code of A is @CODE(\"A\")"
"The numeric code of A is 65"
```

## Example 1:

When used in the following Stack expression it returns a  value of type **Integer**: `65`.

```
> code("A")
65
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @code("A") ..."
"65"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "code(\"A\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 65 = result
    65
    iex> Expression.evaluate_as_string!(
    ...>   "@code(\"A\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "65"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Null**: `null`.

```
> code(nil)
nil
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @code(nil) ..."
""
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "code(nil)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    nil
    iex> Expression.evaluate_as_string!(
    ...>   "@code(nil)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ""

---

## Example 3:

> Return code from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Integer**: `65` when used with the following context:

```elixir
%{"value" => %{"__value__" => "A", "display" => "value for display key", "value" => "value for value key"}}
```

```
> code(value)
65
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @code(value) ..."
"65"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "code(value)",
    ...>   %{"value" => %{"__value__" => "A", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 65 = result
    65
    iex> Expression.evaluate_as_string!(
    ...>   "@code(value)",
    ...>   %{"value" => %{"__value__" => "A", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "65"

---

# `concatenate_vargs`

Joins text strings into one text string

```
> "Your name is @CONCATENATE(contact.first_name, \" \", contact.last_name)"
"Your name is name surname"
```

## Example 1:

When used in the following Stack expression it returns a  value of type **String**: `"name surname"` when used with the following context:

```elixir
%{"contact" => %{"first_name" => "name", "last_name" => "surname"}}
```

```
> concatenate(contact.first_name, " ", contact.last_name)
"name surname"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @concatenate(contact.first_name, " ", contact.last_name) ..."
"name surname"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "concatenate(contact.first_name, \" \", contact.last_name)",
    ...>   %{"contact" => %{"first_name" => "name", "last_name" => "surname"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "name surname" = result
    "name surname"
    iex> Expression.evaluate_as_string!(
    ...>   "@concatenate(contact.first_name, \" \", contact.last_name)",
    ...>   %{"contact" => %{"first_name" => "name", "last_name" => "surname"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "name surname"

---

## Example 2:

> Return concatenated string from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **String**: `"name surname"` when used with the following context:

```elixir
%{"first_name" => %{"__value__" => "name", "display" => "value for display key", "value" => "value for value key"}, "last_name" => %{"__value__" => "surname", "display" => "value for display key", "value" => "value for value key"}, "separator" => %{"__value__" => " ", "display" => "value for display key", "value" => "value for value key"}}
```

```
> concatenate(first_name, separator, last_name)
"name surname"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @concatenate(first_name, separator, last_name) ..."
"name surname"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "concatenate(first_name, separator, last_name)",
    ...>   %{"first_name" => %{"__value__" => "name", "display" => "value for display key", "value" => "value for value key"}, "last_name" => %{"__value__" => "surname", "display" => "value for display key", "value" => "value for value key"}, "separator" => %{"__value__" => " ", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "name surname" = result
    "name surname"
    iex> Expression.evaluate_as_string!(
    ...>   "@concatenate(first_name, separator, last_name)",
    ...>   %{"first_name" => %{"__value__" => "name", "display" => "value for display key", "value" => "value for value key"}, "last_name" => %{"__value__" => "surname", "display" => "value for display key", "value" => "value for value key"}, "separator" => %{"__value__" => " ", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "name surname"

---

# `count`

Return the number of entries in a list, string, or a map.

## Example 1:

When used in the following Stack expression it returns a  value of type **Integer**: `3`.

```
> count([1, 2, 3])
3
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @count([1, 2, 3]) ..."
"3"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "count([1, 2, 3])",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 3 = result
    3
    iex> Expression.evaluate_as_string!(
    ...>   "@count([1, 2, 3])",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "3"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Integer**: `3`.

```
> count("zoë")
3
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @count("zoë") ..."
"3"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "count(\"zoë\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 3 = result
    3
    iex> Expression.evaluate_as_string!(
    ...>   "@count(\"zoë\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "3"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **Integer**: `1` when used with the following context:

```elixir
%{"map" => %{"foo" => "bar"}}
```

```
> count(map)
1
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @count(map) ..."
"1"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "count(map)",
    ...>   %{"map" => %{"foo" => "bar"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 1 = result
    1
    iex> Expression.evaluate_as_string!(
    ...>   "@count(map)",
    ...>   %{"map" => %{"foo" => "bar"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "1"

---

## Example 4:

When used in the following Stack expression it returns a  value of type **Integer**: `0` when used with the following context:

```elixir
%{"nil_value" => nil}
```

```
> count(nil_value)
0
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @count(nil_value) ..."
"0"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "count(nil_value)",
    ...>   %{"nil_value" => nil},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 0 = result
    0
    iex> Expression.evaluate_as_string!(
    ...>   "@count(nil_value)",
    ...>   %{"nil_value" => nil},
    ...>   Expression.Callbacks.Standard
    ...> )
    "0"

---

## Example 5:

> Count value in __value__ key if complex value is provided.

When used in the following Stack expression it returns a  value of type **Integer**: `23` when used with the following context:

```elixir
%{"enum" => %{"__value__" => "value for __value__ key", "display" => "value for display key", "value" => "value for value key"}}
```

```
> count(enum)
23
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @count(enum) ..."
"23"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "count(enum)",
    ...>   %{"enum" => %{"__value__" => "value for __value__ key", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 23 = result
    23
    iex> Expression.evaluate_as_string!(
    ...>   "@count(enum)",
    ...>   %{"enum" => %{"__value__" => "value for __value__ key", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "23"

---

# `date`

Defines a new date value

## Example 1:

> Construct a date from year, month, and day integers

When used in the following Stack expression it returns a  value of type **Date**: `"2022-01-31"` when used with the following context:

```elixir
%{"day" => 31, "month" => 1, "year" => 2022}
```

```
> date(year, month, day)
~D[2022-01-31]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @date(year, month, day) ..."
"2022-01-31"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "date(year, month, day)",
    ...>   %{"day" => 31, "month" => 1, "year" => 2022},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ~D[2022-01-31] = result
    ~D[2022-01-31]
    iex> Expression.evaluate_as_string!(
    ...>   "@date(year, month, day)",
    ...>   %{"day" => 31, "month" => 1, "year" => 2022},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2022-01-31"

---

## Example 2:

> Invalid date inputs

When used in the following Stack expression it returns a complex **Null** type of default value:
```
null
```
with the following fields:

* *__type__* of type **String**
* *error* of type **Boolean**
* *message* of type **String**
 when used with the following context:

```elixir
%{}
```

```
> date(nil, nil, nil)
%{"__type__" => "expression/v1error", "__value__" => nil, "error" => true, "message" => "Invalid date: date(nil, nil, nil)"}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @date(nil, nil, nil) ..."
""
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "date(nil, nil, nil)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__type__" => "expression/v1error", "__value__" => nil, "error" => true, "message" => "Invalid date: date(nil, nil, nil)"} = result
    %{"__type__" => "expression/v1error", "__value__" => nil, "error" => true, "message" => "Invalid date: date(nil, nil, nil)"}
    iex> Expression.evaluate_as_string!(
    ...>   "@date(nil, nil, nil)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ""

---

## Example 3:

> Construct date from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Date**: `"2025-01-15"` when used with the following context:

```elixir
%{"day" => %{"__value__" => 15, "display" => "value for display key", "value" => "value for value key"}, "month" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}, "year" => %{"__value__" => 2025, "display" => "value for display key", "value" => "value for value key"}}
```

```
> date(year, month, day)
~D[2025-01-15]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @date(year, month, day) ..."
"2025-01-15"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "date(year, month, day)",
    ...>   %{"day" => %{"__value__" => 15, "display" => "value for display key", "value" => "value for value key"}, "month" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}, "year" => %{"__value__" => 2025, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ~D[2025-01-15] = result
    ~D[2025-01-15]
    iex> Expression.evaluate_as_string!(
    ...>   "@date(year, month, day)",
    ...>   %{"day" => %{"__value__" => 15, "display" => "value for display key", "value" => "value for value key"}, "month" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}, "year" => %{"__value__" => 2025, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2025-01-15"

---

# `datetime_add`

Calculates a new datetime based on the offset and unit provided.

The unit can be any of the following values:

* "Y" for years
* "M" for months
* "W" for weeks
* "D" for days
* "h" for hours
* "m" for minutes
* "s" for seconds

Specifying a negative offset results in date calculations back in time.

## Example 1:

> Calculates a new datetime based on the offset and unit provided.

When used in the following Stack expression it returns a  value of type **DateTime**: `"2022-08-31T00:00:00Z"` when used with the following context:

```elixir
%{"datetime" => ~U[2022-07-31 00:00:00Z], "offset" => "1", "unit" => "M"}
```

```
> datetime_add(datetime, offset, unit)
~U[2022-08-31 00:00:00Z]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @datetime_add(datetime, offset, unit) ..."
"2022-08-31T00:00:00Z"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "datetime_add(datetime, offset, unit)",
    ...>   %{"datetime" => ~U[2022-07-31 00:00:00Z], "offset" => "1", "unit" => "M"},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ~U[2022-08-31 00:00:00Z] = result
    ~U[2022-08-31 00:00:00Z]
    iex> Expression.evaluate_as_string!(
    ...>   "@datetime_add(datetime, offset, unit)",
    ...>   %{"datetime" => ~U[2022-07-31 00:00:00Z], "offset" => "1", "unit" => "M"},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2022-08-31T00:00:00Z"

---

## Example 2:

> Leap year handling in a leap year.

When used in the following Stack expression it returns a  value of type **DateTime**: `"2020-02-29T00:00:00.000000Z"`.

```
> datetime_add(date(2020, 02, 28), 1, "D")
~U[2020-02-29 00:00:00.000000Z]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @datetime_add(date(2020, 02, 28), 1, "D") ..."
"2020-02-29T00:00:00.000000Z"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "datetime_add(date(2020, 02, 28), 1, \"D\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ~U[2020-02-29 00:00:00.000000Z] = result
    ~U[2020-02-29 00:00:00.000000Z]
    iex> Expression.evaluate_as_string!(
    ...>   "@datetime_add(date(2020, 02, 28), 1, \"D\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2020-02-29T00:00:00.000000Z"

---

## Example 3:

> Leap year handling outside of a leap year.

When used in the following Stack expression it returns a  value of type **DateTime**: `"2021-03-01T00:00:00.000000Z"`.

```
> datetime_add(date(2021, 02, 28), 1, "D")
~U[2021-03-01 00:00:00.000000Z]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @datetime_add(date(2021, 02, 28), 1, "D") ..."
"2021-03-01T00:00:00.000000Z"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "datetime_add(date(2021, 02, 28), 1, \"D\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ~U[2021-03-01 00:00:00.000000Z] = result
    ~U[2021-03-01 00:00:00.000000Z]
    iex> Expression.evaluate_as_string!(
    ...>   "@datetime_add(date(2021, 02, 28), 1, \"D\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2021-03-01T00:00:00.000000Z"

---

## Example 4:

> Negative offsets

When used in the following Stack expression it returns a  value of type **DateTime**: `"2020-02-28T00:00:00.000000Z"`.

```
> datetime_add(date(2020, 02, 29), -1, "D")
~U[2020-02-28 00:00:00.000000Z]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @datetime_add(date(2020, 02, 29), -1, "D") ..."
"2020-02-28T00:00:00.000000Z"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "datetime_add(date(2020, 02, 29), -1, \"D\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ~U[2020-02-28 00:00:00.000000Z] = result
    ~U[2020-02-28 00:00:00.000000Z]
    iex> Expression.evaluate_as_string!(
    ...>   "@datetime_add(date(2020, 02, 29), -1, \"D\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2020-02-28T00:00:00.000000Z"

---

## Example 5:

> Invalid date inputs

When used in the following Stack expression it returns a complex **Null** type of default value:
```
null
```
with the following fields:

* *__type__* of type **String**
* *error* of type **Boolean**
* *message* of type **String**
 when used with the following context:

```elixir
%{}
```

```
> datetime_add("_..[0]._", 0, "h")
%{"__type__" => "expression/v1error", "__value__" => nil, "error" => true, "message" => "Invalid date"}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @datetime_add("_..[0]._", 0, "h") ..."
""
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "datetime_add(\"_..[0]._\", 0, \"h\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__type__" => "expression/v1error", "__value__" => nil, "error" => true, "message" => "Invalid date"} = result
    %{"__type__" => "expression/v1error", "__value__" => nil, "error" => true, "message" => "Invalid date"}
    iex> Expression.evaluate_as_string!(
    ...>   "@datetime_add(\"_..[0]._\", 0, \"h\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ""

---

## Example 6:

> Calculates date from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **DateTime**: `"2022-08-31T00:00:00Z"` when used with the following context:

```elixir
%{"datetime" => %{"__value__" => ~U[2022-07-31 00:00:00Z], "display" => "value for display key", "value" => "value for value key"}, "offset" => %{"__value__" => "1", "display" => "value for display key", "value" => "value for value key"}, "unit" => %{"__value__" => "M", "display" => "value for display key", "value" => "value for value key"}}
```

```
> datetime_add(datetime, offset, unit)
~U[2022-08-31 00:00:00Z]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @datetime_add(datetime, offset, unit) ..."
"2022-08-31T00:00:00Z"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "datetime_add(datetime, offset, unit)",
    ...>   %{"datetime" => %{"__value__" => ~U[2022-07-31 00:00:00Z], "display" => "value for display key", "value" => "value for value key"}, "offset" => %{"__value__" => "1", "display" => "value for display key", "value" => "value for value key"}, "unit" => %{"__value__" => "M", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ~U[2022-08-31 00:00:00Z] = result
    ~U[2022-08-31 00:00:00Z]
    iex> Expression.evaluate_as_string!(
    ...>   "@datetime_add(datetime, offset, unit)",
    ...>   %{"datetime" => %{"__value__" => ~U[2022-07-31 00:00:00Z], "display" => "value for display key", "value" => "value for value key"}, "offset" => %{"__value__" => "1", "display" => "value for display key", "value" => "value for value key"}, "unit" => %{"__value__" => "M", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2022-08-31T00:00:00Z"

---

# `datetime_from_unix`

```elixir
@spec datetime_from_unix(
  map(),
  {:literal, String.t() | integer()},
  {:literal, unit :: String.t()}
) ::
  DateTime.t()
```

Parses a UNIX time and returns a DateTime

## Example 1:

When used in the following Stack expression it returns a  value of type **DateTime**: `"2023-12-06T23:00:00.000Z"` when used with the following context:

```elixir
%{}
```

```
> datetime_from_unix("1701903600000", "millisecond")
~U[2023-12-06 23:00:00.000Z]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @datetime_from_unix("1701903600000", "millisecond") ..."
"2023-12-06T23:00:00.000Z"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "datetime_from_unix(\"1701903600000\", \"millisecond\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ~U[2023-12-06 23:00:00.000Z] = result
    ~U[2023-12-06 23:00:00.000Z]
    iex> Expression.evaluate_as_string!(
    ...>   "@datetime_from_unix(\"1701903600000\", \"millisecond\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2023-12-06T23:00:00.000Z"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **DateTime**: `"2023-12-06T23:00:00.000Z"` when used with the following context:

```elixir
%{}
```

```
> datetime_from_unix(1701903600000, "millisecond")
~U[2023-12-06 23:00:00.000Z]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @datetime_from_unix(1701903600000, "millisecond") ..."
"2023-12-06T23:00:00.000Z"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "datetime_from_unix(1701903600000, \"millisecond\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ~U[2023-12-06 23:00:00.000Z] = result
    ~U[2023-12-06 23:00:00.000Z]
    iex> Expression.evaluate_as_string!(
    ...>   "@datetime_from_unix(1701903600000, \"millisecond\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2023-12-06T23:00:00.000Z"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **DateTime**: `"2023-12-06T23:00:00Z"` when used with the following context:

```elixir
%{}
```

```
> datetime_from_unix("1701903600", "second")
~U[2023-12-06 23:00:00Z]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @datetime_from_unix("1701903600", "second") ..."
"2023-12-06T23:00:00Z"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "datetime_from_unix(\"1701903600\", \"second\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ~U[2023-12-06 23:00:00Z] = result
    ~U[2023-12-06 23:00:00Z]
    iex> Expression.evaluate_as_string!(
    ...>   "@datetime_from_unix(\"1701903600\", \"second\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2023-12-06T23:00:00Z"

---

## Example 4:

> Parses date from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **DateTime**: `"2023-12-06T23:00:00.000Z"` when used with the following context:

```elixir
%{"unit" => %{"__value__" => "millisecond", "display" => "value for display key", "value" => "value for value key"}, "unix_time" => %{"__value__" => "1701903600000", "display" => "value for display key", "value" => "value for value key"}}
```

```
> datetime_from_unix(unix_time, unit)
~U[2023-12-06 23:00:00.000Z]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @datetime_from_unix(unix_time, unit) ..."
"2023-12-06T23:00:00.000Z"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "datetime_from_unix(unix_time, unit)",
    ...>   %{"unit" => %{"__value__" => "millisecond", "display" => "value for display key", "value" => "value for value key"}, "unix_time" => %{"__value__" => "1701903600000", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ~U[2023-12-06 23:00:00.000Z] = result
    ~U[2023-12-06 23:00:00.000Z]
    iex> Expression.evaluate_as_string!(
    ...>   "@datetime_from_unix(unix_time, unit)",
    ...>   %{"unit" => %{"__value__" => "millisecond", "display" => "value for display key", "value" => "value for value key"}, "unix_time" => %{"__value__" => "1701903600000", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2023-12-06T23:00:00.000Z"

---

# `datevalue`

# `datevalue`

Converts date stored in text to an actual date object and
formats it using `strftime` formatting.

It will fallback to "%Y-%m-%d %H:%M:%S" if no formatting is supplied

## Example 1:

> Convert a date from a piece of text to a formatted date string

When used in the following Stack expression it returns a complex **String** type of default value:
```
"2022-01-01 00:00:00"
```
with the following fields:

* *date* of type **Date**
* *datetime* of type **DateTime**
.

```
> datevalue("2022-01-01")
%{"__value__" => "2022-01-01 00:00:00", "date" => ~D[2022-01-01], "datetime" => ~U[2022-01-01 00:00:00Z]}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @datevalue("2022-01-01") ..."
"2022-01-01 00:00:00"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "datevalue(\"2022-01-01\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => "2022-01-01 00:00:00", "date" => ~D[2022-01-01], "datetime" => ~U[2022-01-01 00:00:00Z]} = result
    %{"__value__" => "2022-01-01 00:00:00", "date" => ~D[2022-01-01], "datetime" => ~U[2022-01-01 00:00:00Z]}
    iex> Expression.evaluate_as_string!(
    ...>   "@datevalue(\"2022-01-01\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2022-01-01 00:00:00"

---

## Example 2:

> Convert a date from a piece of text and read the date field

When used in the following Stack expression it returns a  value of type **Date**: `"2022-01-01"`.

```
> datevalue("2022-01-01").date
~D[2022-01-01]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @datevalue("2022-01-01").date ..."
"2022-01-01"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "datevalue(\"2022-01-01\").date",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ~D[2022-01-01] = result
    ~D[2022-01-01]
    iex> Expression.evaluate_as_string!(
    ...>   "@datevalue(\"2022-01-01\").date",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2022-01-01"

---

## Example 3:

> Convert a date value and read the date field

When used in the following Stack expression it returns a  value of type **Date**: `"2022-01-01"`.

```
> datevalue(date(2022, 1, 1)).date
~D[2022-01-01]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @datevalue(date(2022, 1, 1)).date ..."
"2022-01-01"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "datevalue(date(2022, 1, 1)).date",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ~D[2022-01-01] = result
    ~D[2022-01-01]
    iex> Expression.evaluate_as_string!(
    ...>   "@datevalue(date(2022, 1, 1)).date",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2022-01-01"

---

## Example 4:

> Convert from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Date**: `"2022-01-01"` when used with the following context:

```elixir
%{"date" => %{"__value__" => "2022-01-01", "display" => "value for display key", "value" => "value for value key"}}
```

```
> datevalue(date).date
~D[2022-01-01]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @datevalue(date).date ..."
"2022-01-01"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "datevalue(date).date",
    ...>   %{"date" => %{"__value__" => "2022-01-01", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ~D[2022-01-01] = result
    ~D[2022-01-01]
    iex> Expression.evaluate_as_string!(
    ...>   "@datevalue(date).date",
    ...>   %{"date" => %{"__value__" => "2022-01-01", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2022-01-01"

---

# `day`

Returns only the day of the month of a date (1 to 31)

## Example 1:

> Getting today's day of the month

When used in the following Stack expression it returns a  value of type **Integer**: `10`.

```
> day(date(2022, 9, 10))
10
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @day(date(2022, 9, 10)) ..."
"10"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "day(date(2022, 9, 10))",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 10 = result
    10
    iex> Expression.evaluate_as_string!(
    ...>   "@day(date(2022, 9, 10))",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "10"

---

## Example 2:

> Getting today's day of the month

When used in the following Stack expression it returns a  value of type **Integer**: `3`.

```
> day(now())
3
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @day(now()) ..."
"3"
```

    ..$> import ExUnit.Assertions
    ..$> result = Expression.evaluate_block!(
    ...>   "day(now())",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ..$> assert 3 = result
    3
    ..$> Expression.evaluate_as_string!(
    ...>   "@day(now())",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "3"

---

## Example 3:

> Return day from date in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Integer**: `29` when used with the following context:

```elixir
%{"date" => %{"__value__" => ~U[2016-02-29 22:25:00Z], "display" => "value for display key", "value" => "value for value key"}}
```

```
> day(date)
29
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @day(date) ..."
"29"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "day(date)",
    ...>   %{"date" => %{"__value__" => ~U[2016-02-29 22:25:00Z], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 29 = result
    29
    iex> Expression.evaluate_as_string!(
    ...>   "@day(date)",
    ...>   %{"date" => %{"__value__" => ~U[2016-02-29 22:25:00Z], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "29"

---

# `delete`

Deletes an element from a map by the given key.

## Example 1:

When used in the following Stack expression it returns a  value of type **Map**: 

```
{
  "age": 32
}
```

 when used with the following context:

```elixir
%{"patient" => %{"age" => 32, "gender" => "?"}}
```

```
> delete(patient, "gender")
%{"age" => 32}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @delete(patient, "gender") ..."
"%{"age" => 32}"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "delete(patient, \"gender\")",
    ...>   %{"patient" => %{"age" => 32, "gender" => "?"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"age" => 32} = result
    %{"age" => 32}
    iex> Expression.evaluate_as_string!(
    ...>   "@delete(patient, \"gender\")",
    ...>   %{"patient" => %{"age" => 32, "gender" => "?"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "%{\"age\" => 32}"

---

## Example 2:

> Deletes an element from a map by the given key from __value__ keys if complex values are provided.

When used in the following Stack expression it returns a  value of type **Map**: 

```
{
  "age": 32
}
```

 when used with the following context:

```elixir
%{"key" => %{"__value__" => "gender", "display" => "value for display key", "value" => "value for value key"}, "map" => %{"__value__" => %{"age" => 32, "gender" => "?"}, "display" => "value for display key", "value" => "value for value key"}}
```

```
> delete(map, key)
%{"age" => 32}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @delete(map, key) ..."
"%{"age" => 32}"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "delete(map, key)",
    ...>   %{"key" => %{"__value__" => "gender", "display" => "value for display key", "value" => "value for value key"}, "map" => %{"__value__" => %{"age" => 32, "gender" => "?"}, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"age" => 32} = result
    %{"age" => 32}
    iex> Expression.evaluate_as_string!(
    ...>   "@delete(map, key)",
    ...>   %{"key" => %{"__value__" => "gender", "display" => "value for display key", "value" => "value for value key"}, "map" => %{"__value__" => %{"age" => 32, "gender" => "?"}, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "%{\"age\" => 32}"

---

# `edate`

Moves a date by the given number of months

## Example 1:

> Move the date in a date object by 1 month

When used in the following Stack expression it returns a  value of type **DateTime**: `"2022-02-01T00:00:00Z"` when used with the following context:

```elixir
%{right_now: ~U[2022-01-01 00:00:00Z]}
```

```
> edate(right_now, 1)
~U[2022-02-01 00:00:00Z]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @edate(right_now, 1) ..."
"2022-02-01T00:00:00Z"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "edate(right_now, 1)",
    ...>   %{right_now: ~U[2022-01-01 00:00:00Z]},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ~U[2022-02-01 00:00:00Z] = result
    ~U[2022-02-01 00:00:00Z]
    iex> Expression.evaluate_as_string!(
    ...>   "@edate(right_now, 1)",
    ...>   %{right_now: ~U[2022-01-01 00:00:00Z]},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2022-02-01T00:00:00Z"

---

## Example 2:

> Move the date store in a piece of text by 1 month

When used in the following Stack expression it returns a  value of type **Date**: `"2022-11-10"`.

```
> edate("2022-10-10", 1)
~D[2022-11-10]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @edate("2022-10-10", 1) ..."
"2022-11-10"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "edate(\"2022-10-10\", 1)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ~D[2022-11-10] = result
    ~D[2022-11-10]
    iex> Expression.evaluate_as_string!(
    ...>   "@edate(\"2022-10-10\", 1)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2022-11-10"

---

## Example 3:

> Move the date from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Date**: `"2022-11-10"` when used with the following context:

```elixir
%{"date" => %{"__value__" => "2022-10-10", "display" => "value for display key", "value" => "value for value key"}, "months" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}}
```

```
> edate(date, months)
~D[2022-11-10]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @edate(date, months) ..."
"2022-11-10"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "edate(date, months)",
    ...>   %{"date" => %{"__value__" => "2022-10-10", "display" => "value for display key", "value" => "value for value key"}, "months" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ~D[2022-11-10] = result
    ~D[2022-11-10]
    iex> Expression.evaluate_as_string!(
    ...>   "@edate(date, months)",
    ...>   %{"date" => %{"__value__" => "2022-10-10", "display" => "value for display key", "value" => "value for value key"}, "months" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2022-11-10"

---

# `expression_docs`

Return a list of all functions annotated with @expression_docs

# `filter`

Filters a list by returning a new list that contains only the
elements for which `filter_fun` is truthy.

## Example 1:

When used in the following Stack expression it returns a  value of type **List with values String, String**: 

```
[
  "B",
  "B"
]
```

.

```
> filter(["A", "B", "C", "B"], & &1 == "B")
["B", "B"]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @filter(["A", "B", "C", "B"], & &1 == "B") ..."
"BB"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "filter([\"A\", \"B\", \"C\", \"B\"], & &1 == \"B\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ["B", "B"] = result
    ["B", "B"]
    iex> Expression.evaluate_as_string!(
    ...>   "@filter([\"A\", \"B\", \"C\", \"B\"], & &1 == \"B\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "BB"

---

## Example 2:

> If an invalid, non-enumerable value is passed, return an error

When used in the following Stack expression it returns a complex **Null** type of default value:
```
null
```
with the following fields:

* *__type__* of type **String**
* *error* of type **Boolean**
* *message* of type **String**
.

```
> filter(nil, & &1 == "B")
%{"__type__" => "expression/v1error", "__value__" => nil, "error" => true, "message" => "Invalid enumerable"}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @filter(nil, & &1 == "B") ..."
""
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "filter(nil, & &1 == \"B\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__type__" => "expression/v1error", "__value__" => nil, "error" => true, "message" => "Invalid enumerable"} = result
    %{"__type__" => "expression/v1error", "__value__" => nil, "error" => true, "message" => "Invalid enumerable"}
    iex> Expression.evaluate_as_string!(
    ...>   "@filter(nil, & &1 == \"B\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ""

---

## Example 3:

> Filter from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **List with values String, String**: 

```
[
  "B",
  "B"
]
```

 when used with the following context:

```elixir
%{"list" => %{"__value__" => ["A", "B", "C", "B"], "display" => "value for display key", "value" => "value for value key"}}
```

```
> filter(list, & &1 == "B")
["B", "B"]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @filter(list, & &1 == "B") ..."
"BB"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "filter(list, & &1 == \"B\")",
    ...>   %{"list" => %{"__value__" => ["A", "B", "C", "B"], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ["B", "B"] = result
    ["B", "B"]
    iex> Expression.evaluate_as_string!(
    ...>   "@filter(list, & &1 == \"B\")",
    ...>   %{"list" => %{"__value__" => ["A", "B", "C", "B"], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "BB"

---

# `find`

Finds the first element in the list for which `filter_fun` is truthy.

## Example 1:

When used in the following Stack expression it returns a  value of type **List with values String, String**: 

```
[
  "Hi",
  "World"
]
```

.

```
> find([["Hello", "World"], ["Hi", "World"]], & &1[0] == "Hi")
["Hi", "World"]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @find([["Hello", "World"], ["Hi", "World"]], & &1[0] == "Hi") ..."
"HiWorld"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "find([[\"Hello\", \"World\"], [\"Hi\", \"World\"]], & &1[0] == \"Hi\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ["Hi", "World"] = result
    ["Hi", "World"]
    iex> Expression.evaluate_as_string!(
    ...>   "@find([[\"Hello\", \"World\"], [\"Hi\", \"World\"]], & &1[0] == \"Hi\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "HiWorld"

---

## Example 2:

> Find from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **List with values String, String**: 

```
[
  "Hi",
  "World"
]
```

 when used with the following context:

```elixir
%{"list" => %{"__value__" => [["Hello", "World"], ["Hi", "World"]], "display" => "value for display key", "value" => "value for value key"}}
```

```
> find(list, & &1[0] == "Hi")
["Hi", "World"]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @find(list, & &1[0] == "Hi") ..."
"HiWorld"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "find(list, & &1[0] == \"Hi\")",
    ...>   %{"list" => %{"__value__" => [["Hello", "World"], ["Hi", "World"]], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ["Hi", "World"] = result
    ["Hi", "World"]
    iex> Expression.evaluate_as_string!(
    ...>   "@find(list, & &1[0] == \"Hi\")",
    ...>   %{"list" => %{"__value__" => [["Hello", "World"], ["Hi", "World"]], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "HiWorld"

---

# `first_word`

Returns the first word in the given text - equivalent to WORD(text, 1)

## Example 1:

When used in the following Stack expression it returns a  value of type **String**: `"foo"`.

```
> first_word("foo bar baz")
"foo"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @first_word("foo bar baz") ..."
"foo"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "first_word(\"foo bar baz\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "foo" = result
    "foo"
    iex> Expression.evaluate_as_string!(
    ...>   "@first_word(\"foo bar baz\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "foo"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **String**: `""`.

```
> first_word(nil)
""
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @first_word(nil) ..."
""
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "first_word(nil)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "" = result
    ""
    iex> Expression.evaluate_as_string!(
    ...>   "@first_word(nil)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ""

---

## Example 3:

> Return first word from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **String**: `"foo"` when used with the following context:

```elixir
%{"string" => %{"__value__" => "foo bar baz", "display" => "value for display key", "value" => "value for value key"}}
```

```
> first_word(string)
"foo"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @first_word(string) ..."
"foo"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "first_word(string)",
    ...>   %{"string" => %{"__value__" => "foo bar baz", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "foo" = result
    "foo"
    iex> Expression.evaluate_as_string!(
    ...>   "@first_word(string)",
    ...>   %{"string" => %{"__value__" => "foo bar baz", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "foo"

---

# `fixed`

Formats the given number in decimal format using a period and commas

```
> You have @fixed(contact.balance, 2) in your account
"You have 4.21 in your account"
```

## Example 1:

When used in the following Stack expression it returns a  value of type **String**: `"4.21"`.

```
> fixed(4.209922, 2, false)
"4.21"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @fixed(4.209922, 2, false) ..."
"4.21"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "fixed(4.209922, 2, false)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "4.21" = result
    "4.21"
    iex> Expression.evaluate_as_string!(
    ...>   "@fixed(4.209922, 2, false)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "4.21"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **String**: `"4000.4242"`.

```
> fixed(4000.424242, 4, true)
"4000.4242"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @fixed(4000.424242, 4, true) ..."
"4000.4242"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "fixed(4000.424242, 4, true)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "4000.4242" = result
    "4000.4242"
    iex> Expression.evaluate_as_string!(
    ...>   "@fixed(4000.424242, 4, true)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "4000.4242"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **String**: `"3.80"`.

```
> fixed(3.7979, 2, false)
"3.80"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @fixed(3.7979, 2, false) ..."
"3.80"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "fixed(3.7979, 2, false)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "3.80" = result
    "3.80"
    iex> Expression.evaluate_as_string!(
    ...>   "@fixed(3.7979, 2, false)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "3.80"

---

## Example 4:

When used in the following Stack expression it returns a  value of type **String**: `"3.80"`.

```
> fixed(3.7979, 2)
"3.80"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @fixed(3.7979, 2) ..."
"3.80"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "fixed(3.7979, 2)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "3.80" = result
    "3.80"
    iex> Expression.evaluate_as_string!(
    ...>   "@fixed(3.7979, 2)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "3.80"

---

## Example 5:

When used in the following Stack expression it returns a  value of type **String**: `"0.09"`.

```
> fixed(0.0909, 2)
"0.09"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @fixed(0.0909, 2) ..."
"0.09"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "fixed(0.0909, 2)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "0.09" = result
    "0.09"
    iex> Expression.evaluate_as_string!(
    ...>   "@fixed(0.0909, 2)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "0.09"

---

## Example 6:

> Format from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **String**: `"4.21"` when used with the following context:

```elixir
%{"no_commas" => %{"__value__" => false, "display" => "value for display key", "value" => "value for value key"}, "number" => %{"__value__" => 4.209922, "display" => "value for display key", "value" => "value for value key"}, "precision" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}}
```

```
> fixed(number, precision, no_commas)
"4.21"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @fixed(number, precision, no_commas) ..."
"4.21"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "fixed(number, precision, no_commas)",
    ...>   %{"no_commas" => %{"__value__" => false, "display" => "value for display key", "value" => "value for value key"}, "number" => %{"__value__" => 4.209922, "display" => "value for display key", "value" => "value for value key"}, "precision" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "4.21" = result
    "4.21"
    iex> Expression.evaluate_as_string!(
    ...>   "@fixed(number, precision, no_commas)",
    ...>   %{"no_commas" => %{"__value__" => false, "display" => "value for display key", "value" => "value for value key"}, "number" => %{"__value__" => 4.209922, "display" => "value for display key", "value" => "value for value key"}, "precision" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "4.21"

---

# `fixed`

# `handle`

# `has_all_members`

Return true if a list contains all the provided items

## Example 1:

> Check whether the given list contains all the provided items

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_all_members(["A", "B", "C"], ["C", "B"])
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_all_members(["A", "B", "C"], ["C", "B"]) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_all_members([\"A\", \"B\", \"C\"], [\"C\", \"B\"])",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_all_members([\"A\", \"B\", \"C\"], [\"C\", \"B\"])",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

> Return boolean indicating if a list contains all items from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Boolean**: `true` when used with the following context:

```elixir
%{"items" => %{"__value__" => ["C", "B"], "display" => "value for display key", "value" => "value for value key"}, "list" => %{"__value__" => ["A", "B", "C"], "display" => "value for display key", "value" => "value for value key"}}
```

```
> has_all_members(list, items)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_all_members(list, items) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_all_members(list, items)",
    ...>   %{"items" => %{"__value__" => ["C", "B"], "display" => "value for display key", "value" => "value for value key"}, "list" => %{"__value__" => ["A", "B", "C"], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_all_members(list, items)",
    ...>   %{"items" => %{"__value__" => ["C", "B"], "display" => "value for display key", "value" => "value for value key"}, "list" => %{"__value__" => ["A", "B", "C"], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `has_all_words`

Tests whether all the words are contained in text

The words can be in any order and may appear more than once.

## Example 1:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_all_words("the quick brown FOX", "the fox")
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_all_words("the quick brown FOX", "the fox") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_all_words(\"the quick brown FOX\", \"the fox\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_all_words(\"the quick brown FOX\", \"the fox\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_all_words("the quick brown FOX", "red fox")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_all_words("the quick brown FOX", "red fox") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_all_words(\"the quick brown FOX\", \"red fox\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_all_words(\"the quick brown FOX\", \"red fox\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_all_words(nil, "red fox")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_all_words(nil, "red fox") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_all_words(nil, \"red fox\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_all_words(nil, \"red fox\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 4:

> Return boolean whether all the words are contained in text value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Boolean**: `true` when used with the following context:

```elixir
%{"haystack" => %{"__value__" => "the quick brown FOX", "display" => "value for display key", "value" => "value for value key"}, "words" => %{"__value__" => "the fox", "display" => "value for display key", "value" => "value for value key"}}
```

```
> has_all_words(haystack, words)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_all_words(haystack, words) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_all_words(haystack, words)",
    ...>   %{"haystack" => %{"__value__" => "the quick brown FOX", "display" => "value for display key", "value" => "value for value key"}, "words" => %{"__value__" => "the fox", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_all_words(haystack, words)",
    ...>   %{"haystack" => %{"__value__" => "the quick brown FOX", "display" => "value for display key", "value" => "value for value key"}, "words" => %{"__value__" => "the fox", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `has_any_beginning`

Checks if the given text starts with any of the provided prefixes. The function performs a case-insensitive match.

## Example 1:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_any_beginning("HEY HOW ARE YOU?", ["hello", "hey how are you"])
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_any_beginning("HEY HOW ARE YOU?", ["hello", "hey how are you"]) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_any_beginning(\"HEY HOW ARE YOU?\", [\"hello\", \"hey how are you\"])",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_any_beginning(\"HEY HOW ARE YOU?\", [\"hello\", \"hey how are you\"])",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_any_beginning("كيف حالك؟", ["كيف حالك", "hey how are you"])
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_any_beginning("كيف حالك؟", ["كيف حالك", "hey how are you"]) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_any_beginning(\"كيف حالك؟\", [\"كيف حالك\", \"hey how are you\"])",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_any_beginning(\"كيف حالك؟\", [\"كيف حالك\", \"hey how are you\"])",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 3:

> Return boolean indicating if text starts with any of the provided prefixes from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Boolean**: `true` when used with the following context:

```elixir
%{"prefixes" => %{"__value__" => ["hello", "hey how are you"], "display" => "value for display key", "value" => "value for value key"}, "text" => %{"__value__" => "HEY HOW ARE YOU?", "display" => "value for display key", "value" => "value for value key"}}
```

```
> has_any_beginning(text, prefixes)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_any_beginning(text, prefixes) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_any_beginning(text, prefixes)",
    ...>   %{"prefixes" => %{"__value__" => ["hello", "hey how are you"], "display" => "value for display key", "value" => "value for value key"}, "text" => %{"__value__" => "HEY HOW ARE YOU?", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_any_beginning(text, prefixes)",
    ...>   %{"prefixes" => %{"__value__" => ["hello", "hey how are you"], "display" => "value for display key", "value" => "value for value key"}, "text" => %{"__value__" => "HEY HOW ARE YOU?", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `has_any_end`

## Example 1:

> Check whether the given text ends with any of the provided strings. The function performs a case-insensitive match.

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_any_end("I would like to book a vaccine", ["appointment", "visit", "vaccine"])
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_any_end("I would like to book a vaccine", ["appointment", "visit", "vaccine"]) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_any_end(\"I would like to book a vaccine\", [\"appointment\", \"visit\", \"vaccine\"])",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_any_end(\"I would like to book a vaccine\", [\"appointment\", \"visit\", \"vaccine\"])",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

> Return boolean indicating if text ends with any of the provided strings from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Boolean**: `true` when used with the following context:

```elixir
%{"end_texts" => %{"__value__" => ["appointment", "visit", "vaccine"], "display" => "value for display key", "value" => "value for value key"}, "text" => %{"__value__" => "I would like to book a vaccine", "display" => "value for display key", "value" => "value for value key"}}
```

```
> has_any_end(text, end_texts)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_any_end(text, end_texts) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_any_end(text, end_texts)",
    ...>   %{"end_texts" => %{"__value__" => ["appointment", "visit", "vaccine"], "display" => "value for display key", "value" => "value for value key"}, "text" => %{"__value__" => "I would like to book a vaccine", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_any_end(text, end_texts)",
    ...>   %{"end_texts" => %{"__value__" => ["appointment", "visit", "vaccine"], "display" => "value for display key", "value" => "value for value key"}, "text" => %{"__value__" => "I would like to book a vaccine", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `has_any_exact_phrase`

Check whether the given text exactly matches any of the provided phrases. The function performs a case-insensitive exact match.

## Example 1:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_any_exact_phrase("HEY HOW ARE YOU?", ["hello", "hey how are you?"])
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_any_exact_phrase("HEY HOW ARE YOU?", ["hello", "hey how are you?"]) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_any_exact_phrase(\"HEY HOW ARE YOU?\", [\"hello\", \"hey how are you?\"])",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_any_exact_phrase(\"HEY HOW ARE YOU?\", [\"hello\", \"hey how are you?\"])",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_any_exact_phrase("كيف حالك؟", ["كيف حالك", "hey how are you"])
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_any_exact_phrase("كيف حالك؟", ["كيف حالك", "hey how are you"]) ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_any_exact_phrase(\"كيف حالك؟\", [\"كيف حالك\", \"hey how are you\"])",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_any_exact_phrase(\"كيف حالك؟\", [\"كيف حالك\", \"hey how are you\"])",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 3:

> Return boolean indicating if text exactly matches any of the provided phrases from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Boolean**: `true` when used with the following context:

```elixir
%{"phrases" => %{"__value__" => ["hello", "hey how are you?"], "display" => "value for display key", "value" => "value for value key"}, "text" => %{"__value__" => "HEY HOW ARE YOU?", "display" => "value for display key", "value" => "value for value key"}}
```

```
> has_any_exact_phrase(text, phrases)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_any_exact_phrase(text, phrases) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_any_exact_phrase(text, phrases)",
    ...>   %{"phrases" => %{"__value__" => ["hello", "hey how are you?"], "display" => "value for display key", "value" => "value for value key"}, "text" => %{"__value__" => "HEY HOW ARE YOU?", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_any_exact_phrase(text, phrases)",
    ...>   %{"phrases" => %{"__value__" => ["hello", "hey how are you?"], "display" => "value for display key", "value" => "value for value key"}, "text" => %{"__value__" => "HEY HOW ARE YOU?", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `has_any_member`

Return true if a list contains any of the provided items

## Example 1:

> Check whether the given list contains any of the provided items

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_any_member(["A", "B", "C"], ["Z", "C"])
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_any_member(["A", "B", "C"], ["Z", "C"]) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_any_member([\"A\", \"B\", \"C\"], [\"Z\", \"C\"])",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_any_member([\"A\", \"B\", \"C\"], [\"Z\", \"C\"])",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

> Return boolean indicating if a list contains any items from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Boolean**: `true` when used with the following context:

```elixir
%{"items" => %{"__value__" => ["Z", "C"], "display" => "value for display key", "value" => "value for value key"}, "list" => %{"__value__" => ["A", "B", "C"], "display" => "value for display key", "value" => "value for value key"}}
```

```
> has_any_member(list, items)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_any_member(list, items) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_any_member(list, items)",
    ...>   %{"items" => %{"__value__" => ["Z", "C"], "display" => "value for display key", "value" => "value for value key"}, "list" => %{"__value__" => ["A", "B", "C"], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_any_member(list, items)",
    ...>   %{"items" => %{"__value__" => ["Z", "C"], "display" => "value for display key", "value" => "value for value key"}, "list" => %{"__value__" => ["A", "B", "C"], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `has_any_phrase`

Check whether the given text contains any of the provided strings. The function performs a case-insensitive exact match.
The second argument expects either a list of strings or a single string with comma-separated phrases.

## Example 1:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_any_phrase("hey how are you?", ["hello", "bye bye", "how are you"])
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_any_phrase("hey how are you?", ["hello", "bye bye", "how are you"]) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_any_phrase(\"hey how are you?\", [\"hello\", \"bye bye\", \"how are you\"])",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_any_phrase(\"hey how are you?\", [\"hello\", \"bye bye\", \"how are you\"])",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_any_phrase("مرحباً كيف حالك؟", ["كيف حالك", "how are you"])
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_any_phrase("مرحباً كيف حالك؟", ["كيف حالك", "how are you"]) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_any_phrase(\"مرحباً كيف حالك؟\", [\"كيف حالك\", \"how are you\"])",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_any_phrase(\"مرحباً كيف حالك؟\", [\"كيف حالك\", \"how are you\"])",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_any_phrase("hey how are you?", "hello, bye bye, how are you")
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_any_phrase("hey how are you?", "hello, bye bye, how are you") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_any_phrase(\"hey how are you?\", \"hello, bye bye, how are you\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_any_phrase(\"hey how are you?\", \"hello, bye bye, how are you\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 4:

> Return boolean indicating if text contains any of the provided phrases from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Boolean**: `true` when used with the following context:

```elixir
%{"phrases" => %{"__value__" => ["hello", "bye bye", "how are you"], "display" => "value for display key", "value" => "value for value key"}, "text" => %{"__value__" => "hey how are you?", "display" => "value for display key", "value" => "value for value key"}}
```

```
> has_any_phrase(text, phrases)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_any_phrase(text, phrases) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_any_phrase(text, phrases)",
    ...>   %{"phrases" => %{"__value__" => ["hello", "bye bye", "how are you"], "display" => "value for display key", "value" => "value for value key"}, "text" => %{"__value__" => "hey how are you?", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_any_phrase(text, phrases)",
    ...>   %{"phrases" => %{"__value__" => ["hello", "bye bye", "how are you"], "display" => "value for display key", "value" => "value for value key"}, "text" => %{"__value__" => "hey how are you?", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `has_any_word`

Tests whether any of the words are contained in the text

Only one of the words needs to match and it may appear more than once.

## Example 1:

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
true
```
with the following fields:

* *match* of type **String**
.

```
> has_any_word("The Quick Brown Fox", "fox quick")
%{"__value__" => true, "match" => "Quick Fox"}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_any_word("The Quick Brown Fox", "fox quick") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_any_word(\"The Quick Brown Fox\", \"fox quick\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => true, "match" => "Quick Fox"} = result
    %{"__value__" => true, "match" => "Quick Fox"}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_any_word(\"The Quick Brown Fox\", \"fox quick\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
false
```
with the following fields:

* *match* of type **Null**
.

```
> has_any_word("The Quick Brown Fox", "yellow")
%{"__value__" => false, "match" => nil}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_any_word("The Quick Brown Fox", "yellow") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_any_word(\"The Quick Brown Fox\", \"yellow\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => false, "match" => nil} = result
    %{"__value__" => false, "match" => nil}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_any_word(\"The Quick Brown Fox\", \"yellow\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 3:

> Tests whether any of the words are contained in text value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
true
```
with the following fields:

* *match* of type **String**
 when used with the following context:

```elixir
%{"haystack" => %{"__value__" => "The Quick Brown Fox", "display" => "value for display key", "value" => "value for value key"}, "words" => %{"__value__" => "fox quick", "display" => "value for display key", "value" => "value for value key"}}
```

```
> has_any_word(haystack, words)
%{"__value__" => true, "match" => "Quick Fox"}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_any_word(haystack, words) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_any_word(haystack, words)",
    ...>   %{"haystack" => %{"__value__" => "The Quick Brown Fox", "display" => "value for display key", "value" => "value for value key"}, "words" => %{"__value__" => "fox quick", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => true, "match" => "Quick Fox"} = result
    %{"__value__" => true, "match" => "Quick Fox"}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_any_word(haystack, words)",
    ...>   %{"haystack" => %{"__value__" => "The Quick Brown Fox", "display" => "value for display key", "value" => "value for value key"}, "words" => %{"__value__" => "fox quick", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `has_beginning`

Tests whether text starts with beginning

Both text values are trimmed of surrounding whitespace, but otherwise matching is
strict without any tokenization.

## Example 1:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_beginning("The Quick Brown", "the quick")
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_beginning("The Quick Brown", "the quick") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_beginning(\"The Quick Brown\", \"the quick\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_beginning(\"The Quick Brown\", \"the quick\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_beginning("The Quick Brown", "the    quick")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_beginning("The Quick Brown", "the    quick") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_beginning(\"The Quick Brown\", \"the    quick\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_beginning(\"The Quick Brown\", \"the    quick\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_beginning("The Quick Brown", "quick brown")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_beginning("The Quick Brown", "quick brown") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_beginning(\"The Quick Brown\", \"quick brown\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_beginning(\"The Quick Brown\", \"quick brown\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 4:

> Tests whether text starts with beginning value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Boolean**: `true` when used with the following context:

```elixir
%{"beginning" => %{"__value__" => "the quick", "display" => "value for display key", "value" => "value for value key"}, "text" => %{"__value__" => "The Quick Brown", "display" => "value for display key", "value" => "value for value key"}}
```

```
> has_beginning(text, beginning)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_beginning(text, beginning) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_beginning(text, beginning)",
    ...>   %{"beginning" => %{"__value__" => "the quick", "display" => "value for display key", "value" => "value for value key"}, "text" => %{"__value__" => "The Quick Brown", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_beginning(text, beginning)",
    ...>   %{"beginning" => %{"__value__" => "the quick", "display" => "value for display key", "value" => "value for value key"}, "text" => %{"__value__" => "The Quick Brown", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `has_date`

Tests whether `expression` contains a date formatted according to our environment

This is very naively implemented with a regular expression.

## Example 1:

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
true
```
with the following fields:

* *date* of type **Date**
* *datetime* of type **DateTime**
* *match* of type **DateTime**
.

```
> has_date("the date is 15/01/2017 05:50")
%{"__value__" => true, "date" => ~D[2017-01-15], "datetime" => ~U[2017-01-15 05:50:00Z], "match" => ~U[2017-01-15 05:50:00Z]}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_date("the date is 15/01/2017 05:50") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_date(\"the date is 15/01/2017 05:50\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => true, "date" => ~D[2017-01-15], "datetime" => ~U[2017-01-15 05:50:00Z], "match" => ~U[2017-01-15 05:50:00Z]} = result
    %{"__value__" => true, "date" => ~D[2017-01-15], "datetime" => ~U[2017-01-15 05:50:00Z], "match" => ~U[2017-01-15 05:50:00Z]}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_date(\"the date is 15/01/2017 05:50\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Date**: `"2017-01-15"`.

```
> has_date("the date is 15/01/2017").date
~D[2017-01-15]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_date("the date is 15/01/2017").date ..."
"2017-01-15"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_date(\"the date is 15/01/2017\").date",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ~D[2017-01-15] = result
    ~D[2017-01-15]
    iex> Expression.evaluate_as_string!(
    ...>   "@has_date(\"the date is 15/01/2017\").date",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2017-01-15"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **DateTime**: `"2017-01-15T05:50:00Z"`.

```
> has_date("the date is 15/01/2017 05:50").datetime
~U[2017-01-15 05:50:00Z]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_date("the date is 15/01/2017 05:50").datetime ..."
"2017-01-15T05:50:00Z"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_date(\"the date is 15/01/2017 05:50\").datetime",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ~U[2017-01-15 05:50:00Z] = result
    ~U[2017-01-15 05:50:00Z]
    iex> Expression.evaluate_as_string!(
    ...>   "@has_date(\"the date is 15/01/2017 05:50\").datetime",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2017-01-15T05:50:00Z"

---

## Example 4:

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
false
```
with the following fields:

* *date* of type **Null**
* *datetime* of type **Null**
* *match* of type **Null**
.

```
> has_date("there is no date here, just a year 2017")
%{"__value__" => false, "date" => nil, "datetime" => nil, "match" => nil}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_date("there is no date here, just a year 2017") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_date(\"there is no date here, just a year 2017\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => false, "date" => nil, "datetime" => nil, "match" => nil} = result
    %{"__value__" => false, "date" => nil, "datetime" => nil, "match" => nil}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_date(\"there is no date here, just a year 2017\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 5:

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
false
```
with the following fields:

* *date* of type **Null**
* *datetime* of type **Null**
* *match* of type **Null**
.

```
> has_date(1)
%{"__value__" => false, "date" => nil, "datetime" => nil, "match" => nil}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_date(1) ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_date(1)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => false, "date" => nil, "datetime" => nil, "match" => nil} = result
    %{"__value__" => false, "date" => nil, "datetime" => nil, "match" => nil}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_date(1)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 6:

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
false
```
with the following fields:

* *date* of type **Null**
* *datetime* of type **Null**
* *match* of type **Null**
 when used with the following context:

```elixir
%{"var" => 1}
```

```
> has_date(var)
%{"__value__" => false, "date" => nil, "datetime" => nil, "match" => nil}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_date(var) ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_date(var)",
    ...>   %{"var" => 1},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => false, "date" => nil, "datetime" => nil, "match" => nil} = result
    %{"__value__" => false, "date" => nil, "datetime" => nil, "match" => nil}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_date(var)",
    ...>   %{"var" => 1},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 7:

> Tests whether expression contains a date from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
true
```
with the following fields:

* *date* of type **Date**
* *datetime* of type **DateTime**
* *match* of type **DateTime**
 when used with the following context:

```elixir
%{"expression" => %{"__value__" => "the date is 15/01/2017 05:50", "display" => "value for display key", "value" => "value for value key"}}
```

```
> has_date(expression)
%{"__value__" => true, "date" => ~D[2017-01-15], "datetime" => ~U[2017-01-15 05:50:00Z], "match" => ~U[2017-01-15 05:50:00Z]}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_date(expression) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_date(expression)",
    ...>   %{"expression" => %{"__value__" => "the date is 15/01/2017 05:50", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => true, "date" => ~D[2017-01-15], "datetime" => ~U[2017-01-15 05:50:00Z], "match" => ~U[2017-01-15 05:50:00Z]} = result
    %{"__value__" => true, "date" => ~D[2017-01-15], "datetime" => ~U[2017-01-15 05:50:00Z], "match" => ~U[2017-01-15 05:50:00Z]}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_date(expression)",
    ...>   %{"expression" => %{"__value__" => "the date is 15/01/2017 05:50", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `has_date_eq`

Tests whether `expression` is a date equal to `date_string`

## Example 1:

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
true
```
with the following fields:

* *match* of type **Date**
* *test* of type **Date**
.

```
> has_date_eq("the date is 15/01/2017", "2017-01-15")
%{"__value__" => true, "match" => ~D[2017-01-15], "test" => ~D[2017-01-15]}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_date_eq("the date is 15/01/2017", "2017-01-15") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_date_eq(\"the date is 15/01/2017\", \"2017-01-15\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => true, "match" => ~D[2017-01-15], "test" => ~D[2017-01-15]} = result
    %{"__value__" => true, "match" => ~D[2017-01-15], "test" => ~D[2017-01-15]}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_date_eq(\"the date is 15/01/2017\", \"2017-01-15\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
false
```
with the following fields:

* *error* of type **Map**
* *match* of type **Null**
* *test* of type **Date**
.

```
> has_date_eq("there is no date here, just a year 2017", "2017-01-15")
%{"__value__" => false, "error" => %{"__type__" => "expression/v1error", "__value__" => nil, "error" => true, "message" => "The first argument is nil"}, "match" => nil, "test" => ~D[2017-01-15]}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_date_eq("there is no date here, just a year 2017", "2017-01-15") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_date_eq(\"there is no date here, just a year 2017\", \"2017-01-15\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => false, "error" => %{"__type__" => "expression/v1error", "__value__" => nil, "error" => true, "message" => "The first argument is nil"}, "match" => nil, "test" => ~D[2017-01-15]} = result
    %{"__value__" => false, "error" => %{"__type__" => "expression/v1error", "__value__" => nil, "error" => true, "message" => "The first argument is nil"}, "match" => nil, "test" => ~D[2017-01-15]}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_date_eq(\"there is no date here, just a year 2017\", \"2017-01-15\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 3:

> Tests whether expression is equal to date from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
true
```
with the following fields:

* *match* of type **Date**
* *test* of type **Date**
 when used with the following context:

```elixir
%{"date_string" => %{"__value__" => "2017-01-15", "display" => "value for display key", "value" => "value for value key"}, "expression" => %{"__value__" => "the date is 15/01/2017", "display" => "value for display key", "value" => "value for value key"}}
```

```
> has_date_eq("the date is 15/01/2017", "2017-01-15")
%{"__value__" => true, "match" => ~D[2017-01-15], "test" => ~D[2017-01-15]}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_date_eq("the date is 15/01/2017", "2017-01-15") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_date_eq(\"the date is 15/01/2017\", \"2017-01-15\")",
    ...>   %{"date_string" => %{"__value__" => "2017-01-15", "display" => "value for display key", "value" => "value for value key"}, "expression" => %{"__value__" => "the date is 15/01/2017", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => true, "match" => ~D[2017-01-15], "test" => ~D[2017-01-15]} = result
    %{"__value__" => true, "match" => ~D[2017-01-15], "test" => ~D[2017-01-15]}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_date_eq(\"the date is 15/01/2017\", \"2017-01-15\")",
    ...>   %{"date_string" => %{"__value__" => "2017-01-15", "display" => "value for display key", "value" => "value for value key"}, "expression" => %{"__value__" => "the date is 15/01/2017", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `has_date_gt`

Tests whether `expression` is a date after the date `date_string`

## Example 1:

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
true
```
with the following fields:

* *match* of type **Date**
* *test* of type **Date**
.

```
> has_date_gt("the date is 15/01/2017", "2017-01-01")
%{"__value__" => true, "match" => ~D[2017-01-15], "test" => ~D[2017-01-01]}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_date_gt("the date is 15/01/2017", "2017-01-01") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_date_gt(\"the date is 15/01/2017\", \"2017-01-01\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => true, "match" => ~D[2017-01-15], "test" => ~D[2017-01-01]} = result
    %{"__value__" => true, "match" => ~D[2017-01-15], "test" => ~D[2017-01-01]}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_date_gt(\"the date is 15/01/2017\", \"2017-01-01\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
false
```
with the following fields:

* *match* of type **Date**
* *test* of type **Date**
.

```
> has_date_gt("the date is 15/01/2017", "2017-03-15")
%{"__value__" => false, "match" => ~D[2017-01-15], "test" => ~D[2017-03-15]}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_date_gt("the date is 15/01/2017", "2017-03-15") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_date_gt(\"the date is 15/01/2017\", \"2017-03-15\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => false, "match" => ~D[2017-01-15], "test" => ~D[2017-03-15]} = result
    %{"__value__" => false, "match" => ~D[2017-01-15], "test" => ~D[2017-03-15]}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_date_gt(\"the date is 15/01/2017\", \"2017-03-15\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 3:

> Tests whether expression is greater than date from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
true
```
with the following fields:

* *match* of type **Date**
* *test* of type **Date**
 when used with the following context:

```elixir
%{"date_string" => %{"__value__" => "2017-01-01", "display" => "value for display key", "value" => "value for value key"}, "expression" => %{"__value__" => "the date is 15/01/2017", "display" => "value for display key", "value" => "value for value key"}}
```

```
> has_date_gt(expression, date_string)
%{"__value__" => true, "match" => ~D[2017-01-15], "test" => ~D[2017-01-01]}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_date_gt(expression, date_string) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_date_gt(expression, date_string)",
    ...>   %{"date_string" => %{"__value__" => "2017-01-01", "display" => "value for display key", "value" => "value for value key"}, "expression" => %{"__value__" => "the date is 15/01/2017", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => true, "match" => ~D[2017-01-15], "test" => ~D[2017-01-01]} = result
    %{"__value__" => true, "match" => ~D[2017-01-15], "test" => ~D[2017-01-01]}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_date_gt(expression, date_string)",
    ...>   %{"date_string" => %{"__value__" => "2017-01-01", "display" => "value for display key", "value" => "value for value key"}, "expression" => %{"__value__" => "the date is 15/01/2017", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `has_date_lt`

Tests whether `expression` contains a date before the date `date_string`

## Example 1:

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
true
```
with the following fields:

* *match* of type **Date**
* *test* of type **Date**
.

```
> has_date_lt("the date is 15/01/2017", "2017-06-01")
%{"__value__" => true, "match" => ~D[2017-01-15], "test" => ~D[2017-06-01]}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_date_lt("the date is 15/01/2017", "2017-06-01") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_date_lt(\"the date is 15/01/2017\", \"2017-06-01\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => true, "match" => ~D[2017-01-15], "test" => ~D[2017-06-01]} = result
    %{"__value__" => true, "match" => ~D[2017-01-15], "test" => ~D[2017-06-01]}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_date_lt(\"the date is 15/01/2017\", \"2017-06-01\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
false
```
with the following fields:

* *match* of type **Date**
* *test* of type **Date**
.

```
> has_date_lt("the date is 15/01/2021", "2017-03-15")
%{"__value__" => false, "match" => ~D[2021-01-15], "test" => ~D[2017-03-15]}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_date_lt("the date is 15/01/2021", "2017-03-15") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_date_lt(\"the date is 15/01/2021\", \"2017-03-15\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => false, "match" => ~D[2021-01-15], "test" => ~D[2017-03-15]} = result
    %{"__value__" => false, "match" => ~D[2021-01-15], "test" => ~D[2017-03-15]}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_date_lt(\"the date is 15/01/2021\", \"2017-03-15\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 3:

> Tests whether expression is less than date from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
true
```
with the following fields:

* *match* of type **Date**
* *test* of type **Date**
 when used with the following context:

```elixir
%{"date_string" => %{"__value__" => "2017-06-01", "display" => "value for display key", "value" => "value for value key"}, "expression" => %{"__value__" => "the date is 15/01/2017", "display" => "value for display key", "value" => "value for value key"}}
```

```
> has_date_lt(expression, date_string)
%{"__value__" => true, "match" => ~D[2017-01-15], "test" => ~D[2017-06-01]}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_date_lt(expression, date_string) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_date_lt(expression, date_string)",
    ...>   %{"date_string" => %{"__value__" => "2017-06-01", "display" => "value for display key", "value" => "value for value key"}, "expression" => %{"__value__" => "the date is 15/01/2017", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => true, "match" => ~D[2017-01-15], "test" => ~D[2017-06-01]} = result
    %{"__value__" => true, "match" => ~D[2017-01-15], "test" => ~D[2017-06-01]}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_date_lt(expression, date_string)",
    ...>   %{"date_string" => %{"__value__" => "2017-06-01", "display" => "value for display key", "value" => "value for value key"}, "expression" => %{"__value__" => "the date is 15/01/2017", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `has_email`

Tests whether an email is contained in text

## Example 1:

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
true
```
with the following fields:

* *email* of type **String**
.

```
> has_email("my email is foo1@bar.com, please respond")
%{"__value__" => true, "email" => "foo1@bar.com"}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_email("my email is foo1@bar.com, please respond") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_email(\"my email is foo1@bar.com, please respond\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => true, "email" => "foo1@bar.com"} = result
    %{"__value__" => true, "email" => "foo1@bar.com"}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_email(\"my email is foo1@bar.com, please respond\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
false
```
with the following fields:

* *email* of type **Null**
.

```
> has_email("i'm not sharing my email")
%{"__value__" => false, "email" => nil}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_email("i'm not sharing my email") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_email(\"i'm not sharing my email\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => false, "email" => nil} = result
    %{"__value__" => false, "email" => nil}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_email(\"i'm not sharing my email\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 3:

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
false
```
with the following fields:

* *email* of type **Null**
.

```
> has_email(nil)
%{"__value__" => false, "email" => nil}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_email(nil) ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_email(nil)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => false, "email" => nil} = result
    %{"__value__" => false, "email" => nil}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_email(nil)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 4:

> Tests whether an email is contained in expression from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
true
```
with the following fields:

* *email* of type **String**
 when used with the following context:

```elixir
%{"expression" => %{"__value__" => "my email is foo1@bar.com, please respond", "display" => "value for display key", "value" => "value for value key"}}
```

```
> has_email(expression)
%{"__value__" => true, "email" => "foo1@bar.com"}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_email(expression) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_email(expression)",
    ...>   %{"expression" => %{"__value__" => "my email is foo1@bar.com, please respond", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => true, "email" => "foo1@bar.com"} = result
    %{"__value__" => true, "email" => "foo1@bar.com"}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_email(expression)",
    ...>   %{"expression" => %{"__value__" => "my email is foo1@bar.com, please respond", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `has_end`

## Example 1:

> Check whether the given text ends with the provided string. The function performs a case-insensitive match.

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_end("I would like to book a vaccine", "vaccine")
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_end("I would like to book a vaccine", "vaccine") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_end(\"I would like to book a vaccine\", \"vaccine\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_end(\"I would like to book a vaccine\", \"vaccine\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

> Return boolean indicating if text ends with provided string from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Boolean**: `true` when used with the following context:

```elixir
%{"end_text" => %{"__value__" => "vaccine", "display" => "value for display key", "value" => "value for value key"}, "text" => %{"__value__" => "I would like to book a vaccine", "display" => "value for display key", "value" => "value for value key"}}
```

```
> has_end(text, end_text)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_end(text, end_text) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_end(text, end_text)",
    ...>   %{"end_text" => %{"__value__" => "vaccine", "display" => "value for display key", "value" => "value for value key"}, "text" => %{"__value__" => "I would like to book a vaccine", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_end(text, end_text)",
    ...>   %{"end_text" => %{"__value__" => "vaccine", "display" => "value for display key", "value" => "value for value key"}, "text" => %{"__value__" => "I would like to book a vaccine", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `has_group`

Returns whether the contact is part of group with the passed in UUID

## Example 1:

When used in the following Stack expression it returns a  value of type **Boolean**: `true` when used with the following context:

```elixir
%{"contact" => %{"groups" => [%{"uuid" => "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d"}]}}
```

```
> has_group(contact.groups, "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d")
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_group(contact.groups, "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_group(contact.groups, \"b7cf0d83-f1c9-411c-96fd-c511a4cfa86d\")",
    ...>   %{"contact" => %{"groups" => [%{"uuid" => "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d"}]}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_group(contact.groups, \"b7cf0d83-f1c9-411c-96fd-c511a4cfa86d\")",
    ...>   %{"contact" => %{"groups" => [%{"uuid" => "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d"}]}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Boolean**: `false` when used with the following context:

```elixir
%{"contact" => %{"groups" => [%{"uuid" => "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d"}]}}
```

```
> has_group(contact.groups, "00000000-0000-0000-0000-000000000000")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_group(contact.groups, "00000000-0000-0000-0000-000000000000") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_group(contact.groups, \"00000000-0000-0000-0000-000000000000\")",
    ...>   %{"contact" => %{"groups" => [%{"uuid" => "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d"}]}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_group(contact.groups, \"00000000-0000-0000-0000-000000000000\")",
    ...>   %{"contact" => %{"groups" => [%{"uuid" => "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d"}]}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 3:

> Returns whether the groups contain the given uuid from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Boolean**: `false` when used with the following context:

```elixir
%{"groups" => %{"__value__" => [%{"uuid" => "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d"}], "display" => "value for display key", "value" => "value for value key"}, "uuid" => %{"__value__" => "00000000-0000-0000-0000-000000000000", "display" => "value for display key", "value" => "value for value key"}}
```

```
> has_group(groups, uuid)
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_group(groups, uuid) ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_group(groups, uuid)",
    ...>   %{"groups" => %{"__value__" => [%{"uuid" => "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d"}], "display" => "value for display key", "value" => "value for value key"}, "uuid" => %{"__value__" => "00000000-0000-0000-0000-000000000000", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_group(groups, uuid)",
    ...>   %{"groups" => %{"__value__" => [%{"uuid" => "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d"}], "display" => "value for display key", "value" => "value for value key"}, "uuid" => %{"__value__" => "00000000-0000-0000-0000-000000000000", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

# `has_member`

Return true if a list has the given item as a member

## Example 1:

> Check whether the given list has the item as a member

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_member(["A", "B", "C"], "C")
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_member(["A", "B", "C"], "C") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_member([\"A\", \"B\", \"C\"], \"C\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_member([\"A\", \"B\", \"C\"], \"C\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

> Check whether the given list has the item as a member from __value__ keys if complex values are provided.

When used in the following Stack expression it returns a  value of type **Boolean**: `true` when used with the following context:

```elixir
%{"item" => %{"__value__" => "C", "display" => "value for display key", "value" => "value for value key"}, "list" => %{"__value__" => ["A", "B", "C"], "display" => "value for display key", "value" => "value for value key"}}
```

```
> has_member(list, item)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_member(list, item) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_member(list, item)",
    ...>   %{"item" => %{"__value__" => "C", "display" => "value for display key", "value" => "value for value key"}, "list" => %{"__value__" => ["A", "B", "C"], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_member(list, item)",
    ...>   %{"item" => %{"__value__" => "C", "display" => "value for display key", "value" => "value for value key"}, "list" => %{"__value__" => ["A", "B", "C"], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `has_number`

Tests whether `expression` contains a number

## Example 1:

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
true
```
with the following fields:

* *number* of type **Float**
.

```
> has_number("the number is 42 and 5")
%{"__value__" => true, "number" => 42.0}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number("the number is 42 and 5") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number(\"the number is 42 and 5\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => true, "number" => 42.0} = result
    %{"__value__" => true, "number" => 42.0}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number(\"the number is 42 and 5\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
true
```
with the following fields:

* *number* of type **Float**
.

```
> has_number("العدد ٤٢")
%{"__value__" => true, "number" => 42.0}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number("العدد ٤٢") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number(\"العدد ٤٢\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => true, "number" => 42.0} = result
    %{"__value__" => true, "number" => 42.0}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number(\"العدد ٤٢\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 3:

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
true
```
with the following fields:

* *number* of type **Float**
.

```
> has_number("٠.٥")
%{"__value__" => true, "number" => 0.5}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number("٠.٥") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number(\"٠.٥\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => true, "number" => 0.5} = result
    %{"__value__" => true, "number" => 0.5}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number(\"٠.٥\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 4:

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
true
```
with the following fields:

* *number* of type **Float**
.

```
> has_number("0.6")
%{"__value__" => true, "number" => 0.6}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number("0.6") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number(\"0.6\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => true, "number" => 0.6} = result
    %{"__value__" => true, "number" => 0.6}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number(\"0.6\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 5:

> Tests whether expression contains a number from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
true
```
with the following fields:

* *number* of type **Float**
 when used with the following context:

```elixir
%{"string" => %{"__value__" => "the number is 42 and 5", "display" => "value for display key", "value" => "value for value key"}}
```

```
> has_number(string)
%{"__value__" => true, "number" => 42.0}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number(string) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number(string)",
    ...>   %{"string" => %{"__value__" => "the number is 42 and 5", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => true, "number" => 42.0} = result
    %{"__value__" => true, "number" => 42.0}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number(string)",
    ...>   %{"string" => %{"__value__" => "the number is 42 and 5", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `has_number_eq`

Tests whether `expression` contains a number equal to the value

## Example 1:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_number_eq("the number is 42", 42)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_eq("the number is 42", 42) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_eq(\"the number is 42\", 42)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_eq(\"the number is 42\", 42)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_number_eq("the number is 42", 42.0)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_eq("the number is 42", 42.0) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_eq(\"the number is 42\", 42.0)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_eq(\"the number is 42\", 42.0)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_number_eq("the number is 42", "42")
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_eq("the number is 42", "42") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_eq(\"the number is 42\", \"42\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_eq(\"the number is 42\", \"42\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 4:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_number_eq("the number is 0.5", "0.5")
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_eq("the number is 0.5", "0.5") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_eq(\"the number is 0.5\", \"0.5\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_eq(\"the number is 0.5\", \"0.5\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 5:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_number_eq("the number is 42.0", "42")
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_eq("the number is 42.0", "42") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_eq(\"the number is 42.0\", \"42\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_eq(\"the number is 42.0\", \"42\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 6:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_number_eq("the number is 40", "42")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_eq("the number is 40", "42") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_eq(\"the number is 40\", \"42\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_eq(\"the number is 40\", \"42\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 7:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_number_eq("the number is 40", "foo")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_eq("the number is 40", "foo") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_eq(\"the number is 40\", \"foo\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_eq(\"the number is 40\", \"foo\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 8:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_number_eq("four hundred", "foo")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_eq("four hundred", "foo") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_eq(\"four hundred\", \"foo\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_eq(\"four hundred\", \"foo\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 9:

> Tests whether expression is equal to number from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Boolean**: `true` when used with the following context:

```elixir
%{"float" => %{"__value__" => 42, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "the number is 42", "display" => "value for display key", "value" => "value for value key"}}
```

```
> has_number_eq(string, float)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_eq(string, float) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_eq(string, float)",
    ...>   %{"float" => %{"__value__" => 42, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "the number is 42", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_eq(string, float)",
    ...>   %{"float" => %{"__value__" => 42, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "the number is 42", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `has_number_gt`

Tests whether `expression` contains a number greater than min

## Example 1:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_number_gt("the number is 42", 40)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_gt("the number is 42", 40) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_gt(\"the number is 42\", 40)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_gt(\"the number is 42\", 40)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_number_gt("the number is 42", 40.0)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_gt("the number is 42", 40.0) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_gt(\"the number is 42\", 40.0)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_gt(\"the number is 42\", 40.0)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_number_gt("the number is 42", "40")
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_gt("the number is 42", "40") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_gt(\"the number is 42\", \"40\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_gt(\"the number is 42\", \"40\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 4:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_number_gt("the number is 0.6", "0.5")
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_gt("the number is 0.6", "0.5") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_gt(\"the number is 0.6\", \"0.5\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_gt(\"the number is 0.6\", \"0.5\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 5:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_number_gt("the number is 42.0", "40")
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_gt("the number is 42.0", "40") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_gt(\"the number is 42.0\", \"40\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_gt(\"the number is 42.0\", \"40\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 6:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_number_gt("the number is 40", "40")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_gt("the number is 40", "40") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_gt(\"the number is 40\", \"40\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_gt(\"the number is 40\", \"40\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 7:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_number_gt("the number is 40", "foo")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_gt("the number is 40", "foo") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_gt(\"the number is 40\", \"foo\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_gt(\"the number is 40\", \"foo\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 8:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_number_gt("four hundred", "foo")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_gt("four hundred", "foo") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_gt(\"four hundred\", \"foo\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_gt(\"four hundred\", \"foo\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 9:

> Tests whether expression is greater than number from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Boolean**: `true` when used with the following context:

```elixir
%{"float" => %{"__value__" => 40, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "the number is 42", "display" => "value for display key", "value" => "value for value key"}}
```

```
> has_number_gt(string, float)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_gt(string, float) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_gt(string, float)",
    ...>   %{"float" => %{"__value__" => 40, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "the number is 42", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_gt(string, float)",
    ...>   %{"float" => %{"__value__" => 40, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "the number is 42", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `has_number_gte`

Tests whether `expression` contains a number greater than or equal to min

## Example 1:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_number_gte("the number is 42", 42)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_gte("the number is 42", 42) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_gte(\"the number is 42\", 42)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_gte(\"the number is 42\", 42)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_number_gte("the number is 42", 42.0)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_gte("the number is 42", 42.0) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_gte(\"the number is 42\", 42.0)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_gte(\"the number is 42\", 42.0)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_number_gte("the number is 42", "42")
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_gte("the number is 42", "42") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_gte(\"the number is 42\", \"42\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_gte(\"the number is 42\", \"42\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 4:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_number_gte("the number is 0.5", "0.5")
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_gte("the number is 0.5", "0.5") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_gte(\"the number is 0.5\", \"0.5\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_gte(\"the number is 0.5\", \"0.5\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 5:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_number_gte("the number is 42.0", "45")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_gte("the number is 42.0", "45") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_gte(\"the number is 42.0\", \"45\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_gte(\"the number is 42.0\", \"45\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 6:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_number_gte("the number is 40", "45")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_gte("the number is 40", "45") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_gte(\"the number is 40\", \"45\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_gte(\"the number is 40\", \"45\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 7:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_number_gte("the number is 40", "foo")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_gte("the number is 40", "foo") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_gte(\"the number is 40\", \"foo\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_gte(\"the number is 40\", \"foo\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 8:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_number_gte("four hundred", "foo")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_gte("four hundred", "foo") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_gte(\"four hundred\", \"foo\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_gte(\"four hundred\", \"foo\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 9:

> Tests whether expression is greater than or equal to number from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Boolean**: `true` when used with the following context:

```elixir
%{"float" => %{"__value__" => 42, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "the number is 42", "display" => "value for display key", "value" => "value for value key"}}
```

```
> has_number_gte(string, float)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_gte(string, float) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_gte(string, float)",
    ...>   %{"float" => %{"__value__" => 42, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "the number is 42", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_gte(string, float)",
    ...>   %{"float" => %{"__value__" => 42, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "the number is 42", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `has_number_lt`

Tests whether `expression` contains a number less than max

## Example 1:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_number_lt("the number is 42", 44)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_lt("the number is 42", 44) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_lt(\"the number is 42\", 44)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_lt(\"the number is 42\", 44)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_number_lt("the number is 42", 44.0)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_lt("the number is 42", 44.0) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_lt(\"the number is 42\", 44.0)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_lt(\"the number is 42\", 44.0)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_number_lt("the number is 42", "40")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_lt("the number is 42", "40") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_lt(\"the number is 42\", \"40\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_lt(\"the number is 42\", \"40\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 4:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_number_lt("the number is 0.6", "0.5")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_lt("the number is 0.6", "0.5") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_lt(\"the number is 0.6\", \"0.5\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_lt(\"the number is 0.6\", \"0.5\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 5:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_number_lt("the number is 42.0", "40")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_lt("the number is 42.0", "40") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_lt(\"the number is 42.0\", \"40\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_lt(\"the number is 42.0\", \"40\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 6:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_number_lt("the number is 40", "40")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_lt("the number is 40", "40") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_lt(\"the number is 40\", \"40\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_lt(\"the number is 40\", \"40\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 7:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_number_lt("the number is 40", "foo")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_lt("the number is 40", "foo") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_lt(\"the number is 40\", \"foo\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_lt(\"the number is 40\", \"foo\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 8:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_number_lt("four hundred", "foo")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_lt("four hundred", "foo") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_lt(\"four hundred\", \"foo\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_lt(\"four hundred\", \"foo\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 9:

> Tests whether expression is less than number from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Boolean**: `true` when used with the following context:

```elixir
%{"float" => %{"__value__" => 44, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "the number is 42", "display" => "value for display key", "value" => "value for value key"}}
```

```
> has_number_lt(string, float)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_lt(string, float) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_lt(string, float)",
    ...>   %{"float" => %{"__value__" => 44, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "the number is 42", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_lt(string, float)",
    ...>   %{"float" => %{"__value__" => 44, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "the number is 42", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `has_number_lte`

Tests whether `expression` contains a number less than or equal to max

## Example 1:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_number_lte("the number is 42", 42)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_lte("the number is 42", 42) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_lte(\"the number is 42\", 42)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_lte(\"the number is 42\", 42)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_number_lte("the number is 42", 42.0)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_lte("the number is 42", 42.0) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_lte(\"the number is 42\", 42.0)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_lte(\"the number is 42\", 42.0)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_number_lte("the number is 42", "42")
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_lte("the number is 42", "42") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_lte(\"the number is 42\", \"42\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_lte(\"the number is 42\", \"42\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 4:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_number_lte("the number is 0.5", "0.5")
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_lte("the number is 0.5", "0.5") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_lte(\"the number is 0.5\", \"0.5\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_lte(\"the number is 0.5\", \"0.5\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 5:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_number_lte("the number is 42.0", "40")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_lte("the number is 42.0", "40") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_lte(\"the number is 42.0\", \"40\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_lte(\"the number is 42.0\", \"40\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 6:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_number_lte("the number is 40", "foo")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_lte("the number is 40", "foo") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_lte(\"the number is 40\", \"foo\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_lte(\"the number is 40\", \"foo\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 7:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_number_lte("four hundred", "foo")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_lte("four hundred", "foo") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_lte(\"four hundred\", \"foo\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_lte(\"four hundred\", \"foo\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 8:

When used in the following Stack expression it returns a  value of type **Boolean**: `true` when used with the following context:

```elixir
%{"response" => 3}
```

```
> has_number_lte("@response", 5)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_lte("@response", 5) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_lte(\"@response\", 5)",
    ...>   %{"response" => 3},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_lte(\"@response\", 5)",
    ...>   %{"response" => 3},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 9:

> Tests whether expression is less or equal than number from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Boolean**: `true` when used with the following context:

```elixir
%{"float" => %{"__value__" => 42, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "the number is 42", "display" => "value for display key", "value" => "value for value key"}}
```

```
> has_number_lte(string, float)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_number_lte(string, float) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_number_lte(string, float)",
    ...>   %{"float" => %{"__value__" => 42, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "the number is 42", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_number_lte(string, float)",
    ...>   %{"float" => %{"__value__" => 42, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "the number is 42", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `has_only_phrase`

Tests whether the text contains only phrase

The phrase must be the only text in the text to match

## Example 1:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_only_phrase("Quick Brown", "quick brown")
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_only_phrase("Quick Brown", "quick brown") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_only_phrase(\"Quick Brown\", \"quick brown\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_only_phrase(\"Quick Brown\", \"quick brown\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_only_phrase("", "")
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_only_phrase("", "") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_only_phrase(\"\", \"\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_only_phrase(\"\", \"\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_only_phrase("The Quick Brown Fox", "quick brown")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_only_phrase("The Quick Brown Fox", "quick brown") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_only_phrase(\"The Quick Brown Fox\", \"quick brown\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_only_phrase(\"The Quick Brown Fox\", \"quick brown\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 4:

> Tests whether expression contains only phrase from value in __value__ keys if complex values are provided.

When used in the following Stack expression it returns a  value of type **Boolean**: `true` when used with the following context:

```elixir
%{"phrase" => %{"__value__" => "quick brown", "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "Quick Brown", "display" => "value for display key", "value" => "value for value key"}}
```

```
> has_only_phrase(string, phrase)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_only_phrase(string, phrase) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_only_phrase(string, phrase)",
    ...>   %{"phrase" => %{"__value__" => "quick brown", "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "Quick Brown", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_only_phrase(string, phrase)",
    ...>   %{"phrase" => %{"__value__" => "quick brown", "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "Quick Brown", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `has_only_text`

Returns whether two text values are equal (case sensitive). In the case that they are, it will return the text as the match.

## Example 1:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_only_text("foo", "foo")
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_only_text("foo", "foo") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_only_text(\"foo\", \"foo\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_only_text(\"foo\", \"foo\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_only_text("", "")
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_only_text("", "") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_only_text(\"\", \"\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_only_text(\"\", \"\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_only_text("foo", "FOO")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_only_text("foo", "FOO") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_only_text(\"foo\", \"FOO\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_only_text(\"foo\", \"FOO\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 4:

> Returns whether two text values are equal from value in __value__ keys if complex values are provided.

When used in the following Stack expression it returns a  value of type **Boolean**: `true` when used with the following context:

```elixir
%{"expression_one" => %{"__value__" => "foo", "display" => "value for display key", "value" => "value for value key"}, "expression_two" => %{"__value__" => "foo", "display" => "value for display key", "value" => "value for value key"}}
```

```
> has_only_text(string, phrase)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_only_text(string, phrase) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_only_text(string, phrase)",
    ...>   %{"expression_one" => %{"__value__" => "foo", "display" => "value for display key", "value" => "value for value key"}, "expression_two" => %{"__value__" => "foo", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_only_text(string, phrase)",
    ...>   %{"expression_one" => %{"__value__" => "foo", "display" => "value for display key", "value" => "value for value key"}, "expression_two" => %{"__value__" => "foo", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `has_pattern`

Tests whether `expression` matches the regex pattern

Both text values are trimmed of surrounding whitespace and matching is case-insensitive.

## Example 1:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_pattern("Buy cheese please", "buy (\w+)")
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_pattern("Buy cheese please", "buy (\w+)") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_pattern(\"Buy cheese please\", \"buy (\\w+)\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_pattern(\"Buy cheese please\", \"buy (\\w+)\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_pattern("Sell cheese please", "buy (\w+)")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_pattern("Sell cheese please", "buy (\w+)") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_pattern(\"Sell cheese please\", \"buy (\\w+)\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_pattern(\"Sell cheese please\", \"buy (\\w+)\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_pattern(nil, "buy (\w+)")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_pattern(nil, "buy (\w+)") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_pattern(nil, \"buy (\\w+)\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_pattern(nil, \"buy (\\w+)\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 4:

> Returns whether two text values are equal from value in __value__ keys if complex values are provided.

When used in the following Stack expression it returns a  value of type **Boolean**: `true` when used with the following context:

```elixir
%{"expression" => %{"__value__" => "Buy cheese please", "display" => "value for display key", "value" => "value for value key"}, "pattern" => %{"__value__" => "buy (\\w+)", "display" => "value for display key", "value" => "value for value key"}}
```

```
> has_pattern(expression, pattern)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_pattern(expression, pattern) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_pattern(expression, pattern)",
    ...>   %{"expression" => %{"__value__" => "Buy cheese please", "display" => "value for display key", "value" => "value for value key"}, "pattern" => %{"__value__" => "buy (\\w+)", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_pattern(expression, pattern)",
    ...>   %{"expression" => %{"__value__" => "Buy cheese please", "display" => "value for display key", "value" => "value for value key"}, "pattern" => %{"__value__" => "buy (\\w+)", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `has_phone`

Tests whether `expresssion` contains a phone number.
The optional country_code argument specifies the country to use for parsing.

## Example 1:

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
true
```
with the following fields:

* *phonenumber* of type **String**
.

```
> has_phone("my number is +12067799294 thanks")
%{"__value__" => true, "phonenumber" => "+12067799294"}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_phone("my number is +12067799294 thanks") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_phone(\"my number is +12067799294 thanks\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => true, "phonenumber" => "+12067799294"} = result
    %{"__value__" => true, "phonenumber" => "+12067799294"}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_phone(\"my number is +12067799294 thanks\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
true
```
with the following fields:

* *phonenumber* of type **String**
.

```
> has_phone("my number is 2067799294 thanks", "US")
%{"__value__" => true, "phonenumber" => "+12067799294"}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_phone("my number is 2067799294 thanks", "US") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_phone(\"my number is 2067799294 thanks\", \"US\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => true, "phonenumber" => "+12067799294"} = result
    %{"__value__" => true, "phonenumber" => "+12067799294"}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_phone(\"my number is 2067799294 thanks\", \"US\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 3:

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
true
```
with the following fields:

* *phonenumber* of type **String**
.

```
> has_phone("my number is 206 779 9294 thanks", "US")
%{"__value__" => true, "phonenumber" => "+12067799294"}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_phone("my number is 206 779 9294 thanks", "US") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_phone(\"my number is 206 779 9294 thanks\", \"US\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => true, "phonenumber" => "+12067799294"} = result
    %{"__value__" => true, "phonenumber" => "+12067799294"}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_phone(\"my number is 206 779 9294 thanks\", \"US\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 4:

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
false
```
with the following fields:

* *phonenumber* of type **Null**
.

```
> has_phone("my number is none of your business", "US")
%{"__value__" => false, "phonenumber" => nil}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_phone("my number is none of your business", "US") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_phone(\"my number is none of your business\", \"US\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => false, "phonenumber" => nil} = result
    %{"__value__" => false, "phonenumber" => nil}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_phone(\"my number is none of your business\", \"US\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 5:

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
false
```
with the following fields:

* *phonenumber* of type **Null**
.

```
> has_phone(nil, "US")
%{"__value__" => false, "phonenumber" => nil}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_phone(nil, "US") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_phone(nil, \"US\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => false, "phonenumber" => nil} = result
    %{"__value__" => false, "phonenumber" => nil}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_phone(nil, \"US\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 6:

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
false
```
with the following fields:

* *phonenumber* of type **Null**
.

```
> has_phone("+27")
%{"__value__" => false, "phonenumber" => nil}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_phone("+27") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_phone(\"+27\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => false, "phonenumber" => nil} = result
    %{"__value__" => false, "phonenumber" => nil}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_phone(\"+27\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 7:

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
false
```
with the following fields:

* *phonenumber* of type **Null**
.

```
> has_phone("+27", "ZA")
%{"__value__" => false, "phonenumber" => nil}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_phone("+27", "ZA") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_phone(\"+27\", \"ZA\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => false, "phonenumber" => nil} = result
    %{"__value__" => false, "phonenumber" => nil}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_phone(\"+27\", \"ZA\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 8:

> Tests whether expression contains a phone number from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
true
```
with the following fields:

* *phonenumber* of type **String**
 when used with the following context:

```elixir
%{"expression" => %{"__value__" => "my number is +12067799294 thanks", "display" => "value for display key", "value" => "value for value key"}}
```

```
> has_phone(expression)
%{"__value__" => true, "phonenumber" => "+12067799294"}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_phone(expression) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_phone(expression)",
    ...>   %{"expression" => %{"__value__" => "my number is +12067799294 thanks", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => true, "phonenumber" => "+12067799294"} = result
    %{"__value__" => true, "phonenumber" => "+12067799294"}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_phone(expression)",
    ...>   %{"expression" => %{"__value__" => "my number is +12067799294 thanks", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `has_phone`

# `has_phrase`

Tests whether phrase is contained in `expression`

The words in the test phrase must appear in the same order with no other words in between.

## Example 1:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_phrase("the quick brown fox", "brown fox")
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_phrase("the quick brown fox", "brown fox") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_phrase(\"the quick brown fox\", \"brown fox\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_phrase(\"the quick brown fox\", \"brown fox\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_phrase("the quick brown fox", "quick fox")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_phrase("the quick brown fox", "quick fox") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_phrase(\"the quick brown fox\", \"quick fox\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_phrase(\"the quick brown fox\", \"quick fox\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_phrase("the quick brown fox", "")
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_phrase("the quick brown fox", "") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_phrase(\"the quick brown fox\", \"\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_phrase(\"the quick brown fox\", \"\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 4:

> Tests whether expression contains phrase from value in __value__ keys if complex values are provided.

When used in the following Stack expression it returns a  value of type **Boolean**: `true` when used with the following context:

```elixir
%{"expression" => %{"__value__" => "the quick brown fox", "display" => "value for display key", "value" => "value for value key"}, "phrase" => %{"__value__" => "brown fox", "display" => "value for display key", "value" => "value for value key"}}
```

```
> has_phrase(expression, phrase)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_phrase(expression, phrase) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_phrase(expression, phrase)",
    ...>   %{"expression" => %{"__value__" => "the quick brown fox", "display" => "value for display key", "value" => "value for value key"}, "phrase" => %{"__value__" => "brown fox", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_phrase(expression, phrase)",
    ...>   %{"expression" => %{"__value__" => "the quick brown fox", "display" => "value for display key", "value" => "value for value key"}, "phrase" => %{"__value__" => "brown fox", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `has_text`

Tests whether there the `expression` has any characters in it

## Example 1:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_text("quick brown")
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_text("quick brown") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_text(\"quick brown\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_text(\"quick brown\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_text("")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_text("") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_text(\"\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_text(\"\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_text(" 
> ")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_text(" 
") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_text(\" \n\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_text(\" \n\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 4:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> has_text(123)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_text(123) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_text(123)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_text(123)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 5:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_text(nil)
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_text(nil) ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_text(nil)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_text(nil)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 6:

> Tests whether expression has text from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Boolean**: `true` when used with the following context:

```elixir
%{"expression" => %{"__value__" => "quick brown", "display" => "value for display key", "value" => "value for value key"}}
```

```
> has_text(expression)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_text(expression) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_text(expression)",
    ...>   %{"expression" => %{"__value__" => "quick brown", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@has_text(expression)",
    ...>   %{"expression" => %{"__value__" => "quick brown", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `has_time`

Tests whether `expression` contains a time.

## Example 1:

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
true
```
with the following fields:

* *match* of type **Time**
.

```
> has_time("the time is 10:30")
%{"__value__" => true, "match" => ~T[10:30:00]}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_time("the time is 10:30") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_time(\"the time is 10:30\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => true, "match" => ~T[10:30:00]} = result
    %{"__value__" => true, "match" => ~T[10:30:00]}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_time(\"the time is 10:30\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
true
```
with the following fields:

* *match* of type **Time**
.

```
> has_time("the time is 10:00 pm")
%{"__value__" => true, "match" => ~T[10:00:00]}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_time("the time is 10:00 pm") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_time(\"the time is 10:00 pm\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => true, "match" => ~T[10:00:00]} = result
    %{"__value__" => true, "match" => ~T[10:00:00]}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_time(\"the time is 10:00 pm\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 3:

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
true
```
with the following fields:

* *match* of type **Time**
.

```
> has_time("the time is 10:30:45")
%{"__value__" => true, "match" => ~T[10:30:45]}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_time("the time is 10:30:45") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_time(\"the time is 10:30:45\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => true, "match" => ~T[10:30:45]} = result
    %{"__value__" => true, "match" => ~T[10:30:45]}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_time(\"the time is 10:30:45\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 4:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> has_time("there is no time here, just the number 25")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_time("there is no time here, just the number 25") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_time(\"there is no time here, just the number 25\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@has_time(\"there is no time here, just the number 25\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 5:

> Tests whether expression contains time from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a complex **Boolean** type of default value:
```
true
```
with the following fields:

* *match* of type **Time**
 when used with the following context:

```elixir
%{"expression" => %{"__value__" => "the time is 10:30", "display" => "value for display key", "value" => "value for value key"}}
```

```
> has_time(expression)
%{"__value__" => true, "match" => ~T[10:30:00]}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @has_time(expression) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "has_time(expression)",
    ...>   %{"expression" => %{"__value__" => "the time is 10:30", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__value__" => true, "match" => ~T[10:30:00]} = result
    %{"__value__" => true, "match" => ~T[10:30:00]}
    iex> Expression.evaluate_as_string!(
    ...>   "@has_time(expression)",
    ...>   %{"expression" => %{"__value__" => "the time is 10:30", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `hour`

Returns only the hour of a datetime (0 to 23)

## Example 1:

> Get the current hour

When used in the following Stack expression it returns a  value of type **Integer**: `20`.

```
> hour(now())
20
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @hour(now()) ..."
"20"
```

    ..$> import ExUnit.Assertions
    ..$> result = Expression.evaluate_block!(
    ...>   "hour(now())",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ..$> assert 20 = result
    20
    ..$> Expression.evaluate_as_string!(
    ...>   "@hour(now())",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "20"

---

## Example 2:

> Get the hour from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Integer**: `3` when used with the following context:

```elixir
%{"date" => %{"__value__" => ~U[2022-07-31 03:00:00Z], "display" => "value for display key", "value" => "value for value key"}}
```

```
> hour(date)
3
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @hour(date) ..."
"3"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "hour(date)",
    ...>   %{"date" => %{"__value__" => ~U[2022-07-31 03:00:00Z], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 3 = result
    3
    iex> Expression.evaluate_as_string!(
    ...>   "@hour(date)",
    ...>   %{"date" => %{"__value__" => ~U[2022-07-31 03:00:00Z], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "3"

---

# `if_`

Returns one value if the condition evaluates to `true`, and another value if it evaluates to `false`

## Example 1:

When used in the following Stack expression it returns a  value of type **String**: `"Yes"`.

```
> if true do
>   "Yes"
> else
>   "No"
> end
> 
"Yes"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @if(true, "Yes", "No") ..."
"Yes"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "if(true, \"Yes\", \"No\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "Yes" = result
    "Yes"
    iex> Expression.evaluate_as_string!(
    ...>   "@if(true, \"Yes\", \"No\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "Yes"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **String**: `"No"`.

```
> # Shorthand
> if(false, do: "Yes", else: "No")
"No"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @if(false, "Yes", "No") ..."
"No"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "if(false, \"Yes\", \"No\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "No" = result
    "No"
    iex> Expression.evaluate_as_string!(
    ...>   "@if(false, \"Yes\", \"No\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "No"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **String**: `"No"` when used with the following context:

```elixir
%{"boolean" => %{"__value__" => false, "display" => "value for display key", "value" => "value for value key"}, "value1" => %{"__value__" => "Yes", "display" => "value for display key", "value" => "value for value key"}, "value2" => %{"__value__" => "No", "display" => "value for display key", "value" => "value for value key"}}
```

```
> if(boolean, value1, value2)
"No"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @if(boolean, value1, value2) ..."
"No"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "if(boolean, value1, value2)",
    ...>   %{"boolean" => %{"__value__" => false, "display" => "value for display key", "value" => "value for value key"}, "value1" => %{"__value__" => "Yes", "display" => "value for display key", "value" => "value for value key"}, "value2" => %{"__value__" => "No", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "No" = result
    "No"
    iex> Expression.evaluate_as_string!(
    ...>   "@if(boolean, value1, value2)",
    ...>   %{"boolean" => %{"__value__" => false, "display" => "value for display key", "value" => "value for value key"}, "value1" => %{"__value__" => "Yes", "display" => "value for display key", "value" => "value for value key"}, "value2" => %{"__value__" => "No", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "No"

---

# `is_error`

```elixir
@spec is_error(Expression.Context.t(), %{required(String.t()) =&gt; term()}) :: boolean()
```

Checks whether `value` is an error

## Example 1:

When used in the following Stack expression it returns a  value of type **Boolean**: `true` when used with the following context:

```elixir
%{"error" => %{"__type__" => "expression/v1error", "__value__" => nil, "error" => true, "message" => "the error"}}
```

```
> is_error(error)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @is_error(error) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "is_error(error)",
    ...>   %{"error" => %{"__type__" => "expression/v1error", "__value__" => nil, "error" => true, "message" => "the error"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@is_error(error)",
    ...>   %{"error" => %{"__type__" => "expression/v1error", "__value__" => nil, "error" => true, "message" => "the error"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Boolean**: `false` when used with the following context:

```elixir
%{}
```

```
> is_error("not an error")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @is_error("not an error") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "is_error(\"not an error\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@is_error(\"not an error\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

# `is_nil_or_empty`

Returns true if the argument is nil or an empty string

## Example 1:

> Check whether the given argument is nil or an empty string

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> is_nil_or_empty(nil)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @is_nil_or_empty(nil) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "is_nil_or_empty(nil)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@is_nil_or_empty(nil)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

> Return true if value in __value__ key if complex values are provided is nil or an empty string.

When used in the following Stack expression it returns a  value of type **Boolean**: `true` when used with the following context:

```elixir
%{"argument" => %{"__value__" => "", "display" => "value for display key", "value" => "value for value key"}}
```

```
> is_nil_or_empty(argument)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @is_nil_or_empty(argument) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "is_nil_or_empty(argument)",
    ...>   %{"argument" => %{"__value__" => "", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@is_nil_or_empty(argument)",
    ...>   %{"argument" => %{"__value__" => "", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `isbool`

Returns `true` if the argument is a boolean.

## Example 1:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> isbool(true)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @isbool(true) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "isbool(true)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@isbool(true)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> isbool(false)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @isbool(false) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "isbool(false)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@isbool(false)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> isbool(1)
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @isbool(1) ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "isbool(1)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@isbool(1)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 4:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> isbool(0)
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @isbool(0) ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "isbool(0)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@isbool(0)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 5:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> isbool("true")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @isbool("true") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "isbool(\"true\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@isbool(\"true\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 6:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> isbool("false")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @isbool("false") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "isbool(\"false\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@isbool(\"false\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 7:

> Return boolean indicating if value in __value__ key is a boolean if complex values are provided.

When used in the following Stack expression it returns a  value of type **Boolean**: `true` when used with the following context:

```elixir
%{"string" => %{"__value__" => "true", "display" => "value for display key", "value" => "value for value key"}}
```

```
> isbool(string)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @isbool(string) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "isbool(string)",
    ...>   %{"string" => %{"__value__" => "true", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@isbool(string)",
    ...>   %{"string" => %{"__value__" => "true", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `isnumber`

Returns `true` if the argument is a number.

## Example 1:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> isnumber(1)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @isnumber(1) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "isnumber(1)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@isnumber(1)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> isnumber(1.0)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @isnumber(1.0) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "isnumber(1.0)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@isnumber(1.0)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> isnumber("1.0")
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @isnumber("1.0") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "isnumber(\"1.0\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@isnumber(\"1.0\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 4:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> isnumber("a")
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @isnumber("a") ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "isnumber(\"a\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@isnumber(\"a\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 5:

> Return boolean indicating if value in __value__ key is a number if complex values are provided.

When used in the following Stack expression it returns a  value of type **Boolean**: `true` when used with the following context:

```elixir
%{"string" => %{"__value__" => "1", "display" => "value for display key", "value" => "value for value key"}}
```

```
> isnumber(string)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @isnumber(string) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "isnumber(string)",
    ...>   %{"string" => %{"__value__" => "1", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@isnumber(string)",
    ...>   %{"string" => %{"__value__" => "1", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `isstring`

Returns `true` if the argument is a string.

## Example 1:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> isstring("hello")
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @isstring("hello") ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "isstring(\"hello\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@isstring(\"hello\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> isstring(false)
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @isstring(false) ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "isstring(false)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@isstring(false)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> isstring(1)
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @isstring(1) ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "isstring(1)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@isstring(1)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 4:

> Return boolean indicating if value in __value__ key is a string if complex values are provided.

When used in the following Stack expression it returns a  value of type **Boolean**: `true` when used with the following context:

```elixir
%{"string" => %{"__value__" => "hello", "display" => "value for display key", "value" => "value for value key"}}
```

```
> isstring(string)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @isstring(string) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "isstring(string)",
    ...>   %{"string" => %{"__value__" => "hello", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@isstring(string)",
    ...>   %{"string" => %{"__value__" => "hello", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `json`

Converts a data structure to JSON

## Example 1:

When used in the following Stack expression it returns a  value of type **String**: `"{\"foo\":\"bar\"}"` when used with the following context:

```elixir
%{"data" => %{"foo" => "bar"}}
```

```
> json(data)
"{\"foo\":\"bar\"}"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @json(data) ..."
"{"foo":"bar"}"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "json(data)",
    ...>   %{"data" => %{"foo" => "bar"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "{\"foo\":\"bar\"}" = result
    "{\"foo\":\"bar\"}"
    iex> Expression.evaluate_as_string!(
    ...>   "@json(data)",
    ...>   %{"data" => %{"foo" => "bar"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "{\"foo\":\"bar\"}"

---

## Example 2:

> Converts data from __value__ key to JSON if complex values are provided.

When used in the following Stack expression it returns a  value of type **String**: `"{\"foo\":\"bar\"}"` when used with the following context:

```elixir
%{"data" => %{"__value__" => %{"foo" => "bar"}, "display" => "value for display key", "value" => "value for value key"}}
```

```
> json(data)
"{\"foo\":\"bar\"}"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @json(data) ..."
"{"foo":"bar"}"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "json(data)",
    ...>   %{"data" => %{"__value__" => %{"foo" => "bar"}, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "{\"foo\":\"bar\"}" = result
    "{\"foo\":\"bar\"}"
    iex> Expression.evaluate_as_string!(
    ...>   "@json(data)",
    ...>   %{"data" => %{"__value__" => %{"foo" => "bar"}, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "{\"foo\":\"bar\"}"

---

# `left`

Returns the first characters in a text string. This is Unicode safe.

It will return `nil` if the given string is `nil`

## Example 1:

When used in the following Stack expression it returns a  value of type **String**: `"foob"`.

```
> left("foobar", 4)
"foob"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @left("foobar", 4) ..."
"foob"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "left(\"foobar\", 4)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "foob" = result
    "foob"
    iex> Expression.evaluate_as_string!(
    ...>   "@left(\"foobar\", 4)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "foob"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **String**: `"Умерла Мадлен Олбрай"`.

```
> left("Умерла Мадлен Олбрайт - первая женщина на посту главы Госдепа США", 20)
"Умерла Мадлен Олбрай"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @left("Умерла Мадлен Олбрайт - первая женщина на посту главы Госдепа США", 20) ..."
"Умерла Мадлен Олбрай"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "left(\"Умерла Мадлен Олбрайт - первая женщина на посту главы Госдепа США\", 20)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "Умерла Мадлен Олбрай" = result
    "Умерла Мадлен Олбрай"
    iex> Expression.evaluate_as_string!(
    ...>   "@left(\"Умерла Мадлен Олбрайт - первая женщина на посту главы Госдепа США\", 20)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "Умерла Мадлен Олбрай"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **Null**: `null`.

```
> left(nil, 4)
nil
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @left(nil, 4) ..."
""
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "left(nil, 4)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    nil
    iex> Expression.evaluate_as_string!(
    ...>   "@left(nil, 4)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ""

---

## Example 4:

> Return left from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **String**: `"foob"` when used with the following context:

```elixir
%{"size" => %{"__value__" => 4, "display" => "value for display key", "value" => "value for value key"}, "value" => %{"__value__" => "foobar", "display" => "value for display key", "value" => "value for value key"}}
```

```
> left(value, size)
"foob"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @left(value, size) ..."
"foob"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "left(value, size)",
    ...>   %{"size" => %{"__value__" => 4, "display" => "value for display key", "value" => "value for value key"}, "value" => %{"__value__" => "foobar", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "foob" = result
    "foob"
    iex> Expression.evaluate_as_string!(
    ...>   "@left(value, size)",
    ...>   %{"size" => %{"__value__" => 4, "display" => "value for display key", "value" => "value for value key"}, "value" => %{"__value__" => "foobar", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "foob"

---

# `len`

Returns the number of characters in a text string,
returns 0 if the string is null or empty

## Example 1:

When used in the following Stack expression it returns a  value of type **Integer**: `3`.

```
> len("foo")
3
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @len("foo") ..."
"3"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "len(\"foo\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 3 = result
    3
    iex> Expression.evaluate_as_string!(
    ...>   "@len(\"foo\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "3"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Integer**: `3`.

```
> len("zoë")
3
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @len("zoë") ..."
"3"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "len(\"zoë\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 3 = result
    3
    iex> Expression.evaluate_as_string!(
    ...>   "@len(\"zoë\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "3"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **Integer**: `0`.

```
> len(nil)
0
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @len(nil) ..."
"0"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "len(nil)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 0 = result
    0
    iex> Expression.evaluate_as_string!(
    ...>   "@len(nil)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "0"

---

## Example 4:

> Return length from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Integer**: `3` when used with the following context:

```elixir
%{"value" => %{"__value__" => "foo", "display" => "value for display key", "value" => "value for value key"}}
```

```
> len(value)
3
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @len(value) ..."
"3"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "len(value)",
    ...>   %{"value" => %{"__value__" => "foo", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 3 = result
    3
    iex> Expression.evaluate_as_string!(
    ...>   "@len(value)",
    ...>   %{"value" => %{"__value__" => "foo", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "3"

---

# `lower`

Converts a text string to lowercase

## Example 1:

When used in the following Stack expression it returns a  value of type **String**: `"foo bar"`.

```
> lower("Foo Bar")
"foo bar"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @lower("Foo Bar") ..."
"foo bar"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "lower(\"Foo Bar\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "foo bar" = result
    "foo bar"
    iex> Expression.evaluate_as_string!(
    ...>   "@lower(\"Foo Bar\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "foo bar"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Null**: `null`.

```
> lower(nil)
nil
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @lower(nil) ..."
""
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "lower(nil)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    nil
    iex> Expression.evaluate_as_string!(
    ...>   "@lower(nil)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ""

---

## Example 3:

> 
                    Return lowercased string from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **String**: `"foo bar"` when used with the following context:

```elixir
%{"value" => %{"__value__" => "Foo Bar", "display" => "value for display key", "value" => "value for value key"}}
```

```
> lower(value)
"foo bar"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @lower(value) ..."
"foo bar"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "lower(value)",
    ...>   %{"value" => %{"__value__" => "Foo Bar", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "foo bar" = result
    "foo bar"
    iex> Expression.evaluate_as_string!(
    ...>   "@lower(value)",
    ...>   %{"value" => %{"__value__" => "Foo Bar", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "foo bar"

---

# `map`

map over a list of items and apply the mapper function to every item, returning
the result.

## Example 1:

> Map over the range of numbers, create a date in January for every number

When used in the following Stack expression it returns a  value of type **List with values Date, Date, Date**: 

```
[
  "2022-01-01",
  "2022-01-02",
  "2022-01-03"
]
```

.

```
> map(1..3, &date(2022, 1, &1))
[~D[2022-01-01], ~D[2022-01-02], ~D[2022-01-03]]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @map(1..3, &date(2022, 1, &1)) ..."
"2022-01-012022-01-022022-01-03"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "map(1..3, &date(2022, 1, &1))",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert [~D[2022-01-01], ~D[2022-01-02], ~D[2022-01-03]] = result
    [~D[2022-01-01], ~D[2022-01-02], ~D[2022-01-03]]
    iex> Expression.evaluate_as_string!(
    ...>   "@map(1..3, &date(2022, 1, &1))",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2022-01-012022-01-022022-01-03"

---

## Example 2:

> Map over the range of numbers, multiple each by itself and return the result

When used in the following Stack expression it returns a  value of type **List with values Integer, Integer, Integer**: 

```
[
  1,
  4,
  9
]
```

.

```
> map(1..3, &(&1 * &1))
[1, 4, 9]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @map(1..3, &(&1 * &1)) ..."
"149"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "map(1..3, &(&1 * &1))",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert [1, 4, 9] = result
    [1, 4, 9]
    iex> Expression.evaluate_as_string!(
    ...>   "@map(1..3, &(&1 * &1))",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "149"

---

## Example 3:

> If an invalid, non-enumerable value is passed, return an error

When used in the following Stack expression it returns a complex **Null** type of default value:
```
null
```
with the following fields:

* *__type__* of type **String**
* *error* of type **Boolean**
* *message* of type **String**
.

```
> map(nil, &(&1 * &1))
%{"__type__" => "expression/v1error", "__value__" => nil, "error" => true, "message" => "Invalid enumerable"}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @map(nil, &(&1 * &1)) ..."
""
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "map(nil, &(&1 * &1))",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__type__" => "expression/v1error", "__value__" => nil, "error" => true, "message" => "Invalid enumerable"} = result
    %{"__type__" => "expression/v1error", "__value__" => nil, "error" => true, "message" => "Invalid enumerable"}
    iex> Expression.evaluate_as_string!(
    ...>   "@map(nil, &(&1 * &1))",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ""

---

## Example 4:

> Map over a list of items from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **List with values Date, Date, Date**: 

```
[
  "2022-01-01",
  "2022-01-02",
  "2022-01-03"
]
```

 when used with the following context:

```elixir
%{"expression" => %{"__value__" => 1..3, "display" => "value for display key", "value" => "value for value key"}}
```

```
> map(expression, &date(2022, 1, &1))
[~D[2022-01-01], ~D[2022-01-02], ~D[2022-01-03]]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @map(expression, &date(2022, 1, &1)) ..."
"2022-01-012022-01-022022-01-03"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "map(expression, &date(2022, 1, &1))",
    ...>   %{"expression" => %{"__value__" => 1..3, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert [~D[2022-01-01], ~D[2022-01-02], ~D[2022-01-03]] = result
    [~D[2022-01-01], ~D[2022-01-02], ~D[2022-01-03]]
    iex> Expression.evaluate_as_string!(
    ...>   "@map(expression, &date(2022, 1, &1))",
    ...>   %{"expression" => %{"__value__" => 1..3, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2022-01-012022-01-022022-01-03"

---

# `max_vargs`

Returns the maximum value of all arguments

## Example 1:

When used in the following Stack expression it returns a  value of type **Integer**: `3`.

```
> max(1, 2, 3)
3
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @max(1, 2, 3) ..."
"3"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "max(1, 2, 3)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 3 = result
    3
    iex> Expression.evaluate_as_string!(
    ...>   "@max(1, 2, 3)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "3"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Integer**: `4` when used with the following context:

```elixir
%{"value1" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}, "value2" => %{"__value__" => 4, "display" => "value for display key", "value" => "value for value key"}, "value3" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}}
```

```
> max(value1, value2, value3)
4
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @max(value1, value2, value3) ..."
"4"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "max(value1, value2, value3)",
    ...>   %{"value1" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}, "value2" => %{"__value__" => 4, "display" => "value for display key", "value" => "value for value key"}, "value3" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 4 = result
    4
    iex> Expression.evaluate_as_string!(
    ...>   "@max(value1, value2, value3)",
    ...>   %{"value1" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}, "value2" => %{"__value__" => 4, "display" => "value for display key", "value" => "value for value key"}, "value3" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "4"

---

# `mid`

MID extracts part of a string, starting at a specified position and for a specified length.

It correctly handles Unicode characters. For example, taking the first three characters from "héllo" returns "hél".

If the starting position is beyond the string length, it returns an empty string.

Implementation based on https://support.microsoft.com/en-us/office/mid-function-2eba57be-0c05-4bdc-bf81-5ecf4421eb8a

## Example 1:

> MID returns a specific number of characters from a text string, starting at the position you specify, based on the number of characters you specify.

When used in the following Stack expression it returns a  value of type **String**: `"Fluid"`.

```
> MID("Fluid", 1, 5)
"Fluid"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @MID("Fluid", 1, 5) ..."
"Fluid"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "MID(\"Fluid\", 1, 5)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "Fluid" = result
    "Fluid"
    iex> Expression.evaluate_as_string!(
    ...>   "@MID(\"Fluid\", 1, 5)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "Fluid"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **String**: `"Flow"`.

```
> MID("Fluid Flow", 7, 20)
"Flow"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @MID("Fluid Flow", 7, 20) ..."
"Flow"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "MID(\"Fluid Flow\", 7, 20)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "Flow" = result
    "Flow"
    iex> Expression.evaluate_as_string!(
    ...>   "@MID(\"Fluid Flow\", 7, 20)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "Flow"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **String**: `""`.

```
> MID("Fluid Flow", 20, 5)
""
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @MID("Fluid Flow", 20, 5) ..."
""
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "MID(\"Fluid Flow\", 20, 5)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "" = result
    ""
    iex> Expression.evaluate_as_string!(
    ...>   "@MID(\"Fluid Flow\", 20, 5)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ""

---

## Example 4:

> Extract from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **String**: `"Flow"` when used with the following context:

```elixir
%{"num_chars" => %{"__value__" => 5, "display" => "value for display key", "value" => "value for value key"}, "start_num" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}, "value" => %{"__value__" => "Fluid Flow", "display" => "value for display key", "value" => "value for value key"}}
```

```
> mid(value, 7, 20)
"Flow"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @mid(value, 7, 20) ..."
"Flow"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "mid(value, 7, 20)",
    ...>   %{"num_chars" => %{"__value__" => 5, "display" => "value for display key", "value" => "value for value key"}, "start_num" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}, "value" => %{"__value__" => "Fluid Flow", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "Flow" = result
    "Flow"
    iex> Expression.evaluate_as_string!(
    ...>   "@mid(value, 7, 20)",
    ...>   %{"num_chars" => %{"__value__" => 5, "display" => "value for display key", "value" => "value for value key"}, "start_num" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}, "value" => %{"__value__" => "Fluid Flow", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "Flow"

---

# `min_vargs`

Returns the minimum value of all arguments

## Example 1:

When used in the following Stack expression it returns a  value of type **Integer**: `1`.

```
> min(1, 2, 3)
1
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @min(1, 2, 3) ..."
"1"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "min(1, 2, 3)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 1 = result
    1
    iex> Expression.evaluate_as_string!(
    ...>   "@min(1, 2, 3)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "1"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Integer**: `1` when used with the following context:

```elixir
%{"value1" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}, "value2" => %{"__value__" => 4, "display" => "value for display key", "value" => "value for value key"}, "value3" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}}
```

```
> min(value1, value2, value3)
1
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @min(value1, value2, value3) ..."
"1"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "min(value1, value2, value3)",
    ...>   %{"value1" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}, "value2" => %{"__value__" => 4, "display" => "value for display key", "value" => "value for value key"}, "value3" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 1 = result
    1
    iex> Expression.evaluate_as_string!(
    ...>   "@min(value1, value2, value3)",
    ...>   %{"value1" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}, "value2" => %{"__value__" => 4, "display" => "value for display key", "value" => "value for value key"}, "value3" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "1"

---

# `minute`

Returns only the minute of a datetime (0 to 59)

## Example 1:

> Get the current minute

When used in the following Stack expression it returns a  value of type **Integer**: `55`.

```
> minute(now())
55
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @minute(now()) ..."
"55"
```

    ..$> import ExUnit.Assertions
    ..$> result = Expression.evaluate_block!(
    ...>   "minute(now())",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ..$> assert 55 = result
    55
    ..$> Expression.evaluate_as_string!(
    ...>   "@minute(now())",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "55"

---

## Example 2:

> Get the minute from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Integer**: `23` when used with the following context:

```elixir
%{"date" => %{"__value__" => ~U[2022-07-31 03:23:00Z], "display" => "value for display key", "value" => "value for value key"}}
```

```
> minute(date)
23
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @minute(date) ..."
"23"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "minute(date)",
    ...>   %{"date" => %{"__value__" => ~U[2022-07-31 03:23:00Z], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 23 = result
    23
    iex> Expression.evaluate_as_string!(
    ...>   "@minute(date)",
    ...>   %{"date" => %{"__value__" => ~U[2022-07-31 03:23:00Z], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "23"

---

# `month`

Returns only the month of a date (1 to 12)

## Example 1:

> Get the current month

When used in the following Stack expression it returns a  value of type **Integer**: `6`.

```
> month(now())
6
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @month(now()) ..."
"6"
```

    ..$> import ExUnit.Assertions
    ..$> result = Expression.evaluate_block!(
    ...>   "month(now())",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ..$> assert 6 = result
    6
    ..$> Expression.evaluate_as_string!(
    ...>   "@month(now())",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "6"

---

## Example 2:

> Get the month from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Integer**: `7` when used with the following context:

```elixir
%{"date" => %{"__value__" => ~U[2022-07-31 03:23:00Z], "display" => "value for display key", "value" => "value for value key"}}
```

```
> month(date)
7
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @month(date) ..."
"7"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "month(date)",
    ...>   %{"date" => %{"__value__" => ~U[2022-07-31 03:23:00Z], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 7 = result
    7
    iex> Expression.evaluate_as_string!(
    ...>   "@month(date)",
    ...>   %{"date" => %{"__value__" => ~U[2022-07-31 03:23:00Z], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "7"

---

# `not_`

Returns `false` if the argument supplied evaluates to truth-y

## Example 1:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> not(false)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @not(false) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "not(false)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@not(false)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

> Return false if value in __value__ key if complex values are provided evaluates to truth-y.

When used in the following Stack expression it returns a  value of type **Boolean**: `true` when used with the following context:

```elixir
%{"boolean" => %{"__value__" => false, "display" => "value for display key", "value" => "value for value key"}}
```

```
> not(boolean)
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @not(boolean) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "not(boolean)",
    ...>   %{"boolean" => %{"__value__" => false, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@not(boolean)",
    ...>   %{"boolean" => %{"__value__" => false, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

# `now`

Returns the current date time as UTC

```
It is currently @NOW()
```

## Example 1:

> return the current timestamp as a DateTime value

When used in the following Stack expression it returns a  value of type **DateTime**: `"2026-06-03T20:55:34.022947Z"`.

```
> now()
~U[2026-06-03 20:55:34.022947Z]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @now() ..."
"2026-06-03T20:55:34.022947Z"
```

    ..$> import ExUnit.Assertions
    ..$> result = Expression.evaluate_block!(
    ...>   "now()",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ..$> assert ~U[2026-06-03 20:55:34.022947Z] = result
    ~U[2026-06-03 20:55:34.022947Z]
    ..$> Expression.evaluate_as_string!(
    ...>   "@now()",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2026-06-03T20:55:34.022947Z"

---

## Example 2:

> return the current datetime and format it using `datevalue`

When used in the following Stack expression it returns a complex **String** type of default value:
```
"2026-06-03"
```
with the following fields:

* *date* of type **DateTime**
.

```
> datevalue(now(), "%Y-%m-%d")
%{"__value__" => "2026-06-03", "date" => ~U[2026-06-03 20:55:34.081285Z]}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @datevalue(now(), "%Y-%m-%d") ..."
"2026-06-03"
```

    ..$> import ExUnit.Assertions
    ..$> result = Expression.evaluate_block!(
    ...>   "datevalue(now(), \"%Y-%m-%d\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ..$> assert %{"__value__" => "2026-06-03", "date" => ~U[2026-06-03 20:55:34.081285Z]} = result
    %{"__value__" => "2026-06-03", "date" => ~U[2026-06-03 20:55:34.081285Z]}
    ..$> Expression.evaluate_as_string!(
    ...>   "@datevalue(now(), \"%Y-%m-%d\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2026-06-03"

---

# `or_vargs`

Returns `true` if any argument is `true`.
Returns the first truthy value found or otherwise false.

Accepts any amount of arguments for testing truthiness.

## Example 1:

> Return true if any of the values are true

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> true or false
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @or(true, false) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "or(true, false)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@or(true, false)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 2:

> Return the first value that is truthy

When used in the following Stack expression it returns a  value of type **String**: `"foo"`.

```
> false or "foo"
"foo"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @or(false, "foo") ..."
"foo"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "or(false, \"foo\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "foo" = result
    "foo"
    iex> Expression.evaluate_as_string!(
    ...>   "@or(false, \"foo\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "foo"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **Boolean**: `true`.

```
> true or true
true
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @or(true, true) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "or(true, true)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert true = result
    true
    iex> Expression.evaluate_as_string!(
    ...>   "@or(true, true)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 4:

When used in the following Stack expression it returns a  value of type **Boolean**: `false`.

```
> false or false
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @or(false, false) ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "or(false, false)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@or(false, false)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 5:

When used in the following Stack expression it returns a  value of type **String**: `"bee"` when used with the following context:

```elixir
%{"a" => false, "b" => "bee"}
```

```
> a or b
"bee"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @or(a, b) ..."
"bee"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "or(a, b)",
    ...>   %{"a" => false, "b" => "bee"},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "bee" = result
    "bee"
    iex> Expression.evaluate_as_string!(
    ...>   "@or(a, b)",
    ...>   %{"a" => false, "b" => "bee"},
    ...>   Expression.Callbacks.Standard
    ...> )
    "bee"

---

## Example 6:

When used in the following Stack expression it returns a  value of type **String**: `"a"` when used with the following context:

```elixir
%{"a" => "a", "b" => false}
```

```
> a or b
"a"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @or(a, b) ..."
"a"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "or(a, b)",
    ...>   %{"a" => "a", "b" => false},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "a" = result
    "a"
    iex> Expression.evaluate_as_string!(
    ...>   "@or(a, b)",
    ...>   %{"a" => "a", "b" => false},
    ...>   Expression.Callbacks.Standard
    ...> )
    "a"

---

## Example 7:

When used in the following Stack expression it returns a  value of type **Boolean**: `false` when used with the following context:

```elixir
%{}
```

```
> b or b
false
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @or(b, b) ..."
"false"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "or(b, b)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    false
    iex> Expression.evaluate_as_string!(
    ...>   "@or(b, b)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "false"

---

## Example 8:

When used in the following Stack expression it returns a  value of type **String**: `"b"` when used with the following context:

```elixir
%{"a" => %{"__value__" => false, "display" => "value for display key", "value" => "value for value key"}, "b" => %{"__value__" => "b", "display" => "value for display key", "value" => "value for value key"}}
```

```
> or(a, b)
"b"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @or(a, b) ..."
"b"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "or(a, b)",
    ...>   %{"a" => %{"__value__" => false, "display" => "value for display key", "value" => "value for value key"}, "b" => %{"__value__" => "b", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "b" = result
    "b"
    iex> Expression.evaluate_as_string!(
    ...>   "@or(a, b)",
    ...>   %{"a" => %{"__value__" => false, "display" => "value for display key", "value" => "value for value key"}, "b" => %{"__value__" => "b", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "b"

---

# `parse_datevalue`

Parse random dates and times with `strftime` patterns and return a DateTime value
when it matches.

## Example 1:

> Parse a date value using strftime formatting and return a DateTime

When used in the following Stack expression it returns a  value of type **DateTime**: `"2016-02-29T22:25:00Z"`.

```
> parse_datevalue("2016-02-29T22:25:00-00:00", "%FT%T%:z")
~U[2016-02-29 22:25:00Z]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @parse_datevalue("2016-02-29T22:25:00-00:00", "%FT%T%:z") ..."
"2016-02-29T22:25:00Z"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "parse_datevalue(\"2016-02-29T22:25:00-00:00\", \"%FT%T%:z\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ~U[2016-02-29 22:25:00Z] = result
    ~U[2016-02-29 22:25:00Z]
    iex> Expression.evaluate_as_string!(
    ...>   "@parse_datevalue(\"2016-02-29T22:25:00-00:00\", \"%FT%T%:z\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2016-02-29T22:25:00Z"

---

## Example 2:

> Attempt to parse a date value and return nil when failing

When used in the following Stack expression it returns a  value of type **Null**: `null`.

```
> parse_datevalue("👻👻👻👻", "%FT%T%:z")
nil
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @parse_datevalue("👻👻👻👻", "%FT%T%:z") ..."
""
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "parse_datevalue(\"👻👻👻👻\", \"%FT%T%:z\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    nil
    iex> Expression.evaluate_as_string!(
    ...>   "@parse_datevalue(\"👻👻👻👻\", \"%FT%T%:z\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ""

---

## Example 3:

> Parse value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **DateTime**: `"2016-02-29T22:25:00Z"` when used with the following context:

```elixir
%{"datetime" => %{"__value__" => "2016-02-29T22:25:00-00:00", "display" => "value for display key", "value" => "value for value key"}, "format" => %{"__value__" => "%FT%T%:z", "display" => "value for display key", "value" => "value for value key"}}
```

```
> parse_datevalue(datetime, format)
~U[2016-02-29 22:25:00Z]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @parse_datevalue(datetime, format) ..."
"2016-02-29T22:25:00Z"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "parse_datevalue(datetime, format)",
    ...>   %{"datetime" => %{"__value__" => "2016-02-29T22:25:00-00:00", "display" => "value for display key", "value" => "value for value key"}, "format" => %{"__value__" => "%FT%T%:z", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ~U[2016-02-29 22:25:00Z] = result
    ~U[2016-02-29 22:25:00Z]
    iex> Expression.evaluate_as_string!(
    ...>   "@parse_datevalue(datetime, format)",
    ...>   %{"datetime" => %{"__value__" => "2016-02-29T22:25:00-00:00", "display" => "value for display key", "value" => "value for value key"}, "format" => %{"__value__" => "%FT%T%:z", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2016-02-29T22:25:00Z"

---

# `parse_float`

# `parse_json`

Parses a string as JSON when given a String which is assumed
to be JSON encoded.

Will return whatever was supplied as is when the given
argument is not a String.

## Example 1:

When used in the following Stack expression it returns a  value of type **List with values Integer, Integer, Integer**: 

```
[
  1,
  2,
  3
]
```

.

```
> parse_json('[1,2,3]')
[1, 2, 3]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @parse_json('[1,2,3]') ..."
"123"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "parse_json('[1,2,3]')",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert [1, 2, 3] = result
    [1, 2, 3]
    iex> Expression.evaluate_as_string!(
    ...>   "@parse_json('[1,2,3]')",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "123"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **List with values Integer, Integer, Integer**: 

```
[
  1,
  2,
  3
]
```

.

```
> parse_json('[1,2,3]')
[1, 2, 3]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @parse_json('[1,2,3]') ..."
"123"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "parse_json('[1,2,3]')",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert [1, 2, 3] = result
    [1, 2, 3]
    iex> Expression.evaluate_as_string!(
    ...>   "@parse_json('[1,2,3]')",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "123"

---

## Example 3:

> Parses JSON from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **List with values Integer, Integer, Integer**: 

```
[
  1,
  2,
  3
]
```

 when used with the following context:

```elixir
%{"string" => %{"__value__" => "[1,2,3]", "display" => "value for display key", "value" => "value for value key"}}
```

```
> parse_json(string)
[1, 2, 3]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @parse_json(string) ..."
"123"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "parse_json(string)",
    ...>   %{"string" => %{"__value__" => "[1,2,3]", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert [1, 2, 3] = result
    [1, 2, 3]
    iex> Expression.evaluate_as_string!(
    ...>   "@parse_json(string)",
    ...>   %{"string" => %{"__value__" => "[1,2,3]", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "123"

---

# `percent`

Formats a number as a percentage

## Example 1:

When used in the following Stack expression it returns a  value of type **String**: `"20%"`.

```
> percent(2/10)
"20%"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @percent(2/10) ..."
"20%"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "percent(2/10)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "20%" = result
    "20%"
    iex> Expression.evaluate_as_string!(
    ...>   "@percent(2/10)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "20%"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **String**: `"20%"`.

```
> percent(0.2)
"20%"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @percent(0.2) ..."
"20%"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "percent(0.2)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "20%" = result
    "20%"
    iex> Expression.evaluate_as_string!(
    ...>   "@percent(0.2)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "20%"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **String**: `"20%"` when used with the following context:

```elixir
%{"d" => "0.2"}
```

```
> percent(d)
"20%"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @percent(d) ..."
"20%"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "percent(d)",
    ...>   %{"d" => "0.2"},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "20%" = result
    "20%"
    iex> Expression.evaluate_as_string!(
    ...>   "@percent(d)",
    ...>   %{"d" => "0.2"},
    ...>   Expression.Callbacks.Standard
    ...> )
    "20%"

---

## Example 4:

> Return percentage from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **String**: `"20%"` when used with the following context:

```elixir
%{"number" => %{"__value__" => 0.2, "display" => "value for display key", "value" => "value for value key"}}
```

```
> percent(number)
"20%"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @percent(number) ..."
"20%"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "percent(number)",
    ...>   %{"number" => %{"__value__" => 0.2, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "20%" = result
    "20%"
    iex> Expression.evaluate_as_string!(
    ...>   "@percent(number)",
    ...>   %{"number" => %{"__value__" => 0.2, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "20%"

---

# `power`

Returns the result of a number raised to a power - equivalent to the ^ operator

## Example 1:

When used in the following Stack expression it returns a  value of type **Float**: `8.0`.

```
> power(2, 3)
8.0
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @power(2, 3) ..."
"8.0"
```

    ..$> import ExUnit.Assertions
    ..$> result = Expression.evaluate_block!(
    ...>   "power(2, 3)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ..$> assert 8.0 = result
    8.0
    ..$> Expression.evaluate_as_string!(
    ...>   "@power(2, 3)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "8.0"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Float**: `8.0` when used with the following context:

```elixir
%{"number" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}, "power" => %{"__value__" => 3, "display" => "value for display key", "value" => "value for value key"}}
```

```
> power(number, power)
8.0
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @power(number, power) ..."
"8.0"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "power(number, power)",
    ...>   %{"number" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}, "power" => %{"__value__" => 3, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 8.0 = result
    8.0
    iex> Expression.evaluate_as_string!(
    ...>   "@power(number, power)",
    ...>   %{"number" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}, "power" => %{"__value__" => 3, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "8.0"

---

# `proper`

Capitalizes the first letter of every word in a text string

## Example 1:

When used in the following Stack expression it returns a  value of type **String**: `"Foo Bar"`.

```
> proper("foo bar")
"Foo Bar"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @proper("foo bar") ..."
"Foo Bar"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "proper(\"foo bar\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "Foo Bar" = result
    "Foo Bar"
    iex> Expression.evaluate_as_string!(
    ...>   "@proper(\"foo bar\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "Foo Bar"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Null**: `null`.

```
> proper(nil)
nil
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @proper(nil) ..."
""
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "proper(nil)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    nil
    iex> Expression.evaluate_as_string!(
    ...>   "@proper(nil)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ""

---

## Example 3:

> Return first letter of every word capitalized string from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **String**: `"Foo Bar"` when used with the following context:

```elixir
%{"value" => %{"__value__" => "foo bar", "display" => "value for display key", "value" => "value for value key"}}
```

```
> proper(value)
"Foo Bar"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @proper(value) ..."
"Foo Bar"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "proper(value)",
    ...>   %{"value" => %{"__value__" => "foo bar", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "Foo Bar" = result
    "Foo Bar"
    iex> Expression.evaluate_as_string!(
    ...>   "@proper(value)",
    ...>   %{"value" => %{"__value__" => "foo bar", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "Foo Bar"

---

# `rand_between`

Generate a random number between `min` and `max`

## Example 1:

> Generate a number between 1 and 10

When used in the following Stack expression it returns a  value of type **Integer**: `3`.

```
> rand_between(1, 10)
3
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @rand_between(1, 10) ..."
"3"
```

    ..$> import ExUnit.Assertions
    ..$> result = Expression.evaluate_block!(
    ...>   "rand_between(1, 10)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ..$> assert 3 = result
    3
    ..$> Expression.evaluate_as_string!(
    ...>   "@rand_between(1, 10)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "3"

---

## Example 2:

> Generate a number between min and max from value in __value__ keys if complex values are provided.

When used in the following Stack expression it returns a  value of type **Integer**: `3` when used with the following context:

```elixir
%{"max" => %{"__value__" => 10, "display" => "value for display key", "value" => "value for value key"}, "min" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}}
```

```
> rand_between(min, max)
3
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @rand_between(min, max) ..."
"3"
```

    ..$> import ExUnit.Assertions
    ..$> result = Expression.evaluate_block!(
    ...>   "rand_between(min, max)",
    ...>   %{"max" => %{"__value__" => 10, "display" => "value for display key", "value" => "value for value key"}, "min" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    ..$> assert 3 = result
    3
    ..$> Expression.evaluate_as_string!(
    ...>   "@rand_between(min, max)",
    ...>   %{"max" => %{"__value__" => 10, "display" => "value for display key", "value" => "value for value key"}, "min" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "3"

---

# `read_digits`

Formats digits in text for reading in TTS

## Example 1:

When used in the following Stack expression it returns a  value of type **String**: `"plus two seven one"`.

```
> read_digits("+271")
"plus two seven one"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @read_digits("+271") ..."
"plus two seven one"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "read_digits(\"+271\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "plus two seven one" = result
    "plus two seven one"
    iex> Expression.evaluate_as_string!(
    ...>   "@read_digits(\"+271\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "plus two seven one"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **String**: `""`.

```
> read_digits(nil)
""
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @read_digits(nil) ..."
""
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "read_digits(nil)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "" = result
    ""
    iex> Expression.evaluate_as_string!(
    ...>   "@read_digits(nil)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ""

---

## Example 3:

> Return read digits from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **String**: `"plus two seven one"` when used with the following context:

```elixir
%{"digits" => %{"__value__" => "+271", "display" => "value for display key", "value" => "value for value key"}}
```

```
> read_digits(digits)
"plus two seven one"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @read_digits(digits) ..."
"plus two seven one"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "read_digits(digits)",
    ...>   %{"digits" => %{"__value__" => "+271", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "plus two seven one" = result
    "plus two seven one"
    iex> Expression.evaluate_as_string!(
    ...>   "@read_digits(digits)",
    ...>   %{"digits" => %{"__value__" => "+271", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "plus two seven one"

---

# `reduce`

Reduces elements from a list by applying a function and collecting the
results in an accumulator.

The first argument to the lambda function is the item from the list,
the second argument is the accumulator.

## Example 1:

When used in the following Stack expression it returns a  value of type **Integer**: `6`.

```
> reduce(1..3, 0, & &1 + &2)
6
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @reduce(1..3, 0, & &1 + &2) ..."
"6"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "reduce(1..3, 0, & &1 + &2)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 6 = result
    6
    iex> Expression.evaluate_as_string!(
    ...>   "@reduce(1..3, 0, & &1 + &2)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "6"

---

## Example 2:

> If an invalid, non-enumerable value is passed, return an error

When used in the following Stack expression it returns a complex **Null** type of default value:
```
null
```
with the following fields:

* *__type__* of type **String**
* *error* of type **Boolean**
* *message* of type **String**
.

```
> reduce(nil, 0, & &1 + &2)
%{"__type__" => "expression/v1error", "__value__" => nil, "error" => true, "message" => "Invalid enumerable"}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @reduce(nil, 0, & &1 + &2) ..."
""
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "reduce(nil, 0, & &1 + &2)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__type__" => "expression/v1error", "__value__" => nil, "error" => true, "message" => "Invalid enumerable"} = result
    %{"__type__" => "expression/v1error", "__value__" => nil, "error" => true, "message" => "Invalid enumerable"}
    iex> Expression.evaluate_as_string!(
    ...>   "@reduce(nil, 0, & &1 + &2)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ""

---

# `regex_capture`

Capture values out of a string using a regex.
Returns the list of captures in a list.
Returns `nil` if there was nothing to match

## Example 1:

When used in the following Stack expression it returns a  value of type **List with values String**: 

```
[
  "ing"
]
```

.

```
> regex_capture("testing", "test(.+)")
["ing"]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @regex_capture("testing", "test(.+)") ..."
"ing"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "regex_capture(\"testing\", \"test(.+)\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ["ing"] = result
    ["ing"]
    iex> Expression.evaluate_as_string!(
    ...>   "@regex_capture(\"testing\", \"test(.+)\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "ing"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Null**: `null`.

```
> regex_capture("testing", "foo(.+)")
nil
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @regex_capture("testing", "foo(.+)") ..."
""
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "regex_capture(\"testing\", \"foo(.+)\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    nil
    iex> Expression.evaluate_as_string!(
    ...>   "@regex_capture(\"testing\", \"foo(.+)\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ""

---

## Example 3:

> Return captures from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **List with values String**: 

```
[
  "ing"
]
```

 when used with the following context:

```elixir
%{"pattern" => %{"__value__" => "test(.+)", "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "testing", "display" => "value for display key", "value" => "value for value key"}}
```

```
> regex_capture(string, pattern)
["ing"]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @regex_capture(string, pattern) ..."
"ing"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "regex_capture(string, pattern)",
    ...>   %{"pattern" => %{"__value__" => "test(.+)", "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "testing", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ["ing"] = result
    ["ing"]
    iex> Expression.evaluate_as_string!(
    ...>   "@regex_capture(string, pattern)",
    ...>   %{"pattern" => %{"__value__" => "test(.+)", "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "testing", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "ing"

---

# `regex_named_capture`

Captures named values out of a string using a regex.
In contrast to `regex_capture()` this returns a map
where the keys are the names of the captures and the
values are the captured values.

## Example 1:

When used in the following Stack expression it returns a  value of type **Map**: 

```
{
  "match": "ing"
}
```

.

```
> regex_named_capture("testing", "test(?P<match>.+)")
%{"match" => "ing"}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @regex_named_capture("testing", "test(?P<match>.+)") ..."
"%{"match" => "ing"}"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "regex_named_capture(\"testing\", \"test(?P<match>.+)\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"match" => "ing"} = result
    %{"match" => "ing"}
    iex> Expression.evaluate_as_string!(
    ...>   "@regex_named_capture(\"testing\", \"test(?P<match>.+)\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "%{\"match\" => \"ing\"}"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Map**: `{}`.

```
> regex_named_capture("testing", "foo(?P<match>.+)")
%{}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @regex_named_capture("testing", "foo(?P<match>.+)") ..."
"%{}"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "regex_named_capture(\"testing\", \"foo(?P<match>.+)\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{} = result
    %{}
    iex> Expression.evaluate_as_string!(
    ...>   "@regex_named_capture(\"testing\", \"foo(?P<match>.+)\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "%{}"

---

## Example 3:

> Return captures from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Map**: 

```
{
  "match": "ing"
}
```

 when used with the following context:

```elixir
%{"pattern" => %{"__value__" => "test(?P<match>.+)", "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "testing", "display" => "value for display key", "value" => "value for value key"}}
```

```
> regex_named_capture(string, pattern)
%{"match" => "ing"}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @regex_named_capture(string, pattern) ..."
"%{"match" => "ing"}"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "regex_named_capture(string, pattern)",
    ...>   %{"pattern" => %{"__value__" => "test(?P<match>.+)", "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "testing", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"match" => "ing"} = result
    %{"match" => "ing"}
    iex> Expression.evaluate_as_string!(
    ...>   "@regex_named_capture(string, pattern)",
    ...>   %{"pattern" => %{"__value__" => "test(?P<match>.+)", "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "testing", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "%{\"match\" => \"ing\"}"

---

# `reject`

Rejects elements from a list by returning a new list that contains only the
elements for which `reject_fun` is truthy.

## Example 1:

When used in the following Stack expression it returns a  value of type **List with values String, String**: 

```
[
  "A",
  "C"
]
```

.

```
> reject(["A", "B", "C", "B"], & &1 == "B")
["A", "C"]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @reject(["A", "B", "C", "B"], & &1 == "B") ..."
"AC"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "reject([\"A\", \"B\", \"C\", \"B\"], & &1 == \"B\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ["A", "C"] = result
    ["A", "C"]
    iex> Expression.evaluate_as_string!(
    ...>   "@reject([\"A\", \"B\", \"C\", \"B\"], & &1 == \"B\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "AC"

---

## Example 2:

> If an invalid, non-enumerable value is passed, return an error

When used in the following Stack expression it returns a complex **Null** type of default value:
```
null
```
with the following fields:

* *__type__* of type **String**
* *error* of type **Boolean**
* *message* of type **String**
.

```
> reject(nil, & &1 == "B")
%{"__type__" => "expression/v1error", "__value__" => nil, "error" => true, "message" => "Invalid enumerable"}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @reject(nil, & &1 == "B") ..."
""
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "reject(nil, & &1 == \"B\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__type__" => "expression/v1error", "__value__" => nil, "error" => true, "message" => "Invalid enumerable"} = result
    %{"__type__" => "expression/v1error", "__value__" => nil, "error" => true, "message" => "Invalid enumerable"}
    iex> Expression.evaluate_as_string!(
    ...>   "@reject(nil, & &1 == \"B\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ""

---

## Example 3:

> Return list with rejected items from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **List with values String, String**: 

```
[
  "A",
  "C"
]
```

 when used with the following context:

```elixir
%{"list" => %{"__value__" => ["A", "B", "C", "B"], "display" => "value for display key", "value" => "value for value key"}}
```

```
> reject(list, & &1 == "B")
["A", "C"]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @reject(list, & &1 == "B") ..."
"AC"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "reject(list, & &1 == \"B\")",
    ...>   %{"list" => %{"__value__" => ["A", "B", "C", "B"], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ["A", "C"] = result
    ["A", "C"]
    iex> Expression.evaluate_as_string!(
    ...>   "@reject(list, & &1 == \"B\")",
    ...>   %{"list" => %{"__value__" => ["A", "B", "C", "B"], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "AC"

---

# `rem`

Return the division remainder of two integers.

## Example 1:

When used in the following Stack expression it returns a  value of type **Integer**: `0`.

```
> rem(4, 2)
0
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @rem(4, 2) ..."
"0"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "rem(4, 2)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 0 = result
    0
    iex> Expression.evaluate_as_string!(
    ...>   "@rem(4, 2)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "0"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Integer**: `1`.

```
> rem(85, 3)
1
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @rem(85, 3) ..."
"1"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "rem(85, 3)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 1 = result
    1
    iex> Expression.evaluate_as_string!(
    ...>   "@rem(85, 3)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "1"

---

## Example 3:

> Return the division remainder of two integers from value in __value__ keys if complex values are provided.

When used in the following Stack expression it returns a  value of type **Integer**: `0` when used with the following context:

```elixir
%{"int1" => %{"__value__" => 4, "display" => "value for display key", "value" => "value for value key"}, "int2" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}}
```

```
> rem(int1, int2)
0
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @rem(int1, int2) ..."
"0"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "rem(int1, int2)",
    ...>   %{"int1" => %{"__value__" => 4, "display" => "value for display key", "value" => "value for value key"}, "int2" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 0 = result
    0
    iex> Expression.evaluate_as_string!(
    ...>   "@rem(int1, int2)",
    ...>   %{"int1" => %{"__value__" => 4, "display" => "value for display key", "value" => "value for value key"}, "int2" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "0"

---

# `remove_first_word`

Removes the first word from the given text. The remaining text will be unchanged

## Example 1:

When used in the following Stack expression it returns a  value of type **String**: `"bar"`.

```
> remove_first_word("foo bar")
"bar"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @remove_first_word("foo bar") ..."
"bar"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "remove_first_word(\"foo bar\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "bar" = result
    "bar"
    iex> Expression.evaluate_as_string!(
    ...>   "@remove_first_word(\"foo bar\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "bar"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **String**: `"bar"`.

```
> remove_first_word("foo-bar", "-")
"bar"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @remove_first_word("foo-bar", "-") ..."
"bar"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "remove_first_word(\"foo-bar\", \"-\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "bar" = result
    "bar"
    iex> Expression.evaluate_as_string!(
    ...>   "@remove_first_word(\"foo-bar\", \"-\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "bar"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **String**: `""`.

```
> remove_first_word(nil)
""
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @remove_first_word(nil) ..."
""
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "remove_first_word(nil)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "" = result
    ""
    iex> Expression.evaluate_as_string!(
    ...>   "@remove_first_word(nil)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ""

---

## Example 4:

When used in the following Stack expression it returns a  value of type **String**: `""`.

```
> remove_first_word(nil, "-")
""
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @remove_first_word(nil, "-") ..."
""
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "remove_first_word(nil, \"-\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "" = result
    ""
    iex> Expression.evaluate_as_string!(
    ...>   "@remove_first_word(nil, \"-\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ""

---

## Example 5:

> Return string with first word removed from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **String**: `"bar"` when used with the following context:

```elixir
%{"seperator" => %{"__value__" => "-", "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "foo-bar", "display" => "value for display key", "value" => "value for value key"}}
```

```
> remove_first_word(string, seperator)
"bar"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @remove_first_word(string, seperator) ..."
"bar"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "remove_first_word(string, seperator)",
    ...>   %{"seperator" => %{"__value__" => "-", "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "foo-bar", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "bar" = result
    "bar"
    iex> Expression.evaluate_as_string!(
    ...>   "@remove_first_word(string, seperator)",
    ...>   %{"seperator" => %{"__value__" => "-", "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "foo-bar", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "bar"

---

# `remove_first_word`

# `remove_last_word`

## Example 1:

> Remove the last word from a list of words, using the specified separator 

When used in the following Stack expression it returns a  value of type **String**: `"foo"`.

```
> remove_last_word("foo-bar", "-")
"foo"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @remove_last_word("foo-bar", "-") ..."
"foo"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "remove_last_word(\"foo-bar\", \"-\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "foo" = result
    "foo"
    iex> Expression.evaluate_as_string!(
    ...>   "@remove_last_word(\"foo-bar\", \"-\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "foo"

---

## Example 2:

> Remove the last word from a list of words, using spaces as separator between words 

When used in the following Stack expression it returns a  value of type **String**: `"foo"`.

```
> remove_last_word("foo bar")
"foo"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @remove_last_word("foo bar") ..."
"foo"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "remove_last_word(\"foo bar\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "foo" = result
    "foo"
    iex> Expression.evaluate_as_string!(
    ...>   "@remove_last_word(\"foo bar\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "foo"

---

## Example 3:

> Return string with last word removed from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **String**: `"foo"` when used with the following context:

```elixir
%{"seperator" => %{"__value__" => "-", "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "foo-bar", "display" => "value for display key", "value" => "value for value key"}}
```

```
> remove_last_word(string, seperator)
"foo"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @remove_last_word(string, seperator) ..."
"foo"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "remove_last_word(string, seperator)",
    ...>   %{"seperator" => %{"__value__" => "-", "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "foo-bar", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "foo" = result
    "foo"
    iex> Expression.evaluate_as_string!(
    ...>   "@remove_last_word(string, seperator)",
    ...>   %{"seperator" => %{"__value__" => "-", "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "foo-bar", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "foo"

---

# `remove_last_word`

# `rept`

Repeats text a given number of times

## Example 1:

When used in the following Stack expression it returns a  value of type **String**: `"**********"`.

```
> rept("*", 10)
"**********"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @rept("*", 10) ..."
"**********"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "rept(\"*\", 10)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "**********" = result
    "**********"
    iex> Expression.evaluate_as_string!(
    ...>   "@rept(\"*\", 10)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "**********"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Null**: `null`.

```
> rept(nil, 10)
nil
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @rept(nil, 10) ..."
""
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "rept(nil, 10)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    nil
    iex> Expression.evaluate_as_string!(
    ...>   "@rept(nil, 10)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ""

---

## Example 3:

> Return repeated string from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **String**: `"**********"` when used with the following context:

```elixir
%{"amount" => %{"__value__" => 10, "display" => "value for display key", "value" => "value for value key"}, "value" => %{"__value__" => "*", "display" => "value for display key", "value" => "value for value key"}}
```

```
> rept(value, amount)
"**********"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @rept(value, amount) ..."
"**********"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "rept(value, amount)",
    ...>   %{"amount" => %{"__value__" => 10, "display" => "value for display key", "value" => "value for value key"}, "value" => %{"__value__" => "*", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "**********" = result
    "**********"
    iex> Expression.evaluate_as_string!(
    ...>   "@rept(value, amount)",
    ...>   %{"amount" => %{"__value__" => 10, "display" => "value for display key", "value" => "value for value key"}, "value" => %{"__value__" => "*", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "**********"

---

# `right`

Returns the last characters in a text string.
This is Unicode safe.

## Example 1:

When used in the following Stack expression it returns a  value of type **String**: `"ing"`.

```
> right("testing", 3)
"ing"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @right("testing", 3) ..."
"ing"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "right(\"testing\", 3)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "ing" = result
    "ing"
    iex> Expression.evaluate_as_string!(
    ...>   "@right(\"testing\", 3)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "ing"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **String**: `"ту главы Госдепа США"`.

```
> right("Умерла Мадлен Олбрайт - первая женщина на посту главы Госдепа США", 20)
"ту главы Госдепа США"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @right("Умерла Мадлен Олбрайт - первая женщина на посту главы Госдепа США", 20) ..."
"ту главы Госдепа США"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "right(\"Умерла Мадлен Олбрайт - первая женщина на посту главы Госдепа США\", 20)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "ту главы Госдепа США" = result
    "ту главы Госдепа США"
    iex> Expression.evaluate_as_string!(
    ...>   "@right(\"Умерла Мадлен Олбрайт - первая женщина на посту главы Госдепа США\", 20)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "ту главы Госдепа США"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **Null**: `null`.

```
> right(nil, 3)
nil
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @right(nil, 3) ..."
""
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "right(nil, 3)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    nil
    iex> Expression.evaluate_as_string!(
    ...>   "@right(nil, 3)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ""

---

## Example 4:

> Return right from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **String**: `"ing"` when used with the following context:

```elixir
%{"size" => %{"__value__" => 3, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "testing", "display" => "value for display key", "value" => "value for value key"}}
```

```
> right(string, size)
"ing"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @right(string, size) ..."
"ing"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "right(string, size)",
    ...>   %{"size" => %{"__value__" => 3, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "testing", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "ing" = result
    "ing"
    iex> Expression.evaluate_as_string!(
    ...>   "@right(string, size)",
    ...>   %{"size" => %{"__value__" => 3, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "testing", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "ing"

---

# `round`

## Example 1:

> The ROUND function rounds a number to a specified number of digits. For example, if cell A1 contains 23.7825, and you want to round that value to two decimal places you can do ROUND(23.7825, 2)

When used in the following Stack expression it returns a  value of type **String**: `"23.78"`.

```
> ROUND(23.7825, 2)
"23.78"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @ROUND(23.7825, 2) ..."
"23.78"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "ROUND(23.7825, 2)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "23.78" = result
    "23.78"
    iex> Expression.evaluate_as_string!(
    ...>   "@ROUND(23.7825, 2)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "23.78"

---

## Example 2:

> The ROUND function rounds a number to a specified number of digits. For example, if cell A1 contains 23.7825, and you want to round that value to zero decimal places you can do ROUND(23.7825)

When used in the following Stack expression it returns a  value of type **String**: `"24"`.

```
> ROUND(23.7825)
"24"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @ROUND(23.7825) ..."
"24"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "ROUND(23.7825)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "24" = result
    "24"
    iex> Expression.evaluate_as_string!(
    ...>   "@ROUND(23.7825)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "24"

---

## Example 3:

> Rounds from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **String**: `"23.78"` when used with the following context:

```elixir
%{"digits" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}, "value" => %{"__value__" => 23.7825, "display" => "value for display key", "value" => "value for value key"}}
```

```
> round(value, digits)
"23.78"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @round(value, digits) ..."
"23.78"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "round(value, digits)",
    ...>   %{"digits" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}, "value" => %{"__value__" => 23.7825, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "23.78" = result
    "23.78"
    iex> Expression.evaluate_as_string!(
    ...>   "@round(value, digits)",
    ...>   %{"digits" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}, "value" => %{"__value__" => 23.7825, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "23.78"

---

# `round`

# `second`

Returns only the second of a datetime (0 to 59)

## Example 1:

When used in the following Stack expression it returns a  value of type **Integer**: `34` when used with the following context:

```elixir
%{"now" => ~U[2026-06-03 20:55:34.081642Z]}
```

```
> second(now)
34
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @second(now) ..."
"34"
```

    ..$> import ExUnit.Assertions
    ..$> result = Expression.evaluate_block!(
    ...>   "second(now)",
    ...>   %{"now" => ~U[2026-06-03 20:55:34.081642Z]},
    ...>   Expression.Callbacks.Standard
    ...> )
    ..$> assert 34 = result
    34
    ..$> Expression.evaluate_as_string!(
    ...>   "@second(now)",
    ...>   %{"now" => ~U[2026-06-03 20:55:34.081642Z]},
    ...>   Expression.Callbacks.Standard
    ...> )
    "34"

---

## Example 2:

> Get the second from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Integer**: `15` when used with the following context:

```elixir
%{"date" => %{"__value__" => ~U[2022-07-31 03:23:15Z], "display" => "value for display key", "value" => "value for value key"}}
```

```
> second(date)
15
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @second(date) ..."
"15"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "second(date)",
    ...>   %{"date" => %{"__value__" => ~U[2022-07-31 03:23:15Z], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 15 = result
    15
    iex> Expression.evaluate_as_string!(
    ...>   "@second(date)",
    ...>   %{"date" => %{"__value__" => ~U[2022-07-31 03:23:15Z], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "15"

---

# `sort_by`

Sorts a list of values using the result of the sorter function

## Example 1:

When used in the following Stack expression it returns a  value of type **List with values String, String, String**: 

```
[
  "b",
  "c",
  "a"
]
```

.

```
> sort_by(["a", "b", "c"], &rand_between(1, 5))
["b", "c", "a"]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @sort_by(["a", "b", "c"], &rand_between(1, 5)) ..."
"bca"
```

    ..$> import ExUnit.Assertions
    ..$> result = Expression.evaluate_block!(
    ...>   "sort_by([\"a\", \"b\", \"c\"], &rand_between(1, 5))",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ..$> assert ["b", "c", "a"] = result
    ["b", "c", "a"]
    ..$> Expression.evaluate_as_string!(
    ...>   "@sort_by([\"a\", \"b\", \"c\"], &rand_between(1, 5))",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "bca"

---

## Example 2:

> If an invalid, non-enumerable value is passed, return an error

When used in the following Stack expression it returns a complex **Null** type of default value:
```
null
```
with the following fields:

* *__type__* of type **String**
* *error* of type **Boolean**
* *message* of type **String**
.

```
> sort_by(nil, &rand_between(1, 5))
%{"__type__" => "expression/v1error", "__value__" => nil, "error" => true, "message" => "Invalid enumerable"}
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @sort_by(nil, &rand_between(1, 5)) ..."
""
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "sort_by(nil, &rand_between(1, 5))",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert %{"__type__" => "expression/v1error", "__value__" => nil, "error" => true, "message" => "Invalid enumerable"} = result
    %{"__type__" => "expression/v1error", "__value__" => nil, "error" => true, "message" => "Invalid enumerable"}
    iex> Expression.evaluate_as_string!(
    ...>   "@sort_by(nil, &rand_between(1, 5))",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ""

---

## Example 3:

> Return list with unique items from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **List with values String, String, String**: 

```
[
  "a",
  "c",
  "b"
]
```

 when used with the following context:

```elixir
%{"list" => %{"__value__" => ["a", "c", "b"], "display" => "value for display key", "value" => "value for value key"}}
```

```
> sort_by(list, & &1 < &2)
["a", "c", "b"]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @sort_by(list, & &1 < &2) ..."
"acb"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "sort_by(list, & &1 < &2)",
    ...>   %{"list" => %{"__value__" => ["a", "c", "b"], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ["a", "c", "b"] = result
    ["a", "c", "b"]
    iex> Expression.evaluate_as_string!(
    ...>   "@sort_by(list, & &1 < &2)",
    ...>   %{"list" => %{"__value__" => ["a", "c", "b"], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "acb"

---

# `split`

Split a string into an array using the pattern as separator.
Defaults to split the string using a space.

## Example 1:

When used in the following Stack expression it returns a  value of type **List with values String, String**: 

```
[
  "testing",
  "something"
]
```

.

```
> split("testing something")
["testing", "something"]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @split("testing something") ..."
"testingsomething"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "split(\"testing something\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ["testing", "something"] = result
    ["testing", "something"]
    iex> Expression.evaluate_as_string!(
    ...>   "@split(\"testing something\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "testingsomething"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **List with values String, String, String**: 

```
[
  "t",
  "sting som",
  "thing"
]
```

.

```
> split("testing something", "e")
["t", "sting som", "thing"]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @split("testing something", "e") ..."
"tsting somthing"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "split(\"testing something\", \"e\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ["t", "sting som", "thing"] = result
    ["t", "sting som", "thing"]
    iex> Expression.evaluate_as_string!(
    ...>   "@split(\"testing something\", \"e\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "tsting somthing"

---

## Example 3:

> Split from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **List with values String, String**: 

```
[
  "testing",
  "something"
]
```

 when used with the following context:

```elixir
%{"string" => %{"__value__" => "testing something", "display" => "value for display key", "value" => "value for value key"}}
```

```
> split(string)
["testing", "something"]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @split(string) ..."
"testingsomething"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "split(string)",
    ...>   %{"string" => %{"__value__" => "testing something", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ["testing", "something"] = result
    ["testing", "something"]
    iex> Expression.evaluate_as_string!(
    ...>   "@split(string)",
    ...>   %{"string" => %{"__value__" => "testing something", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "testingsomething"

---

## Example 4:

> Split from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **List with values String, String, String**: 

```
[
  "t",
  "sting som",
  "thing"
]
```

 when used with the following context:

```elixir
%{"pattern" => %{"__value__" => "e", "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "testing something", "display" => "value for display key", "value" => "value for value key"}}
```

```
> split(string, pattern)
["t", "sting som", "thing"]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @split(string, pattern) ..."
"tsting somthing"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "split(string, pattern)",
    ...>   %{"pattern" => %{"__value__" => "e", "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "testing something", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ["t", "sting som", "thing"] = result
    ["t", "sting som", "thing"]
    iex> Expression.evaluate_as_string!(
    ...>   "@split(string, pattern)",
    ...>   %{"pattern" => %{"__value__" => "e", "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "testing something", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "tsting somthing"

---

# `split`

# `substitute`

Substitutes new_text for old_text in a text string. If instance_num is given, then only that instance will be substituted

## Example 1:

When used in the following Stack expression it returns a  value of type **String**: `"I can do"`.

```
> substitute("I can't", "can't", "can do")
"I can do"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @substitute("I can't", "can't", "can do") ..."
"I can do"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "substitute(\"I can't\", \"can't\", \"can do\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "I can do" = result
    "I can do"
    iex> Expression.evaluate_as_string!(
    ...>   "@substitute(\"I can't\", \"can't\", \"can do\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "I can do"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Null**: `null`.

```
> substitute(nil, "can't", "can do")
nil
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @substitute(nil, "can't", "can do") ..."
""
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "substitute(nil, \"can't\", \"can do\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    nil
    iex> Expression.evaluate_as_string!(
    ...>   "@substitute(nil, \"can't\", \"can do\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ""

---

## Example 3:

> Return substituted string from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **String**: `"I can do"` when used with the following context:

```elixir
%{"pattern" => %{"__value__" => "can't", "display" => "value for display key", "value" => "value for value key"}, "replacement" => %{"__value__" => "can do", "display" => "value for display key", "value" => "value for value key"}, "subject" => %{"__value__" => "I can't", "display" => "value for display key", "value" => "value for value key"}}
```

```
> substitute(subject, pattern, replacement)
"I can do"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @substitute(subject, pattern, replacement) ..."
"I can do"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "substitute(subject, pattern, replacement)",
    ...>   %{"pattern" => %{"__value__" => "can't", "display" => "value for display key", "value" => "value for value key"}, "replacement" => %{"__value__" => "can do", "display" => "value for display key", "value" => "value for value key"}, "subject" => %{"__value__" => "I can't", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "I can do" = result
    "I can do"
    iex> Expression.evaluate_as_string!(
    ...>   "@substitute(subject, pattern, replacement)",
    ...>   %{"pattern" => %{"__value__" => "can't", "display" => "value for display key", "value" => "value for value key"}, "replacement" => %{"__value__" => "can do", "display" => "value for display key", "value" => "value for value key"}, "subject" => %{"__value__" => "I can't", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "I can do"

---

# `sum_vargs`

Returns the sum of all arguments, equivalent to the + operator

```
You have @SUM(contact.reports, contact.forms) reports and forms
```

## Example 1:

When used in the following Stack expression it returns a  value of type **Integer**: `6`.

```
> sum(1, 2, 3)
6
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @sum(1, 2, 3) ..."
"6"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "sum(1, 2, 3)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 6 = result
    6
    iex> Expression.evaluate_as_string!(
    ...>   "@sum(1, 2, 3)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "6"

---

## Example 2:

> Sum from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Integer**: `6` when used with the following context:

```elixir
%{"val1" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}, "val2" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}, "val3" => %{"__value__" => 3, "display" => "value for display key", "value" => "value for value key"}}
```

```
> sum(val1, val2, val3)
6
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @sum(val1, val2, val3) ..."
"6"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "sum(val1, val2, val3)",
    ...>   %{"val1" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}, "val2" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}, "val3" => %{"__value__" => 3, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 6 = result
    6
    iex> Expression.evaluate_as_string!(
    ...>   "@sum(val1, val2, val3)",
    ...>   %{"val1" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}, "val2" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}, "val3" => %{"__value__" => 3, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "6"

---

# `switch_vargs`

## Example 1:

> The SWITCH function evaluates one value (called the expression) against a list of values, and returns the result corresponding to the first matching value. If there is no match, an optional default value (the last one in the list if the list is odd) may be returned

When used in the following Stack expression it returns a  value of type **String**: `"Sunday"`.

```
> SWITCH(1, 1, "Sunday", 2, "Monday", 3, "Tuesday", "No match")
"Sunday"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @SWITCH(1, 1, "Sunday", 2, "Monday", 3, "Tuesday", "No match") ..."
"Sunday"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "SWITCH(1, 1, \"Sunday\", 2, \"Monday\", 3, \"Tuesday\", \"No match\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "Sunday" = result
    "Sunday"
    iex> Expression.evaluate_as_string!(
    ...>   "@SWITCH(1, 1, \"Sunday\", 2, \"Monday\", 3, \"Tuesday\", \"No match\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "Sunday"

---

## Example 2:

> The SWITCH function evaluates one value (called the expression) against a list of values, and returns the result corresponding to the first matching value. If there is no match, an optional default value (the last one in the list if the list is odd) may be returned

When used in the following Stack expression it returns a  value of type **String**: `"No match"`.

```
> SWITCH(5, 1, "Sunday", 2, "Monday", 3, "Tuesday", "No match")
"No match"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @SWITCH(5, 1, "Sunday", 2, "Monday", 3, "Tuesday", "No match") ..."
"No match"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "SWITCH(5, 1, \"Sunday\", 2, \"Monday\", 3, \"Tuesday\", \"No match\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "No match" = result
    "No match"
    iex> Expression.evaluate_as_string!(
    ...>   "@SWITCH(5, 1, \"Sunday\", 2, \"Monday\", 3, \"Tuesday\", \"No match\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "No match"

---

# `time`

Defines a time value which can be used for time arithmetic

## Example 1:

When used in the following Stack expression it returns a  value of type **Time**: `"12:13:14"`.

```
> time(12, 13, 14)
~T[12:13:14]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @time(12, 13, 14) ..."
"12:13:14"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "time(12, 13, 14)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ~T[12:13:14] = result
    ~T[12:13:14]
    iex> Expression.evaluate_as_string!(
    ...>   "@time(12, 13, 14)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "12:13:14"

---

## Example 2:

> Create a time from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Time**: `"12:13:14"` when used with the following context:

```elixir
%{"hour" => %{"__value__" => 12, "display" => "value for display key", "value" => "value for value key"}, "minute" => %{"__value__" => 13, "display" => "value for display key", "value" => "value for value key"}, "second" => %{"__value__" => 14, "display" => "value for display key", "value" => "value for value key"}}
```

```
> time(hour, minute, second)
~T[12:13:14]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @time(hour, minute, second) ..."
"12:13:14"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "time(hour, minute, second)",
    ...>   %{"hour" => %{"__value__" => 12, "display" => "value for display key", "value" => "value for value key"}, "minute" => %{"__value__" => 13, "display" => "value for display key", "value" => "value for value key"}, "second" => %{"__value__" => 14, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ~T[12:13:14] = result
    ~T[12:13:14]
    iex> Expression.evaluate_as_string!(
    ...>   "@time(hour, minute, second)",
    ...>   %{"hour" => %{"__value__" => 12, "display" => "value for display key", "value" => "value for value key"}, "minute" => %{"__value__" => 13, "display" => "value for display key", "value" => "value for value key"}, "second" => %{"__value__" => 14, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "12:13:14"

---

# `timevalue`

Converts time stored in text to an actual time

## Example 1:

When used in the following Stack expression it returns a  value of type **Time**: `"02:30:00"`.

```
> timevalue("2:30")
~T[02:30:00]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @timevalue("2:30") ..."
"02:30:00"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "timevalue(\"2:30\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ~T[02:30:00] = result
    ~T[02:30:00]
    iex> Expression.evaluate_as_string!(
    ...>   "@timevalue(\"2:30\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "02:30:00"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Time**: `"02:30:55"`.

```
> timevalue("2:30:55")
~T[02:30:55]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @timevalue("2:30:55") ..."
"02:30:55"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "timevalue(\"2:30:55\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ~T[02:30:55] = result
    ~T[02:30:55]
    iex> Expression.evaluate_as_string!(
    ...>   "@timevalue(\"2:30:55\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "02:30:55"

---

## Example 3:

> Create a time from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Time**: `"02:30:00"` when used with the following context:

```elixir
%{"time" => %{"__value__" => "2:30", "display" => "value for display key", "value" => "value for value key"}}
```

```
> timevalue(time)
~T[02:30:00]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @timevalue(time) ..."
"02:30:00"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "timevalue(time)",
    ...>   %{"time" => %{"__value__" => "2:30", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ~T[02:30:00] = result
    ~T[02:30:00]
    iex> Expression.evaluate_as_string!(
    ...>   "@timevalue(time)",
    ...>   %{"time" => %{"__value__" => "2:30", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "02:30:00"

---

# `today`

Returns the current date

## Example 1:

When used in the following Stack expression it returns a  value of type **Date**: `"2026-06-03"`.

```
> today()
~D[2026-06-03]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @today() ..."
"2026-06-03"
```

    ..$> import ExUnit.Assertions
    ..$> result = Expression.evaluate_block!(
    ...>   "today()",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ..$> assert ~D[2026-06-03] = result
    ~D[2026-06-03]
    ..$> Expression.evaluate_as_string!(
    ...>   "@today()",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2026-06-03"

---

# `unichar`

Returns the unicode character specified by a number

## Example 1:

When used in the following Stack expression it returns a  value of type **String**: `"A"`.

```
> unichar(65)
"A"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @unichar(65) ..."
"A"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "unichar(65)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "A" = result
    "A"
    iex> Expression.evaluate_as_string!(
    ...>   "@unichar(65)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "A"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **String**: `"é"`.

```
> unichar(233)
"é"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @unichar(233) ..."
"é"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "unichar(233)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "é" = result
    "é"
    iex> Expression.evaluate_as_string!(
    ...>   "@unichar(233)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "é"

---

## Example 3:

> Return unicode character from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **String**: `"é"` when used with the following context:

```elixir
%{"code" => %{"__value__" => "233", "display" => "value for display key", "value" => "value for value key"}}
```

```
> unichar(code)
"é"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @unichar(code) ..."
"é"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "unichar(code)",
    ...>   %{"code" => %{"__value__" => "233", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "é" = result
    "é"
    iex> Expression.evaluate_as_string!(
    ...>   "@unichar(code)",
    ...>   %{"code" => %{"__value__" => "233", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "é"

---

# `unicode`

Returns a numeric code for the first character in a text string

## Example 1:

When used in the following Stack expression it returns a  value of type **Integer**: `65`.

```
> unicode("A")
65
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @unicode("A") ..."
"65"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "unicode(\"A\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 65 = result
    65
    iex> Expression.evaluate_as_string!(
    ...>   "@unicode(\"A\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "65"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Integer**: `233`.

```
> unicode("é")
233
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @unicode("é") ..."
"233"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "unicode(\"é\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 233 = result
    233
    iex> Expression.evaluate_as_string!(
    ...>   "@unicode(\"é\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "233"

---

## Example 3:

> Return unicode code from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Integer**: `233` when used with the following context:

```elixir
%{"char" => %{"__value__" => "é", "display" => "value for display key", "value" => "value for value key"}}
```

```
> unicode(char)
233
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @unicode(char) ..."
"233"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "unicode(char)",
    ...>   %{"char" => %{"__value__" => "é", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 233 = result
    233
    iex> Expression.evaluate_as_string!(
    ...>   "@unicode(char)",
    ...>   %{"char" => %{"__value__" => "é", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "233"

---

# `uniq`

Removes duplicate values from a list.

## Example 1:

When used in the following Stack expression it returns a  value of type **List with values String, String, String**: 

```
[
  "A",
  "B",
  "C"
]
```

.

```
> uniq(["A", "B", "C", "B"])
["A", "B", "C"]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @uniq(["A", "B", "C", "B"]) ..."
"ABC"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "uniq([\"A\", \"B\", \"C\", \"B\"])",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ["A", "B", "C"] = result
    ["A", "B", "C"]
    iex> Expression.evaluate_as_string!(
    ...>   "@uniq([\"A\", \"B\", \"C\", \"B\"])",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "ABC"

---

## Example 2:

> Return list with unique items from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **List with values String, String, String**: 

```
[
  "A",
  "B",
  "C"
]
```

 when used with the following context:

```elixir
%{"list" => %{"__value__" => ["A", "B", "C", "B"], "display" => "value for display key", "value" => "value for value key"}}
```

```
> uniq(list)
["A", "B", "C"]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @uniq(list) ..."
"ABC"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "uniq(list)",
    ...>   %{"list" => %{"__value__" => ["A", "B", "C", "B"], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert ["A", "B", "C"] = result
    ["A", "B", "C"]
    iex> Expression.evaluate_as_string!(
    ...>   "@uniq(list)",
    ...>   %{"list" => %{"__value__" => ["A", "B", "C", "B"], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "ABC"

---

# `upper`

Converts a text string to uppercase

## Example 1:

When used in the following Stack expression it returns a  value of type **String**: `"FOO"`.

```
> upper("foo")
"FOO"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @upper("foo") ..."
"FOO"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "upper(\"foo\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "FOO" = result
    "FOO"
    iex> Expression.evaluate_as_string!(
    ...>   "@upper(\"foo\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "FOO"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Null**: `null`.

```
> upper(nil)
nil
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @upper(nil) ..."
""
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "upper(nil)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> refute result
    nil
    iex> Expression.evaluate_as_string!(
    ...>   "@upper(nil)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ""

---

## Example 3:

> Return uppercased string from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **String**: `"FOO"` when used with the following context:

```elixir
%{"string" => %{"__value__" => "foo", "display" => "value for display key", "value" => "value for value key"}}
```

```
> upper(string)
"FOO"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @upper(string) ..."
"FOO"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "upper(string)",
    ...>   %{"string" => %{"__value__" => "foo", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "FOO" = result
    "FOO"
    iex> Expression.evaluate_as_string!(
    ...>   "@upper(string)",
    ...>   %{"string" => %{"__value__" => "foo", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "FOO"

---

# `url_decode`

URL decode an expression

## Example 1:

When used in the following Stack expression it returns a  value of type **String**: `"hello world"`.

```
> url_decode("hello%20world")
"hello world"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @url_decode("hello%20world") ..."
"hello world"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "url_decode(\"hello%20world\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "hello world" = result
    "hello world"
    iex> Expression.evaluate_as_string!(
    ...>   "@url_decode(\"hello%20world\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "hello world"

---

## Example 2:

> Return URL decoded string from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **String**: `"hello world"` when used with the following context:

```elixir
%{"url" => %{"__value__" => "hello%20world", "display" => "value for display key", "value" => "value for value key"}}
```

```
> url_decode(url)
"hello world"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @url_decode(url) ..."
"hello world"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "url_decode(url)",
    ...>   %{"url" => %{"__value__" => "hello%20world", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "hello world" = result
    "hello world"
    iex> Expression.evaluate_as_string!(
    ...>   "@url_decode(url)",
    ...>   %{"url" => %{"__value__" => "hello%20world", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "hello world"

---

# `url_encode`

URL encode an expression

## Example 1:

When used in the following Stack expression it returns a  value of type **String**: `"hello%20world"`.

```
> url_encode("hello world")
"hello%20world"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @url_encode("hello world") ..."
"hello%20world"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "url_encode(\"hello world\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "hello%20world" = result
    "hello%20world"
    iex> Expression.evaluate_as_string!(
    ...>   "@url_encode(\"hello world\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "hello%20world"

---

## Example 2:

> URL encode an integer by first converting it to a string.

When used in the following Stack expression it returns a  value of type **String**: `"42"`.

```
> url_encode(42)
"42"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @url_encode(42) ..."
"42"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "url_encode(42)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "42" = result
    "42"
    iex> Expression.evaluate_as_string!(
    ...>   "@url_encode(42)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "42"

---

## Example 3:

> URL encode a float by first converting it to a string.

When used in the following Stack expression it returns a  value of type **String**: `"3.14"`.

```
> url_encode(3.14)
"3.14"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @url_encode(3.14) ..."
"3.14"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "url_encode(3.14)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "3.14" = result
    "3.14"
    iex> Expression.evaluate_as_string!(
    ...>   "@url_encode(3.14)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "3.14"

---

## Example 4:

> URL encode a boolean by first converting it to a string.

When used in the following Stack expression it returns a  value of type **String**: `"true"`.

```
> url_encode(true)
"true"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @url_encode(true) ..."
"true"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "url_encode(true)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "true" = result
    "true"
    iex> Expression.evaluate_as_string!(
    ...>   "@url_encode(true)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "true"

---

## Example 5:

> URL encode nil returns an empty string.

When used in the following Stack expression it returns a  value of type **String**: `""`.

```
> url_encode(nil)
""
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @url_encode(nil) ..."
""
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "url_encode(nil)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "" = result
    ""
    iex> Expression.evaluate_as_string!(
    ...>   "@url_encode(nil)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ""

---

## Example 6:

> URL encode a date by first converting it to a string.

When used in the following Stack expression it returns a  value of type **String**: `"2024-01-15"` when used with the following context:

```elixir
%{"date" => ~D[2024-01-15]}
```

```
> url_encode(date)
"2024-01-15"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @url_encode(date) ..."
"2024-01-15"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "url_encode(date)",
    ...>   %{"date" => ~D[2024-01-15]},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "2024-01-15" = result
    "2024-01-15"
    iex> Expression.evaluate_as_string!(
    ...>   "@url_encode(date)",
    ...>   %{"date" => ~D[2024-01-15]},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2024-01-15"

---

## Example 7:

> Return URL encoded string from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **String**: `"hello%20world"` when used with the following context:

```elixir
%{"url" => %{"__value__" => "hello world", "display" => "value for display key", "value" => "value for value key"}}
```

```
> url_encode(url)
"hello%20world"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @url_encode(url) ..."
"hello%20world"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "url_encode(url)",
    ...>   %{"url" => %{"__value__" => "hello world", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "hello%20world" = result
    "hello%20world"
    iex> Expression.evaluate_as_string!(
    ...>   "@url_encode(url)",
    ...>   %{"url" => %{"__value__" => "hello world", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "hello%20world"

---

## Example 8:

> URL encode an integer from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **String**: `"1"` when used with the following context:

```elixir
%{"number" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}}
```

```
> url_encode(number)
"1"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @url_encode(number) ..."
"1"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "url_encode(number)",
    ...>   %{"number" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "1" = result
    "1"
    iex> Expression.evaluate_as_string!(
    ...>   "@url_encode(number)",
    ...>   %{"number" => %{"__value__" => 1, "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "1"

---

# `weekday`

Returns the day of the week of a date (1 for Sunday to 7 for Saturday)

## Example 1:

When used in the following Stack expression it returns a  value of type **Integer**: `1` when used with the following context:

```elixir
%{"today" => ~D[2022-11-06]}
```

```
> weekday(today)
1
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @weekday(today) ..."
"1"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "weekday(today)",
    ...>   %{"today" => ~D[2022-11-06]},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 1 = result
    1
    iex> Expression.evaluate_as_string!(
    ...>   "@weekday(today)",
    ...>   %{"today" => ~D[2022-11-06]},
    ...>   Expression.Callbacks.Standard
    ...> )
    "1"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Integer**: `3` when used with the following context:

```elixir
%{"today" => ~D[2022-11-01]}
```

```
> weekday(today)
3
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @weekday(today) ..."
"3"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "weekday(today)",
    ...>   %{"today" => ~D[2022-11-01]},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 3 = result
    3
    iex> Expression.evaluate_as_string!(
    ...>   "@weekday(today)",
    ...>   %{"today" => ~D[2022-11-01]},
    ...>   Expression.Callbacks.Standard
    ...> )
    "3"

---

## Example 3:

> Return day of week from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Integer**: `1` when used with the following context:

```elixir
%{"date" => %{"__value__" => ~D[2022-11-06], "display" => "value for display key", "value" => "value for value key"}}
```

```
> weekday(date)
1
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @weekday(date) ..."
"1"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "weekday(date)",
    ...>   %{"date" => %{"__value__" => ~D[2022-11-06], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 1 = result
    1
    iex> Expression.evaluate_as_string!(
    ...>   "@weekday(date)",
    ...>   %{"date" => %{"__value__" => ~D[2022-11-06], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "1"

---

# `with_index`

Wraps each item of the list in a new list with the item itself and its
index in the original list.

## Example 1:

When used in the following Stack expression it returns a  value of type **List with values List with values String, Integer, List with values String, Integer, List with values String, Integer**: 

```
[
  [
    "A",
    0
  ],
  [
    "B",
    1
  ],
  [
    "C",
    2
  ]
]
```

.

```
> with_index(["A", "B", "C"])
[["A", 0], ["B", 1], ["C", 2]]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @with_index(["A", "B", "C"]) ..."
"A0B1C2"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "with_index([\"A\", \"B\", \"C\"])",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert [["A", 0], ["B", 1], ["C", 2]] = result
    [["A", 0], ["B", 1], ["C", 2]]
    iex> Expression.evaluate_as_string!(
    ...>   "@with_index([\"A\", \"B\", \"C\"])",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "A0B1C2"

---

## Example 2:

> Return list with indexes from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **List with values List with values String, Integer, List with values String, Integer, List with values String, Integer**: 

```
[
  [
    "A",
    0
  ],
  [
    "B",
    1
  ],
  [
    "C",
    2
  ]
]
```

 when used with the following context:

```elixir
%{"val1" => %{"__value__" => "A", "display" => "value for display key", "value" => "value for value key"}, "val2" => %{"__value__" => "B", "display" => "value for display key", "value" => "value for value key"}, "val3" => %{"__value__" => "C", "display" => "value for display key", "value" => "value for value key"}}
```

```
> with_index([val1, val2, val3])
[["A", 0], ["B", 1], ["C", 2]]
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @with_index([val1, val2, val3]) ..."
"A0B1C2"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "with_index([val1, val2, val3])",
    ...>   %{"val1" => %{"__value__" => "A", "display" => "value for display key", "value" => "value for value key"}, "val2" => %{"__value__" => "B", "display" => "value for display key", "value" => "value for value key"}, "val3" => %{"__value__" => "C", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert [["A", 0], ["B", 1], ["C", 2]] = result
    [["A", 0], ["B", 1], ["C", 2]]
    iex> Expression.evaluate_as_string!(
    ...>   "@with_index([val1, val2, val3])",
    ...>   %{"val1" => %{"__value__" => "A", "display" => "value for display key", "value" => "value for value key"}, "val2" => %{"__value__" => "B", "display" => "value for display key", "value" => "value for value key"}, "val3" => %{"__value__" => "C", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "A0B1C2"

---

# `word`

Extracts the nth word from the given text string. If stop is a negative number,
then it is treated as count backwards from the end of the text. If by_spaces is
specified and is `true` then the function splits the text into words only by spaces.
Otherwise the text is split by punctuation characters as well

## Example 1:

When used in the following Stack expression it returns a  value of type **String**: `"cow"`.

```
> word("hello cow-boy", 2)
"cow"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @word("hello cow-boy", 2) ..."
"cow"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "word(\"hello cow-boy\", 2)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "cow" = result
    "cow"
    iex> Expression.evaluate_as_string!(
    ...>   "@word(\"hello cow-boy\", 2)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "cow"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **String**: `"cow-boy"`.

```
> word("hello cow-boy", 2, true)
"cow-boy"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @word("hello cow-boy", 2, true) ..."
"cow-boy"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "word(\"hello cow-boy\", 2, true)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "cow-boy" = result
    "cow-boy"
    iex> Expression.evaluate_as_string!(
    ...>   "@word(\"hello cow-boy\", 2, true)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "cow-boy"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **String**: `"boy"`.

```
> word("hello cow-boy", -1)
"boy"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @word("hello cow-boy", -1) ..."
"boy"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "word(\"hello cow-boy\", -1)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "boy" = result
    "boy"
    iex> Expression.evaluate_as_string!(
    ...>   "@word(\"hello cow-boy\", -1)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "boy"

---

## Example 4:

When used in the following Stack expression it returns a  value of type **String**: `""`.

```
> word(nil, 1)
""
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @word(nil, 1) ..."
""
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "word(nil, 1)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "" = result
    ""
    iex> Expression.evaluate_as_string!(
    ...>   "@word(nil, 1)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ""

---

## Example 5:

> Return nth word from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **String**: `"cow"` when used with the following context:

```elixir
%{"n" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "hello cow-boy", "display" => "value for display key", "value" => "value for value key"}}
```

```
> word(string, n)
"cow"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @word(string, n) ..."
"cow"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "word(string, n)",
    ...>   %{"n" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "hello cow-boy", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "cow" = result
    "cow"
    iex> Expression.evaluate_as_string!(
    ...>   "@word(string, n)",
    ...>   %{"n" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "hello cow-boy", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "cow"

---

# `word`

# `word_count`

Returns the number of words in the given text string. If by_spaces is specified and is `true` then the function splits the text into words only by spaces. Otherwise the text is split by punctuation characters as well

```
> You entered @word_count("one two three") words
You entered 3 words
```

## Example 1:

When used in the following Stack expression it returns a  value of type **Integer**: `3`.

```
> word_count("hello cow-boy")
3
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @word_count("hello cow-boy") ..."
"3"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "word_count(\"hello cow-boy\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 3 = result
    3
    iex> Expression.evaluate_as_string!(
    ...>   "@word_count(\"hello cow-boy\")",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "3"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **Integer**: `2`.

```
> word_count("hello cow-boy", true)
2
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @word_count("hello cow-boy", true) ..."
"2"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "word_count(\"hello cow-boy\", true)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 2 = result
    2
    iex> Expression.evaluate_as_string!(
    ...>   "@word_count(\"hello cow-boy\", true)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **Integer**: `0`.

```
> word_count(nil)
0
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @word_count(nil) ..."
"0"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "word_count(nil)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 0 = result
    0
    iex> Expression.evaluate_as_string!(
    ...>   "@word_count(nil)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "0"

---

## Example 4:

> Return word count from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Integer**: `2` when used with the following context:

```elixir
%{"by_spaces" => %{"__value__" => true, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "hello cow-boy", "display" => "value for display key", "value" => "value for value key"}}
```

```
> word_count(string, by_spaces)
2
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @word_count(string, by_spaces) ..."
"2"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "word_count(string, by_spaces)",
    ...>   %{"by_spaces" => %{"__value__" => true, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "hello cow-boy", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 2 = result
    2
    iex> Expression.evaluate_as_string!(
    ...>   "@word_count(string, by_spaces)",
    ...>   %{"by_spaces" => %{"__value__" => true, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "hello cow-boy", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2"

---

# `word_count`

# `word_slice`

Extracts a substring of the words beginning at start, and up to but not-including stop.
If stop is omitted then the substring will be all words from start until the end of the text.
If stop is a negative number, then it is treated as count backwards from the end of the text.
If by_spaces is specified and is `true` then the function splits the text into words only by spaces.
Otherwise the text is split by punctuation characters as well

## Example 1:

When used in the following Stack expression it returns a  value of type **String**: `"expressions are"`.

```
> word_slice("FLOIP expressions are fun", 2, 4)
"expressions are"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @word_slice("FLOIP expressions are fun", 2, 4) ..."
"expressions are"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "word_slice(\"FLOIP expressions are fun\", 2, 4)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "expressions are" = result
    "expressions are"
    iex> Expression.evaluate_as_string!(
    ...>   "@word_slice(\"FLOIP expressions are fun\", 2, 4)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "expressions are"

---

## Example 2:

When used in the following Stack expression it returns a  value of type **String**: `"expressions are fun"`.

```
> word_slice("FLOIP expressions are fun", 2)
"expressions are fun"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @word_slice("FLOIP expressions are fun", 2) ..."
"expressions are fun"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "word_slice(\"FLOIP expressions are fun\", 2)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "expressions are fun" = result
    "expressions are fun"
    iex> Expression.evaluate_as_string!(
    ...>   "@word_slice(\"FLOIP expressions are fun\", 2)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "expressions are fun"

---

## Example 3:

When used in the following Stack expression it returns a  value of type **String**: `"FLOIP expressions"`.

```
> word_slice("FLOIP expressions are fun", 1, -2)
"FLOIP expressions"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @word_slice("FLOIP expressions are fun", 1, -2) ..."
"FLOIP expressions"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "word_slice(\"FLOIP expressions are fun\", 1, -2)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "FLOIP expressions" = result
    "FLOIP expressions"
    iex> Expression.evaluate_as_string!(
    ...>   "@word_slice(\"FLOIP expressions are fun\", 1, -2)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "FLOIP expressions"

---

## Example 4:

When used in the following Stack expression it returns a  value of type **String**: `"fun"`.

```
> word_slice("FLOIP expressions are fun", -1)
"fun"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @word_slice("FLOIP expressions are fun", -1) ..."
"fun"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "word_slice(\"FLOIP expressions are fun\", -1)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "fun" = result
    "fun"
    iex> Expression.evaluate_as_string!(
    ...>   "@word_slice(\"FLOIP expressions are fun\", -1)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    "fun"

---

## Example 5:

When used in the following Stack expression it returns a  value of type **String**: `""`.

```
> word_slice(nil, -1)
""
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @word_slice(nil, -1) ..."
""
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "word_slice(nil, -1)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "" = result
    ""
    iex> Expression.evaluate_as_string!(
    ...>   "@word_slice(nil, -1)",
    ...>   %{},
    ...>   Expression.Callbacks.Standard
    ...> )
    ""

---

## Example 6:

> Return word slice from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **String**: `"expressions are"` when used with the following context:

```elixir
%{"start" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}, "stop" => %{"__value__" => 4, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "FLOIP expressions are fun", "display" => "value for display key", "value" => "value for value key"}}
```

```
> word_slice(string, start, stop)
"expressions are"
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @word_slice(string, start, stop) ..."
"expressions are"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "word_slice(string, start, stop)",
    ...>   %{"start" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}, "stop" => %{"__value__" => 4, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "FLOIP expressions are fun", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert "expressions are" = result
    "expressions are"
    iex> Expression.evaluate_as_string!(
    ...>   "@word_slice(string, start, stop)",
    ...>   %{"start" => %{"__value__" => 2, "display" => "value for display key", "value" => "value for value key"}, "stop" => %{"__value__" => 4, "display" => "value for display key", "value" => "value for value key"}, "string" => %{"__value__" => "FLOIP expressions are fun", "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "expressions are"

---

# `word_slice`

# `word_slice`

# `year`

Returns only the year of a date

## Example 1:

When used in the following Stack expression it returns a  value of type **Integer**: `2026` when used with the following context:

```elixir
%{"now" => ~U[2026-06-03 20:55:34.085767Z]}
```

```
> year(now)
2026
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @year(now) ..."
"2026"
```

    ..$> import ExUnit.Assertions
    ..$> result = Expression.evaluate_block!(
    ...>   "year(now)",
    ...>   %{"now" => ~U[2026-06-03 20:55:34.085767Z]},
    ...>   Expression.Callbacks.Standard
    ...> )
    ..$> assert 2026 = result
    2026
    ..$> Expression.evaluate_as_string!(
    ...>   "@year(now)",
    ...>   %{"now" => ~U[2026-06-03 20:55:34.085767Z]},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2026"

---

## Example 2:

> Return year from value in __value__ key if complex values are provided.

When used in the following Stack expression it returns a  value of type **Integer**: `2022` when used with the following context:

```elixir
%{"date" => %{"__value__" => ~D[2022-11-06], "display" => "value for display key", "value" => "value for value key"}}
```

```
> year(date)
2022
```

When used as an expression in text, prepend it with an `@`:

```expression
> "... @year(date) ..."
"2022"
```

    iex> import ExUnit.Assertions
    iex> result = Expression.evaluate_block!(
    ...>   "year(date)",
    ...>   %{"date" => %{"__value__" => ~D[2022-11-06], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    iex> assert 2022 = result
    2022
    iex> Expression.evaluate_as_string!(
    ...>   "@year(date)",
    ...>   %{"date" => %{"__value__" => ~D[2022-11-06], "display" => "value for display key", "value" => "value for value key"}},
    ...>   Expression.Callbacks.Standard
    ...> )
    "2022"

---

---

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