[Jprogramming] (no subject)

Skip Cave skip at caveconsulting.com
Mon Oct 2 16:49:33 UTC 2017


Given a set of integers, what is the most concise and or efficient way to
list the numbers along with the sum of all combinations of the numbers? the
products of all combinations?

for example:

a =. 2 5 7
+ f a    NB. 2, 5, 7, (2+5), (2+7), (5+7), (2+5+7)
2 5 7 7 9 12 14

* f a    NB. 2, 5, 7, (2*5), (2*7), (5*7), (2*5*7)
2 5 7 10 14 35 70

The function 'f' should work for any verb and any size right argument noun
vector.

Skip

Skip Cave
Cave Consulting LLC


More information about the Programming mailing list