Skip to content

Commit cffa8b1

Browse files
authored
Merge pull request #1061 from mathics/release-1.1.1
Release 1.1.1
2 parents 2b545d7 + 612e045 commit cffa8b1

File tree

7 files changed

+87
-65
lines changed

7 files changed

+87
-65
lines changed

CHANGES.rst

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,50 +4,56 @@ CHANGES
44
1.1.1
55
-----
66

7-
This is the last update before some major refactoring and interface changing occurs.
7+
This may be the last update before some major refactoring and interface changing occurs.
88

9-
After this relase, Django will no longer be bundled here. See `mathics-django <https://github.com/Mathics3/mathics-django>` for the unbundled replacement.
9+
In a future 2.0.0 release, Django will no longer be bundled here. See `mathics-django <https://github.com/Mathics3/mathics-django>` for the unbundled replacement.
1010

1111
Some changes were made to support `Pymathics Graph <https://github.com/Mathics3/pymathics-graph>`_, a new graph package bundled separately,
12-
and to support the ability for front-ends to handle rendering on their own.
12+
and to support the ability for front-ends to handle rendering on their own. Note that currently this doesn't integrate well into the Django interface, although it works
13+
well in ``mathicsscript``.
1314

1415

1516
Package Updates
16-
++++++++++++++++
17+
+++++++++++++++
1718

1819
- sympy 1.7.1
1920

2021
Mathics Packages added:
2122

22-
- ``DiscreteMath`CombinatoricaV0.9`` and
23-
``DiscreteMath`CombinatoricaV0.6``. V0.9 covers Steven Skiena's older "Implementing Discrete Mathematics: Combinatorics and Graph Theory" book.
23+
- ``DiscreteMath`CombinatoricaV0.9`` (preferred) aand
24+
``DiscreteMath`CombinatoricaV0.6``.
25+
26+
Both of these correspond to Steven Skiena's *older* book: "Implementing Discrete Mathematics: Combinatorics and Graph Theory" book.
2427

25-
If you have a package that you would like included in the distribution, and it works with Mathics, please contact us.
28+
If you have a package that you would like included in the distribution, and it works with Mathics, please contact us
2629

30+
Rubi may appear in a future release, possibly in a year or so. However this might be speeded up if we can get people to help out with this.
2731

2832

2933
New builtins:
3034
++++++++++++++++++++++++++++
3135

3236
- ``StirlingS1``, ``StirlingS2`` (not all WL variations handled)
3337
- ``MapAt`` (not all WL variations handled)
34-
- ``PythonForm``, ``SympyForm`` these is not in WL. It simply will show a crude translation to ``sympy`` or ``python``. Expect more and better translation later
38+
- ``PythonForm``, ``SympyForm``: these is not in WL. It simply will show a crude translation to ``sympy`` or ``python``. Expect more and better translation later
3539
- ``Throw`` and ``Catch``
3640
- ``With``
37-
- Start ``FileNameTake``
41+
- ``FileNameTake``
3842

3943
Enhancements and Bug fixes:
4044
+++++++++++++++++++++++++++
4145

4246
- Workaround for ``Compile`` so it accepts functions ##1026
4347
- Add ``Trace`` option to ``Get``. ``Get["fn", Trace->True]`` will show lines as they are read.
44-
- Add bool for ``from_python``
48+
- Convert to/from Boolean types properly in ``from_python``, ``to_python``. Previously they were 0, and 1.
4549
- Extend ``DeleteCases`` to accept a levelspec parameter.
46-
- Set Evaluation#exc_result to capture ``Aborted``, ``Timeout``, ``Overflow1``, etc.
47-
- ``ImageData`` changed to get bits {0,1} not bools.
48-
- add tokenizer symbols for <-> and -> and the unicode versions of those.
49-
- fix ``Needs``
50+
- Set ``Evaluation#exc_result`` to capture ``Aborted``, ``Timeout``, ``Overflow1``, etc.
51+
- ``ImageData`` changed to get bits {0,1}, not booleans as previously.
52+
- Add tokenizer symbols for <-> and -> and the unicode versions of those.
53+
- Small corrections to ``Needs``, e.g check if already loaded, correct a typo, etc.
5054
- ``System`$InputFileName`` is now set inside ``Needs`` and ``Get``
55+
- Install shell scripts ``dmathicserver``, ``dmathicsscript``, and ``dmathics`` to simplify running docker
56+
- Adjust $InputFileName inside ``Get`` and ``Needs``.
5157

5258
1.1.0
5359
-----

mathics/builtin/arithmetic.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
Rational,
3232
Real,
3333
Symbol,
34+
SymbolNull,
3435
Complex,
3536
String,
3637
SymbolTrue,
@@ -916,7 +917,7 @@ def apply_check(self, x, y, evaluation):
916917
return Symbol("ComplexInfinity")
917918

918919
result = self.apply(Expression("Sequence", x, y), evaluation)
919-
if result is None or result != Symbol("Null"):
920+
if result is None or result != SymbolNull:
920921
return result
921922

922923

mathics/builtin/attributes.py

Lines changed: 54 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
from mathics.builtin.base import Predefined, Builtin
1313
from mathics.builtin.evaluation import Sequence
14-
from mathics.core.expression import Expression, Symbol, String
14+
from mathics.core.expression import Expression, Symbol, SymbolNull, String
1515
from mathics.builtin.assignment import get_symbol_list
1616

1717

@@ -46,16 +46,16 @@ class Attributes(Builtin):
4646
= {Listable}
4747
"""
4848

49-
attributes = ('HoldAll', 'Listable')
49+
attributes = ("HoldAll", "Listable")
5050

5151
def apply(self, expr, evaluation):
52-
'Attributes[expr_]'
52+
"Attributes[expr_]"
5353

5454
name = expr.get_lookup_name()
5555
attributes = list(evaluation.definitions.get_attributes(name))
5656
attributes.sort()
5757
attr = [Symbol(attribute) for attribute in attributes]
58-
return Expression('List', *attr)
58+
return Expression("List", *attr)
5959

6060

6161
class SetAttributes(Builtin):
@@ -75,26 +75,28 @@ class SetAttributes(Builtin):
7575
= {Flat, Orderless}
7676
"""
7777

78-
attributes = ('HoldFirst',)
78+
attributes = ("HoldFirst",)
7979

8080
def apply(self, symbols, attributes, evaluation):
81-
'SetAttributes[symbols_, attributes_]'
81+
"SetAttributes[symbols_, attributes_]"
8282

83-
symbols = get_symbol_list(symbols, lambda item: evaluation.message(
84-
'SetAttributes', 'sym', item, 1))
83+
symbols = get_symbol_list(
84+
symbols, lambda item: evaluation.message("SetAttributes", "sym", item, 1)
85+
)
8586
if symbols is None:
8687
return
87-
values = get_symbol_list(attributes, lambda item: evaluation.message(
88-
'SetAttributes', 'sym', item, 2))
88+
values = get_symbol_list(
89+
attributes, lambda item: evaluation.message("SetAttributes", "sym", item, 2)
90+
)
8991
if values is None:
9092
return
9193
for symbol in symbols:
92-
if 'System`Locked' in evaluation.definitions.get_attributes(symbol):
93-
evaluation.message('SetAttributes', 'locked', Symbol(symbol))
94+
if "System`Locked" in evaluation.definitions.get_attributes(symbol):
95+
evaluation.message("SetAttributes", "locked", Symbol(symbol))
9496
else:
9597
for value in values:
9698
evaluation.definitions.set_attribute(symbol, value)
97-
return Symbol('Null')
99+
return SymbolNull
98100

99101

100102
class ClearAttributes(Builtin):
@@ -116,26 +118,29 @@ class ClearAttributes(Builtin):
116118
= {}
117119
"""
118120

119-
attributes = ('HoldFirst',)
121+
attributes = ("HoldFirst",)
120122

121123
def apply(self, symbols, attributes, evaluation):
122-
'ClearAttributes[symbols_, attributes_]'
124+
"ClearAttributes[symbols_, attributes_]"
123125

124-
symbols = get_symbol_list(symbols, lambda item: evaluation.message(
125-
'ClearAttributes', 'sym', item, 1))
126+
symbols = get_symbol_list(
127+
symbols, lambda item: evaluation.message("ClearAttributes", "sym", item, 1)
128+
)
126129
if symbols is None:
127130
return
128-
values = get_symbol_list(attributes, lambda item: evaluation.message(
129-
'ClearAttributes', 'sym', item, 2))
131+
values = get_symbol_list(
132+
attributes,
133+
lambda item: evaluation.message("ClearAttributes", "sym", item, 2),
134+
)
130135
if values is None:
131136
return
132137
for symbol in symbols:
133-
if 'System`Locked' in evaluation.definitions.get_attributes(symbol):
134-
evaluation.message('ClearAttributes', 'locked', Symbol(symbol))
138+
if "System`Locked" in evaluation.definitions.get_attributes(symbol):
139+
evaluation.message("ClearAttributes", "locked", Symbol(symbol))
135140
else:
136141
for value in values:
137142
evaluation.definitions.clear_attribute(symbol, value)
138-
return Symbol('Null')
143+
return SymbolNull
139144

140145

141146
class Protect(Builtin):
@@ -156,9 +161,9 @@ class Protect(Builtin):
156161
= {1, 2, 3}
157162
"""
158163

159-
attributes = ('HoldAll',)
164+
attributes = ("HoldAll",)
160165
messages = {
161-
'ssym': "`1` is not a symbol or a string.",
166+
"ssym": "`1` is not a symbol or a string.",
162167
}
163168

164169
def apply(self, symbols, evaluation):
@@ -174,28 +179,32 @@ def apply(self, symbols, evaluation):
174179
if symbols.get_head_name() in ("System`Sequence", "System`List"):
175180
symbols = symbols.get_leaves()
176181
else:
177-
evaluation.message('Protect', 'ssym', symbols)
178-
return Symbol("Null")
179-
182+
evaluation.message("Protect", "ssym", symbols)
183+
return SymbolNull
184+
180185
for symbol in symbols:
181186
if isinstance(symbol, Symbol):
182187
items.append(symbol)
183188
else:
184189
pattern = symbol.get_string_value()
185-
if not pattern or pattern=="":
186-
evaluation.message('Protect', 'ssym', symbol)
190+
if not pattern or pattern == "":
191+
evaluation.message("Protect", "ssym", symbol)
187192
continue
188193

189194
if pattern[0] == "`":
190195
pattern = evaluation.definitions.get_current_context() + pattern[1:]
191196
names = evaluation.definitions.get_matching_names(pattern)
192197
for defn in names:
193198
symbol = Symbol(defn)
194-
if not 'System`Locked' in evaluation.definitions.get_attributes(defn):
199+
if not "System`Locked" in evaluation.definitions.get_attributes(
200+
defn
201+
):
195202
items.append(symbol)
196203

197-
Expression("SetAttributes", Expression("List", *items), protected).evaluate(evaluation)
198-
return Symbol('Null')
204+
Expression("SetAttributes", Expression("List", *items), protected).evaluate(
205+
evaluation
206+
)
207+
return SymbolNull
199208

200209

201210
class Unprotect(Builtin):
@@ -209,20 +218,20 @@ class Unprotect(Builtin):
209218
</dl>
210219
"""
211220

212-
attributes = ('HoldAll',)
221+
attributes = ("HoldAll",)
213222
messages = {
214-
'ssym': "`1` is not a symbol or a string.",
223+
"ssym": "`1` is not a symbol or a string.",
215224
}
216225

217226
def apply(self, symbols, evaluation):
218227
"Unprotect[symbols___]"
219228
protected = Symbol("System`Protected")
220229
items = []
221-
if isinstance(symbols ,Symbol):
230+
if isinstance(symbols, Symbol):
222231
symbols = [symbols]
223232
elif isinstance(symbols, Expression):
224233
symbols = symbols.get_leaves()
225-
elif isinstance(symbols ,String):
234+
elif isinstance(symbols, String):
226235
symbols = [symbols]
227236
else:
228237
symbols = symbols.get_sequence()
@@ -232,20 +241,24 @@ def apply(self, symbols, evaluation):
232241
items.append(symbol)
233242
else:
234243
pattern = symbol.get_string_value()
235-
if not pattern or pattern=="":
236-
evaluation.message('Unprotect', 'ssym', symbol)
244+
if not pattern or pattern == "":
245+
evaluation.message("Unprotect", "ssym", symbol)
237246
continue
238247

239248
if pattern[0] == "`":
240249
pattern = evaluation.definitions.get_current_context() + pattern[1:]
241250
names = evaluation.definitions.get_matching_names(pattern)
242251
for defn in names:
243252
symbol = Symbol(defn)
244-
if not 'System`Locked' in evaluation.definitions.get_attributes(defn):
253+
if not "System`Locked" in evaluation.definitions.get_attributes(
254+
defn
255+
):
245256
items.append(symbol)
246257

247-
Expression("ClearAttributes", Expression("List", *items), protected).evaluate(evaluation)
248-
return Symbol('Null')
258+
Expression("ClearAttributes", Expression("List", *items), protected).evaluate(
259+
evaluation
260+
)
261+
return SymbolNull
249262

250263

251264
class Protected(Predefined):

mathics/builtin/files.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4930,7 +4930,7 @@ def apply(self, context, evaluation):
49304930
# Already loaded
49314931
return SymbolNull
49324932

4933-
# TODO: Look why this rises the message
4933+
# TODO: Figure out why this raises the message:
49344934
# "Select::normal: Nonatomic expression expected."
49354935
already_loaded = Expression('MemberQ',
49364936
Symbol('System`$Packages'), context)

mathics/builtin/image.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
Real,
1414
MachineReal,
1515
Symbol,
16+
SymbolNull,
1617
from_python,
1718
)
1819
from mathics.builtin.colors import (
@@ -242,7 +243,7 @@ def apply(self, path, expr, opts, evaluation):
242243
"""ImageExport[path_?StringQ, expr_, opts___]"""
243244
if isinstance(expr, Image):
244245
expr.pil().save(path.get_string_value())
245-
return Symbol("Null")
246+
return SymbolNull
246247
else:
247248
return evaluation.message("ImageExport", "noimage")
248249

mathics/builtin/structure.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
Expression,
1414
String,
1515
Symbol,
16-
SymbolTrue,
16+
SymbolNull,
1717
SymbolFalse,
18+
SymbolTrue,
1819
Integer,
1920
Rational,
2021
strip_context,
@@ -291,9 +292,9 @@ def apply(self, p1, p2, evaluation):
291292
"PatternsOrderedQ[p1_, p2_]"
292293

293294
if p1.get_sort_key(True) <= p2.get_sort_key(True):
294-
return Symbol("True")
295+
return SymbolTrue
295296
else:
296-
return Symbol("False")
297+
return SymbolFalse
297298

298299

299300
class OrderedQ(Builtin):
@@ -314,9 +315,9 @@ def apply(self, e1, e2, evaluation):
314315
"OrderedQ[e1_, e2_]"
315316

316317
if e1 <= e2:
317-
return Symbol("True")
318+
return SymbolTrue
318319
else:
319-
return Symbol("False")
320+
return SymbolFalse
320321

321322

322323
class Order(Builtin):
@@ -657,7 +658,7 @@ def callback(level):
657658
heads = self.get_option(options, "Heads", evaluation).is_true()
658659
result, depth = walk_levels(expr, start, stop, heads=heads, callback=callback)
659660

660-
return Symbol("Null")
661+
return SymbolNull
661662

662663

663664
class MapIndexed(Builtin):

mathics/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
# This file is suitable for sourcing inside POSIX shell as
66
# well as importing into Python. That's why there is no
77
# space around "=" below.
8-
__version__="1.1.1dev" # noqa
8+
__version__="1.1.1" # noqa

0 commit comments

Comments
 (0)