Re: [Rd] How to assign NULL value to pairlist element while keeping it a pairlist?

2016-10-19 Thread Henrik Bengtsson
Thanks Luke. Yes, this is what I wrote as a workaround in my original post (and my first follow up): expr[[2]][1] <- list(x = NULL) expr[[2]] <- as.pairlist(expr[[2]]) but your alist <- expr[[2]] alist[1] <- list(NULL) expr[[2]] <- as.pairlist(alist) makes it a bit more clear what the issue

Re: [Rd] How to assign NULL value to pairlist element while keeping it a pairlist?

2016-10-19 Thread luke-tierney
On Wed, 19 Oct 2016, Henrik Bengtsson wrote: On Sat, Oct 15, 2016 at 2:00 AM, Martin Maechler wrote: Michael Lawrence on Wed, 12 Oct 2016 15:21:13 -0700 writes: > Thanks, this was what I expected. There is a desire to >

Re: [Rd] How to assign NULL value to pairlist element while keeping it a pairlist?

2016-10-19 Thread Henrik Bengtsson
On Sat, Oct 15, 2016 at 2:00 AM, Martin Maechler wrote: >> Michael Lawrence >> on Wed, 12 Oct 2016 15:21:13 -0700 writes: > > > Thanks, this was what I expected. There is a desire to > > eliminate the usage of pairlist

Re: [Rd] How to assign NULL value to pairlist element while keeping it a pairlist?

2016-10-15 Thread Martin Maechler
> Michael Lawrence > on Wed, 12 Oct 2016 15:21:13 -0700 writes: > Thanks, this was what I expected. There is a desire to > eliminate the usage of pairlist from user code, which > suggests the alternative of allowing for function > arguments

Re: [Rd] How to assign NULL value to pairlist element while keeping it a pairlist?

2016-10-12 Thread Michael Lawrence
Thanks, this was what I expected. There is a desire to eliminate the usage of pairlist from user code, which suggests the alternative of allowing for function arguments to be stored in lists. That's a much deeper change though. On Wed, Oct 12, 2016 at 12:31 PM, Henrik Bengtsson

Re: [Rd] How to assign NULL value to pairlist element while keeping it a pairlist?

2016-10-12 Thread Henrik Bengtsson
Michael, thanks for this info. I've stumbled upon this in a case where I walk an R expression (the AST) and (optionally) modifies it (part of the globals package). In R expressions, a function definition uses a pairlist to represent the arguments. For example, > expr <- quote(function(x = 1)

Re: [Rd] How to assign NULL value to pairlist element while keeping it a pairlist?

2016-10-12 Thread Michael Lawrence
Hi Henrik, It would help to understand your use case for pairlists. Thanks, Michael On Wed, Oct 12, 2016 at 9:40 AM, Michael Lawrence wrote: > The coercion is probably the most viable workaround for now, as it's > consistent with what happens internally for calls. All

Re: [Rd] How to assign NULL value to pairlist element while keeping it a pairlist?

2016-10-12 Thread Michael Lawrence
The coercion is probably the most viable workaround for now, as it's consistent with what happens internally for calls. All pairlists/calls are converted to list for subassignment, but only calls are converted back. My guess is that the intent was for users to move from using a pairlist to the

[Rd] How to assign NULL value to pairlist element while keeping it a pairlist?

2016-10-12 Thread Henrik Bengtsson
Hi, I seem to not be able to assign NULL to an element of a pairlist without causing it to be coerced to a plain list. For example: > x <- pairlist(1, 2) > class(x) [1] "pairlist" > x[1] <- list(NULL) > class(x) [1] "list" This actually true for all [()<- assignments regardless of list value,