multiple patterns per clause?
Mon Aug 28 17:50:49 CEST 2006
Yariv Sadan wrote:
> Is it possible to have a single clause match multiple patterns in Erlang?
> Specifically, I want to test if a list has a number of different
> prefixes, all of which would lead to the same expression.
> This is what I want to write (pseudo code):
> L = "foo",
> case L of
> [$x|_] ;
> [$a, $b, $c | _] ->
> _ ->
What would this construct mean, if the body expression refers to a variable
that is bound in some of the alternative patterns but not all of them?
David Hopwood <>
More information about the erlang-questions