[erlang-questions] Guards on assignment (i.e. assertions)

Vlad Dumitrescu <>
Mon Mar 1 21:34:09 CET 2010


On Mon, Mar 1, 2010 at 21:13, Garrett Smith <> wrote:
>> What value should A be matched to if B =< C?
> There's no value -- the assignment fails.

Ah, okay. I thought you meant something else, should have read more carefully.

I think it would help reading some code, but it might be tricky to get
the the grammar right. Could we have even
    A = {B when B>C, D when is_list(D)}
or only
    A = {B, D} when B>C, is_list(D)
?

regards,
Vlad


More information about the erlang-questions mailing list