From 2df748e68069f6c446a7d00daf4be983288110c5 Mon Sep 17 00:00:00 2001 From: Angus Griffith <16sn6uv@gmail.com> Date: Thu, 29 Sep 2016 10:34:36 +1000 Subject: [PATCH 1/3] cleanup OutputSizeLimit --- mathics/builtin/evaluation.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/mathics/builtin/evaluation.py b/mathics/builtin/evaluation.py index b0084b7975..6c636ec7d6 100644 --- a/mathics/builtin/evaluation.py +++ b/mathics/builtin/evaluation.py @@ -421,6 +421,3 @@ class OutputSizeLimit(Predefined): rules = { '$OutputSizeLimit': str(value), } - - def evaluate(self, evaluation): - return Integer(self.value) From 1585b309c230d14ac116511a1668d6fd3b8afdb9 Mon Sep 17 00:00:00 2001 From: Angus Griffith <16sn6uv@gmail.com> Date: Thu, 29 Sep 2016 11:00:45 +1000 Subject: [PATCH 2/3] use boxes_to_text for OutputSizeLimit --- mathics/core/expression.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mathics/core/expression.py b/mathics/core/expression.py index c0da8685b4..b3d21c8a87 100644 --- a/mathics/core/expression.py +++ b/mathics/core/expression.py @@ -2409,6 +2409,7 @@ def make(self, items, form, segment=None): delay_break = 0 depth = state.depth + sum_of_costs = 0 for i, (item, push) in enumerate(_interleave(*from_sides)): @@ -2465,11 +2466,11 @@ def _evaluate(self, item, form, **kwargs): box = Expression('MakeBoxes', item, form).evaluate(self._evaluation) - # estimate the cost of the output related to box. always calling boxes_to_xml here is + # estimate the cost of the output related to box. always calling boxes_to_text here is # the simple solution; the problem is that it's redundant, as for {{{a}, b}, c}, we'd - # call boxes_to_xml first on {a}, then on {{a}, b}, then on {{{a}, b}, c}. a good fix + # call boxes_to_text first on {a}, then on {{a}, b}, then on {{{a}, b}, c}. a good fix # is not simple though, so let's keep it this way for now. - cost = len(box.boxes_to_xml(evaluation=self._evaluation)) # evaluate len as XML + cost = len(box.boxes_to_text(evaluation=self._evaluation)) return box, cost finally: From db83cc2ef443b6b8ffd02d821b736d7c83f77641 Mon Sep 17 00:00:00 2001 From: Angus Griffith <16sn6uv@gmail.com> Date: Fri, 30 Sep 2016 02:30:24 +1000 Subject: [PATCH 3/3] fix empty list omitted bug --- mathics/builtin/evaluation.py | 2 ++ mathics/core/expression.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/mathics/builtin/evaluation.py b/mathics/builtin/evaluation.py index 6c636ec7d6..d0687c489d 100644 --- a/mathics/builtin/evaluation.py +++ b/mathics/builtin/evaluation.py @@ -412,6 +412,8 @@ class OutputSizeLimit(Predefined): >> $OutputSizeLimit = 10; >> Table[i, {i, 1, 100}] = {1, <<98>>, 100} + #> {} + = {} >> $OutputSizeLimit = Infinity; """ diff --git a/mathics/core/expression.py b/mathics/core/expression.py index b3d21c8a87..168ca3272f 100644 --- a/mathics/core/expression.py +++ b/mathics/core/expression.py @@ -2379,7 +2379,7 @@ def make(self, items, form, segment=None): capacity = state.capacity if capacity is None or len(items) < 1: - return self._unlimited(items, form, segment) + return self._unlimited.make(items, form, segment) left_leaves = [] right_leaves = []