Skip to content

Commit bf6a8c0

Browse files
authored
Start Operators with no meaning section (#1171)
The Star function is needed for Rubi.
1 parent 15b8092 commit bf6a8c0

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

mathics/builtin/no_meaning.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# -*- coding: utf-8 -*-
2+
# Note: this will be redone soon to pull no-meaning operator information from operators.yml out
3+
# of the MathicsScanner project.
4+
"""
5+
Operators without Built-in Meanings
6+
7+
Not all operators recognized by the Mathics3 are associated with functions that have built‐in meanings.
8+
You can use these operators as a way to build up your own notation within the Mathics3.
9+
"""
10+
11+
from mathics.core.attributes import A_NO_ATTRIBUTES
12+
from mathics.core.builtin import BinaryOperator
13+
14+
15+
class Star(BinaryOperator):
16+
r"""
17+
Star <url>
18+
:WML link:
19+
https://reference.wolfram.com/language/ref/Star.html</url>
20+
21+
<dl>
22+
<dt>'Star[$x$, $y$, ...]'
23+
<dd>displays $x$ ⋆ $y$ ⋆ ...
24+
</dl>
25+
26+
>> Star[x, y, z]
27+
= x ⋆ y ⋆ z
28+
29+
>> a \[Star] b
30+
= a ⋆ b
31+
"""
32+
33+
attributes = A_NO_ATTRIBUTES
34+
default_formats = False # Don't use any default format rules. Instead, see below.
35+
formats = {
36+
(("InputForm", "OutputForm", "StandardForm"), "Star[args__]"): (
37+
'Infix[{args}, "⋆"]'
38+
),
39+
}
40+
41+
operator = "⋆" # \u22C6
42+
summary_text = "star symbol"

mathics/core/builtin.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,9 +1133,11 @@ def __init__(self, *args, **kwargs):
11331133

11341134
class BinaryOperator(Operator):
11351135
"""
1136-
Class for Builtin Binary Operators, e.g. Plus (+)
1136+
Class for Builtin Infix Operators (which includes Binary
1137+
operators), e.g. Plus (+).
11371138
"""
11381139

1140+
# Note: grouping must be Python string, not a Symbol.
11391141
grouping = "System`None" # NonAssociative, None, Left, Right
11401142

11411143
def __init__(self, *args, **kwargs):

0 commit comments

Comments
 (0)