FreeQ
Usage
• 如果在expr中没有任何表达式匹配form,FreeQ[expr, form]产生True, 否则产生False。
• FreeQ[expr, form, levelspec]仅测试在expr的那些由levelspec指定的层的部分。
Notes
• form 可以是一个模式. • 例如: FreeQ[f[x^2] + y^2, x^_]  . • FreeQ 察看原始表达式的头,测试这些头是否匹配form.
Further Examples
(同时参见 the Further Examples for the Heads option.) This example shows a feature of FreeQ that is absent from MemberQ: here, FreeQ recognizes that the sum a+c is a subexpression of the larger sum.
In[1]:=
|
Out[1]=
|
Here we see how the level argument to FreeQ affects its result. When no level is specified, matches at any level are reported.
In[2]:=
|
Out[2]=
|
In[3]:=
|
Out[3]=
|
In[4]:=
|
Out[4]=
|
In[5]:=
|
Out[5]=
|
|