That's because of special code
http://www.jsoftware.com/help/release/amipcommute.htm and how it
interacts with the ref count. (You do not want to be doing an in-place
modification of an array which has multiple references to it.)

Thanks,

-- 
Raul


On Wed, Apr 26, 2017 at 10:08 AM, Xiao-Yong Jin <[email protected]> wrote:
>    f=:4 :'y 0}x'
>    a=:1e6?@#0
>    timespacex'a=:a f 0'
> 0.004784 8.39053e6
>    timespacex'a=:a 0}~0'
> 8e_6 1920
>
>> On Apr 25, 2017, at 10:35 PM, Raul Miller <[email protected]> wrote:
>>
>> What do you mean by "extra copies" and how have you been measuring that?
>>
>> (Most of the time, a "copy" just means incrementing a reference count.
>> There have been some exceptions, though, for boxed data, for example.)
>>
>> Thanks,
>>
>> --
>> Raul
>>
>>
>> On Tue, Apr 25, 2017 at 9:19 PM, Xiao-Yong Jin <[email protected]> wrote:
>>>
>>>> On Apr 25, 2017, at 6:30 PM, Eric Iverson <[email protected]> wrote:
>>>>
>>>> I have not followed this discussion at all and am probably way off base.
>>>>
>>>> But how is:
>>>>
>>>> allocate a few structures, and pass their pointers to the same function in
>>>> separate callings
>>>>
>>>> different from:
>>>>
>>>> allocated a few globals in an agreed upon locale (call it the heap),  and
>>>> pass their names (pointers) to the same verb in separate callings
>>>>
>>>> ?
>>>
>>> This question is actually right on spot, and I am struggling with this.
>>> There are two aspects of this problem in my opinion.
>>>
>>> 1. Unnecessary copying of data, given the current state of the in-place
>>> operations in J.  To have a varied state in J, passing names to verb
>>> essentially amounts to the following operations,
>>>
>>>   State =. State Verb Control   NB. akin to usual functional style
>>>
>>> Most of the time J would make unnecessary copies of the data in State.
>>> I haven't found a reliable way to avoid extra copying, except for when
>>> the 'Verb' here is a primitive.
>>>
>>> 2. Inconvenience, if you want to maintain a set of inhomogeneous states.
>>> I can do
>>>
>>>   'State1A State1B State1C' = (State1A;State1B;State1C) Verb Control
>>>   'State2A State2B State2C' = (State2A;State2B;State2C) Verb Control
>>>
>>> Apart from copying/boxing, there are too many names to keep track of.
>>> I would rather do
>>>
>>>   Verb_1_ Control
>>>   Verb_2_ Control
>>>
>>> I guess I'm just more familiar with the latter, because it resembles
>>> a common C function:
>>>
>>>   void Verb(*Locale, const *Control)
>>>
>>> Maybe I'm missing something in J.  Please feel free to correct me.
>>>
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to