MathGroup Archive 2001

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

Search the Archive

Re: [?] apply a function to members of a list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg26794] Re: [mg26774] [?] apply a function to members of a list
  • From: Tomas Garza <tgarza01 at prodigy.net.mx>
  • Date: Wed, 24 Jan 2001 04:18:36 -0500 (EST)
  • References: <200101220810.DAA27459@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

I suggest you take some time to read some introduction to Mathematica. 

In[1]:=
alist = {1, 1.5, 7, 4, 3, 2001};
In[2]:=
Map[f, alist]
Out[2]=
{f[1], f[1.5], f[7], f[4], f[3], f[2001]}

Or, if you wish, you may use the prefix notation:

In[3]:=
f /@ alist
Out[3]=
{f[1], f[1.5], f[7], f[4], f[3], f[2001]}

Tomas Garza
Mexico City


----- Original Message ----- 
From: "9donco" <chindonco at iname.com>
To: mathgroup at smc.vnet.net
Subject: [mg26794] [mg26774] [?] apply a function to members of a list


> hi all,
> 
> I have a list of arbitrary numbers eg. alist={1, 1.5, 7, 4, 3, 2001}
> and a (user-define) function  f[]
> 
> Is there a quick way/operation to apply f to indiviual
> elements in alist ? say, to produce:
> 
> {f[1], f[1.5], f[7], f[4], f[3], f[2001]}
> 
> Please help !
> thank you in advance
> 9DonCo
> 
> 
> 



  • Prev by Date: RE: [?] apply a function to members of a list
  • Next by Date: Rewriting of Trigonometric Functions
  • Previous by thread: RE: [?] apply a function to members of a list
  • Next by thread: Re: [?] apply a function to members of a list