[Rd] support of `substitute(...())`

2020-03-12 Thread Dénes Tóth

Dear R Core Team,

I learnt approx. two years ago in this mailing list that one can use the 
following "trick" to get a (dotted pair)list of the ellipsis arguments 
inside a function:


`substitute(...())`

Now my problem is that I can not find any occurrence of this call within 
the R source - the most frequent solution there is 
`substitute(list(...))[-1L] `


I would like to know if:
1) substitute(...()) is a trick or a feature in the language;
2) it will be supported in the future;
3) when (in which R version) it was introduced.

A hint on where to look for the machinery in the R source would be also 
appreciated.


Regards,
Denes

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] R 4.0.0 scheduled for April 24

2020-03-12 Thread Peter Dalgaard via R-devel
Full schedule is available on developer.r-project.org.

Notice that Copenhagen Business School, like all Danish educational 
institutions, is physically locked down for two weeks due to COVID-19. The 
schedule is automated, but there may be irregularities with the nightly builds, 
if things act up and I can't get to the machine.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] support of `substitute(...())`

2020-03-12 Thread William Dunlap via R-devel
Note that substitute(...()) and substitute(someFunc(...))[-1] give slightly
different results, the former a pairlist and the latter a call.
  > str((function(...)substitute(...()))(stop(1),stop(2),stop(3)))
  Dotted pair list of 3
   $ : language stop(1)
   $ : language stop(2)
   $ : language stop(3)
  >
str((function(...)substitute(someFunc(...))[-1])(stop(1),stop(2),stop(3)))
   language stop(1)(stop(2), stop(3))

The ...() idiom has been around for a long time, but more recently
(slightly after R-3.4.0?) the ...elt(n) and ...length() functions were
introduced so you don't have to use it much.  I don't see a ...names()
function that would give the names of the ... arguments -
names(substitute(...())).

Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Thu, Mar 12, 2020 at 2:09 AM Dénes Tóth  wrote:

> Dear R Core Team,
>
> I learnt approx. two years ago in this mailing list that one can use the
> following "trick" to get a (dotted pair)list of the ellipsis arguments
> inside a function:
>
> `substitute(...())`
>
> Now my problem is that I can not find any occurrence of this call within
> the R source - the most frequent solution there is
> `substitute(list(...))[-1L] `
>
> I would like to know if:
> 1) substitute(...()) is a trick or a feature in the language;
> 2) it will be supported in the future;
> 3) when (in which R version) it was introduced.
>
> A hint on where to look for the machinery in the R source would be also
> appreciated.
>
> Regards,
> Denes
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] support of `substitute(...())`

2020-03-12 Thread Dénes Tóth



On 3/12/20 4:06 PM, William Dunlap wrote:
Note that substitute(...()) and substitute(someFunc(...))[-1] give 
slightly different results, the former a pairlist and the latter a call.

   > str((function(...)substitute(...()))(stop(1),stop(2),stop(3)))
   Dotted pair list of 3
    $ : language stop(1)
    $ : language stop(2)
    $ : language stop(3)
   > 
str((function(...)substitute(someFunc(...))[-1])(stop(1),stop(2),stop(3)))

    language stop(1)(stop(2), stop(3))


Yes, I am aware of this difference. In my use cases, the ...() form 
gives the result that I prefer (a pairlist).




The ...() idiom has been around for a long time, but more recently 
(slightly after R-3.4.0?) the ...elt(n) and ...length() functions were 
introduced so you don't have to use it much.  


Yes, I know both.

I don't see a ...names() 
function that would give the names of the ... arguments - 
names(substitute(...())).


Exactly, this is a frequent use case. Occasionally I use it in other 
cases as well where I deliberately do not want to evaluate the arguments 
passed as dots.


What I am most interested in is whether this is a 'trick' or a legal use 
of a (rather unadvertised) feature of the language.




Bill Dunlap
TIBCO Software
wdunlap tibco.com 


On Thu, Mar 12, 2020 at 2:09 AM Dénes Tóth > wrote:


Dear R Core Team,

I learnt approx. two years ago in this mailing list that one can use
the
following "trick" to get a (dotted pair)list of the ellipsis arguments
inside a function:

`substitute(...())`

Now my problem is that I can not find any occurrence of this call
within
the R source - the most frequent solution there is
`substitute(list(...))[-1L] `

I would like to know if:
1) substitute(...()) is a trick or a feature in the language;
2) it will be supported in the future;
3) when (in which R version) it was introduced.

A hint on where to look for the machinery in the R source would be also
appreciated.

Regards,
Denes

__
R-devel@r-project.org  mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel



__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel