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
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
>
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
> 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
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
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)
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
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
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,