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

Add wrapper types for R types #7

Open
Vindaar opened this issue Oct 9, 2021 · 1 comment
Open

Add wrapper types for R types #7

Vindaar opened this issue Oct 9, 2021 · 1 comment

Comments

@Vindaar
Copy link
Member

Vindaar commented Oct 9, 2021

For scalar types we can continue to simply copy numbers. However, for larger data we will want to have Nim wrapper types that allow access to the underlying data of the SEXP without copying.

A sketch:

type
  NumericVector[T] = object
    obj: SEXP

proc `[]`[T](v: NumericVector[T], idx: int): T = 
  result = v.obj.accessArray(idx) # where accessArray accesses the data using DATAPTR
...

Need to learn what other types of interest we might want to wrap other than vectors.

@Vindaar
Copy link
Member Author

Vindaar commented Oct 16, 2021

NumericVector and a related RawVector have been implemented in #12.

This will stay open, as other types should also be wrapped.

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