3 ms·
for the sake of language geekdom, it would be done in J something like this: - +/ p * ^. p where p is the array. you can even remove the duplication of the
by tokipin 17y ago
for the sake of language geekdom, it would be done in J something like this:
- +/ p * ^. p
where p is the array. you can even remove the duplication of the array with a so-called hook:
- +/ (* ^.) p