No, Henry is right, Item Amend specifically is supported by special code:

http://www.jsoftware.com/help/release/iamend.htm

In fact, it's one if the (very) few phrases that are special enough to merit 
*in place* updates. Most special code is still copy-on-write, like standard J 
expressions.

If I get time later tonight, I'll try to hunt down the specific motivations for 
this enhancement.

-Dan

PS: Just to be clear, Pascal is correct too: regular amend is also supported by 
special code (and is similarly done in-place where possible).


> On Mar 30, 2014, at 6:31 PM, Pascal Jasmin <[email protected]> wrote:
> 
> Item Amend is the monad form of }.  There is not an obvious reason to have 
> the word amend (no updates take place) in that function either.  Maybe it 
> should be called "sequential select"?.  I think the special code you are 
> referring to applies to dyad m}.
> 
> Item amend being an adverb only because it shares the same } symbol 
> complicates the use case Eel was looking to make of it (by preventing rank or 
> ~ or other modifiers).
> 
> 
> ----- Original Message -----
> From: Henry Rich <[email protected]>
> To: [email protected]
> Cc: 
> Sent: Sunday, March 30, 2014 4:06:17 PM
> Subject: Re: [Jprogramming] Item amend ~: index error.
> 
> I think somebody important must have used m}, because it was supported 
> by special in-place code.
> 
> Henry Rich
> 
>> On 3/30/2014 4:28 PM, Dan Bron wrote:
>> Pascal wrote:
>>> There is no good reason for item amend to be an adverb.
>> 
>> Except that } , is an adverb (and there's a very good reason for that: to 
>> use it for "regular amend" requires 3 distinct arguments, and verbs can't 
>> have more than 2). That is, there's no way for the } in x } y to be a verb 
>> and yet still have x idx} y work (because that requires } to be an adverb, 
>> not a verb. The same symbol can't be an adverb sometimes and a verb other 
>> times).
>> 
>> If you're instead saying that there's no reason for J to offer the 
>> functionality of "item amend", or anyway it shouldn't be advertised in such 
>> a prominent location as the monad u}, then I can only respond: what else 
>> should go there?
>> 
>> All verbs in J are ambivalent. That is, there is literally no way 
>> (grammatically) to prevent a user from invoking a verb with one argument or 
>> with two arguments. So either you provide meanings for both those cases or 
>> you raise an error when the "wrong one" is invoked (viz ~. or E.). 
>> Therefore, the choice is between defining u}y to mean something or raising 
>> an error when someone tries that.
>> 
>> I wouldn't find the argument that a error would be more useful than the 
>> functionality offered by "item amend" to be very compelling. In fact, I 
>> personally like "item amend", though I agree with you that it could have a 
>> better name. I call it "merge" in my head, and my favorite use of it is this:
>> 
>>      'X'&=`(,:&' ') } 'XXXhiXthereXXX!'
>>      hi there   !
>> 
>> That is, I use it for substitution.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to