Skip to content
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

Reshaping/Retyping lenses #19

Open
1 of 7 tasks
cfhammill opened this issue Oct 4, 2018 · 1 comment
Open
1 of 7 tasks

Reshaping/Retyping lenses #19

cfhammill opened this issue Oct 4, 2018 · 1 comment

Comments

@cfhammill
Copy link
Owner

cfhammill commented Oct 4, 2018

In the now closed #9 we proposed adding type conversion lenses.

In general we could have type conversion lenses

  • df2list (with suitable arg checking on set)
  • list2df (with suitable arg checking on view)
  • vec2list (with suitable arg checking on set)
  • list2vec (with suitable arg checking on view)
  • vec2vec (perhaps using https://github.com/r-lib/vctrs)

we could also have reshaping lenses

  • flatten_l: turn a nested list into a flat one
  • reshape_l: change the dimensions of an array subject to the condition that prod(dim(x)) is preserved.
@cfhammill
Copy link
Owner Author

for type conversion it seems like the general principle is when lensing from a more restricted to a less restricted type you need to be careful when you set. When lensing from a less restricted to a more restricted type you need to be careful when you view. Neat symmetry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant