Re: Redirecting input

*To*: mathgroup at smc.vnet.net*Subject*: [mg92380] Re: Redirecting input*From*: Szabolcs Horvat <szhorvat at gmail.com>*Date*: Tue, 30 Sep 2008 07:34:02 -0400 (EDT)*Organization*: University of Bergen*References*: <200809271047.GAA22530@smc.vnet.net> <gbqcqk$e6c$1@smc.vnet.net>

Thomas Dowling wrote: > Or, slightly simpler, > > > f[x_] := x + 1 > > > In[7]= f@{100, 23, 44} > > Out[7]= {101, 24, 45} > > (rather than f /@ {100, 23, 44}) > > f@2, etc. This is misleading advice. The correct way is of course to use Map, i.e. f /@ {1,2,3}. Your specific example accidentally works because Plus happens to have the attribute Listable, but you did not mention this explicitly. With the function f[x_] := If[x > 0, x, 0], f[{1,2,3}] (which is equivalent to f @ {1,2,3}) would produce a different result from f /@ {1,2,3}.

**References**:**Redirecting input***From:*Ignacio Plazeta <Ignacio.Plazeta@speednet.es>