You have a point, IF the interpreter can figure out when a copy can be deleted. Often it can't. We would need the exact code to be sure.

Code that modifies part of an array is often - I would say usually - faster when explicit.

Henry Rich

On 1/13/2014 3:14 PM, Raul Miller wrote:
Could you explain your reasoning?

I understand O(n^3) time from the multiple copies - you have O(n^2)
time cost multiplied by n repetitions. But space cost should be O(n^2)
-- the number of copies of the array needed should have a fixed upper
bound, because previous temporary copies do not need to be preserved.

I am amused though, that this illustrates a case where the interpreter
is designed to be more efficient with explicit code than tacit.

(Or did I miss something?)

Thanks,

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

Reply via email to