From p.dalgaard@biostat.ku.dk  Mon Mar  1 14:11:48 1999
From: p.dalgaard@biostat.ku.dk (Peter Dalgaard BSA)
Date: 01 Mar 1999 15:11:48 +0100
Subject: Inconsistencies with is.function
In-Reply-To: Kjetil Halvorsen's message of Mon, 01 Mar 1999 14:53:31 +0100
References: <36DA9BDA.67F9B953@alumni.uv.es>
Message-ID: <x2aexxe1uj.fsf@blueberry.kubism.ku.dk>

Kjetil Halvorsen <khal@alumni.uv.es> writes:

> > debug("[<-")
> Error in debug("[<-") : argument must be a function
> > is.function(get("[<-"))
> [1] TRUE
> > 
> 
> The problem having to do with .Primitive functions. R should agree
> with itself on what is a function! 

..most likely by fixing the error message in  debug(): "must be a
non-primitive function".

> to work around, I used
> is.Primfun <- function(fun) is.function(fun) && is.null(body(fun))
> 
> but I'm not sure if that is failsafe.

It isn't: 

> is.null(body(function()NULL))
[1] TRUE

However,

> args(function()NULL) 
function () 
NULL
> args(sin)
NULL

so is.null(args(fun)) works better. The construction is also used in
some of the tests/ and demos/ files.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


Inconsistencies with is.function
Peter Dalgaard BSA