Hi Вячеслав:
the reason behind that is that there is a limited set of expresions and
therefore functions that can be executed in guards
so all the functions starting with "is_" are the ones that will work in
guard,
I recommend you to read:
http://elixir-lang.org/getting-started/case-cond-and-if.html#expressions-in-guard-clauses
Expressions in guard clauses
The Erlang Virtual Machine (VM) only allows a limited set of
expressions in guards:
* comparison operators (==, !=, ===, !==, >, <, <=, >=)
* boolean operators (and, or) and negation operators (not, !)
* arithmetic operators (+, -, *, /)
* <> and ++ as long as the left side is a literal
* the in operator
* all the following type check functions:
... just read the article for the full list:
http://elixir-lang.org/getting-started/case-cond-and-if.html#expressions-in-guard-clauses
* and some other functions..
if you want to create your own function/macro to be used in guards, you
can check the source-code for is_record/1 and is_record/2
https://github.com/elixir-lang/elixir/blob/50ab29ffb1217779ed4a38ff41e551c17e2011e3/lib/elixir/lib/record.ex#L72
I hope things are more clear now.
cheers,
On Fri, 3 Apr 2015 14:05:14 -0700 (PDT)
Вячеслав Павлутин <
sl.pa...@gmail.com> wrote:
> It's still unclear why we can't have aliases that provide the same
> functionality beyond guard clauses for the matter of consistency.
> For novices it could be difficult to understand why we need to keep
> both ` *is_**` and `*?*` functions and why API provides one or