SameQ¶
Status: Stable
documented, exercised by the test suite and/or worked examples, with no known limitations recorded.
Description¶
lhs === rhs or SameQ[lhs, rhs]
yields True if lhs and rhs are structurally identical (head-by-head,
argument-by-argument), and False otherwise. Numerically equal but
distinct heads (e.g. 1 and 1.) are NOT considered same.
Examples¶
No verified examples yet for this function.
Implementation notes¶
builtin_sameq tests purely structural identity. With fewer than two arguments it returns True by convention; otherwise it compares every argument against the first with expr_eq and returns True only if all are structurally equal, False otherwise. Unlike Equal, there is no numeric coercion — 1 === 1. is False — and it never returns NULL (the result is always a definite boolean).
- Unlike
Equal,SameQnever stays symbolic and does not coerce numeric
Attributes: Protected.
Implementation status¶
Stable — documented, exercised by the test suite and/or worked examples, with no known limitations recorded.
References¶
- Source:
src/comparisons.c - Specification:
docs/spec/builtins/comparisons.md
Notes & additional examples¶
Worked examples¶
Notes¶
SameQ (===) is a structural test that always returns True or False. Numerically equal but distinct heads, such as 1 (Integer) and 1. (Real), are not the same.