Uh oh!
There was an error while loading. Please reload this page.
Conversation
You can get quite fancy with an Eventually, the limit will still kick in: We could issue a warning via |
ghost
commented
Oct 1, 2016
| cost = sum(leaf.output_cost() for leaf in self.leaves) | ||
| if name == 'System`List': | ||
| return 2 + cost + len(self.leaves) # {a, b, c} |
There was a problem hiding this comment.
would it be better to compute the sum cost of leaves? Also, what about the size of ", " between leaves?
| elif name in _layout_boxes: | ||
| return cost | ||
| else: | ||
| return cost + 2 + self.head.output_cost() + len(self.leaves) # XYZ[a, b, c] |
There was a problem hiding this comment.
cost is the sum cost of leaves (I renamed it now). len(self.leaves) measures the size of ",", which could be one or two (it assumes for now). we could pass the separator size into make_boxes and then pass it on to output_cost, but it's bulky and then should we really measure it that way? If $OutputSizeLimit is understood as number of printable characters (without spaces and layout elements like fractions, parentheses, ...), then it makes sense to always measure 1 for ",".
There was a problem hiding this comment.
In that case I guess technically it should be max(len(self.leaves) - 1, 0).
sn6uv
commented
Oct 1, 2016
It seems like MMA kernels don't even observe |
teaalltr
commented
Oct 1, 2016
So our approach is more efficient! Good to know |
| total_cost = 2 + cost_of_leaves + separator_cost * n_separators # {a, b, c}, [a, b, c] | ||
| if name != 'System`List': | ||
| total_cost += self.head.output_cost() + separator_cost * n_separators |
There was a problem hiding this comment.
doesn't this count the separators twice now?
sn6uv
commented
Oct 3, 2016
This will need to be rebased on a revert of 8e14668. |
87662f3 to
52e46c7Compareab12a77 to
6525df7Compare7a4d68a to
d41fae8Compare96ec58b to
e8a5440Comparemmatera
commented
May 12, 2021
I made a rebase in #1371. @poke1024 if you have the time and the will, look at it. |



see #602