SameAs[y]
is an operator form that yields x===y when applied to an expression x.
SameAs
SameAs[y]
is an operator form that yields x===y when applied to an expression x.
Details
- SameAs[y][x] yields True if the expression x is identical to y, and yields False otherwise.
- SameAs[y][x1,x2,…] is equivalent to SameQ[x1,x2,…,y].
- SameAs requires exact correspondence between expressions, except that it still considers Real numbers equal if they differ in their last binary digit.
- SameAs[y][] is equivalent to SameQ[y].
Examples
open all close allBasic Examples (3)
Scope (2)
Numbers in different representations are not the same:
SameAs[0.][0]Equal nevertheless treats them as equal:
0. == 0Approximate numbers that differ in their last bit are still considered identical:
SameAs[2^^1.000000000000000000000000000000000000000000000000000000000000][2^^1.000000000000000000000000000000000000000000000000000000000001]Applications (1)
Create FalseQ, a variant of TrueQ that returns True when an expression is a:
FalseQ = SameAs[False]FalseQ[a == b]TrueQ[a == b]FalseQ[a === b]TrueQ[a === b]FalseQ[a === a]TrueQ[a === a]TableForm[Table[f[x], {f, {TrueQ, FalseQ}}, {x, {True, False, maybe}}],
TableHeadings -> {{"TrueQ", "FalseQ"}, {True, False, maybe}}]Properties & Relations (2)
SameQ cannot have an operator form, since a single element is the same as itself:
SameQ[x]SameAs can be used as an operator form for SameQ:
xQ = SameAs[x]xQ[x]xQ[y]SameAs applied to null arguments will always be true:
SameAs[x][]This is equivalent to SameQ for one argument:
SameQ[x]Related Guides
History
Text
Wolfram Research (2022), SameAs, Wolfram Language function, https://reference.wolfram.com/language/ref/SameAs.html.
CMS
Wolfram Language. 2022. "SameAs." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SameAs.html.
APA
Wolfram Language. (2022). SameAs. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SameAs.html
BibTeX
@misc{reference.wolfram_2026_sameas, author="Wolfram Research", title="{SameAs}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/SameAs.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_sameas, organization={Wolfram Research}, title={SameAs}, year={2022}, url={https://reference.wolfram.com/language/ref/SameAs.html}, note=[Accessed: 13-June-2026]}