什么是合法的erlang守卫?

什么是合法的erlang守卫?,erlang,Erlang,下面问题的答案正确吗 从下面的列表中选择legal guard表达式,变量A已绑定 true, false, apple, 1+2, 1+2 > 3, is_atom(A), B = 3, A = 3, A == 3,length(A), lists:max(A), list_to_atom(A), A and B, (A > 3) and (A < 12) true,false,apple,1+2,1+2>3,is_原子(A),B=3,A=3,长度(A),列表:max(A)

下面问题的答案正确吗

从下面的列表中选择legal guard表达式,变量A已绑定

true, false, apple, 1+2, 1+2 > 3, is_atom(A), B = 3, A = 3, A == 3,length(A), lists:max(A), list_to_atom(A), A and B, (A > 3) and (A < 12)
true,false,apple,1+2,1+2>3,is_原子(A),B=3,A=3,长度(A),列表:max(A),列表到原子(A),A和B,(A>3)和(A<12)
我的解决方案是(正确的防护):

true,false,1+2>3,is_原子(A),A==3,长度(A),列表:max(A),列表到_原子(A),A和B,(A>3)和(A<12)

列表:max/1不是有效的防护。只要把你的解决方案放在眼里,它似乎是正确的,除了以下列表:max/1

从文档中()

有效的保护表达式集(有时称为保护测试)是有效Erlang表达式集的子集。限制有效表达式集的原因是必须保证对保护表达式的求值没有副作用。有效的保护表达式如下所示:

true,  false,  1+2 > 3,  is_atom(A), A == 3,  length(A), lists:max(A), list_to_atom(A),  A and B,  (A > 3) and (A < 12)
The atom true, 
Other constants (terms and bound variables), all regarded as false
Calls to the BIFs specified in table Type Test BIFs
Term comparisons
Arithmetic expressions
Boolean expressions
Short-circuit expressions (andalso/orelse)
is_atom/1
is_binary/1
is_bitstring/1
is_boolean/1
is_float/1
is_function/1
is_function/2
is_integer/1
is_list/1
is_map/1
is_number/1
is_pid/1
is_port/1
is_record/2
is_record/3
is_reference/1
is_tuple/1
abs(Number)
bit_size(Bitstring)
byte_size(Bitstring)
element(N, Tuple)
float(Term)
hd(List)
length(List)
map_size(Map)
node()
node(Pid|Ref|Port)
round(Number)
self()
size(Tuple|Bitstring)
tl(List)
trunc(Number)
tuple_size(Tuple)