[erlang-questions] illegal guard expression with lists:nth
Thu Jun 11 11:48:35 CEST 2009
Not all functions are allowed in a guard. I can not think of any
function outside of the ones in the erlang module (like erlang:length/1)
that are allowed.
On Thu, 2009-06-11 at 11:37 +0200, Roberto Ostinelli wrote:
> dear all,
> why does the following expression give me an 'illegal guard
> expression' at compile?
> lists:nth(2, List) =:= "test" ->
> lists:nth returns a term, thus i should be enabled to use it. on the
> contrary, the following expression is accepted:
> length(List) =:= 3 ->
> am i missing a point?
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
More information about the erlang-questions