Re: Map-like behaviour for functions of more than a single argument?
- To: mathgroup at smc.vnet.net
- Subject: [mg64526] Re: Map-like behaviour for functions of more than a single argument?
- From: "Borut Levart" <BoLe79 at gmail.com>
- Date: Mon, 20 Feb 2006 22:31:00 -0500 (EST)
- References: <dtc9po$a5g$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
You can do it without the intermediate g. Is the following what you had
in mind? I use your definition of f, and map it directly to a list of
arguments:
f[#, #^2 &] & /@ {{x1, y1}, {x2, y2}}
or:
f[#, Function[{z}, z^2]] & /@ {{x1, y1}, {x2, y2}}
or:
Map[Function[{z}, f[z, #^2 &]], {{x1, y1}, {x2, y2}}]
or:
Map[Function[{z}, f[z, Function[{z2}, z2^2]]], {{x1, y1}, {x2, y2}}]
They all do the same thing, I only wrote out the four combinations of
using two anonymous (pure) functions with named or anonymous argument.
I didn't know the first would work though. I don't use "#&" notation
much, Function is clearer to me.
Bye