Open justone opened 6 years ago
Hi,
Thanks for your comments and feedback! Glad datawalk has proved useful for you :)
Paging is a terrific idea! I'll have to give it some thought -- I've tried to find a balance between simplicity/ease-of-use and power, so I'm pretty cautious about adding more commands. But it'd definitely be a nice feature to have, and not one I've considered before. For me, I'm usually using it to explore data where I care more about examining a representative element (per level) rather than seeking out a specific element. But it seems plausible that there are plenty of folks with your use case.
Any thoughts about the value of next-page/previous-page commands vs jump-to-nth command?
I'm unavailable for a few weeks, but I'll add it to my calendar to come back & think more about this issue when I get back.
I agree that paging would be a useful feature. For my purposes, it would be enough to just have next/previous page commands.
I didn't know about the !
function before seeing this issue, but for others that want this feature before it's implemented, you can approximate paging (in one direction) like:
[datawalk] > !
Please enter a function of one variable
Enter a fn >> (partial drop 30)
Thanks to both of you for the input. I'm feeling good about adding this feature, but it's likely to be a good while before I have a chance (just changed jobs, and things are really busy right now). I'm open to a pull request adding paging, if either of you (or someone else) feel motivated to add it. Otherwise I'll get to it when I can!
The tricky part will be that page-back
attempts to visit data that's not a substructure of the current data structure. It probably makes more sense to only add a page-forward function, and let the user rely on the backward
command (ie backward-in-history) to reverse that. But I'm open to input on that approach.
Adding it will be a matter of:
page-forward
function in datawalk.datawalk
which drops n items from the current data structure (probably n = :max-items
in datawalk.print/config
).>
to datawalk.parse/cmd-map
, mapped to the page-forward
fn.datawalk.datawalk/help-text
.Offhand I think that's everywhere.
Alternately, it might be worth adding an additional state atom in datawalk.datawalk
, containing a map from current data to previous page, and then having a page-backward
fn which returns that, bound to <
. I'm slightly more hesitant on that approach, only because I've tried to limit the amount of state that datawalk
maintains, but I'm potentially open to it.
Hey,
datawalk
is great, I used it to investigate a rather large data structure today, and it helped a lot.One limitation I ran into was that my data structure has 95 (or so) elements in the list, and so when I loaded up datawalk, I had to keep guessing at the last index (the one I wanted to see). I ended up using the
!
function to runlast
on the collection, but I was wondering: would it be useful to add paging to the repl so you can see elements 30-59, and so on?Thanks again for datawalk.