MathGroup Archive 2010

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

Search the Archive

Re: pure function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg113708] Re: pure function
  • From: Sebastian <sebhofer at gmail.com>
  • Date: Mon, 8 Nov 2010 05:39:07 -0500 (EST)
  • References: <ib8cre$2e1$1@smc.vnet.net>

On Nov 8, 9:37 am, Stephan <stschif... at googlemail.com> 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]]

HTH
Sebastian


  • 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