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

Peter Dalgaard BSA (
Fri, 28 Jun 1996 18:59:58 +0200

Date: Fri, 28 Jun 1996 18:59:58 +0200
Message-Id: <>
From: Peter Dalgaard BSA <>
To: Martin Maechler <>
In-Reply-To: Martin Maechler's message of Wed, 26 Jun 96 18:23:05 +0200
Subject: Re: R-alpha: is.function(..)  'lies' sometimes ...

In article <9606261623.AA01374@> Martin Maechler <> writes:

   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 ?

Hmm. At least UseMethod IS no function:

> z<-"plot"
> UseMethod(z,x)
Error in UseMethod(z, x) : first argument must be a method name
> UseMethod("plot",x)

S is different:

> z<-"plot"
> UseMethod(z)
Error in UseMethod(z): Can't find a local object ("x")
> UseMethod("plot")
Error in UseMethod("plot"): Can't find a local object ("x")

I.e. S knows to substitute the value of the first argument to
UseMethod whereas R does not. The semantics are also a little
different, but that's not the point: It's like having log(10) work,
but not log(x). That's not normal behaviour for a function, is it?

On the other hand, with lazy evaluation, I suppose that you *could*
write a function that checked its argument and barfed if it wasn't a
constant (how?). So maybe it should have function status after all?

   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (             FAX: (+45) 35327907
r-testers mailing list -- To (un)subscribe, send
subscribe	or	unsubscribe
(in the "body", not the subject !)  To: