Re: [Rd] A trap for young players with the lapply() function.

2017-03-29 Thread Rolf Turner
On 29/03/17 20:32, Enrico Schumann wrote: (inline) On Tue, 28 Mar 2017, Rolf Turner writes: On 28/03/17 04:21, Barry Rowlingson wrote: On Mon, Mar 27, 2017 at 1:17 AM, Rolf Turner wrote: Is there any way to trap/detect the use of an optional argument called "X" and thereby issue a more per

Re: [Rd] Transferring ownership of R-managed buffer

2017-03-29 Thread Gabriel Becker
Tim, What you're describing is a special case of the ALTREP framework/API that Luke Tierney, Tomas Kalibera, and I are working on putting into R. See my initial proposal to the DSC here: https://www.r-project.org/dsc/2016/slides/customvectors.html and the subsequent branch here: https://svn.r-proj

Re: [Rd] Transferring ownership of R-managed buffer

2017-03-29 Thread Tim Keitt
http://www.keittlab.org/ On Wed, Mar 29, 2017 at 1:04 PM, Hervé Pagès wrote: > Hi Tim, > > On 03/29/2017 08:24 AM, Tim Keitt wrote: > >> I have a use case where I would like to create an SEXP around an existing >> buffer that is managed by R, thus avoiding a copy operation. >> > > What to you me

Re: [Rd] Transferring ownership of R-managed buffer

2017-03-29 Thread Hervé Pagès
On 03/29/2017 11:04 AM, Hervé Pagès wrote: Hi Tim, On 03/29/2017 08:24 AM, Tim Keitt wrote: I have a use case where I would like to create an SEXP around an existing buffer that is managed by R, thus avoiding a copy operation. What to you mean exactly by "an existing buffer managed by R"? I

Re: [Rd] Transferring ownership of R-managed buffer

2017-03-29 Thread Hervé Pagès
Hi Tim, On 03/29/2017 08:24 AM, Tim Keitt wrote: I have a use case where I would like to create an SEXP around an existing buffer that is managed by R, thus avoiding a copy operation. What to you mean exactly by "an existing buffer managed by R"? If I have something like: void *p = (void*)

[Rd] Transferring ownership of R-managed buffer

2017-03-29 Thread Tim Keitt
I have a use case where I would like to create an SEXP around an existing buffer that is managed by R, thus avoiding a copy operation. If I have something like: void *p = (void*) RAW(PROTECT(Rf_allocVector(RAWSXP, n))); ... additional maniupulation ... SEXP x = somefunc(SXPTYPE, n, p); // I

Re: [Rd] A trap for young players with the lapply() function.

2017-03-29 Thread Enrico Schumann
(inline) On Tue, 28 Mar 2017, Rolf Turner writes: > On 28/03/17 04:21, Barry Rowlingson wrote: >> On Mon, Mar 27, 2017 at 1:17 AM, Rolf Turner wrote: >>> >>> Is there any way to trap/detect the use of an optional argument called >>> "X" and thereby issue a more perspicuous error message? >>> >>>

Re: [Rd] `[` not recognized as a primitive in certain cases.

2017-03-29 Thread Martin Maechler
> Joris Meys > on Tue, 28 Mar 2017 15:19:14 +0200 writes: > Thank you gents, I overlooked the subtle differences. > On Tue, Mar 28, 2017 at 2:49 PM, Lukas Stadler > wrote: >> “typeof” is your friend here: >> >> > typeof(`[`) >> [1] "special" >> > ty