eggsyntax / datawalk

Interactively explore complex data structures at the REPL with minimum keystrokes
Eclipse Public License 1.0
275 stars 2 forks source link

Support for paging #5

Open justone opened 6 years ago

justone commented 6 years ago

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 run last 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.

eggsyntax commented 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.

tkocmathla commented 5 years ago

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)
eggsyntax commented 5 years ago

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:

Offhand I think that's everywhere.

eggsyntax commented 5 years ago

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.