Re: how to map function with over 1 arguments to list
- To: mathgroup at smc.vnet.net
- Subject: [mg57219] Re: [mg57205] how to map function with over 1 arguments to list
- From: Sseziwa Mukasa <mukasa at jeol.com>
- Date: Sat, 21 May 2005 02:39:35 -0400 (EDT)
- References: <200505200844.EAA00690@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On May 20, 2005, at 4:44 AM, xun wrote: > Hi, all, > > g[x_]:=x^2; > g/@{1,2,3} results in{1,4,9} > > similarly, how to map f[x_,y_]:=x+y; > to {1,1},{2,2}? > > it seems that f/@{{1,1},{2,2}} doesn't work. In this case you want to use Apply f@@@{{1,1},{2,2}} If you want to use Map then f[#[[1]],#[[2]]]&/@{{1,1},{2,2}} will work. If you want to see details on how these methods work use Trace eg. Trace[f@@@{{1,1},{2,2}}]. Later, Ssezi
- References:
- how to map function with over 1 arguments to list
- From: "xun" <xiaoxun@gmail.com>
- how to map function with over 1 arguments to list