MathGroup Archive 2005

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

Search the Archive

Re: Map, List

  • To: mathgroup at smc.vnet.net
  • Subject: [mg55089] Re: [mg55066] Map, List
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Sat, 12 Mar 2005 02:36:36 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com


On 11 Mar 2005, at 10:20, Steve Gray wrote:

> 	I wanted to convert
>
> {a,b,c} to
> {{a},{b},{c}}, (just an example)
>
> and it occured to me that since List[xx] = {xx}, I could do
>
> ml=Map[List,{a,b,c}] and get
> ml={{a},{b},{c}},
>
> making List in this case the inverse of Flatten. Now,assuming a,b,c 
> have appropriate integer values,
> I can do
>
> Delete[ggon, ml]
>
> where ggon is a list from which I want to delete an arbitrary set of 
> list members.
>
> Of course this worked. My only problem is that I might  not have 
> thought of this obvious (in
> retrospect) operation. Using List as a function is not mentioned in 
> any of my several books. What
> general principle applies that makes all such things functions?
>
> Thank you.
>
> Steve Gray
>
>
In the sense that you are using the word "function" practically every 
valid Mathematica expression is a function. For example, instead of 
list you could use the integer 1:

In[1]:=
Map[1,{a,b,c}]

Out[1]=
{1[a],1[b],1[c]}

Although this may look strange there might actually be a use for it but 
in any case the point is that what we are actually doing is 
constructing expressions with a certain specified Head and calling 
these heads "functions" is at best very vague. More precisely, the only 
true "functions" in Mathematica are expressions with head Function, e.g 
Function[x,x^2] or #^2& and neither List nor 1 is among them.


Andrzej Kozlowski
Chiba, Japan
http://www.akikoz.net/andrzej/index.html
http://www.mimuw.edu.pl/~akoz/


  • Prev by Date: Re: Map, List
  • Next by Date: Re: Re: a request for WRI
  • Previous by thread: Re: Map, List
  • Next by thread: Printing in color