I recently discovered that it is possible to write custom guard macros for Elixir, provided that the macro expands to expressions that are supported in guards natively.
I used this to create an
is_blank guard. Elixir doesn’t come with a
blank? function, so you have to do it manually. Blank values are
nil. To check
blank? in Elixir, you can check if a given value is
in this array of blank values.