Re: Redirecting input
- To: mathgroup at smc.vnet.net
- Subject: [mg92354] Re: Redirecting input
- From: David Bailey <dave at Remove_Thisdbailey.co.uk>
- Date: Sun, 28 Sep 2008 07:23:04 -0400 (EDT)
- 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
>
This is one of those questions where I feel it would be helpful to know
more about what you are doing. I mean, if you have a large number of
data values, perhaps they are already in a file, and you need help
reading them in.
At the very least, you surely want to type the values in and keep them -
in case, perhaps, you make a mistake - so why not use a list:
data={2,67,31};
Map[f,data]
David Bailey
http://www.dbaileyconsultancy.co.uk