Suppose I write:
f1 - function(x) x + 1
f2 - function(x) 2 * f1(x)
f2(10)
# 22
f1 - function(x) x - 1
f2(10)
# 18
This is quite obvious. But is there any way to define f2
in such a way that we freeze the definition of f1?
f1 - function(x) x+1
f1frozen - f1
f2 - function(x)
[EMAIL PROTECTED] wrote:
Suppose I write:
f1 - function(x) x + 1
f2 - function(x) 2 * f1(x)
f2(10)
# 22
f1 - function(x) x - 1
f2(10)
# 18
This is quite obvious. But is there any way to define f2
in such a way that we freeze the definition of f1?
f1 - function(x) x+1
f1frozen
This is just my curiousity working.
Suppose I write:
f1 - function(x) x + 1
f2 - function(x) 2 * f1(x)
f2(10)
# 22
f1 - function(x) x - 1
f2(10)
# 18
This is quite obvious. But is there any way to define f2
in such a way that we freeze the definition of f1?
f1 - function(x) x + 1
f2 -
Try
f2 - local({f1 - f1; function(x) 2 * f1(x) })
On Fri, Apr 18, 2008 at 8:22 AM, Alberto Monteiro
[EMAIL PROTECTED] wrote:
This is just my curiousity working.
Suppose I write:
f1 - function(x) x + 1
f2 - function(x) 2 * f1(x)
f2(10)
# 22
f1 - function(x) x - 1
f2(10)
# 18
This is
://med.kuleuven.be/biostat/
http://www.student.kuleuven.be/~m0390867/dimitris.htm
- Original Message -
From: Alberto Monteiro [EMAIL PROTECTED]
To: r-help@r-project.org
Sent: Friday, April 18, 2008 2:22 PM
Subject: [R] Function redefinition - not urgent, but I am curious
This is just my
5 matches
Mail list logo