In Kip's context (repeatedly amending an array), m} is still going to create new copies of the array, leading to memory use of O(n^3).

An explicit version that uses assignment in place will be leaner for large n.

Henry Rich

On 1/13/2014 2:50 PM, Raul Miller wrote:
This is probably too much information, and unnecessary, but maybe
someone will find some part of it useful.

http://www.jsoftware.com/help/dictionary/d530n.htm says

If m is a gerund, one of its elements determines the index argument to
the adverb } , and the others modify the arguments x and y :
x (v0`v1`v2)} y ↔ (x v0 y) (x v1 y)} (x v2 y)

In other words:

    2 3 0     [`  ([:{.[)`  ]  }     i.3 3
0 1 2
3 4 5
2 3 0

    2 3 0     [                      i.3 3
2 3 0
    2 3 0         ([:{.[)            i.3 3
2
    2 3 0                   ]        i.3 3
0 1 2
3 4 5
6 7 8

    2 3 0         (  2  )      }     i.3 3
0 1 2
3 4 5
2 3 0

(That does not quite look right in the font used by my web browser,
but hopefully the intent is clear.)

Thanks,

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

Reply via email to