momento v0.1.2 Momento.Guards

This module holds all the various custom guards natural?/1, positive?/1, negative?/1 and days_in_month/1.

Summary

Macros

Provides thow many days are in a given month (natural number) and is rollover safe

Is in the set of natural numbers?

Is in the set of natural numbers below 0?

Is in set of natural numbers not including 0?

Macros

days_in_month(month)

Specs

days_in_month(term, integer) :: integer

Provides thow many days are in a given month (natural number) and is rollover safe.

Examples

iex> Momento.Guards.days_in_month(2)
28

...> Momento.Guards.days_in_month(14)
28
natural?(num)

Specs

natural?(term, integer) :: boolean

Is in the set of natural numbers?

Examples

iex> Momento.Guards.natural?(5)
true

...> Momento.Guards.natural?(0)
true

...> Momento.Guards.natural?(-5)
false
negative?(num)

Specs

negative?(term, integer) :: boolean

Is in the set of natural numbers below 0?

Examples

iex> Momento.Guards.negative?(-5)
true

...> Momento.Guards.negative?(0)
false

...> Momento.Guards.negative?(5)
false
positive?(num)

Specs

positive?(term, integer) :: boolean

Is in set of natural numbers not including 0?

Examples

iex> Momento.Guards.positive?(5)
true

...> Momento.Guards.positive?(0)
false

...> Momento.Guards.positive?(-5)
false