From wdun|@p @end|ng |rom t|bco@com  Thu Mar 12 16:06:05 2020
From: wdun|@p @end|ng |rom t|bco@com (William Dunlap)
Date: Thu, 12 Mar 2020 08:06:05 -0700
Subject: [Rd] support of `substitute(...())`
In-Reply-To: <5268fdf5-664f-36ad-3111-d269b8da3d74@kogentum.hu>
References: <5268fdf5-664f-36ad-3111-d269b8da3d74@kogentum.hu>
Message-ID: <CAF8bMcZHhmeuc3onZOj+8KQQ04yt0AmzfRA0JSGogC3fjY58zg@mail.gmail.com>

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 <toth.denes at kogentum.hu> 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 at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

	[[alternative HTML version deleted]]



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