What is the simplest way to write an if statement in Erlang, where a part of the guard is member(E, L), i.e., testing if E is a member of the list L? The naive approach is:
if
... andalso member(E,L) -> ...
end
But is does not work becuase, if I understand correctly, member is not a guard expression. Which way will work?
Member functionality is, as you say, not a valid guard. Instead you might consider using a case pattern? It’s possibly to include your other if-clauses in the case expression.