[erlang-questions] Use of logical "not" in `case`

Michael Nisi michael.nisi@REDACTED
Fri Feb 9 11:10:37 CET 2018


The `not maps:is_key` makes it NOT less confusing.

`true` or `false` don’t carry meaning per se, thus cannot be used to form an argument.
The question gives meaning.

Are you hungry?
Are you not hungry?

Simpler questions are better.

Michael

> On Feb 9, 2018, at 10:31 AM, zxq9@REDACTED wrote:
> 
> foo(Status, Thingy, Assignments) ->
>    case not maps:is_key(Thingy, Assignment) of
>        true ->
>            Assignment = fomulate_assignment(Thingy),
>            NewAssignments = maps:put(Thingy, Assignment, Assignments),
>            {assigned, NewAssignments};
>        false ->
>            {Status, Assignments}
>    end.




More information about the erlang-questions mailing list