summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJulien Cretel <j.cretel@umail.ucc.ie>2015-05-20 08:45:15 +0100
committerJulien Cretel <j.cretel@umail.ucc.ie>2015-05-28 09:16:12 +0200
commitfbfd64b3675fb0e0d9981378b0b6861c61945fcb (patch)
tree13f839312c735ed166437115a080a7e36059e8c8
parentb33799a8d52b77de45505ca533f0533b39bbc1d6 (diff)
[erlang/en] Fix #970
-rw-r--r--erlang.html.markdown8
1 files 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.