[erlang-questions] Guards?

Bengt Kleberg bengt.kleberg@REDACTED
Tue Apr 5 14:30:08 CEST 2016


For F, did you mean:
((is_integer(X) or is_float(X)) and X) < 5

On 04/05/2016 02:27 PM, Roberto Ostinelli wrote:
> 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.
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160405/6f38b5f6/attachment.htm>


More information about the erlang-questions mailing list