[erlang-questions] eep: multiple patterns

Richard A. O'Keefe <>
Wed May 28 08:09:59 CEST 2008


On 28 May 2008, at 1:03 am, Andras Georgy Bekes wrote:
> I think there is a problem. I think I can express a pattern that's
> matching must involve backtracking:
>
> F(A1,A2...) when ({X,_}=A1 or {_,X}=A1) and ({X,_}=A2 ...

I wondered if anyone would spot that.
But the same stricture that we worked out before will answer
again:  no binding inside guard disjuncts.

My feeling here is that elaborate guards with lots of disjunctions
are a bad idea anyway.  Oddly enough, I don't see people doing that
in Haskell, although I do see the equivalent of

	f(...)
	   when ... -> ...;
	   when ... -> ...;
	            -> ...;
	...








More information about the erlang-questions mailing list