It sure gets many difficult points, however, there's two I'd add:

- Verb valence (monad/dyad) in hooks and forks, requiring careful counting
to know how a verb is applied to the arguments. Additionally, a hook's
right verb(s) process only right arguments, which is different from forks.
- More generally speaking: trains not being the same as expressions: e. g.
expecting +/%# y to give the average of y: (+/%#) y
- Perhaps as a special case of J display not showing shape: leading 1 in
shape has gotten me quite often, e.g. when finding the index where a vector
is 1 using I., instead of using i.&1, and the downstream code not working
because of a length error (this became much more instructive with the
recent extended errors in j904 beta-i).

There are more subtle gotchas, but I don't know whether they would be a
good fit for that text e.g. undefined names in trains being considered
verbs, but of rank _, which could give problems if the verb is afterwards
defined as having a different rank (sorry for the silly example):
bar=: +/@foo
   bar b. 0
_ _ _
   foo=:%

   bar b. 0
_ _ _
   bar 1 2 3
1.83333
   foo
%
   bar
+/@foo NB. foo is rank 0, yet @ does not enforce actual foo rank to +/
   foo b. 0
0 0 0
   baz=: +/@% NB. expected
   baz 1 2 3  NB. applied +/ at rank 0
1 0.5 0.333333

Just my two cents.

Jan-Pieter

On Sun, 18 Dec 2022, 15:29 Raul Miller, <[email protected]> wrote:

> I was looking over https://rosettacode.org/wiki/Gotchas#J today, and
> wondering if that writeup was missing anything important.
>
> It occurs to me that other people might have better perspectives on
> this, than I do.
>
> Does anyone here see anything important that got overlooked?
>
> Thanks,
>
> --
> Raul
> ----------------------------------------------------------------------
> 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