$i.10 is a 1-element list, while #i.10 is a scalar. You can determine this
by looking at the shape:
$ $i.10
1
$ #i.10
#@$ $i.10
1
#@$ #i.10
0
A scalar is defined as having zero dimensions, that is, the shape is an
empty list. One important thing to know is that $ always returns a list and
# always returns a scalar.
# is equivalent to {.!.1@$ , which is the first element of the shape, or 1
if it is empty.
@. tends to not work too well, being a complicated conjunction. In this case
I would recommend using (1+2<#) , which accomplishes the task much more
simply, and can also be adjusted to work with rank.
Marshall
On Sat, Oct 8, 2011 at 1:24 PM, EelVex <[email protected]> wrote:
> Thanks,
>
> (2<#) suits me fine
> but I still don't understand why (2<$) is not working here.
> Why
> (2<$) i.10
> doesn't have the same rank as
> (2<{.@$) i.10
> (and how should I know?)
>
> On Sat, Oct 8, 2011 at 2:45 PM, Aai <[email protected]> wrote:
>
> > Look at the result of e.g.
> > (2<$) i.2 3 3
> > 0 1 1
> >
> > and agenda @. uses the result of verb v in m @. v to select one of gerund
> m
> >
> > You probably want something like one of the following:
> >
> > (2<{.@$) i.10
> > 1
> >
> > (2<#@$) i.10
> > 0
> >
> > or use #
> >
> > (2<#) i.10
> > 1
> >
> >
> > 1:`2:@.(2<{.@$) i.10
> > 2
> >
> > 1:`2:@.(2<#@$) i.10
> > 1
> >
> > 1:`2:@.(2<#) i.10
> > 2
> >
> >
> >
> >
> > Hallo EelVex, je schreef op 08-10-11 12:35:
> > > Hi all.
> > >
> > > Why does this:
> > >
> > > 1:`2: @. (2<$) i.10
> > >
> > > give a rank error?
> > > ----------------------------------------------------------------------
> > > For information about J forums seehttp://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