[erlang-questions] Guards?
Roberto Ostinelli
roberto@REDACTED
Tue Apr 5 14:27:16 CEST 2016
All,
I'm a little stumped and I feel I'm missing something sooooooo beginner
here.
1> F = fun(X) when (is_integer(X) or is_float(X)) and X < 5 -> ok end.
#Fun<erl_eval.6.50752066>
2> F(1).
** exception error: no function clause matching
erl_eval:'-inside-an-interpreted-fun-'(1)
3> F2 = fun(X) when (is_integer(X) or is_float(X)) and (X < 5) -> ok end.
#Fun<erl_eval.6.50752066>
4> F2(1).
ok
...Can some kind soul clarify?
Thank you,
r.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160405/1bf37427/attachment.htm>
More information about the erlang-questions
mailing list