Bottle.List (Bottle v0.1.2) View Source

Provides custom guards for lists

Link to this section Summary

Functions

Guard that passes for an empty list

Guard that passes for a list of a specific length

Guard that passes for a non empty list

Link to this section Functions

Link to this macro

is_empty_list(sub)

View Source (macro)

Guard that passes for an empty list

Examples

iex> is_empty_list([]) true

iex> is_empty_list([:foo]) false

iex> is_empty_list(%{foo: "bar"}) false

iex> is_empty_list({"anything", "else"}) false

Link to this macro

is_list_with_length(sub, expected_length)

View Source (macro)

Guard that passes for a list of a specific length

Examples

iex> is_list_with_length([], 0) true

iex> is_list_with_length([:foo], 1) true

iex> is_list_with_length(%{foo: "bar"}, 1) false

iex> is_list_with_length({"anything", "else"}, 2) false

Link to this macro

is_non_empty_list(sub)

View Source (macro)

Guard that passes for a non empty list

Examples

iex> is_non_empty_list([:foo]) true

iex> is_non_empty_list([]) false

iex> is_non_empty_list(%{foo: "bar"}) false

iex> is_non_empty_list({"anything", "else"}) false