This is already done for associative atomic primitives.  For other associative verbs you have to use u/\.&.|. .

Henry Rich

On 2/25/2021 10:10 AM, 'Sergey Kamenev' via Programming wrote:
+/\ 1 2 3 4 5

By computing partial sum every time is recomputed partial fold.

It's time and CPU expensive.
1
1+2
1+2+3 - Sum 1+2 don't need to recalculated
1+2+3+4 - Sum 1+2+3 don't need to recalculated
1+2+3+4+5 - Sum 1+2+3+4 don't need to recalculated

This optimization can be done for absolutely all verbs
by adding an intermediate variable inside /\ implementation.

Sergey.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm


--
This email has been checked for viruses by AVG.
https://www.avg.com

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to