On 23.05.2010 16:14, Josef Leydold wrote:
Hi,

I am a little bit surprised by the following output of
'formals'. Is this the intended behavior?

f<- function(a=1,b=-1) { a+b }
class(formals(f)$a)
[1] "numeric"
class(formals(f)$b)
[1] "call"


Josef




Yes, the arguments have not yet been evaluated, hence -1 is still a language object.

Try to write
 f<- function(a= +1, b= -1) { a+b }
and you will find that this is a fascinating feature.

Uwe Ligges

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to