It should probably be more relaxed.

   9 ''} i.2 2
0 1
2 3
   (i.0 2) ''} i.2 2
0 1
2 3

Conceptually '' the shape of is a prefix of the shape of i.0 2:

   $9

   $''
0
   $i.0 2
0 2

So, it doesn't make sense that this would be a length error. If it
needs to be an error, it should be some other kind of error.

Thanks,


--
Raul

On Mon, Jun 20, 2022 at 1:42 AM Elijah Stone <elro...@elronnd.net> wrote:
>
> 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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to