MathGroup Archive 2010

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

Search the Archive

Re: multiple variables in pure function used in map.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg107644] Re: [mg107632] multiple variables in pure function used in map.
  • From: "David Park" <djmpark at comcast.net>
  • Date: Sun, 21 Feb 2010 04:24:44 -0500 (EST)
  • References: <27651180.1266666269944.JavaMail.root@n11>

ab = {{1, 2}, {2, 3}, {3, 4}}; 

Apply[#1 + #2 &, #] & /@ ab 
{3, 5, 7} 


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/  


From: pipehappy [mailto:pipehappy at gmail.com] 

Hi, All

Is there a way to use multiple variables in pure function with map.

What I want to do is like this:

ab = {{1, 2}, {2, 3}, {3, 4}};
(#[[1]] + #[[2]]) & /@ ab
{3, 5, 7}

Instead of refer to elements in list I want to use multiple variables
in pure function.

something like this:
ab = {{1, 2}, {2, 3}, {3, 4}};
(#1 + #2) & /@ ab
To do the same thing as the above example.

Best

-- pipehappy




  • Prev by Date: Re: Why not a standard name used for this common function? DTFT
  • Next by Date: Re: multiple variables in pure function used in map.
  • Previous by thread: Re: multiple variables in pure function used in map.
  • Next by thread: Re: multiple variables in pure function used in map.