From ligges at statistik.tu-dortmund.de  Sun May 23 16:20:01 2010
From: ligges at statistik.tu-dortmund.de (Uwe Ligges)
Date: Sun, 23 May 2010 16:20:01 +0200
Subject: [Rd] possible bug in formals
In-Reply-To: <20100523141455.GA17210@zwirn.stat-math.wu.ac.at>
References: <mailman.13.1251540004.31955.r-devel@r-project.org>
	<20100523141455.GA17210@zwirn.stat-math.wu.ac.at>
Message-ID: <4BF93991.5090809@statistik.tu-dortmund.de>



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



[Rd] possible bug in formals
Uwe Ligges