momento v0.1.1 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
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
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
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