I understand your argument.  One needs to walk through the execution before 
knowing whether to make an early copy.  I guess we can do it manually, if so 
desires, but how do you actually make a copy that has refcount 1 in J?  The use 
case would be saving the old argument while letting the interpreter do the 
in-place-operation.  With 9!:53]2, if I just use
  ip=:1 :0
   c=. y
   c=. v c
   c
  )
the potentially in-place-able verb v wouldn't do in-place-operation, because n 
and y points to the same memory.  I guess I need
   c =. copy y
so c-:y but points to a different memory region.  How would you write this copy 
verb such that it's cheap enough to justify this optimization?  Is such an 
adverb ip even possible?

> On Oct 5, 2016, at 5:13 PM, Henry Rich <[email protected]> wrote:
> 
> I agree with you until 'a large advantage in speed'.  If I have to make a 
> copy of every argument, that's a loser.  I would need to analyze the sentence 
> to find out whether to make an early copy. That is fraught with possibilities 
> for error, and is impossible if any explicit definition is in the unexecuted 
> part of the sentence.
> 
> Henry Rich

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

Reply via email to