Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
An operator form of SameQ
ResourceFunction["SameAsQ"][x1,x2,…][y1,y2,…] is equivalent to SameQ[x1,x2,…,y1,y2,…]. |
Test whether two expressions are identically the same:
In[1]:= |
Out[1]= |
In[2]:= |
Out[2]= |
Separate a specific element from a list:
In[3]:= |
Out[3]= |
Test equivalence of strings:
In[4]:= |
Out[4]= |
Numbers in different representations are not the same:
In[5]:= |
Out[5]= |
== nevertheless treats them as equal:
In[6]:= |
Out[6]= |
Approximate numbers that differ in their last bit are still considered identical:
In[7]:= |
Out[7]= |
Compare unevaluated expressions:
In[8]:= |
Out[8]= |
In[9]:= |
Out[9]= |
In[10]:= |
Out[10]= |
Without the Unevaluated, expressions will be compared with 2:
In[11]:= |
Out[11]= |
In[12]:= |
Out[12]= |
In[13]:= |
Out[13]= |
SameQ cannot have an operator form, since a single element is the same as itself:
In[14]:= |
Out[14]= |
SameAsQ can be used as an operator form for SameQ:
In[15]:= |
Out[15]= |
In[16]:= |
Out[16]= |
In[17]:= |
Out[17]= |
Multiple arguments can be given in either position:
In[18]:= |
Out[18]= |
In[19]:= |
Out[19]= |
This function will always return False:
In[20]:= |
Out[20]= |
In[21]:= |
Out[21]= |
In[22]:= |
Out[22]= |
This is effectively equivalent to the following:
In[23]:= |
Out[23]= |
In[24]:= |
Out[24]= |
In[25]:= |
Out[25]= |
Absolutely nothing is the same as absolutely nothing:
In[26]:= |
Out[26]= |
This is equivalent:
In[27]:= |
Out[27]= |
Create FalseQ, a variant of TrueQ that does what you probably expect:
In[28]:= |
Out[28]= |
In[29]:= |
Out[29]= |
In[30]:= |
Out[30]= |
In[31]:= |
Out[31]= |
In[32]:= |
Out[32]= |
In[33]:= |
Out[33]= |
In[34]:= |
Out[34]= |
Compare:
In[35]:= |
Out[35]= |
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License