[erlang-questions] : eep: multiple patterns
Thu May 15 13:40:56 CEST 2008
Raimo Niskanen wrote:
> On Thu, May 15, 2008 at 01:27:55PM +1200, Richard A. O'Keefe wrote:
>> I don't like vague suggestions that
>> "It is rather common to check the value of an expression with a
>> case expression and do the same actions in some of the cases."
>> I want to see *actual cases*.
> But on this one I have experienced so many *actual cases*
> myself to accept it as an inconveniance. A solution
> to the multiple patterns to one branch problem would
> be convenient, indeed.
i don't know where ro'k gets his code examples from, but i for one
have seen tons and tons of code where many patterns winds up in the same
i find virding's suggestion  much nicer though;
foo(Pat11, ...) when Guard1 ;
foo(Pat12, ...) when Guard2 ;
foo(Pat13, ...) when Guard3 ->
case ... of
Pat1 when Guard1 ;
Pat2 when Guard2 -> ...;
as for the "~=" operator; i guess i don't see the point.
More information about the erlang-questions