From murdoch at stats.uwo.ca  Mon Oct 31 20:44:27 2005
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Mon, 31 Oct 2005 14:44:27 -0500
Subject: [Rd] [R] unvectorized option for outer()
In-Reply-To: <971536df0510311133g38247e74j6450b68549b0a555@mail.gmail.com>
References: <8B08A3A1EA7AAC41BE24C750338754E69FDF14@HERMES.demogr.mpg.de>	<43629490.9060204@acm.org>	<971536df0510281643u50929fa6rf097c40948700804@mail.gmail.com>	<4364A4FC.2030400@durham.ac.uk>	<Pine.LNX.4.63a.0510301300260.28148@homer23.u.washington.edu>	<x2y84amyv4.fsf@turmalin.kubism.ku.dk>
	<43666D4D.7070602@acm.org>
	<971536df0510311133g38247e74j6450b68549b0a555@mail.gmail.com>
Message-ID: <4366741B.3090301@stats.uwo.ca>

On 10/31/2005 2:33 PM, Gabor Grothendieck wrote:
> On 10/31/05, Tony Plate <tplate at acm.org> wrote:
>>
>> I have to confess I don't really understand how environments work with
>> functions, so I don't know if this Vectorize() function will work in
>> general.  What is the appropriate environment for returned value of
>> Vectorize()?  Is this approach to creating a Vectorize() function on the
> 
> I think the environments of the input and output functions should be
> the same which can be accomplished via:
> 
> environment(FUNV) <- environment(FUN)

No, definitely not.  For example, FUN may have been defined in an 
environment in which "eval" has been replaced, but if FUNV needs eval, 
it needs the original one.

At some point FUNV will call FUN.  As long as that evaluation of FUN 
keeps its original environment things will be fine.

Duncan Murdoch



[Rd] [R] unvectorized option for outer()
Duncan Murdoch