From fbfd64b3675fb0e0d9981378b0b6861c61945fcb Mon Sep 17 00:00:00 2001 From: Julien Cretel Date: Wed, 20 May 2015 08:45:15 +0100 Subject: [PATCH 1/3] [erlang/en] Fix #970 --- erlang.html.markdown | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/erlang.html.markdown b/erlang.html.markdown index 322e437d..a897755e 100644 --- a/erlang.html.markdown +++ b/erlang.html.markdown @@ -167,8 +167,12 @@ is_dog(A) -> false. % A guard sequence is either a single guard or a series of guards, separated % by semicolons (`;`). The guard sequence `G1; G2; ...; Gn` is true if at % least one of the guards `G1`, `G2`, ..., `Gn` evaluates to `true`. -is_pet(A) when is_dog(A); is_cat(A) -> true; -is_pet(A) -> false. +is_pet(A) when is_atom(A), (A =:= dog) or (A =:= cat) -> true; +is_pet(A) -> false. + +% Warning: not all valid Erlang expressions can be used as guard expressions; +% in particular, our `is_cat` and `is_dog` functions cannot be used within the +% guard sequence in `is_pet`'s definition. % Records provide a method for associating a name with a particular element in a % tuple. From e4c0629c38223db43e91414b2d44a540da47565e Mon Sep 17 00:00:00 2001 From: Julien Cretel Date: Wed, 20 May 2015 10:35:04 +0100 Subject: [PATCH 2/3] [erlang/en] Add link to Erlang reference manual --- erlang.html.markdown | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erlang.html.markdown b/erlang.html.markdown index a897755e..e5db6423 100644 --- a/erlang.html.markdown +++ b/erlang.html.markdown @@ -172,7 +172,10 @@ is_pet(A) -> false. % Warning: not all valid Erlang expressions can be used as guard expressions; % in particular, our `is_cat` and `is_dog` functions cannot be used within the -% guard sequence in `is_pet`'s definition. +% guard sequence in `is_pet`'s definition. For a list of the built-in +% functions (BIFs) allowed in guard sequences, refer to this +% [section](http://erlang.org/doc/reference_manual/expressions.html#id81912) +% of the Erlang reference manual. % Records provide a method for associating a name with a particular element in a % tuple. From f9649ac5529eed31a6b954b160c4e461a6bc25dd Mon Sep 17 00:00:00 2001 From: Julien Cretel Date: Thu, 28 May 2015 09:21:27 +0200 Subject: [PATCH 3/3] [erlang/en] Clarify bit about guard sequences --- erlang.html.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erlang.html.markdown b/erlang.html.markdown index e5db6423..a3b571d1 100644 --- a/erlang.html.markdown +++ b/erlang.html.markdown @@ -172,8 +172,8 @@ is_pet(A) -> false. % Warning: not all valid Erlang expressions can be used as guard expressions; % in particular, our `is_cat` and `is_dog` functions cannot be used within the -% guard sequence in `is_pet`'s definition. For a list of the built-in -% functions (BIFs) allowed in guard sequences, refer to this +% guard sequence in `is_pet`'s definition. For a description of the +% expressions allowed in guard sequences, refer to this % [section](http://erlang.org/doc/reference_manual/expressions.html#id81912) % of the Erlang reference manual.