guard syntax

Ulf Wiger (AL/EAB) ulf.wiger@REDACTED
Mon Oct 3 17:21:09 CEST 2005

Is there a profound reason why I can't write a guard like this:

  is_one(X) when erlang:'=='(X,1) -> true;
  is_one(X) -> false.

Since this works:

  is_one(X) when X == 1 -> true;

and erlang:'=='(X,1) and X == 1 appear to be the same thing?

(And yes, I happen to have a certain case where it would be
convenient -- not that I couldn't live without it  =)


More information about the erlang-questions mailing list