[Jprogramming] Item amend ~: index error.

Dan Bron j at bron.us
Sun Mar 30 22:20:37 UTC 2014


Changing } to a conjunction would break just about every J codebase in existence, so I can't jump on that bandwagon.

Moving item amend to }:: would conflict with the interpretation of LHAs to {:: , which }:: will and should share when it is available (ie the obstacles to implementation are worked out [Roger, what are those?]). Since I see native tree-processing as an important progression of the J language,  I can't see my way to this suggestion either.

Of course, we could "move" item amend somewhere else, but at that point I'd rather just have it in user space (the standard library, so everyone would still at least have access to that).

But before we get there, I'd still like to see a better candidate for the interpretation of the monadic verb m} with a comparison of benefits and drawbacks, or a really strong argument for why m}y should be changed to an error. Any change at all (redefinition or "de"-definition) would have to be worth breaking backwards compatibility - especially with my code! :)

-Dan



> On Mar 30, 2014, at 5:46 PM, Pascal Jasmin <godspiral2000 at yahoo.ca> wrote:
> 
> I realize there would be a loss in flexibility from changing the v0`v1`v2 } form, and so good reason to keep it.
> 
> For item amend, putting it on }:: would place it "out of the way".  With it out of the way, } can make more sense as a conjunction than an adverb, and not have the decision clouded with Item amend using the same symbol. 
> 
> A natural definition for monad } would be "item delete" ie. amend with fill if a full item is not amended, or otherwise remove if a full item.
> 
> 
> My definition for the amend conjunction is extremely useful, and might form a better 2 gerund version of  }
> 
> so +:` 1: } i. 3 3 would be the same as my amend conjunction
> 
> +: amend 1 i. 3 3
> 
> It would apply to both monad and dyad } the definition again:
> 
> amend_z_ =: 2 : 0 
>  s=. v"_ y 
>  (u"_ (s{y)) (s}) y 
> : 
>  s=. v"_ y 
>  (x u"_ (s{y)) (s}) y 
> )
> 
> 
> 
> 
> The proposal to completely replace } with my amend conjunction instead of an adverb, could work.  Its still possible to apply ranked } as:
> 
>   5 (0)}"1 i. 3 3 
> 5 1 2 
> 5 4 5 
> 5 7 8 
> 
>   5 amend 0"1 i. 3 3 
> 5 1 2 
> 5 4 5 
> 5 7 8 
> 
> 
> The existing 2 gerund } seems pretty useless (minimal benefit from x v2 y not repeating x to the right of }... Not much expectation that the same x would be useful to v2 as it is to v0,v1). Though a gerund version of the amend conjunction would be a bit harder to use (than conjunction) if there were a performance benefit from being built in, it might still be.
> 
> 
> ----- Original Message -----
> From: Dan Bron <j at bron.us>
> To: "programming at jsoftware.com" <programming at jsoftware.com>
> Cc: 
> Sent: Sunday, March 30, 2014 3:28:58 PM
> Subject: Re: [Jprogramming] Item amend ~: index error.
> 
> 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


More information about the Programming mailing list