|
[Date Index]
[Thread Index]
[Author Index]
Re: Redirecting input
- To: mathgroup at smc.vnet.net
- Subject: [mg92327] Re: Redirecting input
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Sat, 27 Sep 2008 22:21:21 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <gbl2vp$m00$1@smc.vnet.net>
Ignacio Plazeta wrote:
> Dear Friends
>
> Let, as an example,
>
> f[x_] := x + 1
>
> be a function I have to calculate over and over again;
> it would result useful redirecting input to avoid
> typing
>
> f[2] Enter
> f[67] Enter
> f[31] Enter
> ....
>
> and simply make use of
>
> 2 Enter
> 67 Enter
> 31 Enter
> ....
>
> Plese, can you point out a trick to perform it ?
>
> Best Regard
>
> Ignacio Plazeta
At your own risk (you may have to restart the kernel to work as usual),
but you could (re)define the global variable *$Pre* so f would be
applied to any subsequent entry. For instance,
In[225]:= f[x_] := x + 1
In[226]:= f[2]
Out[226]= 3
In[227]:= $Pre = f[#] &
Out[227]= f[#1] &
In[228]:= 2
Out[228]= 3
In[229]:= 3
Out[229]= 4
Regards,
-- Jean-Marc
Prev by Date:
Re: Help
Next by Date:
Re: copying a variable
Previous by thread:
Re: Redirecting input
Next by thread:
Re: Redirecting input
|