Re: Pure function in a pure function (again)

*To*: mathgroup at smc.vnet.net*Subject*: [mg69823] Re: [mg69797] Pure function in a pure function (again)*From*: Sseziwa Mukasa <mukasa at jeol.com>*Date*: Sat, 23 Sep 2006 23:45:32 -0400 (EDT)*References*: <200609230844.EAA22562@smc.vnet.net>

On Sep 23, 2006, at 4:44 AM, 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]] > > This line is incorrect, however. How do I fix it? Map[Function[x,Plus@@Column[Select[Dat,#1[[1]]==x&],2]],Range[3]] Regards, Ssezi

**References**:**Pure function in a pure function (again)***From:*Skirmantas Janusonis <janusonis@psych.ucsb.edu>