In particular, the difference has to do with rank. J has verb rank; hence, x
#: y is uniformly equivalent to x #:"1 0 y. But even in apls which have a
rank conjunction, verbs do not generally have rank; hence, the behaviour of
primitives is all special-cased. We can bring the apl code into closer
alignment with j by explicitly reranking:
2 2⊤⍤1 0⊢⍳0 ⍝empty result; ok
2 2⊤⍤1 0⊢''
DOMAIN ERROR
2 2⊤⍤1 0⊢''
∧
Dyalog is being less kind than j: dyalog applies ⊤ to a fill, just like j,
but in dyalog, when ⊤ errors, it makes the whole computation error.
-E
On Fri, 9 Jun 2023, Mike Duvos wrote:
Well, I was asking if J follows the APL convention of not being too strict
about the type of null arguments.
Apparently, it doesn’t, but I wasn’t sure when I encountered the behavior
whether it was a feature or a bug.
Regards,
Mike
On Fri, Jun 9, 2023 at 1:17 AM Henry Rich <henryhr...@gmail.com> wrote:
Your supposition is not quite right. Characters are not in the domain of
arithmetic operations and produce domain error.
HOWEVER, when a verb that is executed on an empty argument is executed on a
cell of fill, and the execution on the fill cell results in error, the
error is ignored and execution proceeds as if the execution had returned 0.
Henry Rich
On Fri, Jun 9, 2023, 5:33 AM Mike Duvos <mdu...@gmail.com> wrote:
> Hi,
>
> Isn’t it a convention that a null character vector behaves the same as a
> null numeric vector in an arithmetic context?
>
> I get the following results in J
>
> $$ 2 2 #: i. 0
>
> 2
>
> $$ 2 2 #: ''
>
> 1
>
>
> Yet in APL, of course…
>
>
> ⍴⍴2 2 ⊤''
>
> 2
>
> ⍴⍴2 2 ⊤⍳0
>
> 2
>
>
>
> This seems somewhat unhelpful.
>
>
> Regards,
>
> Mike
> ----------------------------------------------------------------------
> 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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm