MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: pure function

On Nov 8, 9:37 am, Stephan <stschif... at> wrote:
> Hi,
> 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 a=
ctual _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...
> Thanks,
> Stephan

getFunc := With[{a=2}, Function[{x}, a * x]]


  • Prev by Date: Re: pure function
  • Next by Date: Re: x and y labels in ArrayPlot
  • Previous by thread: Re: pure function
  • Next by thread: Re: pure function