-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Queue show
method to hide backing Deque
#734
base: master
Are you sure you want to change the base?
Conversation
I was looking over the Queue method per JuliaCollections#479 and while I didn't find any issues I noticed that during printing at the REPL the backing Deque is printed inside. Decided to try to write a small show method to hide the backing type to pretty it up.
A method for Also we probably want to call |
Sorry for causing probably more work than this is all worth. I like DataStructures.jl and wanted to help in some small way to polish things up for 1.0. I've never gotten an actual PR accepted before though so I'm figuring things out. For the latter point would something more like the following be what you mean by calling calling "call
As for the first point, a constructor to create a Queue from an array (or probably other iterables as well) so that If Deque were being modified it's show could be changed to have the same style. Last point, should they be shown as |
No this is appreciated
(you missed passing the
Does
yes, and that could be in this PR.
I think |
No they do not. The only way to construct one at the moment is empty (unless I am really missing something but I see no constructors for it and it errors at the REPL). Stacks similarly don't have printing or a constructor from an iterable. I'll add the improved show methods to those 3 types in this PR but then we can pause this PR until the constructors are done. I'm going to open an issue about the Deque (and Queue and Stack) constructors for tracking, then when I have time I'll see if I can figure out the implementation of that constructor in Deque. The corresponding constructors in Stack/Queue would then be simple. |
One further question. Deque implements a custom As such should we show the contents of a Queue by simply collecting the Queue instead of collecting the backing Deque? and should the Deque |
I am not sure, I haven't looked at the collect method. |
I was looking over the Queue method per #479 and while I didn't find any issues on that front (not that I'm in any way qualified to make that assessment) I noticed that during printing at the REPL the backing Deque is printed inside. Decided to try to write a small show method to hide the backing type to pretty it up. This formatting matches how a Deque is currently printed.
Changes the REPL representation from
Queue [Deque [[6, 10]]]
to
Queue [[6, 10]]