Jay,

Thank you. This made me aware of the fact that I still don't understand
this. You are right that the rank is zero, shown by the fact that ⍴,/1
2 3returns an empty result:

      *8⎕CR ⍴,/1 2 3*
┌⊖┐
│0│
└─┘


Can you explain to me why that is the case? When I look at the result from ,/1
2 3 it looks like an array that contains a single element: another array
with the values 1 2 3 in it. But it isn't. The result is rank zero, and I
can't take the first element from it:

      *(,/1 2 3)[1]*
RANK ERROR
      (,/1 2 3)[1]


But wait, I *can* take the first element from it:

      *↑,/1 2 3*
1 2 3


What's going on here?

Regards,
Elias


On 3 February 2014 18:07, Jay Foad <[email protected]> wrote:

> On 31 January 2014 17:37, Elias Mårtenson <[email protected]> wrote:
> >       8⎕CR ,/1 2 3 4
> > ┌─────────┐
> > │┌→──────┐│
> > ││1 2 3 4││
> > │└───────┘│
> > └∊────────┘
>
> I just have one comment to add to Kacper's excellent explanation: a
> useful thing to remember about this implementation of *reduction* is
> that it always *reduces* the rank of the argument by one (except
> there's a special case for scalar arguments).
>
> The vector 1 2 3 4 has rank 1, so the result must have rank 0, so you
> get an enclosed vector.
>
> Jay.
>

Reply via email to