Function Repository Resource:

SymbolQ

Source Notebook

Check whether an expression is a symbol

Contributed by: Arnoud Buzing

ResourceFunction["SymbolQ"][expr]

gives True if expr is a symbol and False otherwise.

Details and Options

ResourceFunction["SymbolQ"] has the attribute HoldAllComplete.

Examples

Basic Examples (2) 

Check if an expression is a symbol or not:

In[1]:=
ResourceFunction["SymbolQ"][x]
Out[1]=
In[2]:=
ResourceFunction["SymbolQ"][42]
Out[2]=
In[3]:=
ResourceFunction["SymbolQ"][f[x]]
Out[3]=

SymbolQ does not evaluate its arguments:

In[4]:=
ResourceFunction["SymbolQ"][$CloudBase]
Out[4]=
In[5]:=
ResourceFunction["SymbolQ"][a + a - a]
Out[5]=

Scope (1) 

SymbolQ can be used with Select:

In[6]:=
Select[{1, 4.2, f[x], x}, ResourceFunction["SymbolQ"]]
Out[6]=

Publisher

Arnoud Buzing

Version History

  • 1.0.0 – 07 July 2020

Related Resources

License Information