Skip to content
Prev 21954 / 63424 Next

Question about substitute() and function def

On 9/14/2006 3:01 PM, Seth Falcon wrote:
I think it's the same reason that this happens:

 > substitute(c( a = 1, b = a), list(a = quote(foo)))
c(a = 1, b = foo)

The "a" in function(a) is the name of the arg, it's not the arg itself 
(which is missing).  Now a harder question to answer is why this happens:

 > substitute(function(a=a) 1, list(a=quote(foo)))
function(a = a) 1

I would have expected to get "function(a = foo) 1".

Duncan Murdoch