On 10.03.2010 13:26, Mark Heckmann wrote:
I have the following function that makes use of lazy loading.
I guess you mean *lazy evaluation* rather than *lazy loading* (as used
in loading functions or data from the package databases).
foo - function(x=2*y, y=x/2) cat(x,y)
Now I want to
Yes. I meant lazy evaluation :)
I will try to clarify what I mean.
I have a function foo and in its arguments use a reference to another
argument, like:
foo - function(x=y, y=x)
I would like to specify the function in a way it is possible to change
the way the argument y is evaluated.
e.g.:
On 14/03/2010 4:33 PM, Mark Heckmann wrote:
Yes. I meant lazy evaluation :)
I will try to clarify what I mean.
I have a function foo and in its arguments use a reference to another
argument, like:
foo - function(x=y, y=x)
I would like to specify the function in a way it is possible to
Try this:
foo2 - function(x=2*y, y=x/2) eval(substitute(cat(x,y,\n)))
foo2(x = 1, y = x/3)
1 0.333
foo2(x = y/2, y = 10)
5 10
On Wed, Mar 10, 2010 at 7:26 AM, Mark Heckmann mark.heckm...@gmx.de wrote:
I have the following function that makes use of lazy loading.
foo - function(x=2*y,
I have the following function that makes use of lazy loading.
foo - function(x=2*y, y=x/2) cat(x,y)
Now I want to be able to modify it like below:
foo(y=x/3)
Of course, this does not work as the object x is not known. Still I
would like to be able to pass a function as an argument that is
5 matches
Mail list logo