Re: Pure function in a pure function (again)
- To: mathgroup at smc.vnet.net
- Subject: [mg69805] Re: Pure function in a pure function (again)
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Sat, 23 Sep 2006 06:14:52 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <ef2tl4$mn4$1@smc.vnet.net>
Skirmantas Janusonis wrote: > Hello, > > I've already asked this question, but I thought there was a better way to state it. If Dat is a 2D-table, the following picks out the rows whose first element is 1,2 or 3 and adds up their the second elements: > > f[x_] := Plus @@ Column[Select[Dat, #[[1]] == x &], 2] > f /@ Range[3] > > Instead of f/@Range[3], I'd like to use a second pure function, something like this: > > Map[Plus @@ Column[Select[Dat, #1[[1]] == #2 &], 2]&,Range[3]] --------------------------------------------** What this variable is supposed to be and from where it is supposed to get any value? Jean-Marc