MathGroup Archive 2008

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

Search the Archive

Re: Redirecting input

  • To: mathgroup at smc.vnet.net
  • Subject: [mg92330] Re: [mg92292] Redirecting input
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Sat, 27 Sep 2008 22:21:54 -0400 (EDT)
  • Reply-to: hanlonr at cox.net

In[1]:= f[x_] := x + 1

Automatically apply f to any input

In[2]:= $Post = f[#] &

Out[2]= f(#1)&+1

In[3]:= 2

Out[3]= 3

In[4]:= 67

Out[4]= 68

In[5]:= 31

Out[5]= 32

Stop applying f

In[6]:= $Post =.

In[7]:= 2

Out[7]= 2

Map f onto a list

In[8]:= f /@ {2, 67, 31}

Out[8]= {3,68,32}


Bob Hanlon

---- Ignacio Plazeta <Ignacio.Plazeta at speednet.es> 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


--

Bob Hanlon



  • Prev by Date: convex optimization
  • Next by Date: Re: Manipulate / Space Phasor
  • Previous by thread: Re: Redirecting input
  • Next by thread: Re: Redirecting input