From clausen at econ.upenn.edu  Tue May 15 20:13:25 2007
From: clausen at econ.upenn.edu (Andrew Clausen)
Date: Tue, 15 May 2007 14:13:25 -0400
Subject: [Rd] optim bug (PR#9684)
In-Reply-To: <Pine.LNX.4.64.0705151821490.909@gannet.stats.ox.ac.uk>
References: <20070514181124.4D9602A36F@slim.kubism.ku.dk>
	<Pine.LNX.4.64.0705150748380.12894@auk.stats>
	<Pine.GSO.4.56.0705150857280.20562@durian.statsci.com>
	<Pine.LNX.4.64.0705151821490.909@gannet.stats.ox.ac.uk>
Message-ID: <20070515181325.GD21178@econ.upenn.edu>

On Tue, May 15, 2007 at 07:02:56PM +0100, Prof Brian Ripley wrote:
> In R you rarely need to pass additional arguments in programming as 
> lexical scoping can be used to capture them.

You can also use currying, like this:

	ll <- function(data) function(params)
	{
		# compute whatever you want with data and params.
	}

Then you can call optim like this:

	optim(initial.param, ll(some.data))

Cheers,
Andrew



[Rd] optim bug (PR#9684)
Andrew Clausen