[Rd] args / formals on primitives

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Apr 17 09:12:49 CEST 2007


On Mon, 16 Apr 2007, Thomas Friedrichsmeier wrote:

> On SVN revision 41087:

which is over 100 old.

Now we are in code freeze, the pace of change should reduce considerably 
(although people will continue to work in R-devel)

> ?args has this example line:
>
> args(c)            # -> NULL (c is a 'primitive' function)
>
> The comment seems out of date, as args(c) does in fact have a non-NULL return
> value:
>
> args(c)
> # function (..., recursive = FALSE)
> # NULL

That has been fixed once but the fix seems to have got lost, so I have put 
in back.

> While at it, I was wondering, why
>
> formals(c)
>
> still returns NULL, in contrast.

Because only closures have formals, the way things are defined.  This 
makes sense to me as formals<-() cannot work on primitives.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list