MathGroup Archive 1996

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

Search the Archive

Re: How to think about Map[ ] ?

  • To: mathgroup at
  • Subject: [mg4685] Re: How to think about Map[ ] ?
  • From: wagner at (Dave Wagner)
  • Date: Sun, 25 Aug 1996 18:23:13 -0400
  • Organization: University of Colorado, Boulder
  • Sender: owner-wri-mathgroup at

In article <4ve91p$l93 at>,
AES <siegman at> wrote:
>I can understand that  
>   Map[f,{a,b,c}] --> {f[a], f[b], f[c]}
>But would someone want to give a little tutorial on how to understand 
>the (what seem to me) bizarre results I get when I try various
>combinations like
>   Map[f, a + b + c]
>   Map[f, a + b - c]
>   Map[f, a * b * c]
>   Map[f, a / b / c]

The seemingly inscrutable results that you get in some cases are due
to the way the those expressions are represented internally.
If you look at the internal forms of these expressions you will
see that the way Map works is quite simple and consistent:

In[1]:= FullForm[{a,b,c}]
Out[1]//FullForm= List[a, b, c]

In[2]:= FullForm[Map[f, {a,b,c}]]
Out[2]//FullForm= List[f[a], f[b], f[c]]

In[3]:= FullForm[a+b+c]
Out[3]//FullForm= Plus[a, b, c]

In[4]:= FullForm[Map[f, a+b+c]]
Out[4]//FullForm= Plus[f[a], f[b], f[c]]

I'll leave the rest to your own explorations.

		Dave Wagner
		Principia Consulting
		(303) 786-8371
		dbwagner at


  • Prev by Date: new cellular automata book
  • Next by Date: Slowdown of MMA running WIN95 and what to do about it
  • Previous by thread: Re: How to think about Map[ ] ?
  • Next by thread: Re: How to think about Map[ ] ?