Re: [Rd] Surprising results from INTEGER_GET_REGION with ALTREP object

2019-03-01 Thread Tomas Kalibera
On 3/1/19 1:52 PM, Ralf Stubner wrote: > Dear Listmembers, > > wanting to learn more about ALTREP I wrote the following function to > extract a subsequence from an integer vector: > > #include > > SEXP integer_get_region(SEXP _x, SEXP _i, SEXP _n) { >int i = INTEGER(_i)[0]; >int n = INTEGE

[Rd] Surprising results from INTEGER_GET_REGION with ALTREP object

2019-03-01 Thread Ralf Stubner
Dear Listmembers, wanting to learn more about ALTREP I wrote the following function to extract a subsequence from an integer vector: #include SEXP integer_get_region(SEXP _x, SEXP _i, SEXP _n) { int i = INTEGER(_i)[0]; int n = INTEGER(_n)[0]; SEXP result = PROTECT(Rf_allocVector(INTSXP, n