Hmm, there is an annoyance.  } is specified in terms of {, and:

   $(1 0;0 1){i.2 2
2
   $(,<1 0){i.2 2
1
   $''{i.2 2
0 2

On the other hand, it's _really_ annoying that the original code doesn't work. Thoughts--would it be permissible for } to be more relaxed here? It is difficult because implementation cannot know what sort of empty list was intended; being lax may also hide bugs. I am not sure if that is likely to come up, though. Passing an empty list to { or } is a degenerate case, since it does not perform useful work or produce useful results. Therefore, any context in which '' is passed to { or } is one in which a nonempty list will also be passed at some point, and if the latter is malformed, the problem will be diagnosed and the error signalled then.

On Sun, 19 Jun 2022, Elijah Stone wrote:

  '' ''} i.2 2
|length error
|   ''    ''}i.2 2

Should it be an error?  I would expect it not to be, because:

   (,27) (,<1 0)} i.2 2
 0 1
27 3
   (27 28) (1 0;0 1)} i.2 2
 0 28
27  3

So the original snippet is just the degenerate case where no indices are supplied. But I want to ensure I am not missing anything obvious.
----------------------------------------------------------------------
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