moodymudskipper / debugverse

Brainstorming ideas for debugging workflow and tools, not a package (yet ?)
1 stars 0 forks source link

better list manipulation #40

Open moodymudskipper opened 1 year ago

moodymudskipper commented 1 year ago

modifyList() and purrr::modify_in() are not enough.

We need better utilities to rename, reorder, remove, apply etc

We need also to do a bit better than pluck accessors, by being able to access several items.

We can use tidy selection, but it returns a number, so we need to map these numbers to nodes or leafs.

If we want a pluck like notation we might combine with |, and use list() rather than c(), e.g. list(1, "a" | has_depth(3), "foo")

note that pluck might support tidy selection soonish.

We could have a ls_prune() function that would look and work like pluck except that it would return a subset of the list. We would use v like "vertical" to go deeper into the indices, and h like "horizontal" to select different elements at a given depth.

any_of() and all_of() would be put to good use

moodymudskipper commented 1 year ago

A nested list can be represented as a data.frame of leaves and addresses, except there can be empty lists.

It is in a sense similar to the parse data of the building list call