Skip to content

Conversation

@poke1024
Copy link
Contributor

@poke1024 poke1024 commented Oct 1, 2016

see #602

@poke1024
Copy link
Contributor Author

poke1024 commented Oct 1, 2016

You can get quite fancy with an $OutputSizeLimit of 1000 now:

example1

Eventually, the limit will still kick in:

example2

We could issue a warning via evaluate.message in these cases, telling the user to bump the $OutputSizeLimit. We could also use MakeBoxes to make the omit tags like <<2>> appear in a slightly color/background.

@poke1024
Copy link
Contributor Author

poke1024 commented Oct 1, 2016

With warning:

example3

cost = sum(leaf.output_cost() for leaf in self.leaves)

if name == 'System`List':
return 2 + cost + len(self.leaves) # {a, b, c}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here also

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ",".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case I guess technically it should be max(len(self.leaves) - 1, 0).

@sn6uv
Copy link
Member

sn6uv commented Oct 1, 2016

It seems like MMA kernels don't even observe $OutputSizeLimit only the notebook interface does and the full boxes are still generated anyway.

@teaalltr
Copy link
Contributor

teaalltr commented Oct 1, 2016

So our approach is more efficient! Good to know

@sn6uv sn6uv added this to the 1.0 milestone Oct 2, 2016
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't this count the separators twice now?

@sn6uv sn6uv removed this from the 1.0 milestone Oct 3, 2016
@sn6uv
Copy link
Member

sn6uv commented Oct 3, 2016

This will need to be rebased on a revert of 8e14668.

@GarkGarcia GarkGarcia added the needs rabase An old PR that needs to be rebased label Sep 9, 2020
@rocky rocky force-pushed the master branch 3 times, most recently from 87662f3 to 52e46c7 Compare October 24, 2020 14:56
@rocky rocky force-pushed the master branch 4 times, most recently from ab12a77 to 6525df7 Compare October 24, 2020 16:36
@rocky rocky force-pushed the master branch 3 times, most recently from 7a4d68a to d41fae8 Compare November 14, 2020 18:16
@rocky rocky force-pushed the master branch 2 times, most recently from 96ec58b to e8a5440 Compare March 14, 2021 13:55
@mmatera
Copy link
Contributor

mmatera commented May 12, 2021

I made a rebase in #1371. @poke1024 if you have the time and the will, look at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug enhancement needs rabase An old PR that needs to be rebased

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants