|
45 | 45 | from mathics.builtin.numbers.randomnumbers import RandomEnv |
46 | 46 | from mathics.builtin.codetables import iso639_3 |
47 | 47 | from mathics.builtin.strings import to_regex, anchor_pattern |
| 48 | +from mathics.core.atoms import Integer, String, Real |
48 | 49 | from mathics.core.expression import ( |
49 | 50 | Expression, |
50 | | - String, |
51 | | - Integer, |
52 | | - Real, |
53 | 51 | Symbol, |
54 | 52 | strip_context, |
55 | 53 | string_list, |
56 | 54 | ) |
| 55 | +from mathics.core.listg import to_list_expression |
| 56 | +from mathics.core.symbols import SymbolDivide |
| 57 | +from mathics.core.systemsymbols import SymbolN |
57 | 58 |
|
58 | 59 | import os |
59 | 60 | import re |
@@ -493,7 +494,7 @@ def apply(self, text, word, evaluation, options): |
493 | 494 | text = text.lower() |
494 | 495 | if text in words: |
495 | 496 | n += 1 |
496 | | - return Expression("N", Expression("Divide", n, len(doc))) |
| 497 | + return Expression(SymbolN, Expression(SymbolDivide, Integer(n), Integer(len(doc)))) |
497 | 498 |
|
498 | 499 |
|
499 | 500 | class Containing(Builtin): |
@@ -583,7 +584,7 @@ def apply(self, text, form, evaluation, options): |
583 | 584 | "TextCases[text_String, form_, OptionsPattern[%(name)s]]" |
584 | 585 | doc = self._nlp(text.get_string_value(), evaluation, options) |
585 | 586 | if doc: |
586 | | - return Expression("List", *[t.text for t in _cases(doc, form)]) |
| 587 | + return to_list_expression(*[t.text for t in _cases(doc, form)]) |
587 | 588 |
|
588 | 589 | def apply_n(self, text, form, n, evaluation, options): |
589 | 590 | "TextCases[text_String, form_, n_Integer, OptionsPattern[%(name)s]]" |
|
0 commit comments