R-alpha: is.function(..) 'lies' sometimes ...

Martin Maechler (maechler@stat.math.ethz.ch)
Wed, 26 Jun 96 18:23:05 +0200


Date: Wed, 26 Jun 96 18:23:05 +0200
Message-Id: <9606261623.AA01374@>
From: Martin Maechler <maechler@stat.math.ethz.ch>
To: R-testers mailing list <R-testers@stat.math.ethz.ch>
Subject: R-alpha: is.function(..)  'lies' sometimes ...

R 0.9  [ SunOS, but anywhere ] :

is.function(..) is sometimes lying,
telling that a function is not one.
It is clear that 'for' or 'function' are not functions, eg, 
but what about, e.g.,
	UseMethod, browser, expression, interactive ?

Here is a nice line of code to try :

> for(f in builtins()) if(!is.function(fn <- get(f))) cat(f,if(nchar(f)<6)"\t"else"","\t: is NOT function ;  mode =", mode(fn) ,"\n")
$ 	 	: is NOT function ;  mode = special 
$<- 	 	: is NOT function ;  mode = special 
&& 	 	: is NOT function ;  mode = special 
.ColorTable  	: is NOT function ;  mode = numeric 
.Colors  	: is NOT function ;  mode = numeric 
.Internal  	: is NOT function ;  mode = special 
.Options  	: is NOT function ;  mode = list 
:= 	 	: is NOT function ;  mode = special 
<- 	 	: is NOT function ;  mode = special 
<<- 	 	: is NOT function ;  mode = special 
F 	 	: is NOT function ;  mode = logical 
LETTERS  	: is NOT function ;  mode = character 
T 	 	: is NOT function ;  mode = logical 
UseMethod  	: is NOT function ;  mode = special 
[ 	 	: is NOT function ;  mode = special 
[.data.frame  	: is NOT function ;  mode = special 
[<- 	 	: is NOT function ;  mode = special 
[<-.data.frame  	: is NOT function ;  mode = special 
[[ 	 	: is NOT function ;  mode = special 
[[.data.frame  	: is NOT function ;  mode = special 
[[<- 	 	: is NOT function ;  mode = special 
[[<-.data.frame  	: is NOT function ;  mode = special 
break 	 	: is NOT function ;  mode = special 
browser  	: is NOT function ;  mode = special 
call 	 	: is NOT function ;  mode = special 
deprecated  	: is NOT function ;  mode = special 
expression  	: is NOT function ;  mode = special 
for 	 	: is NOT function ;  mode = special 
function  	: is NOT function ;  mode = special 
globalEnv  	: is NOT function ;  mode = environment 
gr.pars  	: is NOT function ;  mode = character 
if 	 	: is NOT function ;  mode = special 
interactive  	: is NOT function ;  mode = special 
letters  	: is NOT function ;  mode = character 
missing  	: is NOT function ;  mode = special 
month.abb  	: is NOT function ;  mode = character 
month.name  	: is NOT function ;  mode = character 
nargs 	 	: is NOT function ;  mode = special 
next 	 	: is NOT function ;  mode = special 
on.exit  	: is NOT function ;  mode = special 
pi 	 	: is NOT function ;  mode = numeric 
repeat  	: is NOT function ;  mode = special 
return  	: is NOT function ;  mode = special 
substitute  	: is NOT function ;  mode = special 
version  	: is NOT function ;  mode = list 
while 	 	: is NOT function ;  mode = special 
{ 	 	: is NOT function ;  mode = special 
|| 	 	: is NOT function ;  mode = special 
~ 	 	: is NOT function ;  mode = special 
> 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-testers mailing list -- To (un)subscribe, send
subscribe	or	unsubscribe
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-