[erlang-questions] Guards on assignment (i.e. assertions)

Richard O'Keefe ok@REDACTED
Mon Mar 1 21:27:21 CET 2010


On Mar 2, 2010, at 9:00 AM, Garrett Smith wrote:

> In most cases, assertions come "free" in Erlang in guards and pattern
> matching. There are cases though where I'd like to apply a guard a
> statement like this:
>
>  A = B when B > C

What's wrong with

	if B > C -> A = B end?

I have a faint memory of someone, possibly me, suggesting
something like (A when B > C) = B last year.  If it was me,
I was probably explaining how you could do this with abstract patterns.





More information about the erlang-questions mailing list