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

Mutable vectors passed to R as mutable #416

Open
djsamperi opened this issue May 27, 2023 · 1 comment
Open

Mutable vectors passed to R as mutable #416

djsamperi opened this issue May 27, 2023 · 1 comment

Comments

@djsamperi
Copy link
Contributor

Is your feature request related to a problem? Please describe.
One might expect that when a mutable vector is passed to a quasiquote, that the R code in the quasiquote can modify the vector. But this is not the case. The vector is passed by value.

Describe the solution you'd like
Since these mutable vectors on the Haskell side are actually proxies for R vectors, R should be able to work with
them just like it works with native R vectors.

Describe alternatives you've considered
Of course, we could simply copy out the vector as a list using fromList, but the point is to reduce the amount of copying.

Additional context
This would probably require some redesign of the Haskell/R interface because the current interface evaluates the
R expresion in a quasiquote by placing it into an R function parametrized by the input Haskell variables/vectors, and
vector parameters are passed by value in R (so the called function cannot change the input vector, mutable or not).

@djsamperi
Copy link
Contributor Author

After reading the online docs it seems this would violate the working assumption that hexp can be assumed to be pure. I would close this issue of I could, but it seems this is not possible.

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