guard syntax
Corrado Santoro
csanto@REDACTED
Mon Oct 3 18:14:36 CEST 2005
Ulf Wiger (AL/EAB) wrote:
> 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?
It seems that erlang:'==' is equivalent to a function call while == is a
BIF, and it's not possible to use function calls in guards.
Am I right?
--Corrado
--
======================================================
Eng. Corrado Santoro, Ph.D.
University of Catania - Engineering Faculty
Department of Computer Science and
Telecommunications Engineering
Viale A. Doria, 6 - 95125 CATANIA (ITALY)
Tel: +39 095 7382144 Int. (5) 8035
+39 095 7382380
+39 095 7382365
+39 095 7382364
VoIP: sip:8035@REDACTED
Fax: +39 095 7382397
EMail: csanto@REDACTED
Personal Home Page:
http://www.diit.unict.it/users/csanto
NUXI Home Page:
http://nuxi.iit.unict.it
======================================================
More information about the erlang-questions
mailing list