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 allclose all

Basic Examples  (3)

Test whether two expressions are identically the same:

Separate a specific element from a list:

Test equivalence of strings:

Scope  (2)

Numbers in different representations are not the same:

Equal nevertheless treats them as equal:

Approximate numbers that differ in their last bit are still considered identical:

Applications  (1)

Create FalseQ, a variant of TrueQ that returns True when an expression is a:

Compare:

Properties & Relations  (2)

SameQ cannot have an operator form, since a single element is the same as itself:

SameAs can be used as an operator form for SameQ:

SameAs applied to null arguments will always be true:

This is equivalent to SameQ for one argument:

Wolfram Research (2022), SameAs, Wolfram Language function, https://reference.wolfram.com/language/ref/SameAs.html.

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_2024_sameas, author="Wolfram Research", title="{SameAs}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/SameAs.html}", note=[Accessed: 21-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_sameas, organization={Wolfram Research}, title={SameAs}, year={2022}, url={https://reference.wolfram.com/language/ref/SameAs.html}, note=[Accessed: 21-December-2024 ]}