[erlang-questions] Guards syntax for multiple values

Florent Gallaire fgallaire@REDACTED
Wed Mar 27 02:55:54 CET 2019


Tanks a lot José for your great examples, even if obvious for me some
people seem to really need them.

> char_unreserved(Char)
>     when Char >= ?0, Char =< ?9;
>          Char >= ?A, Char =< ?Z;
>          Char >= ?a, Char =< ?z;
>          is_member("~_-.", Char) ->
>   true;
>

char_unreserved(Char)
    when is_member("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ~_-.")
->
true;

Cheers

Florent

> char_unreserved(Char) when Char >= 0, Char <= 16x10FFFF ->
>
>   false.
>
>
> And similar for reserved characters:
>
> char_reserved(Char)
>     when is_member(":/?#[]@!$&\'()*+,;=", Char) ->
>
>   true;
>
> char_reserved(Char) when Char >= 0, Char <= 16x10FFFF ->
>
>   false.
>
>
> There are likely other examples but this should be enough to push the discussion forward.
>
> José Valim
> www.plataformatec.com.br
> Skype: jv.ptec
> Founder and Director of R&D
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions



-- 
FLOSS Engineer & Lawyer



More information about the erlang-questions mailing list