Imagine you have these data:
data = Range /@ Range[2, 5]
{{1, 2}, {1, 2, 3}, {1, 2, 3, 4}, {1, 2, 3, 4, 5}}
Then this will do:
(Plus @@@ Subsets[#, {2}]) & /@ data
{{3}, {3, 4, 5}, {3, 4, 5, 5, 6, 7}, {3, 4, 5, 6, 5, 6, 7, 7, 8, 9}}
Application f@@@expr
is equivalent to Apply[f,expr,{1}]
. It will simultaneously map over internal elements and replace their heads with f
. Using this on you data:
(Plus @@@ Subsets[#, {2}]) & /@ {{1, 5}, {1, 13}, {1, 5, 25}}
{{6}, {14}, {6, 26, 30}}
With the same success you could use any functions offered to you for your privious answer. For example:
#~Subsets~{2}~Total~{2} & /@ {{1, 5}, {1, 13}, {1, 5, 25}}
{{6}, {14}, {6, 26, 30}}
or from @Verde & @OleksandrR. comments:
(Total /@ Subsets[#, {2}]) & /@ {{1, 5}, {1, 13}, {1, 5, 25}}
{{6}, {14}, {6, 26, 30}}
Map
and any of the suggestions in your previous question. You are very close. $\endgroup$