MathGroup Archive 2007

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

Search the Archive

Re: Mapping a pure function with 2 conponents.


phoenix7744 at gmail.com wrote:
> I'm trying to get the following code to work:
> 
> Map[#1^2 + #2 &, {{0, 1}, {2, 3}, {4, 5}}]
> 
> The goal is to use a pure function in order to achieve the result:
> {1, 7, 21}
> 
> The issue is that the evaluation involves   #1^2 + #2 & [{0,1}]
> instead of #1^2 + #2 & [0,1]
> 
> Thanks, in advance.

Try

In[1]:= Map[#[[1]]^2 + #[[2]] &, {{0, 1}, {2, 3}, {4, 5}}]

Out[1]= {1, 7, 21}

Regards,
Jean-Marc


  • Prev by Date: Re: Link to reference guide in 6
  • Next by Date: Re: Polynomial as a List
  • Previous by thread: Re: Mapping a pure function with 2 conponents.
  • Next by thread: Re: Mapping a pure function with 2 conponents.