[Jprogramming] @ and @: (atop and at)

Henry Rich henryhrich at gmail.com
Mon Jan 25 16:31:43 UTC 2016


1. is alas a little misleading.  For the two forms to be equivalent, 
they must have the same result when applied to arguments, and also the 
same rank so that when they themselves are used in compounds, those 
compounds are also guaranteed to produce the same result; so your 
statement is true.

But many users aren't thinking past getting a result from noun 
arguments.  If you just use the verbs as

   ([: f g) y

or

   f at g y

there are many combinations of f and g that produce the same results for 
the two cases.  Start with f=.*:, g=.+: .

I think it is that fact - that often the difference between @ and @: is 
invisible - that leads people to an incorrect but tenaciously held 
internal model of the operation.

[It reminds me of those who learn that 'Jim and me went to the store' is 
wrong, and then forever after always use 'I' following 'and'.  Ken 
thought that if a user learned J from use, as a child acquires a natural 
language, they would pick it up naturally.  This topic refutes that 
notion IMO.]

Your point 2. is a very good idea.

Henry Rich

On 1/25/2016 11:01 AM, Dan Bron wrote:
> Linda wrote:
>> But, it doesn't mean  f at g and [:f at g  can't be equivalent.
> I think you meant f at g and [: f g can sometimes be equivalent (not [: f at g, which always produces a domain error, because you’re trying to execute [:, which cannot be executed).
>
> Two points about that:
>
>    1. f at g and [: f g are equivalent precisely when g has unbound (i.e. _) rank.
>
> Since so many primitive, and almost all compound, verbs have unbound rank, f at g is correspondingly frequently equivalent to [: f g .
>
>    2. If you’re going to memorize a rule to keep you out of trouble, I would phrase it:  [: f g and f@:(g)  — with the parentheses! — are equivalent.
>
> That way, for example, you won’t get tripped up by the difference between  [: *: +/  and  *: @: +/  which are _not_ equivalent.  But  [: *: +/  and  *: @: (+/)  — with parentheses around g! — are.
>
> -Dan
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm



More information about the Programming mailing list