|
3 | 3 |
|
4 | 4 | from mathics.version import __version__ # noqa used in loading to check consistency. |
5 | 5 |
|
6 | | -from typing import Optional, Union |
| 6 | +from typing import Optional |
7 | 7 |
|
8 | 8 | import sympy |
9 | 9 |
|
|
16 | 16 | from mathics.builtin.constants import mp_convert_constant |
17 | 17 |
|
18 | 18 | from mathics.core.expression import ( |
19 | | - Atom, |
20 | 19 | COMPARE_PREC, |
21 | 20 | Complex, |
22 | 21 | Expression, |
@@ -44,9 +43,10 @@ def is_number(sympy_value) -> bool: |
44 | 43 | class SameQ(BinaryOperator): |
45 | 44 | """ |
46 | 45 | <dl> |
47 | | - <dt>'SameQ[$x$, $y$]' |
48 | | - <dt>'$x$ === $y$' |
49 | | - <dd>returns 'True' if $x$ and $y$ are structurally identical. |
| 46 | + <dt>'SameQ[$x$, $y$]' |
| 47 | + <dt>'$x$ === $y$' |
| 48 | + <dd>returns 'True' if $x$ and $y$ are structurally identical. |
| 49 | + Commutative properties apply, so if $x$ === $y$ then $y$ === $x$. |
50 | 50 | </dl> |
51 | 51 |
|
52 | 52 | Any object is the same as itself: |
@@ -74,9 +74,10 @@ def apply(self, lhs, rhs, evaluation): |
74 | 74 | class UnsameQ(BinaryOperator): |
75 | 75 | """ |
76 | 76 | <dl> |
77 | | - <dt>'UnsameQ[$x$, $y$]' |
78 | | - <dt>'$x$ =!= $y$' |
79 | | - <dd>returns 'True' if $x$ and $y$ are not structurally identical. |
| 77 | + <dt>'UnsameQ[$x$, $y$]' |
| 78 | + <dt>'$x$ =!= $y$' |
| 79 | + <dd>returns 'True' if $x$ and $y$ are not structurally identical. |
| 80 | + Commutative properties apply, so if $x$ =!= $y$, then $y$ =!= $x$. |
80 | 81 | </dl> |
81 | 82 |
|
82 | 83 | >> a=!=a |
@@ -528,12 +529,12 @@ def pairs(items): |
528 | 529 | class Equal(_EqualityOperator, SympyComparison): |
529 | 530 | """ |
530 | 531 | <dl> |
531 | | - <dt>'Equal[$x$, $y$]' |
| 532 | + <dt>'Equal[$x$, $y$]' |
532 | 533 | <dt>'$x$ == $y$' |
533 | | - <dd>yields 'True' if $x$ and $y$ are known to be equal, or |
534 | | - 'False' if $x$ and $y$ are known to be unequal. |
535 | | - <dt>'$lhs$ == $rhs$' |
536 | | - <dd>represents the equation $lhs$ = $rhs$. |
| 534 | + <dd>is 'True' if $x$ and $y$ are known to be equal, or |
| 535 | + 'False' if $x$ and $y$ are known to be unequal, in which case |
| 536 | + case, 'Not[$x$ == $y$]' will be 'True'. |
| 537 | + Commutative properties apply, so if $x$ === $y$ then $y$ === $x$. |
537 | 538 | </dl> |
538 | 539 |
|
539 | 540 | >> a==a |
@@ -638,12 +639,12 @@ def _op(x): |
638 | 639 | class Unequal(_EqualityOperator, SympyComparison): |
639 | 640 | """ |
640 | 641 | <dl> |
641 | | - <dt>'Unequal[$x$, $y$]' |
642 | | - <dt>'$x$ != $y$' |
643 | | - <dd>yields 'False' if $x$ and $y$ are known to be equal, or |
| 642 | + <dt>'Unequal[$x$, $y$]' |
| 643 | + <dt>'$x$ != $y$' |
| 644 | + <dd>is 'False' if $x$ and $y$ are known to be equal, or |
644 | 645 | 'True' if $x$ and $y$ are known to be unequal. |
645 | | - <dt>'$lhs$ == $rhs$' |
646 | | - <dd>represents the inequality $lhs$ $rhs$. |
| 646 | + Commutative properties apply so if $x$ != $y$ then |
| 647 | + $y$ != $x$. |
647 | 648 | </dl> |
648 | 649 |
|
649 | 650 | >> 1 != 1. |
|
0 commit comments