My two cents, I would further say, in general, that two forms can be equivalent even if they might produce different results when applied to (the same) argument(s).
For example, [: (+/ % #) [: ? $&0 and (+/ % #)@:?@:$&0 are equivalent, at least in my mind, because both are meant (if I am not mistaken) to produce the average of a (pseudo) sample of a uniform (in the 0 1 interval) random variable of a sample size given by its argument, ([: (+/ % #) [: ? $&0) 10000 0.4975501 ((+/ % #)@:?@:$&0) 10000 0.50452014 At any rate, it seems obvious to me that [: (+/ % #) [: ? $&0 ought to be equivalent to itself (and (+/ % #)@:?@:$&0 ought to be equivalent to itself as well), ([: (+/ % #) [: ? $&0) 10000 0.499056671 ((+/ % #)@:?@:$&0) 10000 0.497502936 Regarding @ and @:, sometimes I wonder how often users would had used @: instead of @ if their definitions had been swapped (and &: instead of &, etc.). On Mon, Jan 25, 2016 at 11:31 AM, Henry Rich <[email protected]> wrote: > 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@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@g and [:f@g can't be equivalent. >>> >> I think you meant f@g and [: f g can sometimes be equivalent (not [: f@g, >> which always produces a domain error, because you’re trying to execute [:, >> which cannot be executed). >> >> Two points about that: >> >> 1. f@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@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 >> > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
