
Pure function in a pure function (again)
Posted:
Sep 23, 2006 5:09 AM


Hello,
I've already asked this question, but I thought there was a better way to state it. If Dat is a 2Dtable, 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?
Thanks!
Skirmantas

