MathGroup Archive 2006

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

Search the Archive

Re: To apply a function to a List

  • To: mathgroup at smc.vnet.net
  • Subject: [mg65633] Re: [mg65597] To apply a function to a List
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Tue, 11 Apr 2006 04:04:48 -0400 (EDT)
  • Reply-to: hanlonr at cox.net
  • Sender: owner-wri-mathgroup at wolfram.com

a={a1,a2,a3,a4};

Use Map

f/@a

{f(a1),f(a2),f(a3),f(a4)}

or if f has the attribute Listable

SetAttributes[f,Listable];

f[a]

{f(a1),f(a2),f(a3),f(a4)}


Bob Hanlon

> 
> From: Francisco Javier <pacoga at ctv.es>
To: mathgroup at smc.vnet.net
> Subject: [mg65633] [mg65597] To apply a function to a List
> 
> Dear all,
> 
> Let f, l be a function and a list respectively. How can we do
> 
> Table[f[list[[n]]],{n,1, Length[list]}]
> 
> in another way?
> 
> Thanks.
> 
> -- 
> ----
> Francisco Javier García Capitán
> http://garciacapitan.auna.com
> 
> 


  • Prev by Date: Re: To apply a function to a List
  • Next by Date: Re: To apply a function to a List
  • Previous by thread: Re: To apply a function to a List
  • Next by thread: Re: To apply a function to a List