Re: pure function
- To: mathgroup at smc.vnet.net
- Subject: [mg113704] Re: pure function
- From: Ray Koopman <koopman at sfu.ca>
- Date: Mon, 8 Nov 2010 05:38:21 -0500 (EST)
- References: <ib8cre$2e1$1@smc.vnet.net>
On Nov 8, 12:37 am, Stephan <stschif... at googlemail.com> wrote: > I have a function that returns a pure function: > > In[1]:= getFunc := Module[{a=2}, Function[{x}, a * x]] > > In[2]:= f = getFunc > > Out[2]= Function[{x$}, a$57 x$] > > Is there any way, to have the body of the returned function contain > the actual _value_ of the local variable a, instead of the _symbol_ ? > > So I would like the returned function to be written as > > Function[{x$}, 2 x$] > > The reason is, that I would like to have a quick way to actually > see the value instead of digging out the local variable a$57... Use 'With' instead of 'Module'.